Beispiel #1
0
  @Override
  protected void onCreate(Bundle savedInstanceBundle) {
    requestWindowFeature(Window.FEATURE_PROGRESS);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    super.onCreate(savedInstanceBundle);

    setContentView(R.layout.activity_reading);
    this.overlayLeft = (Button) findViewById(R.id.reading_overlay_left);
    this.overlayRight = (Button) findViewById(R.id.reading_overlay_right);
    this.overlayCount = (TextView) findViewById(R.id.reading_overlay_count);

    fragmentManager = getSupportFragmentManager();

    storiesToMarkAsRead = new HashSet<Story>();
    storiesAlreadySeen = new HashSet<Story>();

    passedPosition = getIntent().getIntExtra(EXTRA_POSITION, 0);
    currentState = getIntent().getIntExtra(ItemsList.EXTRA_STATE, 0);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    contentResolver = getContentResolver();

    this.apiManager = new APIManager(this);

    // this value is expensive to compute but doesn't change during a single runtime
    this.overlayRangeTopPx = (float) UIUtils.convertDPsToPixels(this, OVERLAY_RANGE_TOP_DP);
    this.overlayRangeBotPx = (float) UIUtils.convertDPsToPixels(this, OVERLAY_RANGE_BOT_DP);

    // the unread count overlay defaults to neutral colour.  set it to positive if we are in focus
    // mode
    if (this.currentState == AppConstants.STATE_BEST) {
      ViewUtils.setViewBackground(this.overlayCount, R.drawable.positive_count_rect);
    }
  }
Beispiel #2
0
  private void setOverlayAlpha(float a) {
    UIUtils.setViewAlpha(this.overlayLeft, a);
    UIUtils.setViewAlpha(this.overlayRight, a);

    if (this.unreadCount > 0) {
      UIUtils.setViewAlpha(this.overlayCount, a);
    } else {
      UIUtils.setViewAlpha(this.overlayCount, 0.0f);
    }
  }
Beispiel #3
0
  /**
   * Sets up the local pager widget. Should be called from onCreate() after both the cursor and
   * adapter are created.
   */
  protected void setupPager() {
    syncFragment = (SyncUpdateFragment) fragmentManager.findFragmentByTag(SyncUpdateFragment.TAG);
    if (syncFragment == null) {
      syncFragment = new SyncUpdateFragment();
      fragmentManager.beginTransaction().add(syncFragment, SyncUpdateFragment.TAG).commit();
    }

    pager = (ViewPager) findViewById(R.id.reading_pager);
    pager.setPageMargin(UIUtils.convertDPsToPixels(getApplicationContext(), 1));
    pager.setPageMarginDrawable(R.drawable.divider_light);
    pager.setOnPageChangeListener(this);

    pager.setAdapter(readingAdapter);
    pager.setCurrentItem(passedPosition);
    this.enableOverlays();
  }
Beispiel #4
0
  @Override
  protected void onResume() {
    super.onResume();

    NBSyncService.clearPendingStoryRequest();
    NBSyncService.flushRecounts();
    NBSyncService.setActivationMode(NBSyncService.ActivationMode.ALL);
    FeedUtils.activateAllStories();
    FeedUtils.clearReadingSession();

    updateStatusIndicators();
    triggerSync();

    if (PrefsUtils.isLightThemeSelected(this) != isLightTheme) {
      UIUtils.restartActivity(this);
    }
  }
  @Override
  protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);

    UIUtils.setCustomActionBar(
        this, R.drawable.ak_icon_blurblogs, getResources().getString(R.string.all_shared_stories));

    itemListFragment =
        (AllSharedStoriesItemListFragment)
            fragmentManager.findFragmentByTag(AllSharedStoriesItemListFragment.class.getName());
    if (itemListFragment == null) {
      itemListFragment = AllSharedStoriesItemListFragment.newInstance();
      itemListFragment.setRetainInstance(true);
      FragmentTransaction listTransaction = fragmentManager.beginTransaction();
      listTransaction.add(
          R.id.activity_itemlist_container,
          itemListFragment,
          AllSharedStoriesItemListFragment.class.getName());
      listTransaction.commit();
    }
  }