Skip to content

Commit d24a102

Browse files
authored
Merge pull request #43 from amirisback/develop/create-lib
DEVELOP :: READY FOR RELEASE BETA LIBRARY
2 parents 96ea02f + 8642f01 commit d24a102

File tree

5 files changed

+383
-24
lines changed

5 files changed

+383
-24
lines changed

README.md

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

23-
$version_release = 1.1.0
23+
$version_release = 1.1.1
2424

2525
What's New??
2626

@@ -64,17 +64,246 @@ allprojects {
6464

6565
dependencies {
6666
// library frogo-keyboard
67-
implementation 'com.github.amirisback:keyboard:1.1.0'
67+
implementation 'com.github.amirisback:keyboard:1.1.1'
6868
}
6969

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

7272
dependencies {
7373
// library frogo-keyboard
74-
implementation("com.github.amirisback:keyboard:1.1.0")
74+
implementation("com.github.amirisback:keyboard:1.1.1")
7575
}
7676

77-
### Step 3. Coming Soon
77+
### Step 3. Create Service Keyboard IME
78+
79+
#### Create Class Keyboard IME
80+
```kotlin
81+
class KeyboardIME : BaseKeyboardIME<YourIMELayoutBinding>() {
82+
83+
// ovveride function from IKeyboardIME
84+
85+
}
86+
```
87+
88+
#### Interface IKeyboardIME
89+
```kotlin
90+
interface IKeyboardIME {
91+
92+
fun initialSetupKeyboard()
93+
94+
fun setupBinding()
95+
96+
fun invalidateKeyboard()
97+
98+
fun initCurrentInputConnection()
99+
100+
fun hideMainKeyboard()
101+
102+
fun showMainKeyboard()
103+
104+
fun showOnlyKeyboard()
105+
106+
fun hideOnlyKeyboard()
107+
108+
fun EditText.showKeyboardExt()
109+
110+
fun initBackToMainKeyboard()
111+
112+
fun setupFeatureKeyboard()
113+
114+
fun initView()
115+
116+
fun invalidateAllKeys()
117+
118+
@RequiresApi(Build.VERSION_CODES.M)
119+
fun runEmojiBoard()
120+
121+
fun updateShiftKeyState()
122+
123+
@RequiresApi(Build.VERSION_CODES.M)
124+
fun onKeyExt(code: Int, inputConnection: InputConnection)
125+
126+
fun moveCursor(moveRight: Boolean)
127+
128+
fun getImeOptionsActionId(): Int
129+
130+
fun getKeyboardLayoutXML(): Int
131+
132+
}
133+
```
134+
135+
### Step 4. Create Layout Keyboard IME
136+
```xml
137+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
138+
xmlns:app="http://schemas.android.com/apk/res-auto"
139+
android:id="@+id/keyboard_holder"
140+
android:layout_width="match_parent"
141+
android:layout_height="wrap_content"
142+
android:background="@color/keyboard_bg_root">
143+
144+
<LinearLayout
145+
android:id="@+id/container_keyboard_main"
146+
android:layout_width="match_parent"
147+
android:layout_height="match_parent"
148+
android:orientation="vertical"
149+
app:layout_constraintBottom_toBottomOf="parent">
150+
151+
<androidx.recyclerview.widget.RecyclerView
152+
android:id="@+id/keyboard_header"
153+
android:layout_width="match_parent"
154+
android:layout_height="wrap_content"
155+
android:background="@color/keyboard_bg_root"
156+
android:minHeight="@dimen/frogo_dimen_64dp" />
157+
158+
<com.frogobox.libkeyboard.ui.main.MainKeyboard
159+
android:id="@+id/keyboard_main"
160+
style="@style/KwKeyboardView"
161+
android:layout_width="match_parent"
162+
android:layout_height="wrap_content"
163+
android:background="@color/theme_dark_background_color" />
164+
165+
</LinearLayout>
166+
167+
<LinearLayout
168+
android:id="@+id/mock_measure_height_keyboard"
169+
android:layout_width="match_parent"
170+
android:layout_height="match_parent"
171+
android:orientation="vertical"
172+
android:visibility="gone"
173+
app:layout_constraintBottom_toTopOf="@id/container_keyboard_main">
174+
175+
<androidx.recyclerview.widget.RecyclerView
176+
android:id="@+id/mock_keyboard_header"
177+
android:layout_width="match_parent"
178+
android:layout_height="wrap_content"
179+
android:background="@color/keyboard_bg_root"
180+
android:minHeight="@dimen/frogo_dimen_64dp" />
181+
182+
<com.frogobox.libkeyboard.ui.main.MainKeyboard
183+
android:id="@+id/mock_measure_height_keyboard_main"
184+
style="@style/KwKeyboardView"
185+
android:layout_width="match_parent"
186+
android:layout_height="wrap_content"
187+
android:background="@color/theme_dark_background_color" />
188+
189+
</LinearLayout>
190+
191+
<com.frogobox.appkeyboard.ui.keyboard.autotext.AutoTextKeyboard
192+
android:id="@+id/keyboard_autotext"
193+
android:layout_width="match_parent"
194+
android:layout_height="0dp"
195+
android:clickable="true"
196+
android:focusable="true"
197+
android:visibility="gone"
198+
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
199+
app:layout_constraintEnd_toEndOf="parent"
200+
app:layout_constraintStart_toStartOf="parent"
201+
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />
202+
203+
<com.frogobox.appkeyboard.ui.keyboard.templatetext.TemplateTextKeyboard
204+
android:id="@+id/keyboard_template_text"
205+
android:layout_width="match_parent"
206+
android:layout_height="0dp"
207+
android:clickable="true"
208+
android:focusable="true"
209+
android:visibility="gone"
210+
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
211+
app:layout_constraintEnd_toEndOf="parent"
212+
app:layout_constraintStart_toStartOf="parent"
213+
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />
214+
215+
<com.frogobox.appkeyboard.ui.keyboard.news.NewsKeyboard
216+
android:id="@+id/keyboard_news"
217+
android:layout_width="match_parent"
218+
android:layout_height="0dp"
219+
android:clickable="true"
220+
android:focusable="true"
221+
android:visibility="gone"
222+
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
223+
app:layout_constraintEnd_toEndOf="parent"
224+
app:layout_constraintStart_toStartOf="parent"
225+
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />
226+
227+
<com.frogobox.appkeyboard.ui.keyboard.movie.MovieKeyboard
228+
android:id="@+id/keyboard_moview"
229+
android:layout_width="match_parent"
230+
android:layout_height="0dp"
231+
android:clickable="true"
232+
android:focusable="true"
233+
android:visibility="gone"
234+
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
235+
app:layout_constraintEnd_toEndOf="parent"
236+
app:layout_constraintStart_toStartOf="parent"
237+
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />
238+
239+
<com.frogobox.appkeyboard.ui.keyboard.webview.WebiewKeyboard
240+
android:id="@+id/keyboard_webview"
241+
android:layout_width="match_parent"
242+
android:layout_height="0dp"
243+
android:clickable="true"
244+
android:focusable="true"
245+
android:visibility="gone"
246+
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
247+
app:layout_constraintEnd_toEndOf="parent"
248+
app:layout_constraintStart_toStartOf="parent"
249+
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />
250+
251+
<com.frogobox.appkeyboard.ui.keyboard.form.FormKeyboard
252+
android:id="@+id/keyboard_form"
253+
android:layout_width="match_parent"
254+
android:layout_height="0dp"
255+
android:clickable="true"
256+
android:focusable="true"
257+
android:visibility="gone"
258+
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
259+
app:layout_constraintEnd_toEndOf="parent"
260+
app:layout_constraintStart_toStartOf="parent"
261+
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />
262+
263+
<com.frogobox.libkeyboard.ui.emoji.EmojiKeyboard
264+
android:id="@+id/keyboard_emoji"
265+
android:layout_width="match_parent"
266+
android:layout_height="0dp"
267+
android:clickable="true"
268+
android:focusable="true"
269+
android:visibility="gone"
270+
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
271+
app:layout_constraintEnd_toEndOf="parent"
272+
app:layout_constraintStart_toStartOf="parent"
273+
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />
274+
275+
</androidx.constraintlayout.widget.ConstraintLayout>
276+
```
277+
278+
### Step 5. Create KeyConfig
279+
```xml
280+
<?xml version="1.0" encoding="utf-8"?>
281+
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
282+
android:icon="@drawable/ic_frogobox"
283+
android:settingsActivity="com.frogobox.appkeyboard.ui.main.MainActivity">
284+
285+
<subtype android:imeSubtypeMode="Keyboard" />
286+
287+
</input-method>
288+
289+
```
290+
291+
### Step 6. Create Keyboard Service In Manifest
292+
```xml
293+
<service
294+
android:name=".services.KeyboardIME"
295+
android:exported="true"
296+
android:label="@string/app_name"
297+
android:permission="android.permission.BIND_INPUT_METHOD">
298+
<meta-data
299+
android:name="android.view.im"
300+
android:resource="@xml/keys_config" />
301+
<intent-filter>
302+
<action android:name="android.view.InputMethod" />
303+
</intent-filter>
304+
</service>
305+
```
306+
78307

79308
## Video Play
80309
https://user-images.githubusercontent.com/24654871/231431022-4410933f-7199-4967-9db1-24544f5593e0.mp4
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Created by Faisal Amir on 24/10/22
3+
* -----------------------------------------
4+
* E-mail : faisalamircs@gmail.com
5+
* Github : github.com/amirisback
6+
* -----------------------------------------
7+
* Copyright (C) Frogobox ID / amirisback
8+
* All rights reserved
9+
*/
10+
11+
12+
import ProjectSetting.APP_DOMAIN
13+
import ProjectSetting.APP_PLAY_CONSOLE
14+
15+
object LibrarySetting {
16+
17+
const val GITHUB_ACCOUNT = "amirisback"
18+
const val GITHUB_REPOSITORY = "keyboard"
19+
20+
const val LIB_NAME = "libkeyboard"
21+
22+
const val ARTIFACT_ID = GITHUB_REPOSITORY
23+
const val GROUP_ID = "com.github.$GITHUB_ACCOUNT"
24+
25+
const val NAME_SPACE = "$APP_DOMAIN.$APP_PLAY_CONSOLE.$LIB_NAME"
26+
27+
const val MAVEN_URI = "https://maven.pkg.github.com/$GITHUB_ACCOUNT/$GITHUB_REPOSITORY"
28+
29+
}

frogo-keyboard/build.gradle.kts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
id("com.android.library")
33
id("org.jetbrains.kotlin.android")
4+
`maven-publish`
45
}
56

67
android {
@@ -51,4 +52,43 @@ dependencies {
5152
api(Frogo.recyclerView)
5253

5354
api(Androidx.emoji2)
55+
56+
}
57+
58+
afterEvaluate {
59+
publishing {
60+
publications {
61+
62+
repositories {
63+
maven {
64+
name = LibrarySetting.LIB_NAME
65+
url = uri(LibrarySetting.MAVEN_URI)
66+
credentials {
67+
username = project.findProperty("gpr.user") as String? ?: ""
68+
password = project.findProperty("gpr.key") as String? ?: ""
69+
}
70+
}
71+
}
72+
73+
// Creates a Maven publication called "release".
74+
register("release", MavenPublication::class) {
75+
76+
// Applies the component for the release build variant.
77+
// NOTE : Delete this line code if you publish Native Java / Kotlin Library
78+
from(components["release"])
79+
80+
// Library Package Name (Example : "com.frogobox.androidfirstlib")
81+
// NOTE : Different GroupId For Each Library / Module, So That Each Library Is Not Overwritten
82+
groupId = LibrarySetting.GROUP_ID
83+
84+
// Library Name / Module Name (Example : "androidfirstlib")
85+
// NOTE : Different ArtifactId For Each Library / Module, So That Each Library Is Not Overwritten
86+
artifactId = LibrarySetting.ARTIFACT_ID
87+
88+
// Version Library Name (Example : "1.0.0")
89+
version = ProjectSetting.PROJECT_VERSION_NAME
90+
91+
}
92+
}
93+
}
5494
}

0 commit comments

Comments
 (0)