Search in sources :

Example 1 with GitHubContributorsListFragment

use of com.genonbeta.TrebleShot.fragment.external.GitHubContributorsListFragment in project TrebleShot by genonbeta.

the class AboutActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    mUpdater = new GitHubUpdater(this, AppConfig.URI_REPO_APP_UPDATE, R.style.AppTheme);
    mTextUpdates = findViewById(R.id.activity_about_update_text);
    findViewById(R.id.fab).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent intent = new Intent(Intent.ACTION_SENDTO);
            intent.setType("*/*");
            intent.setData(Uri.parse("mailto:" + AppConfig.EMAIL_DEVELOPER));
            intent.putExtra(Intent.EXTRA_EMAIL, AppConfig.EMAIL_DEVELOPER);
            intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.text_appName));
            startActivity(Intent.createChooser(intent, getString(R.string.text_application)));
        }
    });
    findViewById(R.id.activity_about_see_source_layout).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse(AppConfig.URI_REPO_APP)));
        }
    });
    findViewById(R.id.activity_about_translate_layout).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse(AppConfig.URI_TRANSLATE)));
        }
    });
    findViewById(R.id.activity_about_update_layout).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            mUpdater.checkForUpdates(true, null);
        }
    });
    if (mPreferences.contains("availableVersion") && mUpdater.isNewVersion(mPreferences.getString("availableVersion", null)))
        highlightUpdater(mPreferences.getString("availableVersion", null));
    else
        mUpdater.checkForUpdates(false, new GitHubUpdater.OnInfoAvailableListener() {

            @Override
            public void onInfoAvailable(boolean newVersion, String versionName, String title, String description, String releaseDate) {
                mPreferences.edit().putString("availableVersion", versionName).apply();
                if (newVersion)
                    highlightUpdater(versionName);
            }
        });
    GitHubContributorsListFragment contributorsListFragment = (GitHubContributorsListFragment) getSupportFragmentManager().findFragmentById(R.id.activity_about_contributors_fragment);
    if (contributorsListFragment != null)
        contributorsListFragment.getListView().setNestedScrollingEnabled(false);
}
Also used : GitHubUpdater(velitasali.updatewithgithub.GitHubUpdater) GitHubContributorsListFragment(com.genonbeta.TrebleShot.fragment.external.GitHubContributorsListFragment) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

Intent (android.content.Intent)1 Toolbar (android.support.v7.widget.Toolbar)1 View (android.view.View)1 TextView (android.widget.TextView)1 GitHubContributorsListFragment (com.genonbeta.TrebleShot.fragment.external.GitHubContributorsListFragment)1 GitHubUpdater (velitasali.updatewithgithub.GitHubUpdater)1