Skip to content

Commit

Permalink
Add options to clear the cache and recent emojis
Browse files Browse the repository at this point in the history
  • Loading branch information
AkosPaha01 committed Mar 20, 2022
1 parent 0856b2e commit 579bcad
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 11 deletions.
1 change: 1 addition & 0 deletions .idea/misc.xml

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

16 changes: 8 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ 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
versionCode = 346001
versionName = "3.4.6"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -90,8 +90,8 @@ android {

dependencies {
implementation(platform("com.google.firebase:firebase-bom:29.2.0"))
implementation("com.google.firebase:firebase-messaging-ktx:23.0.1")
implementation("com.google.firebase:firebase-analytics-ktx:20.1.0")
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 @@ -112,8 +112,8 @@ dependencies {
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.1")
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 @@ -128,7 +128,7 @@ 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")
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"
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/${if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) "user_de" else "data"}/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
6 changes: 6 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,10 @@
<string name="silk">Silk Popup</string>
<string name="silk_details">Silk Popup</string>
<string name="keyboard_redesign_google_sans">Keyboard Redesign Google Sans</string>
<string name="gboard_cache_cleared">Gboard cache cleared</string>
<string name="gboard_cache_clear">Gboard cache clear</string>
<string name="gboard_cache_clear_long">Deletes cache and force closed gboard.</string>
<string name="clear_recent_emojis">Clear recent used emojis</string>
<string name="clear_recent_emojis_long">Deletes recent used emojis and force closed gboard.</string>
<string name="recent_emojis_cleared">Recent used emojis cleared</string>
</resources>
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.0-alpha06")
classpath("com.android.tools.build:gradle:7.3.0-alpha07")
//noinspection DifferentKotlinGradleVersion
classpath(kotlin("gradle-plugin", version = "1.6.20-RC"))
classpath("com.google.gms:google-services:4.3.10")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx6144m -Dfile.encoding=UTF-8
org.gradle.jvmargs=-Xmx8192m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Dec 07 07:49:33 CET 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.5-20220312232108+0000-all.zip
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.5-20220318231621+0000-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 579bcad

Please sign in to comment.