コード例 #1
0
ファイル: NotepriseActivity.java プロジェクト: e6/noteprise
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    FragmentManager.enableDebugLogging(Boolean.FALSE);
    if (android.os.Build.VERSION.SDK_INT > 9) {
      StrictMode.ThreadPolicy policy =
          new StrictMode.ThreadPolicy.Builder().permitNetwork().build();
      StrictMode.setThreadPolicy(policy);
    }
    setUpWelcomeScreen();
  }
コード例 #2
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.welcome_screen_layout);
   FragmentManager.enableDebugLogging(Boolean.FALSE);
   if (android.os.Build.VERSION.SDK_INT > 9) {
     StrictMode.ThreadPolicy policy =
         new StrictMode.ThreadPolicy.Builder().permitNetwork().build();
     StrictMode.setThreadPolicy(policy);
   }
   evernoteLoginButton = (Button) findViewById(R.id.evernote_login_button);
   evernoteLoginButton.setOnClickListener(this);
 }
コード例 #3
0
  @SuppressWarnings("unchecked")
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    printLog(
        Consts.TAG,
        "onCreate: savedInstanceState " + (savedInstanceState == null ? "==" : "!=") + " null");

    // This has to be called before setContentView and you must use the
    // class in android.support.v4.view and NOT android.view

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setContentView(R.layout.activity_main);

    /*
     * if(Consts.DEVELOPER_MODE) Debug.startMethodTracing();
     */
    fm = getSupportFragmentManager();

    if (Consts.DEVELOPER_MODE) FragmentManager.enableDebugLogging(true);

    /* CREATE OUR DISK CACHE TO STORE IMAGES */
    if (Utils.isExternalStorageAvailable())
      imageDiskCache =
          new DiskLruImageCache(
              this,
              "diskcache",
              Consts.DISK_CACHE_SIZE,
              CompressFormat.PNG,
              Consts.COMPRESS_QUALITY);

    // Restore state

    if (savedInstanceState != null) {
      // The fragment manager will handle restoring them if we are being
      // restored from a saved state
      /* restore our call backs after config change */
      isFromSavedState = true;
      /* restore our call backs after config change */
      mFragmentListCallback =
          (TweeterListFragment) fm.findFragmentByTag(TweeterListFragment.class.getName());

      /* on orientation change restore the data */
      tweeters =
          (ArrayList<ArrayList<HashMap<String, String>>>)
              savedInstanceState.getSerializable(Consts.SAVED_INSTANCE_TWEETERS);
      restoredIndex = savedInstanceState.getInt(Consts.SAVED_INSTANCE_POSITION);

      isEditing = savedInstanceState.getBoolean(Consts.SAVED_INSTANCE_EDIT_MODE);

    }
    // If this is the first creation of the activity, add fragments to it
    else {

      /*
       * If our layout has a container for the modifytweeters fragment,
       * create and add it. btw if this exist, we know we are in two pane
       * mode
       */
      mModiftyTweetersLayout = (ViewGroup) findViewById(R.id.activity_modifytweeters_container);
      if (mModiftyTweetersLayout != null) {
        printLog(Consts.TAG, "onCreate: adding modifytweeters Fragment to MainActivity");

        // Add modify tweeters fragment to the activity's container layout
        ModifyTweetersFragment modifyTweetersFragment = new ModifyTweetersFragment();
        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(
            mModiftyTweetersLayout.getId(),
            modifyTweetersFragment,
            ModifyTweetersFragment.class.getName());

        // Commit the transaction
        fragmentTransaction.commit();
      }

      // If our layout has a container for the tweetslist fragment, create
      // it and add it
      mTweetslistLayout = (ViewGroup) findViewById(R.id.activity_tweetslist_container);
      if (mTweetslistLayout != null) {
        printLog(Consts.TAG, "onCreate: adding tweetslist Fragment to MainActivity");

        // Add tweeter list fragment to the activity's container layout
        TweeterListFragment tweeterListFragment = new TweeterListFragment();
        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.replace(
            mTweetslistLayout.getId(), tweeterListFragment, TweeterListFragment.class.getName());

        mFragmentListCallback = (TweeterListObserver) tweeterListFragment;

        // Commit the transaction
        fragmentTransaction.commit();
      }
    }
  }