コード例 #1
0
 /**
  * Open the MilestoneList Activity for the selected milestone
  *
  * @param view
  */
 public void openProjectView(View view) {
   MenuItem item = this.actionBarmenu.findItem(R.id.action_all_tasks);
   item.setVisible(true);
   int container =
       mGlobalVariables.ismTwoPane() ? R.id.twopane_list : R.id.main_fragment_container;
   Bundle args = new Bundle();
   args.putBoolean("TwoPane", mGlobalVariables.ismTwoPane());
   ProjectListFragment fragment = new ProjectListFragment();
   this.fragmentStack.push(fragment);
   getFragmentManager()
       .beginTransaction()
       .add(fragment, "Project_View")
       .addToBackStack("Project_View");
   fragment.setArguments(args);
   this.currFragment = fragment;
   getFragmentManager().beginTransaction().replace(container, fragment).commit();
   if (mGlobalVariables.ismTwoPane()) {
     getFragmentManager()
         .beginTransaction()
         .remove(getFragmentManager().findFragmentById(R.id.twopane_detail_container))
         .commit();
   }
   getActionBar().setDisplayHomeAsUpEnabled(false);
 }
コード例 #2
0
 /**
  * Determines if this activity should operate in two pane mode and creates the fragment to display
  * a list of projects.
  */
 private void createProjectList() {
   mGlobalVariables.setmTwoPane(
       (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK)
           >= Configuration.SCREENLAYOUT_SIZE_LARGE);
   this.fragmentStack = new Stack<Fragment>();
   Bundle args = new Bundle();
   args.putBoolean("TwoPane", mGlobalVariables.ismTwoPane());
   ProjectListFragment fragment = new ProjectListFragment();
   this.fragmentStack.push(fragment);
   getFragmentManager()
       .beginTransaction()
       .add(fragment, "Project_List")
       .addToBackStack("Project_List");
   fragment.setArguments(args);
   this.currFragment = fragment;
   if (!mGlobalVariables.ismTwoPane()) {
     setContentView(R.layout.activity_onepane);
     getFragmentManager().beginTransaction().add(R.id.main_fragment_container, fragment).commit();
     this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
   } else {
     setContentView(R.layout.activity_twopane);
     getFragmentManager().beginTransaction().add(R.id.twopane_list, fragment).commit();
   }
 }