Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
AkosPaha01 committed Mar 9, 2022
1 parent ccd931d commit 4dbb6a2
Show file tree
Hide file tree
Showing 13 changed files with 228 additions and 51 deletions.
11 changes: 11 additions & 0 deletions .idea/misc.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ class Props(private val activity: AppCompatActivity, private val args: SafeJSON)
val prefs = listOf(
"ch_margins",

"kb_pad_land_b",
"kb_pad_land_l",
"kb_pad_land_r",
"kb_pad_port_b",
"kb_pad_port_l",
"kb_pad_port_r",

"ch_margins_lanscape",

"kb_pad_land_b",
"kb_pad_land_l",
"kb_pad_land_r",

"ch_radius",

"corner_key_r"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.util.Log
import android.widget.Toast
import androidx.activity.result.ActivityResultLauncher
import androidx.core.content.FileProvider
import androidx.fragment.app.FragmentActivity
import de.dertyp7214.rboardthememanager.R
import de.dertyp7214.rboardthememanager.core.runAsCommand
import java.io.File

object PackageUtils {
@SuppressLint("SdCardPath")
@SuppressLint("SdCardPath", "SetWorldReadable")
fun install(
context: FragmentActivity,
file: File,
Expand All @@ -28,27 +25,25 @@ object PackageUtils {
if (file.extension == "apk") {
val intent: Intent?
val downloadedApk = getFileUri(context, file)
val newFile = File(context.getExternalFilesDir(""), "updater" + "/update.apk")
when {
Build.VERSION.SDK_INT > Build.VERSION_CODES.O -> {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N -> {
intent = Intent(Intent.ACTION_VIEW).setDataAndType(
downloadedApk,
"application/vnd.android.package-archive"
)
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
context.startActivity(intent)
}
else -> {
intent = null
if ("chmod 775 ${"/data/user/0/de.dertyp7214.rboardthememanager.debug/files/updater"}".runAsCommand() && "chmod 775 ${file.absolutePath}".runAsCommand() && "pm install ${file.absolutePath}".runAsCommand() || " pm install -r ${file.absolutePath}".runAsCommand()) Toast.makeText(
context,
R.string.app_updated,
Toast.LENGTH_SHORT
).show()
else error()
intent = Intent(Intent.ACTION_VIEW).setDataAndType(
Uri.fromFile(newFile),
"application/vnd.android.package-archive");
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
context.startActivity(intent)
}
}
intent?.let {
resultLauncher?.launch(it) ?: context.startActivity(it)
}
} else error()
} else error()
} catch (e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package de.dertyp7214.rboardthememanager.utils

import android.content.Context
import android.os.Build
import android.os.Environment
import com.downloader.Error
import com.downloader.OnDownloadListener
import com.downloader.PRDownloader
Expand All @@ -13,11 +15,17 @@ import kotlin.math.roundToLong
class UpdateHelper(
private val url: String,
private val context: Context,
private val path: String = getPath(context, "updater")
private val path: String = getPath(context, "updater"),
) {
companion object {
private fun getPath(context: Context, folder: String): String {
return File(context.filesDir, folder).absolutePath
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return File(context.filesDir, folder).absolutePath
}
else
{
return File(context.getExternalFilesDir(""), folder).absolutePath
}
}
}

Expand Down
26 changes: 12 additions & 14 deletions app/src/main/res/drawable/ic_bitmoji.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="88"
android:viewportHeight="88">
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillAlpha="0.7"
android:fillColor="#000000"
android:pathData="M21.3,13.1c-1.8,0.5 -4.4,2.5 -6,4.6l-2.8,3.6 -0.3,20.3c-0.4,23.6 0.3,27.1 5.5,31.1 2.8,2.1 4.9,2.8 9.9,3.1l6.4,0.4 0,3.3c0,3.4 2.5,6.5 5.4,6.5 0.9,-0 4.4,-2.3 7.7,-5 5.8,-4.8 6.2,-5 12.2,-5 7.5,-0 12.3,-2.1 15.5,-7 2.3,-3.4 2.3,-3.8 2,-26.1 -0.3,-22.7 -0.3,-22.8 -2.8,-25.5 -4.6,-4.9 -7.2,-5.4 -29.2,-5.3 -11.2,-0 -21.7,0.5 -23.5,1zM68.5,20.5c2.5,2.4 2.5,2.4 2.5,23.5 0,21.1 0,21.1 -2.5,23.5 -2,2.1 -3.4,2.5 -8.4,2.5 -7.3,-0 -10.2,1.1 -15.8,5.6l-4.3,3.5 0,-2.7c0,-4.9 -2.5,-6.4 -10.2,-6.4 -6.2,-0 -7.2,-0.3 -9.3,-2.6 -2.5,-2.7 -2.5,-2.8 -2.5,-23.6l0,-20.9 2.6,-2.4c2.7,-2.5 2.8,-2.5 24.1,-2.5 21.4,-0 21.4,-0 23.8,2.5z"
android:strokeColor="#00000000" />
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd"
android:pathData="M17 3.7H7c-1.1 0-2 0.9-2 2v10.75c0 0.7 0.56 1.25 1.25 1.25H8.2c1.38 0 2.56 0.84 3.05 2.04l1.28-1.02c0.82-0.66 1.84-1.02 2.9-1.02H17c1.1 0 2-0.9 2-2v-10c0-1.1-0.9-2-2-2Zm-10-2c-2.2 0-4 1.8-4 4v10.75c0 1.8 1.46 3.25 3.25 3.25H8.2c0.72 0 1.3 0.58 1.3 1.3 0 1.09 1.26 1.7 2.11 1.01l2.17-1.73c0.47-0.38 1.05-0.58 1.64-0.58H17c2.2 0 4-1.79 4-4v-10c0-2.2-1.8-4-4-4H7Z"/>
<path
android:fillAlpha="0.7"
android:fillColor="#000000"
android:pathData="M55,30.8c-4.1,1.2 -5.3,6.8 -2.1,9.6 3.9,3.6 9.2,-1.4 7.2,-6.8 -1,-2.6 -2.8,-3.6 -5.1,-2.8z"
android:strokeColor="#00000000" />
android:fillColor="#FFFFFFFF"
android:pathData="M16.32 8.46c0 0.96-0.67 1.74-1.5 1.74-0.82 0-1.5-0.78-1.5-1.74s0.68-1.73 1.5-1.73c0.83 0 1.5 0.77 1.5 1.73Z"/>
<path
android:fillAlpha="0.7"
android:fillColor="#000000"
android:pathData="M30,32.4c0,0.8 1,1.8 2.2,2.2 2.1,0.6 2.1,0.7 -0.6,2.1 -4.3,2.3 -2.7,3.8 3.5,3.5 6.3,-0.4 7.5,-1.2 6,-4.1 -2.2,-3.9 -11.1,-6.9 -11.1,-3.7z"
android:strokeColor="#00000000" />
android:fillColor="#FFFFFFFF"
android:pathData="M8.14 6.87c-0.39 0-0.7 0.31-0.7 0.7 0 0.38 0.31 0.7 0.7 0.7 0.14 0 0.29 0 0.45 0.03-0.17 0.05-0.32 0.1-0.45 0.17-0.23 0.1-0.47 0.24-0.63 0.4-0.27 0.27-0.27 0.71 0 0.98s0.71 0.28 0.98 0H8.5l0.04-0.02 0.18-0.1c0.14-0.06 0.33-0.12 0.52-0.15 0.39-0.07 0.72 0 0.95 0.26 0.22 0.23 0.57 0.29 0.84 0.13 0.28-0.15 0.42-0.47 0.35-0.78V9.18l-0.01-0.03-0.03-0.08-0.1-0.26c-0.08-0.2-0.22-0.48-0.43-0.76-0.23-0.31-0.62-0.6-1.08-0.82-0.46-0.21-1.01-0.36-1.6-0.36Z"/>
<path
android:fillAlpha="0.7"
android:fillColor="#000000"
android:pathData="M32.4,52.5c-0.8,2.1 0.4,3.5 5,5.6 5.3,2.4 11,2.4 16.4,-0.1 4.5,-2 6.2,-4.4 4.3,-6.3 -0.8,-0.8 -2.2,-0.5 -5.4,1.1 -5.5,2.7 -9.1,2.8 -14.2,0.2 -4.7,-2.4 -5.4,-2.4 -6.1,-0.5z"
android:strokeColor="#00000000" />
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd"
android:pathData="M7.92 12.8c0.2-0.36 0.67-0.49 1.03-0.28l0.52 0.3c1.61 0.92 3.6 0.92 5.2 0l0.53-0.3c0.36-0.2 0.82-0.08 1.03 0.28 0.2 0.36 0.08 0.82-0.28 1.02l-0.53 0.3c-2.07 1.19-4.62 1.19-6.7 0l-0.52-0.3c-0.36-0.2-0.48-0.66-0.28-1.02Z"/>
</vector>
12 changes: 6 additions & 6 deletions app/src/main/res/drawable/ic_float.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
android:viewportHeight="24">
<path
android:fillAlpha="0.7"
android:fillColor="#fff"
android:pathData="M21,2L3,2c-1.1,0 -2,0.9 -2,2v13c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,4c0,-1.1 -0.9,-2 -2,-2zM21,17L3,17L3,4h18v13z" />
android:fillColor="#FFFFFFFF"
android:pathData="M21 2H3C1.9 2 1 2.9 1 4v13c0 1.1 0.9 2 2 2h18c1.1 0 2-0.9 2-2V4c0-1.1-0.9-2-2-2Zm0 15H3V4h18v13Z"/>
<path
android:fillAlpha="0.7"
android:fillColor="#fff"
android:pathData="M9,6h2v2L9,8L9,6zM5,6h2v2L5,8L5,6zM8,14h8v1L8,15v-1zM13,6h2v2h-2L13,6zM9,10h2v2L9,12v-2zM5,10h2v2L5,12v-2zM13,10h2v2h-2v-2zM17,6h2v2h-2L17,6zM17,10h2v2h-2v-2zM19,22L5,22v1h14v-1z" />
android:fillColor="#FFFFFFFF"
android:pathData="M9 6h2v2H9V6ZM5 6h2v2H5V6Zm3 8h8v1H8v-1Zm5-8h2v2h-2V6Zm-4 4h2v2H9v-2Zm-4 0h2v2H5v-2Zm8 0h2v2h-2v-2Zm4-4h2v2h-2V6Zm0 4h2v2h-2v-2Z"/>
<path
android:fillAlpha="0.7"
android:fillColor="#fff"
android:pathData="M12,19m-2,0a2,2 0,1 1,4 0a2,2 0,1 1,-4 0" />
android:fillColor="#FFFFFFFF"
android:pathData="M19 22H5v1h14v-1Z"/>
</vector>
20 changes: 20 additions & 0 deletions app/src/main/res/drawable/ic_float_v2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillAlpha="0.7"
android:fillColor="#FFFFFFFF"
android:pathData="M21 2H3C1.9 2 1 2.9 1 4v13c0 1.1 0.9 2 2 2h18c1.1 0 2-0.9 2-2V4c0-1.1-0.9-2-2-2Zm0 15H3V4h18v13Z"/>
<path
android:fillAlpha="0.7"
android:fillColor="#FFFFFFFF"
android:pathData="M19 22H5v1h14v-1Z"/>
<path
android:fillAlpha="0.7"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd"
android:pathData="M14.5 5.5l-1.25 2.75L10.5 9.5l2.75 1.25 1.25 2.75 1.25-2.75L18.5 9.5l-2.75-1.25L14.5 5.5Zm-6 4l-0.94 2.06L5.5 12.5l2.06 0.94 0.94 2.06 0.94-2.06 2.06-0.94-2.06-0.94L8.5 9.5Z"/>
</vector>
11 changes: 11 additions & 0 deletions app/src/main/res/drawable/ic_g_sans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillAlpha="0.7"
android:fillColor="#FFFFFFFF"
android:pathData="M2 4v3h5v12h3V7h5V4H2Zm19 5h-9v3h3v7h3v-7h3V9Z"/>
</vector>
16 changes: 16 additions & 0 deletions app/src/main/res/drawable/ic_silk_popup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillAlpha="0.7"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd"
android:pathData="M12 20c4.42 0 8-3.58 8-8s-3.58-8-8-8-8 3.58-8 8 3.58 8 8 8Zm0 2c5.52 0 10-4.48 10-10S17.52 2 12 2 2 6.48 2 12s4.48 10 10 10Z"/>
<path
android:fillAlpha="0.7"
android:fillColor="#FFFFFFFF"
android:pathData="M9 7v2h4v2h-2c-0.53 0-1.04 0.21-1.41 0.59C9.2 11.96 9 12.47 9 13v4h2 4v-2h-4v-2h2c0.53 0 1.04-0.21 1.41-0.59C14.8 12.04 15 11.53 15 11V9c0-0.53-0.21-1.04-0.59-1.41C14.04 7.2 13.53 7 13 7H9Z"/>
</vector>
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/ic_translate_new_ui.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillAlpha="0.7"
android:fillColor="#FFFFFFFF"
android:fillType="evenOdd"
android:pathData="M11 4h10c1.1 0 2 0.9 2 2v15c0 1.1-0.9 2-2 2h-9l-1-3H3c-1.1 0-2-0.9-2-2V3c0-1.1 0.9-2 2-2h7l1 3Zm5.87 6.58h-3.7l0.79 2.37c0.26 0.38 0.55 0.75 0.86 1.1 0.94-1.04 1.62-2.22 2.05-3.47ZM20.5 21.5c0.55 0 1-0.45 1-1v-14c0-0.55-0.45-1-1-1h-9.04l1.28 3.79h1.44V8h1.29v1.29H20v1.3h-1.9c-0.47 1.53-1.27 2.97-2.4 4.22l-0.02 0.02 3.3 3.25L18.06 19l-3.1-3.1L16 19l-2 2.5h6.5ZM12 13.15L9.25 11.9 8 9.15 6.75 11.9 4 13.15l2.75 1.25L8 17.15l1.25-2.75L12 13.15Zm-4-6L5.94 6.2 5 4.15 4.06 6.2 2 7.15l2.06 0.94L5 10.15l0.94-2.06L8 7.15Z"/>
</vector>
Loading

0 comments on commit 4dbb6a2

Please sign in to comment.