Beispiel #1
0
 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);
 }
Beispiel #2
0
  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);
  }
Beispiel #3
0
 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();
     }
   }
 }
Beispiel #4
0
  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);
  }
Beispiel #5
0
  /**
   * 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;
  }
Beispiel #6
0
 private void showUserGuide() {
   Utils.showUserGuard(this, UserGuideActivity.START_FROM_SETTINGS);
   Utils.overridePendingTransitionRight2Left(this);
 }
Beispiel #7
0
  @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();
  }