Skip to content

Commit e495ad3

Browse files
authored
Merge pull request #75 from amirisback/release/1.2.2
Release/1.2.2
2 parents 2d63f03 + 4ad5cd6 commit e495ad3

File tree

24 files changed

+373
-214
lines changed

24 files changed

+373
-214
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
## Version Release
2222
This Is Latest Release
2323

24-
$version_release = 1.2.1
24+
$version_release = 1.2.2
2525

2626
What's New??
2727

@@ -65,14 +65,14 @@ allprojects {
6565

6666
dependencies {
6767
// library frogo-keyboard
68-
implementation 'com.github.amirisback:keyboard:1.2.1'
68+
implementation 'com.github.amirisback:keyboard:1.2.2'
6969
}
7070

7171
#### <Option 2> Kotlin DSL Gradle
7272

7373
dependencies {
7474
// library frogo-keyboard
75-
implementation("com.github.amirisback:keyboard:1.2.1")
75+
implementation("com.github.amirisback:keyboard:1.2.2")
7676
}
7777

7878
### Step 3. Create Layout Keyboard IME
@@ -526,7 +526,7 @@ class KeyboardIME : BaseKeyboardIME<YourIMELayoutBinding>() {
526526

527527
### if your feature is using a textfield, add below code to your KeyboardIME class
528528
```kotlin
529-
@RequiresApi(Build.VERSION_CODES.M)
529+
530530
override fun onKey(code: Int) {
531531
val formView = binding?.keyboardForm
532532
var inputConnection = currentInputConnection

app/build.gradle.kts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
import java.text.SimpleDateFormat
3+
import java.util.Date
24

35
plugins {
46
alias(libs.plugins.android.application)
@@ -12,6 +14,12 @@ ksp {
1214
arg("room.schemaLocation", "$projectDir/schemas") // If Using Ksp
1315
}
1416

17+
base {
18+
// Naming APK // AAB
19+
val timestamp = SimpleDateFormat("dd-MM-yyyy_hh-mm").format(Date())
20+
archivesName = "${ProjectSetting.NAME_APK}-${ProjectSetting.PROJECT_VERSION_CODE}-[${ProjectSetting.PROJECT_VERSION_NAME}]-$timestamp"
21+
}
22+
1523
android {
1624

1725
namespace = ProjectSetting.PROJECT_NAME_SPACE_APP
@@ -33,9 +41,6 @@ android {
3341
buildConfigField("String", "DATABASE_NAME", ProjectSetting.DB)
3442
buildConfigField("String", "PREF_NAME", ProjectSetting.PREF)
3543

36-
// Naming APK // AAB
37-
setProperty("archivesBaseName", "${ProjectSetting.NAME_APK}(${versionName})")
38-
3944
// Declaration apps name debug mode
4045
val debugAttribute = "Dev"
4146
val nameAppDebug = "${ProjectSetting.NAME_APP} $debugAttribute"
@@ -90,8 +95,8 @@ android {
9095
}
9196

9297
buildFeatures {
93-
viewBinding = true
9498
buildConfig = true
99+
viewBinding = true
95100
}
96101

97102
compileOptions {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.frogobox.appkeyboard.common.base
22

3-
import com.frogobox.sdk.view.FrogoViewModel2
3+
import com.frogobox.sdk.view.FrogoViewModel
44

55
/**
66
* Created by Faisal Amir on 09/02/23
77
* https://github.com/amirisback
88
*/
99

1010

11-
abstract class BaseViewModel : FrogoViewModel2() {
11+
abstract class BaseViewModel : FrogoViewModel() {
1212

1313
}
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
package com.frogobox.appkeyboard.common.ext
2+
3+
import java.text.ParseException
4+
import java.text.SimpleDateFormat
5+
import java.util.Calendar
6+
import java.util.Date
7+
import java.util.Locale
8+
import java.util.TimeZone
9+
10+
/**
11+
* Created by faisalamircs on 09/11/2025
12+
* -----------------------------------------
13+
* Name : Muhammad Faisal Amir
14+
* E-mail : [email protected]
15+
* Github : github.com/amirisback
16+
* -----------------------------------------
17+
*/
18+
19+
20+
21+
// Format Second
22+
const val SECOND_MILLIS = 1000
23+
const val MINUTE_MILLIS = 60 * SECOND_MILLIS
24+
const val HOUR_MILLIS = 60 * MINUTE_MILLIS
25+
const val DAY_MILLIS = 24 * HOUR_MILLIS
26+
27+
// Format Date
28+
const val DATE_TIME_GLOBAL = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" //
29+
const val DATE_TIME_STANDARD = "yyyy-MM-dd HH:mm:ss" // 2018-10-02 12:12:12
30+
const val DATE_ENGLISH_YYYY_MM_DD = "yyyy-MM-dd" // 2018-10-02
31+
const val DATE_ENGLISH_YYYY_MM_DD_CLEAR = "yyyy MM dd" // 2018 10 02
32+
const val DATE_DD_MM_YYYY = "dd-MM-yyyy" // 02-10-2018
33+
const val DATE_EEEE_DD_MM_YYYY = "EEEE, dd MMMM yyyy" // 02-10-2018
34+
const val DATE_DD_MM_YYYY_CLEAR = "dd MM yyyy" // 02-10-2018
35+
36+
// Format Time
37+
const val TIME_GENERAL_HH_MM_SS = "HH:mm:ss" // 12:12:12
38+
const val TIME_GENERAL_HH_MM = "HH:mm" // 12:12
39+
40+
// Format Day
41+
const val DAY_WITH_DATE_TIME_ENGLISH = "EEE, MMM dd yyyy HH:mm" // Mon, Aug 12 2018 12:12
42+
const val DAY_WITH_DATE_TIME_LOCALE = "EEE, dd MMM yyyy HH:mm" // Sen, 12 Agt 2019 12:12
43+
const val DAY_WITH_DATE_TIME_ENGLISH_FULL = "EEEE, MMMM dd yyyy HH:mm" // Monday, August 12 2018 12:12
44+
const val DAY_WITH_DATE_TIME_LOCALE_FULL = "EEEE, dd MMMM yyyy HH:mm" // Senin, 12 Agustus 2018 12:12
45+
46+
fun getTimeStamp(): String {
47+
val simpleDateFormat = SimpleDateFormat(DATE_TIME_STANDARD, Locale.getDefault())
48+
return simpleDateFormat.format(Date())
49+
}
50+
51+
fun getTimeNow(): String {
52+
val simpleDateFormat = SimpleDateFormat(TIME_GENERAL_HH_MM_SS, Locale.getDefault())
53+
return simpleDateFormat.format(Date())
54+
}
55+
56+
fun getCurrentDate(format: String): String {
57+
val simpleDateFormat = SimpleDateFormat(format, Locale.getDefault())
58+
return simpleDateFormat.format(Date())
59+
}
60+
61+
fun dateTimeToTimeStamp(date: String?): Long {
62+
var timestamp: Long = 0
63+
val tz = TimeZone.getTimeZone("UTC")
64+
val df = SimpleDateFormat(DATE_TIME_GLOBAL, Locale.getDefault())
65+
df.timeZone = tz
66+
67+
if (date != null) {
68+
try {
69+
timestamp = df.parse(date).time / 1000
70+
} catch (e: ParseException) {
71+
e.printStackTrace()
72+
}
73+
74+
} else {
75+
timestamp = Date().time / 1000
76+
}
77+
return timestamp
78+
}
79+
80+
fun getCurrentUTC(): String {
81+
val time = Calendar.getInstance().time
82+
val outputFmt = SimpleDateFormat(TIME_GENERAL_HH_MM_SS, Locale.getDefault())
83+
outputFmt.timeZone = TimeZone.getTimeZone("UTC")
84+
return outputFmt.format(time)
85+
}
86+
87+
fun convertClassificationDate(string: String?): String {
88+
return if (string != null) {
89+
if (string.contains("/")) {
90+
val temp = string.split("/")
91+
temp[1] + "-" + temp[0] + "-01"
92+
} else {
93+
""
94+
}
95+
} else {
96+
""
97+
}
98+
}
99+
100+
fun convertDateNewFormat(string: String?): String {
101+
val formatter = SimpleDateFormat(DATE_ENGLISH_YYYY_MM_DD, Locale.getDefault())
102+
val date = formatter.parse(string) as Date
103+
val newFormat = SimpleDateFormat(DATE_DD_MM_YYYY, Locale("EN"))
104+
return newFormat.format(date)
105+
}
106+
107+
fun convertLongDateNewFormat(string: String?): String {
108+
val formatter = SimpleDateFormat(DATE_TIME_STANDARD, Locale.getDefault())
109+
val date = formatter.parse(string) as Date
110+
val newFormat = SimpleDateFormat("dd-MM-yy HH:mm:ss", Locale("EN"))
111+
return newFormat.format(date)
112+
}
113+
114+
fun revertFromLongDateNewFormat(string: String?): String {
115+
val formatter = SimpleDateFormat("dd-MM-yy HH:mm:ss", Locale("EN"))
116+
val date = formatter.parse(string) as Date
117+
val newFormat = SimpleDateFormat(DATE_TIME_STANDARD, Locale.getDefault())
118+
val finalString = newFormat.format(date)
119+
return finalString
120+
}
121+
122+
fun convertTargetDate(string: String?): String {
123+
return if (string != null) {
124+
if (string.contains("/")) {
125+
val temp = string.split("/")
126+
temp[1] + "-" + temp[0] + "-01 00:00:00"
127+
} else {
128+
""
129+
}
130+
} else {
131+
""
132+
}
133+
}
134+
135+
fun diffTime(timeStart: String, timeEnd: String): Long {
136+
var min: Long = 0
137+
val diff: Long
138+
val format = SimpleDateFormat(TIME_GENERAL_HH_MM_SS, Locale.getDefault())
139+
140+
val d1: Date?
141+
val d2: Date?
142+
143+
try {
144+
d1 = format.parse(timeStart)
145+
d2 = format.parse(timeEnd)
146+
147+
diff = d2.time - d1.time
148+
min = diff / (60 * 1000)
149+
150+
} catch (e: Exception) {
151+
e.printStackTrace()
152+
}
153+
154+
return min
155+
}

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

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.frogobox.appkeyboard.services
22

33
import android.content.Intent
4-
import android.os.Build
54
import android.view.LayoutInflater
65
import android.view.View
76
import android.view.ViewGroup
87
import android.view.inputmethod.EditorInfo
98
import android.view.inputmethod.InputMethodManager
109
import android.widget.EditText
11-
import androidx.annotation.RequiresApi
1210
import com.frogobox.appkeyboard.R
1311
import com.frogobox.appkeyboard.databinding.ItemKeyboardHeaderBinding
1412
import com.frogobox.appkeyboard.databinding.KeyboardImeBinding
@@ -82,7 +80,7 @@ class KeyboardIME : BaseKeyboardIME<KeyboardImeBinding>() {
8280
}
8381

8482
override fun invalidateKeyboard() {
85-
binding?.keyboardAutotext?.setupData()
83+
binding?.keyboardAutotext?.initData()
8684
setupFeatureKeyboard()
8785
}
8886

@@ -119,7 +117,7 @@ class KeyboardIME : BaseKeyboardIME<KeyboardImeBinding>() {
119117
keyboardWebview.gone()
120118
keyboardForm.gone()
121119
keyboardEmoji.gone()
122-
keyboardEmoji.binding?.emojiList?.scrollToPosition(0)
120+
keyboardEmoji.binding.emojiList.scrollToPosition(0)
123121
}
124122
}
125123

@@ -144,38 +142,38 @@ class KeyboardIME : BaseKeyboardIME<KeyboardImeBinding>() {
144142

145143
override fun initBackToMainKeyboard() {
146144
binding?.apply {
147-
keyboardAutotext.binding?.toolbarBack?.setOnClickListener {
145+
keyboardAutotext.binding.toolbarBack.setOnClickListener {
148146
keyboardAutotext.gone()
149147
showMainKeyboard()
150148
}
151149

152-
keyboardNews.binding?.toolbarBack?.setOnClickListener {
150+
keyboardNews.binding.toolbarBack.setOnClickListener {
153151
keyboardNews.gone()
154152
showMainKeyboard()
155153
}
156154

157-
keyboardMoview.binding?.toolbarBack?.setOnClickListener {
155+
keyboardMoview.binding.toolbarBack.setOnClickListener {
158156
keyboardMoview.gone()
159157
showMainKeyboard()
160158
}
161159

162-
keyboardWebview.binding?.toolbarBack?.setOnClickListener {
160+
keyboardWebview.binding.toolbarBack.setOnClickListener {
163161
keyboardWebview.gone()
164162
showMainKeyboard()
165163
}
166164

167-
keyboardForm.binding?.toolbarBack?.setOnClickListener {
165+
keyboardForm.binding.toolbarBack.setOnClickListener {
168166
keyboardForm.gone()
169167
showMainKeyboard()
170168
}
171169

172-
keyboardEmoji.binding?.toolbarBack?.setOnClickListener {
170+
keyboardEmoji.binding.toolbarBack.setOnClickListener {
173171
keyboardEmoji.gone()
174-
keyboardEmoji.binding?.emojiList?.scrollToPosition(0)
172+
keyboardEmoji.binding.emojiList.scrollToPosition(0)
175173
showMainKeyboard()
176174
}
177175

178-
keyboardTemplateText.binding?.toolbarBack?.setOnClickListener {
176+
keyboardTemplateText.binding.toolbarBack.setOnClickListener {
179177
keyboardTemplateText.gone()
180178
showMainKeyboard()
181179
}
@@ -265,9 +263,9 @@ class KeyboardIME : BaseKeyboardIME<KeyboardImeBinding>() {
265263
KeyboardFeatureType.FORM -> {
266264
keyboardHeader.gone()
267265
keyboardForm.visible()
268-
keyboardForm.binding?.etText?.showKeyboardExt()
269-
keyboardForm.binding?.etText2?.showKeyboardExt()
270-
keyboardForm.binding?.etText3?.showKeyboardExt()
266+
keyboardForm.binding.etText.showKeyboardExt()
267+
keyboardForm.binding.etText2.showKeyboardExt()
268+
keyboardForm.binding.etText3.showKeyboardExt()
271269

272270
keyboardForm.setOnClickListener {
273271
hideOnlyKeyboard()
@@ -330,26 +328,26 @@ class KeyboardIME : BaseKeyboardIME<KeyboardImeBinding>() {
330328
}
331329
}
332330

333-
@RequiresApi(Build.VERSION_CODES.M)
331+
334332
override fun onKey(code: Int) {
335333
val formView = binding?.keyboardForm
336334
var inputConnection = currentInputConnection
337335

338336
if (formView?.visibility == View.VISIBLE) {
339-
val et1 = formView.binding?.etText
340-
val et1Connection = et1?.onCreateInputConnection(EditorInfo())
337+
val et1 = formView.binding.etText
338+
val et1Connection = et1.onCreateInputConnection(EditorInfo())
341339

342-
val et2 = formView.binding?.etText2
343-
val et2Connection = et2?.onCreateInputConnection(EditorInfo())
340+
val et2 = formView.binding.etText2
341+
val et2Connection = et2.onCreateInputConnection(EditorInfo())
344342

345-
val et3 = formView.binding?.etText3
346-
val et3Connection = et3?.onCreateInputConnection(EditorInfo())
343+
val et3 = formView.binding.etText3
344+
val et3Connection = et3.onCreateInputConnection(EditorInfo())
347345

348-
if (et1?.isFocused == true) {
346+
if (et1.isFocused) {
349347
inputConnection = et1Connection
350-
} else if (et2?.isFocused == true) {
348+
} else if (et2.isFocused) {
351349
inputConnection = et2Connection
352-
} else if (et3?.isFocused == true) {
350+
} else if (et3.isFocused) {
353351
inputConnection = et3Connection
354352
}
355353

@@ -371,7 +369,7 @@ class KeyboardIME : BaseKeyboardIME<KeyboardImeBinding>() {
371369
binding?.keyboardMain?.invalidateAllKeys()
372370
}
373371

374-
@RequiresApi(Build.VERSION_CODES.M)
372+
375373
override fun runEmojiBoard() {
376374
binding?.keyboardEmoji?.visible()
377375
binding?.keyboardMain?.invisible()

0 commit comments

Comments
 (0)