Example #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    app = (AnalyticsApplication) getApplication();
    app.send(this);

    theme =
        getSharedPreferences(MainActivity.THEME_PREFERENCES, MODE_PRIVATE)
            .getString(MainActivity.THEME_SAVED, MainActivity.LIGHTTHEME);
    if (theme.equals(MainActivity.DARKTHEME)) {
      setTheme(R.style.CustomStyle_DarkTheme);
    } else {
      setTheme(R.style.CustomStyle_LightTheme);
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.about_layout);
    //  Intent i = getIntent();
    //        mId = (UUID)i.getSerializableExtra(TodoNotificationService.TODOUUID);

    final Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    if (backArrow != null) {
      backArrow.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
    }
    try {
      PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0);
      appVersion = info.versionName;
    } catch (Exception e) {
      e.printStackTrace();
    }

    mVersionTextView = (TextView) findViewById(R.id.aboutVersionTextView);
    mVersionTextView.setText(
        String.format(getResources().getString(R.string.app_version), appVersion));
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    contactMe = (TextView) findViewById(R.id.aboutContactMe);

    contactMe.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            app.send(
                this,
                new HitBuilders.EventBuilder().setCategory("Action").setAction("Feedback").build());
          }
        });

    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      getSupportActionBar().setHomeAsUpIndicator(backArrow);
    }
  }