mirror of
https://github.com/YTVanced/VancedManager
synced 2024-11-22 19:25:11 +00:00
code optimisations
This commit is contained in:
parent
4c3edbd67b
commit
d8bae1dfff
12 changed files with 182 additions and 149 deletions
|
@ -3,7 +3,7 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.vanced.manager">
|
||||
|
||||
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
|
|
@ -5,13 +5,11 @@ import android.os.Bundle
|
|||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.ui.setupWithNavController
|
||||
import com.google.android.material.appbar.MaterialToolbar
|
||||
import com.vanced.manager.ui.fragments.HomeFragment
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.ui.fragments.SettingsFragment
|
||||
import com.vanced.manager.ui.core.ThemeActivity
|
||||
|
||||
class MainActivity : ThemeActivity() {
|
||||
|
@ -37,11 +35,11 @@ class MainActivity : ThemeActivity() {
|
|||
when (item.itemId) {
|
||||
R.id.navigation_home -> {
|
||||
navHost.navigate(R.id.toHomeFragment)
|
||||
navBar.menu.getItem(R.id.navigation_home).isChecked = true
|
||||
return@setOnNavigationItemSelectedListener true
|
||||
}
|
||||
R.id.navigation_settings -> {
|
||||
navHost.navigate(R.id.toSettingsFragment)
|
||||
navBar.menu.getItem(R.id.navigation_settings).isChecked = true
|
||||
return@setOnNavigationItemSelectedListener true
|
||||
}
|
||||
}
|
||||
false
|
||||
|
|
|
@ -1,34 +1,16 @@
|
|||
package com.vanced.manager.ui.core
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import com.vanced.manager.R
|
||||
import com.vanced.manager.ui.MainActivity
|
||||
|
||||
class SplashScreenActivity : AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
setTheme(R.style.SplashTheme)
|
||||
if (android.os.Build.VERSION.SDK_INT < 28) {
|
||||
setTaskBG()
|
||||
}
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
startActivity(Intent(this@SplashScreenActivity, MainActivity::class.java))
|
||||
finish()
|
||||
}
|
||||
|
||||
private fun setTaskBG() {
|
||||
val icon = BitmapFactory.decodeResource(resources, R.drawable.splash192)
|
||||
val label = getString(R.string.app_name)
|
||||
val color = ResourcesCompat.getColor(resources, R.color.Black, null)
|
||||
val taskDec: ActivityManager.TaskDescription = ActivityManager.TaskDescription(label, icon, color)
|
||||
setTaskDescription(taskDec)
|
||||
}
|
||||
}
|
||||
|
|
6
app/src/main/res/font/exo.xml
Normal file
6
app/src/main/res/font/exo.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:fontProviderAuthority="com.google.android.gms.fonts"
|
||||
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs"
|
||||
app:fontProviderPackage="com.google.android.gms"
|
||||
app:fontProviderQuery="Exo"></font-family>
|
6
app/src/main/res/font/exo_2.xml
Normal file
6
app/src/main/res/font/exo_2.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
app:fontProviderAuthority="com.google.android.gms.fonts"
|
||||
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs"
|
||||
app:fontProviderPackage="com.google.android.gms"
|
||||
app:fontProviderQuery="Exo 2"></font-family>
|
|
@ -1,62 +1,49 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
<androidx.core.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:context=".ui.fragments.AboutFragment">
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="@dimen/twelvedp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="?colorSurface"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<include
|
||||
android:id="@+id/about_header_wrapper"
|
||||
layout="@layout/include_about_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/twelvedp"
|
||||
android:background="?colorSurface"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp">
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<include
|
||||
android:id="@+id/about_header_wrapper"
|
||||
layout="@layout/include_about_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<include
|
||||
android:id="@+id/about_vanced_devs_wrapper"
|
||||
layout="@layout/include_about_vanced_devs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/stdp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/about_vanced_devs_wrapper"
|
||||
layout="@layout/include_about_vanced_devs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/stdp" />
|
||||
<include
|
||||
android:id="@+id/about_app_devs_wrapper"
|
||||
layout="@layout/include_about_app_devs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/stdp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/about_app_devs_wrapper"
|
||||
layout="@layout/include_about_app_devs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/stdp" />
|
||||
<include
|
||||
android:id="@+id/about_github_container_wrapper"
|
||||
layout="@layout/include_about_sources"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/stdp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/about_github_container_wrapper"
|
||||
layout="@layout/include_about_github"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/stdp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,75 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.fragments.AboutFragment">
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:scrollbars="none"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
android:layout_marginTop="@dimen/twelvedp"
|
||||
android:background="?colorSurface"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
<include
|
||||
android:id="@+id/home_vanced_wrapper"
|
||||
layout="@layout/include_vanced"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/twelvedp"
|
||||
android:background="?colorSurface"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/stdp"
|
||||
android:layout_marginEnd="@dimen/stdp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<include
|
||||
android:id="@+id/home_microg_wrapper"
|
||||
layout="@layout/include_microg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/stdp"
|
||||
android:layout_marginTop="@dimen/stdp"
|
||||
android:layout_marginEnd="@dimen/stdp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/home_vanced_wrapper"
|
||||
layout="@layout/include_vanced"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/stdp"
|
||||
android:layout_marginEnd="@dimen/stdp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/home_microg_wrapper"
|
||||
layout="@layout/include_microg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/stdp"
|
||||
android:layout_marginTop="@dimen/stdp"
|
||||
android:layout_marginEnd="@dimen/stdp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/home_changelog_wrapper"
|
||||
layout="@layout/include_changelogs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/stdp"
|
||||
android:layout_marginTop="@dimen/stdp"
|
||||
android:layout_marginEnd="@dimen/stdp" />
|
||||
<include
|
||||
android:id="@+id/home_changelog_wrapper"
|
||||
layout="@layout/include_changelogs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/stdp"
|
||||
android:layout_marginTop="@dimen/stdp"
|
||||
android:layout_marginEnd="@dimen/stdp" />
|
||||
|
||||
|
||||
<include
|
||||
android:id="@+id/home_useful_links_wrapper"
|
||||
layout="@layout/include_useful_links"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/stdp"
|
||||
android:layout_marginTop="@dimen/stdp"
|
||||
android:layout_marginEnd="@dimen/stdp" />
|
||||
<include
|
||||
android:id="@+id/home_useful_links_wrapper"
|
||||
layout="@layout/include_useful_links"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/stdp"
|
||||
android:layout_marginTop="@dimen/stdp"
|
||||
android:layout_marginEnd="@dimen/stdp" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
@ -44,13 +42,15 @@
|
|||
android:id="@+id/button_nonroot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:text="non-root"/>
|
||||
android:fontFamily="@font/exo_semibold"
|
||||
android:text="non-root"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<com.google.android.material.radiobutton.MaterialRadioButton
|
||||
android:id="@+id/button_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/exo_semibold"
|
||||
android:textSize="18sp"
|
||||
android:text="root"/>
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
app:cardBackgroundColor="?colorSurfaceVariant"
|
||||
app:cardCornerRadius="8dp"
|
||||
app:cardElevation="0dp"
|
||||
app:contentPaddingLeft="8dp"
|
||||
app:contentPaddingRight="8dp"
|
|
@ -7,14 +7,14 @@
|
|||
app:cardCornerRadius="@dimen/eightdp"
|
||||
app:cardBackgroundColor="?colorSurfaceVariant"
|
||||
app:cardElevation="0dp"
|
||||
app:contentPaddingLeft="12dp"
|
||||
app:contentPaddingRight="12dp"
|
||||
app:contentPaddingBottom="12dp"
|
||||
app:contentPaddingBottom="4dp"
|
||||
app:contentPaddingLeft="8dp"
|
||||
app:contentPaddingRight="8dp"
|
||||
app:cardPreventCornerOverlap="true">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/useful_links_title"
|
||||
|
@ -58,7 +58,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/support_us"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="#ffffff"
|
||||
app:backgroundTint="?colorPrimary"
|
||||
|
|
|
@ -10,26 +10,98 @@
|
|||
android:id="@+id/home_fragment"
|
||||
android:name="com.vanced.manager.ui.fragments.HomeFragment"
|
||||
android:label="@string/title_home"
|
||||
tools:layout="@layout/fragment_home" />
|
||||
tools:layout="@layout/fragment_home">
|
||||
|
||||
<action
|
||||
android:id="@+id/toAboutFragment"
|
||||
app:destination="@id/about_fragment"
|
||||
app:enterAnim="@anim/fragment_fade_enter"
|
||||
app:exitAnim="@anim/fragment_fade_exit"
|
||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||
|
||||
<action
|
||||
android:id="@+id/toInstallThemeFragment"
|
||||
app:destination="@id/install_theme_fragment"
|
||||
app:enterAnim="@anim/fragment_fade_enter"
|
||||
app:exitAnim="@animator/fragment_exit"
|
||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/settings_fragment"
|
||||
android:name="com.vanced.manager.ui.fragments.SettingsFragment"
|
||||
android:label="@string/title_settings" />
|
||||
android:label="@string/title_settings">
|
||||
|
||||
<action
|
||||
android:id="@+id/toAboutFragment"
|
||||
app:destination="@id/about_fragment"
|
||||
app:enterAnim="@anim/fragment_fade_enter"
|
||||
app:exitAnim="@anim/fragment_fade_exit"
|
||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/about_fragment"
|
||||
android:name="com.vanced.manager.ui.fragments.AboutFragment"
|
||||
android:label="@string/about"
|
||||
tools:layout="@layout/fragment_about" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/install_theme_fragment"
|
||||
android:name="com.vanced.manager.ui.fragments.VancedThemeSelectionFragment"
|
||||
android:label="@string/about"
|
||||
tools:layout="@layout/fragment_vanced_theme_selection">
|
||||
|
||||
<action
|
||||
android:id="@+id/toInstallVariantFragment"
|
||||
app:destination="@id/install_variant_fragment"
|
||||
app:enterAnim="@animator/fragment_enter"
|
||||
app:exitAnim="@animator/fragment_exit"
|
||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/install_variant_fragment"
|
||||
android:name="com.vanced.manager.ui.fragments.VancedVariantSelectionFragment"
|
||||
android:label="@string/about"
|
||||
tools:layout="@layout/fragment_vanced_variant_selection">
|
||||
|
||||
<action
|
||||
android:id="@+id/toInstallLanguageFragment"
|
||||
app:destination="@id/install_language_fragment"
|
||||
app:enterAnim="@animator/fragment_enter"
|
||||
app:exitAnim="@animator/fragment_exit"
|
||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/install_language_fragment"
|
||||
android:name="com.vanced.manager.ui.fragments.VancedLanguageSelectionFragment"
|
||||
android:label="@string/about"
|
||||
tools:layout="@layout/fragment_vanced_language_selection" />
|
||||
|
||||
<action
|
||||
android:id="@+id/toSettingsFragment"
|
||||
app:destination="@id/settings_fragment"
|
||||
app:enterAnim="@anim/nav_default_enter_anim"
|
||||
app:exitAnim="@anim/nav_default_exit_anim"
|
||||
app:enterAnim="@anim/fragment_fade_enter"
|
||||
app:exitAnim="@anim/fragment_fade_exit"
|
||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||
|
||||
<action
|
||||
android:id="@+id/toHomeFragment"
|
||||
app:destination="@id/home_fragment"
|
||||
app:enterAnim="@anim/nav_default_enter_anim"
|
||||
app:exitAnim="@anim/nav_default_exit_anim"
|
||||
app:enterAnim="@anim/fragment_fade_enter"
|
||||
app:exitAnim="@anim/fragment_fade_exit"
|
||||
app:popEnterAnim="@anim/nav_default_pop_enter_anim"
|
||||
app:popExitAnim="@anim/nav_default_pop_exit_anim" />
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<array name="preloaded_fonts" translatable="false">
|
||||
<item>@font/exo</item>
|
||||
<item>@font/exo_2</item>
|
||||
<item>@font/exo_semibold</item>
|
||||
</array>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue