diff --git a/app/build.gradle b/app/build.gradle index 891d8ac..163ab72 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -54,8 +54,8 @@ dependencies { implementation "com.github.topjohnwu.libsu:core:5.2.2" // AboutPage - implementation 'io.github.medyo:android-about-page:2.0.0' - implementation 'de.psdev.licensesdialog:licensesdialog:2.2.0' + //implementation 'io.github.medyo:android-about-page:2.0.0' + //implementation 'de.psdev.licensesdialog:licensesdialog:2.2.0' implementation 'com.afollestad.material-dialogs:core:0.9.6.0' implementation 'org.jdeferred:jdeferred-android-aar:1.2.6' @@ -69,5 +69,5 @@ dependencies { implementation 'org.tukaani:xz:1.9' implementation 'com.github.hzy3774:AndroidP7zip:1.7.2' - implementation 'com.cleveroad:androidmanimation:0.9.1' + //implementation 'com.cleveroad:androidmanimation:0.9.1' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 365f10c..1c7d4e8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -36,11 +36,6 @@ - - { - mLoadingView.stopAnimation(); mLoadingLayout.setVisibility(View.GONE); }); }, "waiting-boot").start(); diff --git a/app/src/main/java/io/twoyi/provider/TwoyiDocumentsProvider.java b/app/src/main/java/io/twoyi/provider/TwoyiDocumentsProvider.java index 78ab519..7359007 100644 --- a/app/src/main/java/io/twoyi/provider/TwoyiDocumentsProvider.java +++ b/app/src/main/java/io/twoyi/provider/TwoyiDocumentsProvider.java @@ -20,6 +20,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.util.Objects; import io.twoyi.R; import io.twoyi.utils.RomManager; @@ -60,7 +61,7 @@ public Cursor queryRoots(String[] projection) { File BASE_DIR = RomManager.getRomSdcardDir(getContext()); final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_ROOT_PROJECTION); - final String applicationName = getContext().getString(R.string.app_name); + final String applicationName = Objects.requireNonNull(getContext()).getString(R.string.app_name); final MatrixCursor.RowBuilder row = result.newRow(); row.add(Root.COLUMN_ROOT_ID, DEFAULT_ROOT_ID); @@ -182,7 +183,7 @@ private File getRootDir() { } private String getRootSummary() { - return getContext().getResources().getString(R.string.sdcard_of_twoyi); + return Objects.requireNonNull(getContext()).getResources().getString(R.string.sdcard_of_twoyi); } private void includeFile(MatrixCursor result, String docId, File file) diff --git a/app/src/main/java/io/twoyi/ui/AboutActivity.java b/app/src/main/java/io/twoyi/ui/AboutActivity.java deleted file mode 100644 index b76be32..0000000 --- a/app/src/main/java/io/twoyi/ui/AboutActivity.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - */ - -package io.twoyi.ui; - -import android.content.Intent; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.net.Uri; -import android.os.Bundle; -import android.view.Gravity; -import android.view.MenuItem; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.app.AppCompatActivity; - -import java.util.Calendar; - -import de.psdev.licensesdialog.LicensesDialog; -import de.psdev.licensesdialog.licenses.ApacheSoftwareLicense20; -import de.psdev.licensesdialog.licenses.BSD2ClauseLicense; -import de.psdev.licensesdialog.licenses.GnuGeneralPublicLicense20; -import de.psdev.licensesdialog.licenses.GnuLesserGeneralPublicLicense3; -import de.psdev.licensesdialog.licenses.MITLicense; -import de.psdev.licensesdialog.model.Notice; -import de.psdev.licensesdialog.model.Notices; -import io.twoyi.R; -import io.twoyi.utils.RomManager; -import io.twoyi.utils.UIHelper; -import mehdi.sakout.aboutpage.AboutPage; -import mehdi.sakout.aboutpage.Element; - -/** - * @author weishu - * @date 2018/9/14. - */ -public class AboutActivity extends AppCompatActivity { - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - AboutPage mPage = new AboutPage(this) - .isRTL(false) - .setImage(R.mipmap.ic_launcher) - .addItem(getCopyRightsElement()) - .addItem(getAuthorElement()) - .addItem(getVersionElement()) - .addItem(getWeChatPublicNumberElement()) - .addItem(getWebsiteElement()) - .addItem(getFaqElement()) - .addItem(getFeedbackEmailElement()) - .addItem(getFeedbackTelegramElement()) - .addItem(getLicenseElement()) - .addItem(getPrivacyElement()); - - mPage.setDescription(getResources().getString(R.string.app_name)); - - View aboutView = mPage.create(); - setContentView(aboutView); - - ActionBar actionBar = getSupportActionBar(); - - if (actionBar != null) { - actionBar.setDisplayHomeAsUpEnabled(true); - // actionBar.setBackgroundDrawable(getResources().getDrawable(R.color.colorPrimary)); - actionBar.setTitle(R.string.about_btn); - } - } - - @Override - public boolean onOptionsItemSelected(@NonNull MenuItem item) { - if (item.getItemId() == android.R.id.home) { - onBackPressed(); - return true; - } - - return super.onOptionsItemSelected(item); - } - - Element getCopyRightsElement() { - Element copyRightsElement = new Element(); - final String copyrights = String.format(getString(R.string.copy_right), Calendar.getInstance().get(Calendar.YEAR)); - copyRightsElement.setTitle(copyrights); - copyRightsElement.setGravity(Gravity.START); - return copyRightsElement; - } - - Element getVersionElement() { - Element version = new Element(); - String versionName = "unknown"; - try { - PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); - versionName = packageInfo.versionName; - } catch (PackageManager.NameNotFoundException ignored) { - } - - RomManager.RomInfo info = RomManager.getCurrentRomInfo(this); - versionName = versionName + "-" + info.code; - version.setTitle(versionName); - - return version; - } - - Element getFaqElement() { - Element element = new Element(); - element.setTitle(getResources().getString(R.string.help_text)); - element.setOnClickListener(v -> UIHelper.showFAQ(AboutActivity.this)); - return element; - } - - Element getWeChatPublicNumberElement() { - Element element = new Element(); - element.setTitle(getResources().getString(R.string.about_follow_gongzhonghao)); - element.setOnClickListener(v -> { - UIHelper.openWeiXin(AboutActivity.this, "虚拟框架"); - }); - return element; - } - - Element getAuthorElement() { - Element author = new Element(); - author.setTitle(getResources().getString(R.string.about_author)); - author.setOnClickListener(v -> { - String[] contacts = new String[]{ - getResources().getString(R.string.about_author_github), - getResources().getString(R.string.about_author_zhihu), - getResources().getString(R.string.about_author_xda), - getResources().getString(R.string.about_author_coolapk), - getResources().getString(R.string.about_author_email), - }; - - String[] urls = new String[]{"https://github.com/tiann", - "https://www.zhihu.com/people/tian-weishu", - "https://forum.xda-developers.com/member.php?u=8994560", - "http://www.coolapk.com/u/1257513", - "mailto:twsxtd@gmail.com", - }; - - AlertDialog alertDialog = UIHelper.getDialogBuilder(this) - .setIcon(R.mipmap.ic_launcher) - .setTitle(R.string.about_author_contact) - .setItems(contacts, (dialog, which) -> { - try { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setData(Uri.parse(urls[which])); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); - } catch (Throwable ignored) { - } - }) - .create(); - UIHelper.show(alertDialog); - }); - return author; - } - - Element getFeedbackTelegramElement() { - Element telegramGroup = new Element(); - telegramGroup.setTitle(getResources().getString(R.string.about_telegram_group)); - telegramGroup.setOnClickListener(v -> { - UIHelper.goTelegram(this); - }); - return telegramGroup; - } - - Element getWebsiteElement() { - Element website = new Element(); - website.setTitle(getResources().getString(R.string.about_page_website)); - website.setOnClickListener(v -> UIHelper.goWebsite(this)); - return website; - } - - Element getPrivacyElement() { - Element website = new Element(); - website.setTitle(getResources().getString(R.string.privacy)); - website.setOnClickListener(v -> UIHelper.showPrivacy(this)); - return website; - } - - Element getFeedbackEmailElement() { - Element emailElement = new Element(); - final String email = "twsxtd@gmail.com"; - String title = getResources().getString(R.string.about_feedback_title); - emailElement.setTitle(title); - - emailElement.setOnClickListener(v -> { - AlertDialog alertDialog = UIHelper.getDialogBuilder(AboutActivity.this) - .setTitle(R.string.about_feedback_title) - .setMessage(R.string.feedback_confirm) - .setPositiveButton(R.string.feedback_ok, (dialog, which) -> { - Uri uri = Uri.parse("mailto:" + email); - Intent intent = new Intent(Intent.ACTION_SENDTO, uri); - intent.putExtra(Intent.EXTRA_SUBJECT, title); // 主题 - }).setNegativeButton(R.string.read_faq_text, (dialog, which) -> { - UIHelper.showFAQ(this); - }) - .create(); - UIHelper.show(alertDialog); - }); - return emailElement; - } - - - Element getLicenseElement() { - Element license = new Element(); - license.setTitle(getResources().getString(de.psdev.licensesdialog.R.string.notices_title)); - Notices notices = new Notices(); - notices.addNotice(new Notice("AndroidP7Zip", "https://github.com/hzy3774/AndroidP7zip", - "7-Zip Copyright (C) 1999-2020 Igor Pavlov.",new GnuLesserGeneralPublicLicense3())); - notices.addNotice(new Notice("termux-adb-fastboot", "https://github.com/rendiix/termux-adb-fastboot", - "Copyright (c) 2022 rendiix", new ApacheSoftwareLicense20())); - notices.addNotice(new Notice("libsu", "https://github.com/topjohnwu/libsu", "topjohnwu", new ApacheSoftwareLicense20())); - notices.addNotice(new Notice("qemu", "https://android.googlesource.com/platform/external/qemu", "qemu", new GnuGeneralPublicLicense20())); - notices.addNotice(new Notice("LicenseDialog", "https://github.com/PSDev/LicensesDialog", - "Copyright 2013 Philip Schiffer", new ApacheSoftwareLicense20())); - notices.addNotice(new Notice("material-dialogs", "https://github.com/afollestad/material-dialogs", - "Aidan Follestad (@afollestad)", new ApacheSoftwareLicense20())); - notices.addNotice(new Notice("FloatingActionButton", "https://github.com/Clans/FloatingActionButton", - "Clans", new ApacheSoftwareLicense20())); - notices.addNotice(new Notice("android-about-page", "https://github.com/medyo/android-about-page", - "Copyright (c) 2016 Mehdi Sakout", new MITLicense())); - notices.addNotice(new Notice("AlipayZeroSdk", "https://github.com/fython/AlipayZeroSdk", - "Copyright 2016 Fung Go (fython)", new ApacheSoftwareLicense20())); - notices.addNotice(new Notice("Glide", "https://github.com/bumptech/glide", - "Copyright 2014 Google, Inc.", new BSD2ClauseLicense())); - notices.addNotice(new Notice("Once", "https://github.com/jonfinerty/Once", - "Copyright 2018 Jon Finerty", new ApacheSoftwareLicense20())); - - license.setOnClickListener(v -> { - LicensesDialog licensesDialog = new LicensesDialog.Builder(AboutActivity.this) - .setThemeResourceId(androidx.appcompat.R.style.Theme_AppCompat_DayNight_Dialog_Alert) - .setNotices(notices) - .build(); - try { - licensesDialog.show(); - } catch (Throwable ignored) { - ignored.printStackTrace(); - } - - }); - return license; - } - - -} diff --git a/app/src/main/java/io/twoyi/ui/SettingsActivity.java b/app/src/main/java/io/twoyi/ui/SettingsActivity.java index cbaf7c3..a73260b 100644 --- a/app/src/main/java/io/twoyi/ui/SettingsActivity.java +++ b/app/src/main/java/io/twoyi/ui/SettingsActivity.java @@ -98,8 +98,6 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { Preference replaceRom = findPreference(R.string.settings_key_replace_rom); Preference factoryReset = findPreference(R.string.settings_key_factory_reset); - Preference about = findPreference(R.string.settings_key_about); - importApp.setOnPreferenceClickListener(preference -> { UIHelper.startActivity(getContext(), SelectAppActivity.class); return true; @@ -157,11 +155,6 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { .show(); return true; }); - - about.setOnPreferenceClickListener(preference -> { - UIHelper.startActivity(getContext(), AboutActivity.class); - return true; - }); } diff --git a/app/src/main/java/io/twoyi/utils/AppKV.java b/app/src/main/java/io/twoyi/utils/AppKV.java index d34e051..25c63e6 100644 --- a/app/src/main/java/io/twoyi/utils/AppKV.java +++ b/app/src/main/java/io/twoyi/utils/AppKV.java @@ -20,7 +20,6 @@ public class AppKV { private static final String PREF_NAME = "app_kv"; public static final String ADD_APP_NOT_SHOW_SYSTEM= "add_app_not_show_system"; - public static final String ADD_APP_NOT_SHOW_ADDED = "add_app_not_show_added"; public static final String SHOW_ANDROID12_TIPS = "show_android12_tips_v2"; public static final String ADD_APP_NOT_SHOW_32BIT = "add_app_not_show_32bit"; diff --git a/app/src/main/java/io/twoyi/utils/UIHelper.java b/app/src/main/java/io/twoyi/utils/UIHelper.java index cbfc4c3..8dca1a1 100644 --- a/app/src/main/java/io/twoyi/utils/UIHelper.java +++ b/app/src/main/java/io/twoyi/utils/UIHelper.java @@ -12,7 +12,6 @@ import android.app.ProgressDialog; import android.content.ClipData; import android.content.ClipboardManager; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; @@ -24,7 +23,6 @@ import android.text.TextUtils; import android.util.TypedValue; import android.webkit.WebView; -import android.widget.Toast; import androidx.annotation.StringRes; import androidx.appcompat.app.AlertDialog; @@ -74,28 +72,6 @@ public static void dismiss(Dialog dialog) { } } - public static void openWeiXin(Context context, String weixin) { - try { - // 获取剪贴板管理服务 - ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); - if (cm == null) { - return; - } - cm.setText(weixin); - - Intent intent = new Intent(Intent.ACTION_MAIN); - ComponentName cmp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI"); - intent.addCategory(Intent.CATEGORY_LAUNCHER); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.setComponent(cmp); - - context.startActivity(intent); - Toast.makeText(context, R.string.wechat_public_account_tips, Toast.LENGTH_LONG).show(); - } catch (Throwable e) { - Toast.makeText(context, "WeChat is not installed.", Toast.LENGTH_SHORT).show(); - } - } - public static void show(Dialog dialog) { if (dialog == null) { return; @@ -141,39 +117,6 @@ public static MaterialDialog getNumberProgressDialog(Context context) { .build(); } - public static void showPrivacy(Context context) { - try { - Intent intent = new Intent(Intent.ACTION_VIEW); - if (!(context instanceof AppCompatActivity)) { - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - } - intent.setData(Uri.parse("https://twoyi.app/privacy")); - context.startActivity(intent); - } catch (Throwable ignored) { - } - } - - public static void showFAQ(Context context) { - try { - Intent intent = new Intent(Intent.ACTION_VIEW); - if (!(context instanceof AppCompatActivity)) { - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - } - intent.setData(Uri.parse("https://twoyi.app/guide")); - context.startActivity(intent); - } catch (Throwable ignored) { - ignored.printStackTrace(); - } - } - - public static void goWebsite(Context context) { - visitSite(context, "https://twoyi.app"); - } - - public static void goTelegram(Context context) { - visitSite(context, "https://t.me/twoyi"); - } - public static void visitSite(Context context, String url) { try { Intent intent = new Intent(Intent.ACTION_VIEW); diff --git a/app/src/main/res/layout/ac_render.xml b/app/src/main/res/layout/ac_render.xml index 349d8d7..5ee7fa1 100644 --- a/app/src/main/res/layout/ac_render.xml +++ b/app/src/main/res/layout/ac_render.xml @@ -26,18 +26,6 @@ android:layout_width="match_parent" android:layout_height="match_parent"/> - -