[app] Replace about activity with dialog

This commit is contained in:
tehcneko 2021-02-13 17:13:50 +08:00
parent e5deb0936d
commit 03792c6138
14 changed files with 113 additions and 318 deletions

View File

@ -40,9 +40,6 @@
<activity
android:name=".ui.activity.CrashReportActivity"
android:process=":error_activity" />
<activity
android:name=".ui.activity.AboutActivity"
android:label="@string/About" />
<activity
android:name=".ui.activity.LogsActivity"
android:label="@string/Logs" />

View File

@ -1,55 +0,0 @@
/*
* This file is part of LSPosed.
*
* LSPosed is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LSPosed is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2020 EdXposed Contributors
* Copyright (C) 2021 LSPosed Contributors
*/
package io.github.lsposed.manager.ui.activity;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.ActionBar;
import io.github.lsposed.manager.R;
import io.github.lsposed.manager.databinding.ActivityAboutBinding;
import io.github.lsposed.manager.ui.activity.base.BaseActivity;
import io.github.lsposed.manager.util.NavUtil;
public class AboutActivity extends BaseActivity {
ActivityAboutBinding binding;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityAboutBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
binding.toolbar.setNavigationOnClickListener(view -> finish());
ActionBar bar = getSupportActionBar();
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
}
setupView(binding.sourceCodeView, R.string.about_source);
setupView(binding.tgChannelView, R.string.group_telegram_channel_link);
}
void setupView(View v, final int url) {
v.setOnClickListener(v1 -> NavUtil.startURL(this, getString(url)));
}
}

View File

@ -24,9 +24,12 @@ import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AlertDialog;
import androidx.core.text.HtmlCompat;
import com.bumptech.glide.Glide;
import com.google.android.material.snackbar.Snackbar;
@ -36,6 +39,7 @@ import java.util.Locale;
import io.github.lsposed.manager.Constants;
import io.github.lsposed.manager.R;
import io.github.lsposed.manager.databinding.ActivityMainBinding;
import io.github.lsposed.manager.databinding.DialogAboutBinding;
import io.github.lsposed.manager.ui.activity.base.BaseActivity;
import io.github.lsposed.manager.ui.fragment.StatusDialogBuilder;
import io.github.lsposed.manager.util.GlideHelper;
@ -69,7 +73,17 @@ public class MainActivity extends BaseActivity {
binding.download.setOnClickListener(new StartActivityListener(RepoActivity.class, false));
binding.logs.setOnClickListener(new StartActivityListener(LogsActivity.class, true));
binding.settings.setOnClickListener(new StartActivityListener(SettingsActivity.class, false));
binding.about.setOnClickListener(new StartActivityListener(AboutActivity.class, false));
binding.about.setOnClickListener(v -> {
DialogAboutBinding binding = DialogAboutBinding.inflate(LayoutInflater.from(this), null, false);
binding.sourceCode.setMovementMethod(LinkMovementMethod.getInstance());
binding.sourceCode.setText(HtmlCompat.fromHtml(getString(
R.string.about_view_source_code,
"<b><a href=\"https://github.com/RikkaApps/Shizuku\">GitHub</a></b>",
"<b><a href=\"https://t.me/LSPosed\">Telegram</a></b>"), HtmlCompat.FROM_HTML_MODE_LEGACY));
new AlertDialog.Builder(this)
.setView(binding.getRoot())
.show();
});
Glide.with(binding.appIcon)
.load(GlideHelper.wrapApplicationInfoForIconLoader(getApplicationInfo()))
.into(binding.appIcon);

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2020 EdXposed Contributors
~ Copyright (C) 2021 LSPosed Contributors
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24.0dip"
android:height="24.0dip"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,2A10,10 0 0,0 2,12C2,16.42 4.87,20.17 8.84,21.5C9.34,21.58 9.5,21.27 9.5,21C9.5,20.77 9.5,20.14 9.5,19.31C6.73,19.91 6.14,17.97 6.14,17.97C5.68,16.81 5.03,16.5 5.03,16.5C4.12,15.88 5.1,15.9 5.1,15.9C6.1,15.97 6.63,16.93 6.63,16.93C7.5,18.45 8.97,18 9.54,17.76C9.63,17.11 9.89,16.67 10.17,16.42C7.95,16.17 5.62,15.31 5.62,11.5C5.62,10.39 6,9.5 6.65,8.79C6.55,8.54 6.2,7.5 6.75,6.15C6.75,6.15 7.59,5.88 9.5,7.17C10.29,6.95 11.15,6.84 12,6.84C12.85,6.84 13.71,6.95 14.5,7.17C16.41,5.88 17.25,6.15 17.25,6.15C17.8,7.5 17.45,8.54 17.35,8.79C18,9.5 18.38,10.39 18.38,11.5C18.38,15.32 16.04,16.16 13.81,16.41C14.17,16.72 14.5,17.33 14.5,18.26C14.5,19.6 14.5,20.68 14.5,21C14.5,21.27 14.66,21.59 15.17,21.5C19.14,20.16 22,16.42 22,12A10,10 0 0,0 12,2Z" />
</vector>

View File

@ -1,30 +0,0 @@
<!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2020 EdXposed Contributors
~ Copyright (C) 2021 LSPosed Contributors
-->
<vector android:height="24dp"
android:viewportHeight="240"
android:viewportWidth="240"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M165.866,71.135s12.492,-4.858 11.451,6.94c-0.347,4.858 -3.47,21.861 -5.899,40.252L163.09,172.806s-0.694,7.981 -6.94,9.369c-6.246,1.388 -15.615,-4.858 -17.35,-6.246 -1.388,-1.041 -26.025,-16.656 -34.7,-24.29 -2.429,-2.082 -5.205,-6.246 0.347,-11.104l36.435,-34.7c4.164,-4.164 8.328,-13.88 -9.022,-2.082l-48.58,32.965s-5.552,3.47 -15.962,0.347l-22.555,-6.94s-8.328,-5.205 5.899,-10.41c34.7,-16.309 77.381,-32.965 115.204,-48.58z" />
</vector>

View File

@ -1,166 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2020 EdXposed Contributors
~ Copyright (C) 2021 LSPosed Contributors
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/snackbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:consumeSystemWindowsInsets="top|start|end"
app:edgeToEdge="true"
app:fitSystemWindowsInsets="top|start|end">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?actionBarTheme"
app:liftOnScrollTargetViewId="@id/nestedScrollView">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="?actionBarPopupTheme" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
app:fitSystemWindowsInsets="bottom"
tools:ignore="UseCompoundDrawables,ContentDescription">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="#000"
app:cardCornerRadius="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="20dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textSize="48sp"
android:paddingHorizontal="10dp"
android:textStyle="bold"
android:text="LS" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="5dp"
android:background="@drawable/ph_drawable"
android:paddingVertical="7dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="48sp"
android:textStyle="bold"
android:text="Posed" />
</FrameLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false"
android:paddingHorizontal="8dp">
<LinearLayout
android:id="@+id/tgChannelView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/item_background"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:orientation="vertical"
android:layout_weight="0.5"
android:paddingVertical="16dp">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:scaleX="1.2"
android:scaleY="1.2"
app:srcCompat="@drawable/ic_telegram_2019_logo" />
<TextView
android:layout_marginTop="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="\@LSPosed"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:id="@+id/sourceCodeView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/item_background"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:orientation="vertical"
android:layout_weight="0.5"
android:paddingVertical="16dp">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
app:tint="?colorControlNormal"
app:srcCompat="@drawable/ic_github" />
<TextView
android:layout_marginTop="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_source_label"
android:textAppearance="@style/TextAppearance.AppCompat.Subhead" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2020 EdXposed Contributors
~ Copyright (C) 2021 LSPosed Contributors
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="#000"
app:cardCornerRadius="0dp"
app:cardElevation="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="20dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textSize="48sp"
android:paddingHorizontal="10dp"
android:textStyle="bold"
android:text="LS"
tools:ignore="HardcodedText" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="5dp"
android:background="@drawable/ph_drawable"
android:paddingVertical="7dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="48sp"
android:textStyle="bold"
android:text="Posed"
tools:ignore="HardcodedText" />
</FrameLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingHorizontal="?android:dialogPreferredPadding"
android:paddingTop="16dp"
android:paddingBottom="?android:dialogPreferredPadding">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/versionName"
android:textSize="14sp" />
<TextView
android:id="@+id/source_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
tools:text="@string/about_view_source_code" />
</LinearLayout>
</LinearLayout>

View File

@ -30,7 +30,6 @@
<string name="ModulesDetail">%d модулей включено</string>
<string name="Settings">Настройки</string>
<string name="about_source">https://github.com/LSPosed/LSPosed/</string>
<string name="about_source_label">Исходный код</string>
<string name="accent_color">Цвет акцента</string>
<string name="android_framework">System Framework</string>
<string name="android_sdk">Android %2$s (%1$s, API %3$d)</string>

View File

@ -28,7 +28,6 @@
<string name="ModulesDetail">%d модулі(в) увімкнено</string>
<string name="Settings">Налаштування</string>
<string name="about_source">https://github.com/LSPosed/LSPosed/</string>
<string name="about_source_label">Вихідний код</string>
<string name="accent_color">Колір акценту</string>
<string name="android_framework">System Framework</string>
<string name="android_sdk">Android %2$s (%1$s, API %3$d)</string>
@ -43,7 +42,6 @@
<string name="enable_module">Увімкнути модуль</string>
<string name="failed_to_save_scope_list">Не вдалося зберегти список областей</string>
<string name="follow_system">Слідувати системі</string>
<string name="group_telegram_channel_link">http://t.me/LSPosed</string>
<string name="info">Інформація</string>
<string name="install_warning_title">Обережно!</string>
<string name="loading">Завантаження…</string>

View File

@ -78,7 +78,6 @@
<string name="log_is_empty">日志为空</string>
<!-- About tab -->
<string name="about_source_label">源代码</string>
<!-- DownloadView -->

View File

@ -76,7 +76,6 @@
<string name="log_is_empty">日誌為空</string>
<!-- About tab -->
<string name="about_source_label">源代碼</string>
<!-- DownloadView -->

View File

@ -60,7 +60,6 @@
<string name="log_is_empty">日誌為空</string>
<!-- About tab -->
<string name="about_source_label">原始碼</string>
<!-- DownloadView -->

View File

@ -81,7 +81,6 @@
<string name="log_is_empty">Log is empty.</string>
<!-- About tab -->
<string name="about_source_label">Source code</string>
<!-- DownloadView -->
@ -106,8 +105,6 @@
<string name="about_source" translatable="false">https://github.com/LSPosed/LSPosed/</string>
<string name="group_telegram_channel_link" translatable="false">http://t.me/LSPosed</string>
<string name="pref_title_disable_verbose_log">Disable verbose logs</string>
<string name="logs_cannot_read">Cannot read log: \n</string>
<string name="app_launch">Launch it</string>
@ -177,4 +174,5 @@
<string name="group_network">Network</string>
<string name="dns_over_http">DNS over HTTPS</string>
<string name="dns_over_http_summary">Workaround DNS poisoning in some nations</string>
<string name="about_view_source_code"><![CDATA[View source code at %s<br/>Join our %s channel]]></string>
</resources>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ This file is part of LSPosed.
~
~ LSPosed is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ LSPosed is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
~
~ Copyright (C) 2020 EdXposed Contributors
~ Copyright (C) 2021 LSPosed Contributors
-->
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@drawable/afs_*" />