Skip to content

Commit

Permalink
Add Collapsing action bar, Add options to clear the cache and recent …
Browse files Browse the repository at this point in the history
…emojis, Grammar fix, bump version to 3.4.7
  • Loading branch information
AkosPaha01 authored Mar 21, 2022
2 parents 1c4c38b + 836e017 commit 3757362
Show file tree
Hide file tree
Showing 21 changed files with 206 additions and 76 deletions.
9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 14 additions & 12 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ plugins {
kotlin("kapt")
}

val libsuVersion = "4.0.0"
val libsuVersion = "4.0.2"
val kotlinVersion: String = project.getKotlinPluginVersion()

android {
compileSdkPreview = "Tiramisu"
buildToolsVersion = "33.0.0-rc1"
buildToolsVersion = "33.0.0-rc2"
buildFeatures.dataBinding = true
buildFeatures.viewBinding = true

defaultConfig {
applicationId = "de.dertyp7214.rboardthememanager"
minSdk = 23
targetSdk = 32
versionCode = 346000
versionName = "3.4.6"
versionCode = 347000
versionName = "3.4.7"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -59,7 +59,9 @@ android {
jniLibs {
useLegacyPackaging = true
}
resources.excludes.add("META-INF/*")
}
namespace = "de.dertyp7214.rboardthememanager"
}

/*protobuf {
Expand Down Expand Up @@ -87,9 +89,9 @@ android {
}*/

dependencies {
implementation(platform("com.google.firebase:firebase-bom:29.1.0"))
implementation("com.google.firebase:firebase-messaging-ktx:23.0.0")
implementation("com.google.firebase:firebase-analytics-ktx:20.1.0")
implementation(platform("com.google.firebase:firebase-bom:29.2.1"))
implementation("com.google.firebase:firebase-messaging-ktx:23.0.2")
implementation("com.google.firebase:firebase-analytics-ktx:20.1.1")

implementation("androidx.legacy:legacy-support-v4:1.0.0")
implementation("androidx.navigation:navigation-fragment-ktx:2.5.0-alpha03")
Expand All @@ -102,16 +104,16 @@ dependencies {
implementation("dev.chrisbanes.insetter:insetter:0.6.1")
implementation("androidx.core:core-ktx:1.9.0-alpha01")
//noinspection DifferentStdlibGradleVersion
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.20-RC")
implementation("androidx.core:core:1.9.0-alpha01")
implementation("com.google.android.material:material:1.6.0-alpha03")
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
implementation("androidx.preference:preference-ktx:1.2.0")
implementation("androidx.activity:activity-ktx:1.5.0-alpha03")
implementation("androidx.fragment:fragment-ktx:1.5.0-alpha03")
implementation("com.jaredrummler:android-shell:1.0.0")
implementation("com.google.firebase:firebase-analytics:20.1.0")
implementation("com.google.firebase:firebase-messaging:23.0.0")
implementation("com.google.firebase:firebase-analytics:20.1.1")
implementation("com.google.firebase:firebase-messaging:23.0.2")
implementation("com.google.code.gson:gson:2.9.0")
implementation("com.bignerdranch.android:simple-item-decoration:1.0.0")
implementation("de.dertyp7214:PRDownloader:v0.6.0")
Expand All @@ -126,8 +128,8 @@ dependencies {
implementation("com.github.murgupluoglu:flagkit-android:1.0.2")
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))

debugImplementation("androidx.compose.ui:ui-tooling:1.2.0-alpha04")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10")
debugImplementation("androidx.compose.ui:ui-tooling:1.2.0-alpha05")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.20-RC")

/*var grpc_version = "1.44.1"
implementation("io.grpc:grpc-android:$grpc_version")
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="de.dertyp7214.rboardthememanager">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
Expand All @@ -28,7 +27,7 @@
<activity
android:name=".screens.ShareFlags"
android:exported="true"
android:theme="@style/Theme.RboardThemeManagerV3.Info" />
android:theme="@style/Theme.RboardThemeManagerV3.ShareFlags" />
<activity
android:name=".screens.ReadMoreReadFast"
android:exported="true" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.dertyp7214.rboardthememanager.preferences


import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
Expand Down Expand Up @@ -30,6 +31,14 @@ import de.dertyp7214.rboardthememanager.utils.GboardUtils
import de.dertyp7214.rboardthememanager.utils.MagiskUtils

class Settings(private val activity: Activity, private val args: SafeJSON) : AbstractPreference() {
enum class FILES(val Path: String) {
@SuppressLint("SdCardPath")
CACHE("/data/user${if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) "_de" else ""}/0/${Config.GBOARD_PACKAGE_NAME}/cache/auto_clean/"),
@SuppressLint("SdCardPath")
EMOJIS("/data/data/${Config.GBOARD_PACKAGE_NAME}/databases/expression-history.db")

}

enum class TYPE {
BOOLEAN,
STRING,
Expand Down Expand Up @@ -186,6 +195,38 @@ class Settings(private val activity: Activity, private val args: SafeJSON) : Abs
Toast.makeText(this, R.string.flags_fixed, Toast.LENGTH_LONG).show()
}
),
GBOARD_CACHE_CLEAR(
"gboard_cache_clear",
R.string.gboard_cache_clear,
R.string.gboard_cache_clear_long,
R.drawable.ic_keyboard_theme,
"",
TYPE.STRING,
listOf(),
{
listOf(
"rm -r \"${FILES.CACHE.Path}\"",
"am force-stop ${Config.GBOARD_PACKAGE_NAME}"
).runAsCommand()
Toast.makeText(this, R.string.gboard_cache_cleared, Toast.LENGTH_LONG).show()
}
),
CLEAR_RECENT_EMOJIS(
"clear_recent_emojis",
R.string.clear_recent_emojis,
R.string.clear_recent_emojis_long,
R.drawable.ic_emoji_compat,
"",
TYPE.STRING,
listOf(),
{
listOf(
"rm \"${FILES.EMOJIS.Path}\"",
"am force-stop ${Config.GBOARD_PACKAGE_NAME}"
).runAsCommand()
Toast.makeText(this, R.string.recent_emojis_cleared, Toast.LENGTH_LONG).show()
}
),
DEEP_LINK(
"deep_link",
R.string.deep_link,
Expand Down
102 changes: 61 additions & 41 deletions app/src/main/res/layout/activity_preferences.xml
Original file line number Diff line number Diff line change
@@ -1,49 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
<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">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.constraintlayout.widget.ConstraintLayout
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="de.dertyp7214.rboardthememanager.screens.InfoScreen">

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
android:clickable="true"
android:visibility="gone"
app:backgroundTint="?attr/colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/ic_baseline_add_24"
app:tint="?attr/colorBackgroundFloating"
tools:ignore="ContentDescription,SpeakableTextPresentCheck"
tools:visibility="visible" />
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/Theme.RboardThemeManagerV3.AppBarOverlay"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:liftOnScroll="true">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsingToolbarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.RboardThemeManagerV3.AppBarOverlay"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
android:layout_height="?attr/collapsingToolbarLayoutLargeSize"
android:fitsSystemWindows="true"
app:contentScrim="@color/foreground"
app:expandedTitleTextAppearance="?attr/textAppearanceHeadlineMedium"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:toolbarId="@+id/toolbar">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/preferences_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:textAlignment="center"
android:theme="?attr/actionBarTheme"
app:titleCentered="true" />
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />

</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>


<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
android:clickable="true"
android:visibility="gone"
app:backgroundTint="?attr/colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/ic_baseline_add_24"
app:tint="?attr/colorBackgroundFloating"
tools:ignore="ContentDescription,SpeakableTextPresentCheck"
tools:visibility="visible" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/appBarLayout"
tools:context="de.dertyp7214.rboardthememanager.screens.InfoScreen">

</com.google.android.material.appbar.AppBarLayout>

<TextView
android:id="@+id/loadingPreferences"
Expand All @@ -54,14 +72,16 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/appBarLayout" />
app:layout_constraintTop_toTopOf="parent" />

<LinearLayout
android:id="@+id/extraContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/appBarLayout" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
Expand All @@ -71,8 +91,8 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/extraContent">

</androidx.recyclerview.widget.RecyclerView>
app:layout_constraintTop_toBottomOf="@+id/extraContent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>


</androidx.coordinatorlayout.widget.CoordinatorLayout>
5 changes: 2 additions & 3 deletions app/src/main/res/raw/flags.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"time": "1646936790156",
"time": "1647889732082",
"flags": [
{
"key": "general",
Expand Down Expand Up @@ -394,8 +394,7 @@
"icon": "ic_box_shadow",
"defaultValue": false,
"type": "BOOLEAN",
"file": "FLAGS",
"visible": false
"file": "FLAGS"
},
{
"key": "keyboard_height_ratio",
Expand Down
Loading

0 comments on commit 3757362

Please sign in to comment.