Magisk/src/main/java/com/topjohnwu/magisk/AboutActivity.java

81 lines
2.8 KiB
Java
Raw Normal View History

2016-08-23 17:02:32 +02:00
package com.topjohnwu.magisk;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
2017-12-03 02:48:21 +08:00
import com.topjohnwu.magisk.asyncs.MarkDownWindow;
import com.topjohnwu.magisk.components.AboutCardRow;
2017-02-07 02:01:32 +08:00
import com.topjohnwu.magisk.components.Activity;
2017-11-06 04:41:23 +08:00
import com.topjohnwu.magisk.utils.Const;
2016-08-23 17:02:32 +02:00
2017-10-15 03:12:13 +08:00
import java.util.Locale;
2016-08-23 17:02:32 +02:00
import butterknife.BindView;
import butterknife.ButterKnife;
2017-02-07 02:01:32 +08:00
public class AboutActivity extends Activity {
2016-08-23 17:02:32 +02:00
@BindView(R.id.toolbar) Toolbar toolbar;
2016-11-07 21:06:18 +08:00
@BindView(R.id.app_version_info) AboutCardRow appVersionInfo;
@BindView(R.id.app_changelog) AboutCardRow appChangelog;
@BindView(R.id.app_translators) AboutCardRow appTranslators;
@BindView(R.id.app_source_code) AboutCardRow appSourceCode;
@BindView(R.id.support_thread) AboutCardRow supportThread;
@BindView(R.id.donation) AboutCardRow donation;
2016-08-23 17:02:32 +02:00
2017-12-03 15:15:00 +08:00
@Override
public int getDarkTheme() {
return R.style.AppTheme_Transparent_Dark;
}
2016-08-23 17:02:32 +02:00
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
2016-08-29 06:35:07 +08:00
toolbar.setNavigationOnClickListener(view -> finish());
2016-08-23 17:02:32 +02:00
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setTitle(R.string.about);
ab.setDisplayHomeAsUpEnabled(true);
}
2017-12-03 02:48:21 +08:00
appVersionInfo.setSummary(String.format(Locale.US, "%s (%d) (%s)",
BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE, getPackageName()));
2016-08-23 17:02:32 +02:00
appChangelog.removeSummary();
2017-12-03 02:48:21 +08:00
appChangelog.setOnClickListener(v -> {
2018-02-20 05:07:18 +08:00
new MarkDownWindow(this, getString(R.string.app_changelog),
getResources().openRawResource(R.raw.changelog)).exec();
2016-08-23 17:02:32 +02:00
});
String translators = getString(R.string.translators);
if (TextUtils.isEmpty(translators)) {
appTranslators.setVisibility(View.GONE);
} else {
appTranslators.setSummary(translators);
}
appSourceCode.removeSummary();
2017-11-06 04:41:23 +08:00
appSourceCode.setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Const.Url.SOURCE_CODE_URL))));
2016-08-23 17:02:32 +02:00
supportThread.removeSummary();
2017-11-06 04:41:23 +08:00
supportThread.setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Const.Url.XDA_THREAD))));
2016-08-26 13:01:12 +02:00
2016-09-29 23:24:31 +08:00
donation.removeSummary();
2017-11-06 04:41:23 +08:00
donation.setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Const.Url.DONATION_URL))));
2016-09-29 23:24:31 +08:00
2016-08-26 13:01:12 +02:00
setFloating();
}
2016-08-23 17:02:32 +02:00
}