Пример #1
0
 @Override
 protected void onChartSelected(int page, int column) {
   super.onChartSelected(page, column);
   if (page != currentChartSet.ordinal()) {
     currentChartSet = ChartSet.values()[page];
     updateTabbarButtons();
   }
 }
Пример #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    smoothEnabled = Preferences.getChartSmooth(this);
    super.onCreate(savedInstanceState);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    setCurrentChartSet(ChartSet.RATINGS);

    Bundle b = getIntent().getExtras();
    if (b != null) {
      String chartSet = b.getString(DetailsActivity.EXTRA_CHART_SET);
      if (chartSet != null) {
        currentChartSet = ChartSet.valueOf(chartSet);
      }
    }

    if (currentChartSet == null) {
      currentChartSet = ChartSet.DOWNLOADS;
    }

    if (ChartSet.RATINGS.equals(currentChartSet)) {
      getSupportActionBar().setTitle(R.string.ratings);
    } else {
      getSupportActionBar().setTitle(R.string.downloads);
    }

    // chartFrame = (ViewSwitcher) ;

    oneEntryHint = (View) findViewById(R.id.base_chart_one_entry_hint);

    historyList = (ListView) findViewById(R.id.base_chart_list);
    View inflate = getLayoutInflater().inflate(R.layout.chart_list_footer, null);
    historyListFooter = (TextView) inflate.findViewById(R.id.chart_footer_text);
    historyList.addFooterView(inflate, null, false);

    // XXX this whole package is going away, make it compile for now
    historyListAdapter = null; // new ChartListAdapter(this);
    setAdapter(historyListAdapter);

    historyListAdapter.setCurrentChart(currentChartSet.ordinal(), 1);
    setAllowChangePageSliding(false);

    if (getLastCustomNonConfigurationInstance() != null) {
      loadChartData = (LoadChartData) getLastCustomNonConfigurationInstance();
      loadChartData.attach(this);
      if (loadChartData.statsForApp != null) {
        updateView(loadChartData.statsForApp);
        dataUpdateRequested = false;
      }
    }
    // first load is handled in onResume()
  }
Пример #3
0
  @Override
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);
    Bundle b = intent.getExtras();
    if (b != null) {
      String chartSet = b.getString(DetailsActivity.EXTRA_CHART_SET);
      if (chartSet != null) {
        currentChartSet = ChartSet.valueOf(chartSet);
      }
    }

    if (currentChartSet == null) {
      currentChartSet = ChartSet.DOWNLOADS;
    }
    setCurrentChart(currentChartSet.ordinal(), 1);
  }
Пример #4
0
  public void startChartActivity(ChartSet set) {
    Intent intent = new Intent(BaseActivity.this, ChartActivity.class);
    intent.putExtra(BaseActivity.EXTRA_PACKAGE_NAME, packageName);
    intent.putExtra(BaseActivity.EXTRA_DEVELOPER_ID, developerId);
    intent.putExtra(BaseActivity.EXTRA_ICON_FILE, iconFilePath);
    intent.putExtra(BaseActivity.EXTRA_AUTH_ACCOUNT_NAME, accountName);
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.putExtra(DetailsActivity.EXTRA_CHART_SET, set.name());

    startActivity(intent);
  }
Пример #5
0
  private void updateView(AppStatsSummary appStatsList) {
    List<AppStats> statsForApp = appStatsList.getStats();
    if (statsForApp != null && statsForApp.size() > 0) {
      boolean smoothedValues = applySmoothedValues(statsForApp);
      historyListAdapter.setOverallStats(appStatsList.getOverallStats());
      // XXX this package is going away ,make it compile for now
      //			historyListAdapter.setHighestRatingChange(appStatsList.getHighestRatingChange());
      //			historyListAdapter.setLowestRatingChange(appStatsList.getLowestRatingChange());

      updateCharts(statsForApp);

      DateFormat dateFormat = Preferences.getDateFormatLong(this);
      timetext =
          dateFormat.format(statsForApp.get(0).getDate())
              + " - "
              + dateFormat.format(statsForApp.get(statsForApp.size() - 1).getDate());

      updateChartHeadline();

      // make a shallow copy, otherwise original data can't be used to
      // restore state
      List<AppStats> statsForAppReversed = new ArrayList<AppStats>();
      statsForAppReversed.addAll(statsForApp);
      Collections.reverse(statsForAppReversed);
      historyListAdapter.setStats(statsForAppReversed);
      /*
       * int page=historyListAdapter.getCurrentPage(); int
       * column=historyListAdapter.getCurrentColumn();
       * historyListAdapter.setCurrentChart(page, column);
       */
      historyListAdapter.notifyDataSetChanged();

      if (smoothedValues && currentChartSet.equals(ChartSet.DOWNLOADS)) {
        historyListFooter.setVisibility(View.VISIBLE);
      } else {
        historyListFooter.setVisibility(View.INVISIBLE);
      }

      if (oneEntryHint != null) {
        if (statsForApp.size() == 1) {
          oneEntryHint.setVisibility(View.VISIBLE);
        } else {
          oneEntryHint.setVisibility(View.INVISIBLE);
        }
      }

      // chartFrame.showNext();

    }
  }