コード例 #1
0
ファイル: ActivityMain.java プロジェクト: JCulver/NotePad-2
  @Override
  public void onCreate(Bundle b) {
    // Must do this before super.onCreate
    ActivityHelper.readAndSetSettings(this);
    super.onCreate(b);

    syncStatusReceiver = new SyncStatusMonitor();

    // First load, then don't add to backstack
    shouldAddToBackStack = false;

    // To know if we should animate exits
    if (getIntent() != null && getIntent().getBooleanExtra(ANIMATEEXIT, false)) {
      mAnimateExit = true;
    }

    // If user has donated some other time
    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    mHasPremiumAccess = prefs.getBoolean(PREMIUMSTATUS, false);
    mDonatedInApp = prefs.getBoolean(SKU_INAPP_PREMIUM, false);

    alreadyShowcased = prefs.getBoolean(SHOWCASED_MAIN, false);
    alreadyShowcasedDrawer = prefs.getBoolean(SHOWCASED_DRAWER, false);

    // To listen on fragment changes
    getSupportFragmentManager()
        .addOnBackStackChangedListener(
            new FragmentManager.OnBackStackChangedListener() {
              public void onBackStackChanged() {
                if (showingEditor && !isNoteIntent(getIntent())) {
                  setHomeAsDrawer(true);
                }
                // Always update menu
                invalidateOptionsMenu();
              }
            });

    if (b != null) {
      Log.d("nononsenseapps list", "Activity Saved not null: " + b);
      this.state = b;
    }

    // Create a PullToRefreshAttacher instance
    pullToRefreshAttacher = PullToRefreshAttacher.get(this);

    // Clear possible notifications, schedule future ones
    final Intent intent = getIntent();
    // Clear notification if present
    clearNotification(intent);
    // Schedule notifications
    NotificationHelper.schedule(this);
  }
コード例 #2
0
  @SuppressLint("SimpleDateFormat")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    // Must do this before super.onCreate
    ActivityHelper.readAndSetSettings(this);
    super.onCreate(savedInstanceState);

    // Intent must contain a task id
    if (getIntent() == null || getIntent().getLongExtra(Task.Columns._ID, -1) < 1) {
      setResult(RESULT_CANCELED, new Intent());
      finish();
      return;
    } else {
      mTaskID = getIntent().getLongExtra(Task.Columns._ID, -1);
    }

    timeFormatter = TimeFormatter.getLocalFormatterLong(this);
    // Default datetime format in sqlite. Set to UTC timezone
    dbTimeParser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    dbTimeParser.setTimeZone(TimeZone.getTimeZone("UTC"));
  }