@Override
 public void onClick(View v) {
   if (mCurrentActivity.getClass().equals(mTargetContext)) {
     RelativeLayout touchInterceptor =
         (RelativeLayout) mCurrentActivity.findViewById(R.id.touch_interceptor);
     touchInterceptor.setVisibility(View.GONE);
     mParent.scrollToApplicationView();
   } else {
     Intent intent = new Intent(mCurrentActivity, mTargetContext);
     mCurrentActivity.startActivity(intent);
   }
 }
Exemplo n.º 2
0
  public static void initializeShell(Activity activity, int layoutId) {
    mCurrentActivity = activity;

    // First, initialize Navigation menu
    LinearLayout bookmarksListButton =
        (LinearLayout) mShell.findViewById(R.id.nav_bookmarks_list_button);
    bookmarksListButton.setOnClickListener(
        new UiNavigationItemOnClickListener(mShell, ListBookmarks.class, activity));
    LinearLayout historyListButton =
        (LinearLayout) mShell.findViewById(R.id.nav_recent_history_button);
    historyListButton.setOnClickListener(
        new UiNavigationItemOnClickListener(mShell, RecentHistory.class, activity));
    LinearLayout accountsButton = (LinearLayout) mShell.findViewById(R.id.nav_account_button);
    accountsButton.setOnClickListener(
        new UiNavigationItemOnClickListener(mShell, Account.class, activity));

    // Then Actions menu
    clearActionsMenu();

    RelativeLayout infoItButton = (RelativeLayout) mShell.findViewById(R.id.infoit_button);
    infoItButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            EasyTracker.getTracker()
                .trackEvent(
                    Constants.SHELL_CATEGORY,
                    Constants.SHELL_INFOIT_BUTTON,
                    getCurrentActivity().getClass().getName(),
                    0);
            Intent intent = new Intent(mCurrentActivity, InfoChooser.class);
            mCurrentActivity.startActivity(intent);
          }
        });

    setBackgroundColor(R.color.standard_bg);

    setActivityContent(layoutId);
    mShell.scrollToApplicationView();
  }