コード例 #1
0
  public void onCreate(final Bundle savedInstanceState) {

    PrefsUtility.applyTheme(this);

    super.onCreate(savedInstanceState);

    getActionBar().setHomeButtonEnabled(true);
    getActionBar().setDisplayHomeAsUpEnabled(true);

    OptionsMenuUtility.fixActionBar(this, getString(R.string.app_name));

    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    final boolean solidblack =
        PrefsUtility.appearance_solidblack(this, sharedPreferences)
            && PrefsUtility.appearance_theme(this, sharedPreferences)
                == PrefsUtility.AppearanceTheme.NIGHT;

    // TODO load from savedInstanceState

    final View layout = getLayoutInflater().inflate(R.layout.main_single, null);
    if (solidblack) layout.setBackgroundColor(Color.BLACK);
    setContentView(layout);
    mPane = (FrameLayout) layout.findViewById(R.id.main_single_frame);

    RedditAccountManager.getInstance(this).addUpdateListener(this);

    if (getIntent() != null) {

      final Intent intent = getIntent();

      final ArrayList<String> urls = intent.getStringArrayListExtra("urls");

      for (final String url : urls) {
        final RedditURLParser.RedditURL redditURL =
            RedditURLParser.parseProbableCommentListing(Uri.parse(url));
        if (redditURL != null) {
          mUrls.add(redditURL);
        }
      }

      doRefresh(RefreshableFragment.COMMENTS, false);

    } else {
      throw new RuntimeException("Nothing to show! (should load from bundle)"); // TODO
    }
  }
コード例 #2
0
 @Override
 public void onBackPressed() {
   if (General.onBackPressed()) super.onBackPressed();
 }
コード例 #3
0
 @Override
 protected void onSaveInstanceState(final Bundle outState) {
   super.onSaveInstanceState(outState);
   // TODO save instance state
 }