Skip to content

Commit 63284f7

Browse files
committed
update: enhance code and update libs
1 parent e4fa0bb commit 63284f7

File tree

9 files changed

+38
-71
lines changed

9 files changed

+38
-71
lines changed

app/src/main/java/com/frogobox/appkeyboard/services/KeyboardIME.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class KeyboardIME : BaseKeyboardIME<KeyboardImeBinding>() {
8080
}
8181

8282
override fun invalidateKeyboard() {
83-
binding?.keyboardAutotext?.setupData()
83+
binding?.keyboardAutotext?.initData()
8484
setupFeatureKeyboard()
8585
}
8686

app/src/main/java/com/frogobox/appkeyboard/ui/keyboard/autotext/AutoTextKeyboard.kt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,15 @@ class AutoTextKeyboard(
2727
return KeyboardAutotextBinding.inflate(LayoutInflater.from(context), this, true)
2828
}
2929

30-
override fun onCreate() {
31-
initView()
32-
setupData()
33-
}
34-
35-
private fun initView() {
30+
override fun initUI() {
31+
super.initUI()
3632
binding.apply {
3733
tvToolbarTitle.text = "Auto Text"
3834
}
3935
}
4036

41-
fun setupData() {
37+
override fun initData() {
38+
super.initData()
4239
val viewModel = AutoTextKeyboardViewModel(context)
4340
viewModel.getAutoText {
4441
setupRv(it)

app/src/main/java/com/frogobox/appkeyboard/ui/keyboard/form/FormKeyboard.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import android.util.AttributeSet
55
import android.view.LayoutInflater
66
import android.widget.LinearLayout
77
import com.frogobox.appkeyboard.databinding.KeyboardFormBinding
8+
import com.frogobox.appkeyboard.ui.keyboard.autotext.AutoTextKeyboardViewModel
89
import com.frogobox.appkeyboard.ui.keyboard.movie.MovieKeyboard
910
import com.frogobox.appkeyboard.util.KeyboardNavigationHelper
1011
import com.frogobox.libkeyboard.common.core.BaseKeyboard
@@ -30,11 +31,8 @@ class FormKeyboard(
3031
return KeyboardFormBinding.inflate(LayoutInflater.from(context), this, true)
3132
}
3233

33-
override fun onCreate() {
34-
initView()
35-
}
36-
37-
private fun initView() {
34+
override fun initUI() {
35+
super.initUI()
3836
binding.apply {
3937
btnSubmit.setOnClickListener {
4038
KeyboardNavigationHelper.navigateTo(this@FormKeyboard, destinationKeyboard)

app/src/main/java/com/frogobox/appkeyboard/ui/keyboard/movie/MovieKeyboard.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,16 @@ class MovieKeyboard(
4040
return KeyboardGridBinding.inflate(LayoutInflater.from(context), this, true)
4141
}
4242

43-
override fun onCreate() {
44-
setupData()
45-
initView()
46-
}
47-
48-
private fun initView() {
43+
override fun initUI() {
44+
super.initUI()
4945
binding.apply {
5046
tvToolbarTitle.text = "Movie Api"
5147
}
5248
}
5349

54-
private fun setupData() {
50+
override fun initData() {
51+
super.initData()
52+
5553
val consumeMovieApi = ConsumeMovieApi(MovieUrl.API_KEY) // Your API_KEY
5654
consumeMovieApi.getTrendingMovieDay(object : FrogoDataResponse<Trending<TrendingMovie>> {
5755
override fun onFailed(statusCode: Int, errorMessage: String) {}

app/src/main/java/com/frogobox/appkeyboard/ui/keyboard/templatetext/TemplateTextKeyboard.kt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,14 @@ class TemplateTextKeyboard(
3030
return KeyboardAutotextBinding.inflate(LayoutInflater.from(context), this, true)
3131
}
3232

33-
override fun onCreate() {
34-
initView()
33+
override fun initUI() {
34+
super.initUI()
35+
typePlayStore?.let { setupContent(it) }
36+
}
37+
38+
fun setupTemplateTextType(templateTextType: KeyboardFeatureType) {
39+
this.typePlayStore = templateTextType
40+
setupContent(templateTextType)
3541
}
3642

3743
private fun setupContent(templateTextType: KeyboardFeatureType) {
@@ -75,15 +81,6 @@ class TemplateTextKeyboard(
7581
setupRv(list)
7682
}
7783

78-
private fun initView() {
79-
typePlayStore?.let { setupContent(it) }
80-
}
81-
82-
fun setupTemplateTextType(templateTextType: KeyboardFeatureType) {
83-
this.typePlayStore = templateTextType
84-
setupContent(templateTextType)
85-
}
86-
8784
private fun getTitleText(title: String): String {
8885
return title.replace("TEMPLATE_TEXT_", "")
8986
}

app/src/main/java/com/frogobox/appkeyboard/ui/keyboard/webview/WebiewKeyboard.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ class WebiewKeyboard(
2727
return KeyboardWebviewBinding.inflate(LayoutInflater.from(context), this, true)
2828
}
2929

30-
override fun onCreate() {
31-
initView()
32-
}
33-
34-
private fun initView() {
30+
override fun initUI() {
31+
super.initUI()
3532
binding.apply {
3633
webview.loadUrlFrogoExt("https://www.google.com")
3734
}

frogo-keyboard/build.gradle.kts

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ android {
2020
}
2121

2222
buildTypes {
23-
release {
23+
getByName("release") {
2424
isMinifyEnabled = false
25+
2526
proguardFiles(
2627
getDefaultProguardFile("proguard-android-optimize.txt"),
2728
"proguard-rules.pro"
@@ -59,36 +60,11 @@ dependencies {
5960
afterEvaluate {
6061
publishing {
6162
publications {
62-
63-
repositories {
64-
maven {
65-
name = LibrarySetting.LIB_NAME
66-
url = uri(LibrarySetting.MAVEN_URI)
67-
credentials {
68-
username = project.findProperty("gpr.user") as String? ?: ""
69-
password = project.findProperty("gpr.key") as String? ?: ""
70-
}
71-
}
72-
}
73-
74-
// Creates a Maven publication called "release".
7563
register("release", MavenPublication::class) {
76-
77-
// Applies the component for the release build variant.
78-
// NOTE : Delete this line code if you publish Native Java / Kotlin Library
7964
from(components["release"])
80-
81-
// Library Package Name (Example : "com.frogobox.androidfirstlib")
82-
// NOTE : Different GroupId For Each Library / Module, So That Each Library Is Not Overwritten
8365
groupId = LibrarySetting.GROUP_ID
84-
85-
// Library Name / Module Name (Example : "androidfirstlib")
86-
// NOTE : Different ArtifactId For Each Library / Module, So That Each Library Is Not Overwritten
8766
artifactId = LibrarySetting.ARTIFACT_ID
88-
89-
// Version Library Name (Example : "1.0.0")
9067
version = ProjectSetting.PROJECT_VERSION_NAME
91-
9268
}
9369
}
9470
}

frogo-keyboard/src/main/java/com/frogobox/libkeyboard/common/core/BaseKeyboard.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,20 @@ abstract class BaseKeyboard<VB : ViewBinding> @JvmOverloads constructor(
5252
* Called once after the binding has been created and attached.
5353
* Use this to initialize your views and listeners.
5454
*/
55-
protected abstract fun onCreate()
55+
protected open fun onCreate() {
56+
initUI()
57+
initData()
58+
}
5659

5760
/**
5861
* Called when the keyboard is being destroyed or detached.
5962
* Override to release resources or remove callbacks.
6063
*/
6164
protected open fun onDestroy() {}
6265

66+
open fun initUI() {}
67+
open fun initData() {}
68+
6369
init {
6470
orientation = VERTICAL
6571
initialize()

gradle.properties

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,19 @@
66
# http://www.gradle.org/docs/current/userguide/build_environment.html
77
# Specifies the JVM arguments used for the daemon process.
88
# The setting is particularly useful for tweaking memory settings.
9-
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
9+
org.gradle.jvmargs=-Xmx4608m
1010
# When configured, Gradle will run in incubating parallel mode.
1111
# This option should only be used with decoupled projects. More details, visit
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13-
# org.gradle.parallel=true
13+
org.gradle.daemon=false
14+
org.gradle.parallel=false
1415
# AndroidX package structure to make it clearer which packages are bundled with the
1516
# Android operating system, and which are packaged with your app"s APK
1617
# https://developer.android.com/topic/libraries/support-library/androidx-rn
1718
android.useAndroidX=true
18-
# Kotlin code style for this project: "official" or "obsolete":
1919
# Automatically convert third-party libraries to use AndroidX
2020
android.enableJetifier=true
21+
# Kotlin code style for this project: "official" or "obsolete":
2122
kotlin.code.style=official
22-
# Enables namespacing of each library's R class so that its R class includes only the
23-
# resources declared in the library itself and none from the library's dependencies,
24-
# thereby reducing the size of the R class for that library
25-
android.nonTransitiveRClass=true
26-
android.nonFinalResIds=false
23+
android.nonTransitiveRClass=false
24+
android.nonFinalResIds=false

0 commit comments

Comments
 (0)