Skip to content

Commit 582e0cd

Browse files
committed
added target support upto Pie(Api 28)
1 parent 005ed5f commit 582e0cd

File tree

8 files changed

+38
-41
lines changed

8 files changed

+38
-41
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.DS_Store
66
/build
77
/captures
8+
/gradle
89
*.iml
910
.idea
1011
/app/build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This is a simple example of creating Custom KeyboardView for Multi-Lingual Keybo
55
I have referred sample project available on github at: https://github.com/rciovati/Android-KeyboardView-Example
66

77
## Sample App
8-
[![Get it on Google Play](http://www.android.com/images/brand/get_it_on_play_logo_small.png)](https://play.google.com/store/apps/details?id=com.firozmemon.customkeyboard)
8+
[![Get it on Google Play](https://play.google.com/intl/en_us/badges/images/badge_new.png)](https://play.google.com/store/apps/details?id=com.firozmemon.customkeyboard)
99

1010
### Keyboard Languages available in App
1111
- Default (Default Keyboard)

app/build.gradle

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
apply plugin: 'com.android.application'
1818

1919
android {
20-
compileSdkVersion 24
21-
buildToolsVersion "24.0.2"
20+
compileSdkVersion 28
21+
buildToolsVersion '28.0.3'
2222
defaultConfig {
2323
applicationId "com.firozmemon.customkeyboard"
2424
minSdkVersion 15
25-
targetSdkVersion 24
26-
versionCode 1
27-
versionName "1.0"
25+
targetSdkVersion 28
26+
versionCode 2
27+
versionName "1.0.1"
2828
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
2929
}
3030
buildTypes {
@@ -36,12 +36,12 @@ android {
3636
}
3737

3838
dependencies {
39-
compile fileTree(dir: 'libs', include: ['*.jar'])
40-
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
39+
implementation fileTree(dir: 'libs', include: ['*.jar'])
40+
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
4141
exclude group: 'com.android.support', module: 'support-annotations'
4242
})
43-
compile 'com.android.support:appcompat-v7:24.2.1'
44-
testCompile 'junit:junit:4.12'
43+
implementation 'com.android.support:appcompat-v7:28.0.0'
44+
testImplementation 'junit:junit:4.12'
4545

46-
compile 'com.android.support:design:24.2.1'
46+
implementation 'com.android.support:design:28.0.0'
4747
}

app/src/main/java/com/firozmemon/customkeyboard/CustomKeyboardView.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ public void showWithAnimation(Animation animation) {
3838

3939
@Override
4040
public void onAnimationStart(Animation animation) {
41-
// TODO Auto-generated method stub
42-
41+
/* no-op */
4342
}
4443

4544
@Override
4645
public void onAnimationRepeat(Animation animation) {
47-
// TODO Auto-generated method stub
48-
46+
/* no-op */
4947
}
5048

5149
@Override

app/src/main/java/com/firozmemon/customkeyboard/MainActivity.java

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import android.content.Context;
2121
import android.inputmethodservice.Keyboard;
2222
import android.inputmethodservice.KeyboardView;
23+
import android.os.Bundle;
2324
import android.support.design.widget.TextInputLayout;
2425
import android.support.v7.app.AppCompatActivity;
25-
import android.os.Bundle;
2626
import android.text.Layout;
2727
import android.view.KeyEvent;
2828
import android.view.MotionEvent;
@@ -59,10 +59,10 @@ protected void onCreate(Bundle savedInstanceState) {
5959
super.onCreate(savedInstanceState);
6060
setContentView(R.layout.activity_main);
6161

62-
messageInputLayout = (TextInputLayout) findViewById(R.id.messageInputLayout);
63-
messageEditText = (EditText) findViewById(R.id.messageEditText);
64-
switchLang = (Spinner)findViewById(R.id.switchLang);
65-
mKeyboardView = (CustomKeyboardView)findViewById(R.id.keyboardView);
62+
messageInputLayout = findViewById(R.id.messageInputLayout);
63+
messageEditText = findViewById(R.id.messageEditText);
64+
switchLang = findViewById(R.id.switchLang);
65+
mKeyboardView = findViewById(R.id.keyboardView);
6666

6767
langAdapter = ArrayAdapter.createFromResource(this, R.array.switchLangArr, android.R.layout.simple_spinner_item);
6868
langAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
@@ -79,7 +79,7 @@ public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l)
7979

8080
@Override
8181
public void onNothingSelected(AdapterView<?> adapterView) {
82-
82+
/* no-op */
8383
}
8484
});
8585

@@ -257,46 +257,48 @@ public BasicOnKeyboardActionListener(Activity targetActivity, EditText editText,
257257

258258
@Override
259259
public void swipeUp() {
260-
// TODO Auto-generated method stub
261-
260+
/* no-op */
262261
}
263262

264263
@Override
265264
public void swipeRight() {
266-
// TODO Auto-generated method stub
267-
265+
/* no-op */
268266
}
269267

270268
@Override
271269
public void swipeLeft() {
272-
// TODO Auto-generated method stub
273-
270+
/* no-op */
274271
}
275272

276273
@Override
277274
public void swipeDown() {
278-
// TODO Auto-generated method stub
279-
275+
/* no-op */
280276
}
281277

282278
@Override
283279
public void onText(CharSequence text) {
284-
// TODO Auto-generated method stub
285280
int cursorPosition = editText.getSelectionEnd();
286-
String before = editText.getText().toString().substring(0, cursorPosition);
287-
String after = editText.getText().toString().substring(cursorPosition);
281+
String previousText = editText.getText().toString();
282+
String before, after;
283+
if (cursorPosition < previousText.length()) {
284+
before = previousText.substring(0, cursorPosition);
285+
after = previousText.substring(cursorPosition);
286+
} else {
287+
before = previousText;
288+
after = "";
289+
}
288290
editText.setText(before + text + after);
289291
editText.setSelection(cursorPosition + 1);
290292
}
291293

292294
@Override
293295
public void onRelease(int primaryCode) {
294-
// TODO Auto-generated method stub
296+
/* no-op */
295297
}
296298

297299
@Override
298300
public void onPress(int primaryCode) {
299-
// TODO Auto-generated method stub
301+
/* no-op */
300302
}
301303

302304
@Override

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
buildscript {
2020
repositories {
2121
jcenter()
22+
google()
2223
}
2324
dependencies {
24-
classpath 'com.android.tools.build:gradle:2.2.0'
25+
classpath 'com.android.tools.build:gradle:3.2.1'
2526

2627
// NOTE: Do not place your application dependencies here; they belong
2728
// in the individual module build.gradle files
@@ -31,6 +32,7 @@ buildscript {
3132
allprojects {
3233
repositories {
3334
jcenter()
35+
google()
3436
}
3537
}
3638

gradle/wrapper/gradle-wrapper.jar

-52.4 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)