Skip to content

Commit e918a9b

Browse files
committed
Rate this app dialog
1 parent d5414e8 commit e918a9b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ dependencies {
140140
implementation 'com.google.firebase:firebase-storage:15.0.2'
141141
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.2'
142142

143+
implementation 'io.github.kobakei:ratethisapp:1.2.0'
143144
}
144145

145146

app/src/main/java/com/duy/editor/CodeEditorActivity.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import com.jecelyin.editor.v2.editor.EditorDelegate;
5151
import com.jecelyin.editor.v2.editor.task.SaveAllTask;
5252
import com.jecelyin.editor.v2.widget.menu.MenuDef;
53+
import com.kobakei.ratethisapp.RateThisApp;
5354
import com.pdaxrom.cctools.BuildConstants;
5455
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
5556

@@ -93,6 +94,9 @@ public void onPanelSlide(View panel, float slideOffset) {
9394
.replace(R.id.container_diagnostic_list_view, diagnosticFragment, tag)
9495
.commit();
9596
mDiagnosticPresenter = new DiagnosticPresenter(diagnosticFragment, this, mTabManager);
97+
98+
// Monitor launch times and interval from installation
99+
RateThisApp.onCreate(this);
96100
}
97101

98102
@Override
@@ -282,8 +286,12 @@ public void onBackPressed() {
282286
return;
283287
}
284288
}
285-
super.onBackPressed();
286289

290+
291+
// If the condition is satisfied, "Rate this app" dialog will be shown
292+
if (!RateThisApp.showRateDialogIfNeeded(this)) {
293+
super.onBackPressed();
294+
}
287295
}
288296

289297
@Override

0 commit comments

Comments
 (0)