Skip to content

Commit

Permalink
Merge pull request #43 from amirisback/develop/create-lib
Browse files Browse the repository at this point in the history
DEVELOP :: READY FOR RELEASE BETA LIBRARY
  • Loading branch information
amirisback authored May 19, 2023
2 parents 96ea02f + 8642f01 commit d24a102
Show file tree
Hide file tree
Showing 5 changed files with 383 additions and 24 deletions.
237 changes: 233 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
## Version Release
This Is Latest Release

$version_release = 1.1.0
$version_release = 1.1.1

What's New??

Expand Down Expand Up @@ -64,17 +64,246 @@ allprojects {

dependencies {
// library frogo-keyboard
implementation 'com.github.amirisback:keyboard:1.1.0'
implementation 'com.github.amirisback:keyboard:1.1.1'
}

#### <Option 2> Kotlin DSL Gradle

dependencies {
// library frogo-keyboard
implementation("com.github.amirisback:keyboard:1.1.0")
implementation("com.github.amirisback:keyboard:1.1.1")
}

### Step 3. Coming Soon
### Step 3. Create Service Keyboard IME

#### Create Class Keyboard IME
```kotlin
class KeyboardIME : BaseKeyboardIME<YourIMELayoutBinding>() {

// ovveride function from IKeyboardIME

}
```

#### Interface IKeyboardIME
```kotlin
interface IKeyboardIME {

fun initialSetupKeyboard()

fun setupBinding()

fun invalidateKeyboard()

fun initCurrentInputConnection()

fun hideMainKeyboard()

fun showMainKeyboard()

fun showOnlyKeyboard()

fun hideOnlyKeyboard()

fun EditText.showKeyboardExt()

fun initBackToMainKeyboard()

fun setupFeatureKeyboard()

fun initView()

fun invalidateAllKeys()

@RequiresApi(Build.VERSION_CODES.M)
fun runEmojiBoard()

fun updateShiftKeyState()

@RequiresApi(Build.VERSION_CODES.M)
fun onKeyExt(code: Int, inputConnection: InputConnection)

fun moveCursor(moveRight: Boolean)

fun getImeOptionsActionId(): Int

fun getKeyboardLayoutXML(): Int

}
```

### Step 4. Create Layout Keyboard IME
```xml
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/keyboard_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/keyboard_bg_root">

<LinearLayout
android:id="@+id/container_keyboard_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/keyboard_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/keyboard_bg_root"
android:minHeight="@dimen/frogo_dimen_64dp" />

<com.frogobox.libkeyboard.ui.main.MainKeyboard
android:id="@+id/keyboard_main"
style="@style/KwKeyboardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/theme_dark_background_color" />

</LinearLayout>

<LinearLayout
android:id="@+id/mock_measure_height_keyboard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/container_keyboard_main">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/mock_keyboard_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/keyboard_bg_root"
android:minHeight="@dimen/frogo_dimen_64dp" />

<com.frogobox.libkeyboard.ui.main.MainKeyboard
android:id="@+id/mock_measure_height_keyboard_main"
style="@style/KwKeyboardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/theme_dark_background_color" />

</LinearLayout>

<com.frogobox.appkeyboard.ui.keyboard.autotext.AutoTextKeyboard
android:id="@+id/keyboard_autotext"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />

<com.frogobox.appkeyboard.ui.keyboard.templatetext.TemplateTextKeyboard
android:id="@+id/keyboard_template_text"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />

<com.frogobox.appkeyboard.ui.keyboard.news.NewsKeyboard
android:id="@+id/keyboard_news"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />

<com.frogobox.appkeyboard.ui.keyboard.movie.MovieKeyboard
android:id="@+id/keyboard_moview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />

<com.frogobox.appkeyboard.ui.keyboard.webview.WebiewKeyboard
android:id="@+id/keyboard_webview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />

<com.frogobox.appkeyboard.ui.keyboard.form.FormKeyboard
android:id="@+id/keyboard_form"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />

<com.frogobox.libkeyboard.ui.emoji.EmojiKeyboard
android:id="@+id/keyboard_emoji"
android:layout_width="match_parent"
android:layout_height="0dp"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/mock_measure_height_keyboard"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/mock_measure_height_keyboard" />

</androidx.constraintlayout.widget.ConstraintLayout>
```

### Step 5. Create KeyConfig
```xml
<?xml version="1.0" encoding="utf-8"?>
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:icon="@drawable/ic_frogobox"
android:settingsActivity="com.frogobox.appkeyboard.ui.main.MainActivity">

<subtype android:imeSubtypeMode="Keyboard" />

</input-method>

```

### Step 6. Create Keyboard Service In Manifest
```xml
<service
android:name=".services.KeyboardIME"
android:exported="true"
android:label="@string/app_name"
android:permission="android.permission.BIND_INPUT_METHOD">
<meta-data
android:name="android.view.im"
android:resource="@xml/keys_config" />
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
</service>
```


## Video Play
https://user-images.githubusercontent.com/24654871/231431022-4410933f-7199-4967-9db1-24544f5593e0.mp4
Expand Down
29 changes: 29 additions & 0 deletions buildSrc/src/main/kotlin/LibrarySetting.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Created by Faisal Amir on 24/10/22
* -----------------------------------------
* E-mail : [email protected]
* Github : github.com/amirisback
* -----------------------------------------
* Copyright (C) Frogobox ID / amirisback
* All rights reserved
*/


import ProjectSetting.APP_DOMAIN
import ProjectSetting.APP_PLAY_CONSOLE

object LibrarySetting {

const val GITHUB_ACCOUNT = "amirisback"
const val GITHUB_REPOSITORY = "keyboard"

const val LIB_NAME = "libkeyboard"

const val ARTIFACT_ID = GITHUB_REPOSITORY
const val GROUP_ID = "com.github.$GITHUB_ACCOUNT"

const val NAME_SPACE = "$APP_DOMAIN.$APP_PLAY_CONSOLE.$LIB_NAME"

const val MAVEN_URI = "https://maven.pkg.github.com/$GITHUB_ACCOUNT/$GITHUB_REPOSITORY"

}
40 changes: 40 additions & 0 deletions frogo-keyboard/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
`maven-publish`
}

android {
Expand Down Expand Up @@ -51,4 +52,43 @@ dependencies {
api(Frogo.recyclerView)

api(Androidx.emoji2)

}

afterEvaluate {
publishing {
publications {

repositories {
maven {
name = LibrarySetting.LIB_NAME
url = uri(LibrarySetting.MAVEN_URI)
credentials {
username = project.findProperty("gpr.user") as String? ?: ""
password = project.findProperty("gpr.key") as String? ?: ""
}
}
}

// Creates a Maven publication called "release".
register("release", MavenPublication::class) {

// Applies the component for the release build variant.
// NOTE : Delete this line code if you publish Native Java / Kotlin Library
from(components["release"])

// Library Package Name (Example : "com.frogobox.androidfirstlib")
// NOTE : Different GroupId For Each Library / Module, So That Each Library Is Not Overwritten
groupId = LibrarySetting.GROUP_ID

// Library Name / Module Name (Example : "androidfirstlib")
// NOTE : Different ArtifactId For Each Library / Module, So That Each Library Is Not Overwritten
artifactId = LibrarySetting.ARTIFACT_ID

// Version Library Name (Example : "1.0.0")
version = ProjectSetting.PROJECT_VERSION_NAME

}
}
}
}
Loading

0 comments on commit d24a102

Please sign in to comment.