private void showShare() { final String text = String.format(getString(R.string.share_text_full_total), appPreference.getTotalNumber()); // ScreenshotUtils.shotBitmap(MainActivity.this, shareFileName); // Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), // R.anim.fade_out); // animation.setAnimationListener(new Animation.AnimationListener() { // @Override // public void onAnimationStart(Animation animation) { // } // // @Override // public void onAnimationEnd(Animation animation) { // // } // // @Override // public void onAnimationRepeat(Animation animation) { // // } // }); // share.startAnimation(animation); takeScreenshot(); Utils.share( MainActivity.this, MainActivity.this.getString(R.string.app_name), text, shareFileName); }
private void showAbout() { // Utils.openUrlInsideApp(this, getString(R.string.about_url)); // Utils.overridePendingTransitionRight2Left(this); Intent intent = new Intent(); // intent.setClass(this, AboutActivity.class); intent.setClass(this, BaseActivity.class); startActivity(intent); Utils.overridePendingTransitionRight2Left(this); }
public void onShowInvitationRequested() { if (isSignedInPublic()) { startActivityForResult(getGamesClient().getInvitationInboxIntent(), RC_UNUSED); Utils.overridePendingTransitionRight2Left(this); } else { showAlertPublic(getString(R.string.invitation_not_available)); if (!currentFragmentTag.equalsIgnoreCase(GameBoardFragment.TAG)) { showGameBoardFragment(); } } }
private void sendToWeChat() { final String text = String.format(getString(R.string.share_text_full_total), appPreference.getTotalNumber()); ScreenshotUtils.shotBitmap2(this, shareFileName); weChatUtils.createAppendReq2(this.getString(R.string.app_name), text, shareFileName); Intent intent = new Intent(); intent.setClass(this, me.pjq.pushup.activity.SendToWXActivity.class); startActivity(intent); Utils.overridePendingTransitionRight2Left(this); }
/** * Defines a default (dummy) share intent to initialize the action provider. However, as soon as * the actual content to be used in the intent is known or changes, you must update the share * intent by again calling mShareActionProvider.setShareIntent() */ private Intent updateShareIntent() { if (null == appPreference) { return null; } final String text = String.format(getString(R.string.share_text_full_total), appPreference.getTotalNumber()); takeScreenshot(); Intent intent = Utils.getShareIntent( MainActivity.this, MainActivity.this.getString(R.string.app_name), text, shareFileName); if (null != mShareActionProvider) { // mShareActionProvider.setShareIntent(Utils.getShareRawIntent(this)); mShareActionProvider.setShareIntent(intent); } return intent; }
private void showUserGuide() { Utils.showUserGuard(this, UserGuideActivity.START_FROM_SETTINGS); Utils.overridePendingTransitionRight2Left(this); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_drawer); CONTENT_VIEW_ID = R.id.content_frame; Utils.showUserGuardIfNeed(this, UserGuideActivity.START_FROM_SPLASH); mTitle = mDrawerTitle = getTitle(); // mDrawerItems = getResources().getStringArray(R.array.drawer_items_array); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener drawerListAdapter = new DrawerListAdapter(getApplicationContext()); drawerItemArrayList = new ArrayList<Object>(); drawerItemArrayList.add( new DrawerListAdapter.DrawerItem( Constants.DRAWER_ITEM_DASHBOARD, getString(R.string.menu_item_dashboard))); drawerItemArrayList.add( new DrawerListAdapter.DrawerItem( Constants.DRAWER_ITEM_PUSHUPS, getString(R.string.menu_item_pushup))); drawerItemArrayList.add( new DrawerListAdapter.DrawerItem( Constants.DRAWER_ITEM_MULTI, getString(R.string.menu_item_multi))); drawerItemArrayList.add( new DrawerListAdapter.DrawerItem( Constants.DRAWER_ITEM_WRIST, getString(R.string.menu_item_wrist))); drawerItemArrayList.add( new DrawerListAdapter.DrawerItem( Constants.DRAWER_ITEM_GOOGLE, getString(R.string.menu_item_google))); drawerItemArrayList.add( new DrawerListAdapter.DrawerItem( Constants.DRAWER_ITEM_LEADERBOARD, getString(R.string.menu_item_leaderboard))); drawerItemArrayList.add( new DrawerListAdapter.DrawerItem( Constants.DRAWER_ITEM_ARCHIEVEMENT, getString(R.string.menu_item_archievement))); drawerItemArrayList.add( new DrawerListAdapter.DrawerItem( Constants.DRAWER_ITEM_HELPER, getString(R.string.menu_item_helper))); drawerItemArrayList.add( new DrawerListAdapter.DrawerItem( Constants.DRAWER_ITEM_ABOUT, getString(R.string.menu_item_about))); drawerListAdapter.setDataList(drawerItemArrayList); mDrawerList.setAdapter(drawerListAdapter); // mDrawerList.setAdapter(new ArrayAdapter<String>(this, // R.layout.drawer_list_item, mDrawerItems)); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); // enable ActionBar app icon to behave as action to toggle nav drawer getActionBarImpl().setDisplayHomeAsUpEnabled(true); getActionBarImpl().setHomeButtonEnabled(true); // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggle = new ActionBarDrawerToggle( this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */) { public void onDrawerClosed(View view) { getActionBarImpl().setTitle(mTitle); supportInvalidateOptionsMenu(); // invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBarImpl().setTitle(mDrawerTitle); supportInvalidateOptionsMenu(); // invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem((DrawerListAdapter.DrawerItem) drawerListAdapter.getItem(0)); } else { selectItem((DrawerListAdapter.DrawerItem) drawerListAdapter.getItem(0)); } bus = ServiceProvider.getBus(); bus.register(this); appPreference = AppPreference.getInstance(getApplicationContext()); titlebarHelper = new TitlebarHelper( MainActivity.this, new TitlebarHelper.OnTitlebarClickListener() { @Override public void onClickIcon() {} @Override public void onClickTitle() {} }); userIcon = (ImageView) findViewById(R.id.user_icon); userInfo = (TextView) findViewById(R.id.user_info); share = (TextView) findViewById(R.id.share_textview); userInfo.setOnClickListener(this); userIcon.setOnClickListener(this); share.setOnClickListener(this); findViewById(R.id.button_sign_in).setOnClickListener(this); findViewById(R.id.button_sign_out).setOnClickListener(this); getGamesClient() .registerConnectionCallbacks( new GooglePlayServicesClient.ConnectionCallbacks() { @Override public void onConnected(Bundle bundle) { submitScore(); } @Override public void onDisconnected() { showAlert("Connect", "Disconnected!"); } }); getGamesClient().connect(); // if (!isSignedIn()) { // beginUserInitiatedSignIn(); // } // showDashboardFragment(); initWeChat(); }
@Override public void save() { if (mainUdobraSpinner.getSelectedItemPosition() != 0) { if (TextUtils.isEmpty(volume.getText())) { volume.setError(getResources().getString(R.string.empty_field)); volume.requestFocus(); return; } } if (mainUdobraSpinner.getSelectedItemPosition() != 0) { if (TextUtils.isEmpty(mainUdobraExitText.getText())) { mainUdobraExitText.setError(getResources().getString(R.string.empty_field)); mainUdobraExitText.requestFocus(); return; } } ContentValues contentValues = new ContentValues(); Calendar calendar = Calendar.getInstance(); calendar.set( year, (month - 1), day, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE)); if (!TextUtils.isEmpty(volume.getText().toString()) || !TextUtils.isEmpty(temperature.getText().toString()) || !TextUtils.isEmpty(humadity.getText().toString()) || !TextUtils.isEmpty(comment.getText().toString())) { contentValues.put(DBHelper.ID_CYCLE, idCycle); contentValues.put(DBHelper.DAY, day); contentValues.put(DBHelper.MONTH, month); contentValues.put(DBHelper.YEAR, year); contentValues.put(DBHelper.TIME, calendar.getTimeInMillis()); contentValues.put(DBHelper.VOLUME, volume.getText().toString()); contentValues.put(DBHelper.PH, ph.getText().toString()); Cursor cursor = db.query( DBHelper.TABLENAME_NOTE, new String[] {DBHelper.ID_NOTE}, null, null, null, null, null); int id_note = 1; if (cursor.moveToLast()) id_note = cursor.getInt(cursor.getColumnIndex(DBHelper.ID_NOTE)) + 1; if (mainUdobraSpinner.getSelectedItemPosition() != 0) { contentValues.put(DBHelper.UDOBRA_FLAG, 1); contentValues.put(DBHelper.UDOBRA, makeUdobraString()); makeUdobraComposition(); insertComposition(id_note); } contentValues.put(DBHelper.TEMPERATURE, temperature.getText().toString()); contentValues.put(DBHelper.HUMIDITY, humadity.getText().toString()); contentValues.put(DBHelper.COMMENT, comment.getText().toString()); contentValues.put(DBHelper.ID_NOTE, id_note); db.insert(DBHelper.TABLENAME_NOTE, null, contentValues); } if (!Utils.isTablet(context)) { Intent intent = new Intent(context, GanjCalendar_activity.class); intent.putExtra("idCycle", idCycle); startActivity(intent); } else { Intent intent = new Intent(context, Pager_main.class); intent.putExtra("position", getActivity().getIntent().getIntExtra("position", 0)); startActivity(intent); } }