Skip to content

Commit 6f7060d

Browse files
committed
Add keyboard and api level utils
1 parent 2f2842e commit 6f7060d

28 files changed

+80
-163
lines changed

.gitignore

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
*.iml
2-
.gradle
3-
/local.properties
4-
/.idea/caches
5-
/.idea/libraries
6-
/.idea/modules.xml
7-
/.idea/workspace.xml
8-
/.idea/navEditor.xml
9-
/.idea/assetWizardSettings.xml
1+
*.apk
2+
*.ap_
3+
*.dex
4+
*.class
5+
bin/
6+
gen/
7+
out/
8+
build/
9+
workspace.xml
10+
.idea
11+
local.properties
12+
ks.properties
13+
.classpath
14+
.project
1015
.DS_Store
11-
/build
12-
/captures
13-
.externalNativeBuild
16+
lint.xml
17+
protected_strings.xml
18+
.gradle
19+
/dist
20+
*.iml

.idea/gradle.xml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

app/src/main/AndroidManifest.xml

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

app/src/main/res/drawable-v24/ic_launcher_foreground.xml

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

app/src/main/res/drawable/ic_launcher_background.xml

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

app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

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

app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

Lines changed: 0 additions & 5 deletions
This file was deleted.
-2.89 KB
Binary file not shown.
Binary file not shown.
-2.01 KB
Binary file not shown.
Binary file not shown.
-4.38 KB
Binary file not shown.
Binary file not shown.
-6.24 KB
Binary file not shown.
Binary file not shown.
-8.91 KB
Binary file not shown.
Binary file not shown.

app/src/main/res/values/colors.xml

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

app/src/main/res/values/styles.xml

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

lib/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
*.apk
2+
*.ap_
3+
*.dex
4+
*.class
5+
bin/
6+
gen/
7+
out/
8+
build/
9+
workspace.xml
10+
.idea
11+
local.properties
12+
ks.properties
13+
.classpath
14+
.project
15+
.DS_Store
16+
lint.xml
17+
protected_strings.xml
18+
.gradle
19+
/dist
20+
*.iml
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
apply plugin: 'com.android.library'
2-
apply plugin: 'kotlin-android'
32

43
android {
54
compileSdkVersion 28
5+
66
defaultConfig {
77
minSdkVersion 21
88
targetSdkVersion 28
99
}
10+
1011
buildTypes {
1112
release {
1213
minifyEnabled false
1314
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
1415
}
1516
}
17+
1618
}
1719

1820
dependencies {
19-
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
20-
}
21+
implementation 'androidx.appcompat:appcompat:1.0.2'
22+
}
File renamed without changes.

lib/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="org.buffer.android.utils"/>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package org.buffer.android.utils
2+
3+
import android.os.Build
4+
5+
object ApiLevelHelper {
6+
7+
fun isAtLeast(apiLevel: Int): Boolean {
8+
return Build.VERSION.SDK_INT >= apiLevel
9+
}
10+
11+
fun isLowerThan(apiLevel: Int): Boolean {
12+
return Build.VERSION.SDK_INT < apiLevel
13+
}
14+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package org.buffer.android.utils
2+
3+
import android.content.Context
4+
import android.view.View
5+
import android.view.inputmethod.InputMethodManager
6+
7+
object KeyboardUtil {
8+
fun closeSoftKeyboard(view: View?) {
9+
if (view != null) {
10+
val inputManager = view.context.getSystemService(
11+
Context.INPUT_METHOD_SERVICE) as InputMethodManager?
12+
inputManager?.hideSoftInputFromWindow(view.windowToken, 0)
13+
}
14+
}
15+
}

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include ':app'
1+
include ':lib'

0 commit comments

Comments
 (0)