1
0
mirror of https://github.com/topjohnwu/Magisk.git synced 2025-03-28 03:02:25 +00:00

82 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
import java.io.IOException;
import java.io.InputStream;
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
@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 -> {
try {
InputStream is = getAssets().open("changelog.md");
new MarkDownWindow(this, getString(R.string.app_changelog), is).exec();
} catch (IOException e) {
e.printStackTrace();
2016-09-25 10:11:57 -05:00
}
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
}