Skip to content

Commit dd8f32c

Browse files
committed
Refactor method names
1 parent 28eec42 commit dd8f32c

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

library/src/main/java/br/fernandodev/easyratingdialog/library/EasyRatingDialog.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public EasyRatingDialog(Context context) {
3636
}
3737

3838
public void onStart() {
39-
if (wasRated() || neverReminder()) return;
39+
if (didRate() || didNeverReminder()) return;
4040

4141
int lauchTimes = mPreferences.getInt(KEY_LAUNCH_TIMES, 0);
4242
long firstDate = mPreferences.getLong(KEY_FIRST_HIT_DATE, -1L);
@@ -58,7 +58,7 @@ public void showIfNeeded(Activity activity) {
5858
}
5959
}
6060

61-
public void dontReminder() {
61+
public void neverReminder() {
6262
mPreferences.edit().putBoolean(KEY_NEVER_REMINDER, true).commit();
6363
}
6464

@@ -74,11 +74,11 @@ public void remindMeLater() {
7474
registerDate();
7575
}
7676

77-
public boolean wasRated() {
77+
public boolean didRate() {
7878
return mPreferences.getBoolean(KEY_WAS_RATED, false);
7979
}
8080

81-
public boolean neverReminder() {
81+
public boolean didNeverReminder() {
8282
return mPreferences.getBoolean(KEY_NEVER_REMINDER, false);
8383
}
8484

@@ -157,7 +157,7 @@ private android.app.AlertDialog createDialog(Context context) {
157157
.setNegativeButton(R.string.erd_no_thanks, new DialogInterface.OnClickListener() {
158158
@Override
159159
public void onClick(DialogInterface dialogInterface, int i) {
160-
dontReminder();
160+
neverReminder();
161161
}
162162
})
163163
.setNeutralButton(R.string.erd_remind_me_later, new DialogInterface.OnClickListener() {

sample/src/main/java/br/fernandodev/easyratingdialog/sample/MainActivity.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,37 @@
77

88
public class MainActivity extends Activity {
99

10-
EasyRatingDialog ratingDialog;
10+
EasyRatingDialog easyRatingDialog;
1111

1212
@Override
1313
protected void onCreate(Bundle savedInstanceState) {
1414
super.onCreate(savedInstanceState);
1515
setContentView(R.layout.activity_main);
16-
ratingDialog = new EasyRatingDialog(this);
16+
easyRatingDialog = new EasyRatingDialog(this);
17+
18+
19+
EasyRatingDialog.ConditionTrigger conditionTrigger = new EasyRatingDialog.ConditionTrigger() {
20+
@Override
21+
public boolean shouldShow() {
22+
//Your custom condition
23+
return false;
24+
}
25+
};
26+
27+
easyRatingDialog.setConditionTrigger(conditionTrigger);
28+
29+
1730
}
1831

1932
@Override
2033
protected void onStart() {
2134
super.onStart();
22-
ratingDialog.onStart();
35+
easyRatingDialog.onStart();
2336
}
2437

2538
@Override
2639
protected void onResume() {
2740
super.onResume();
28-
ratingDialog.showIfNeeded(this);
41+
easyRatingDialog.showIfNeeded(this);
2942
}
3043
}

sample/src/main/res/layout/activity_main.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
<TextView
88
android:text="@string/hello_world"
9+
android:textSize="40sp"
910
android:layout_width="wrap_content"
10-
android:layout_height="wrap_content" />
11+
android:layout_height="wrap_content"
12+
android:layout_centerVertical="true"
13+
android:layout_centerHorizontal="true"/>
1114

1215
</RelativeLayout>

0 commit comments

Comments
 (0)