Skip to content

Commit 3dec413

Browse files
committed
reenable keyboard pop-up
1 parent d7c3983 commit 3dec413

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Next Release]
88

9+
## 2.5.4 - 2021-7-26
10+
- New (and working) way for opening keyboard
11+
- Update deps versions
12+
913
## 2.5.3 - 2021-6-6
1014
- crash fix #475
1115
- Deps update

app/src/main/res/layout/fragment_introduction.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,12 @@
116116
android:layout_width="wrap_content"
117117
android:layout_height="wrap_content"
118118
app:ccpDialog_cornerRadius="8dp"
119-
app:ccpDialog_keyboardAutoPopup="false"
119+
app:ccpDialog_keyboardAutoPopup="true"
120+
app:ccpDialog_allowSearch="true"
120121
app:ccp_autoDetectCountry="true"
121122
app:ccp_countryPreference="in,us,nz,gb"
122-
app:ccp_hintExampleNumber="true" />
123+
app:ccp_hintExampleNumber="true"
124+
/>
123125

124126
<EditText
125127
android:id="@+id/et_phone"

ccp/build.gradle

+4-11
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,9 @@ android {
2525
dependencies {
2626
implementation fileTree(include: ['*.jar'], dir: 'libs')
2727
testImplementation 'junit:junit:4.13.2'
28-
implementation 'androidx.recyclerview:recyclerview:1.2.0'
29-
implementation 'androidx.appcompat:appcompat:1.3.0'
30-
implementation 'io.michaelrocks:libphonenumber-android:8.12.19-2'
28+
implementation 'androidx.recyclerview:recyclerview:1.2.1'
29+
implementation 'androidx.appcompat:appcompat:1.3.1'
30+
implementation 'androidx.core:core:1.6.0'
31+
implementation 'io.michaelrocks:libphonenumber-android:8.12.28'
3132
implementation "androidx.cardview:cardview:1.0.0"
3233
}
33-
34-
35-
/**
36-
* While uploading,
37-
* ./gradlew install
38-
*
39-
* ./gradlew bintrayUpload
40-
*/

ccp/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GROUP=com.hbb20
22
POM_ARTIFACT_ID=ccp
3-
VERSION_NAME=2.5.3
3+
VERSION_NAME=2.5.4
44
POM_NAME=CountryCodePicker
55
POM_PACKAGING=aar
66
POM_DESCRIPTION=Country Code Picker (CCP) is an android library which provides an easy way to search and select international country code for the phone number.

ccp/src/main/java/com/hbb20/CountryCodeDialog.java

+10-7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
import androidx.cardview.widget.CardView;
2222
import androidx.core.content.ContextCompat;
23+
import androidx.core.view.WindowInsetsCompat;
24+
import androidx.core.view.WindowInsetsControllerCompat;
2325
import androidx.recyclerview.widget.LinearLayoutManager;
2426
import androidx.recyclerview.widget.RecyclerView;
2527

@@ -86,13 +88,6 @@ public static void openCountryCodeDialog(final CountryCodePicker codePicker) {
8688
dialog.getWindow().setContentView(R.layout.layout_picker_dialog);
8789
dialog.getWindow().setBackgroundDrawable(ContextCompat.getDrawable(context, android.R.color.transparent));
8890

89-
//keyboard
90-
if (codePicker.isSearchAllowed() && codePicker.isDialogKeyboardAutoPopup()) {
91-
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
92-
} else {
93-
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
94-
}
95-
9691

9792
//dialog views
9893
RecyclerView recyclerView_countryDialog = (RecyclerView) dialog.findViewById(R.id.recycler_countryDialog);
@@ -104,6 +99,14 @@ public static void openCountryCodeDialog(final CountryCodePicker codePicker) {
10499
CardView dialogRoot = (CardView) dialog.findViewById(R.id.cardViewRoot);
105100
ImageView imgDismiss = (ImageView) dialog.findViewById(R.id.img_dismiss);
106101

102+
//keyboard
103+
if (codePicker.isSearchAllowed() && codePicker.isDialogKeyboardAutoPopup()) {
104+
new WindowInsetsControllerCompat(dialog.getWindow(), editText_search)
105+
.show(WindowInsetsCompat.Type.ime());
106+
editText_search.requestFocus();
107+
} else {
108+
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
109+
}
107110
// type faces
108111
//set type faces
109112
try {

0 commit comments

Comments
 (0)