Skip to content

Commit

Permalink
fixed state loss of dialog fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
r-cohen committed Dec 11, 2018
1 parent 9e60853 commit 210c8af
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Add the dependency to the **Module** gradle file:
```gradle
dependencies {
...
compile 'com.github.phearme:bt-scan-selector:1.1.8'
implementation 'com.github.phearme:bt-scan-selector:1.1.9'
}
```
Enable databinding in the **Module** grade file:
Expand Down
14 changes: 7 additions & 7 deletions btscanselector/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
compileSdkVersion 28
buildToolsVersion "26.0.3"

defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 21
versionName "1.1.8"
targetSdkVersion 28
versionCode 22
versionName "1.1.9"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand All @@ -29,7 +29,7 @@ dependencies {
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
Expand Down Expand Up @@ -144,4 +146,15 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
}
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

@Override
public void show(FragmentManager manager, String tag) {
try {
FragmentTransaction ft = manager.beginTransaction();
ft.add(this, tag);
ft.commitAllowingStateLoss();
} catch (Exception e) {
e.printStackTrace();
}
}
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

0 comments on commit 210c8af

Please sign in to comment.