Skip to content

Commit

Permalink
fixed rating adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
tehfonsi committed Jan 3, 2016
1 parent 397320b commit 29ae020
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
36 changes: 20 additions & 16 deletions app/src/main/java/com/github/tehfonsi/appvirality/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,6 @@ protected void onCreate(Bundle savedInstanceState) {
.withTimesShown(2);
ratingDialogBuilder.withDelay(10);

Button resetButton = (Button) findViewById(R.id.button_reset);
resetButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ratingDialogBuilder.reset();
}
});

Button crashButton = (Button) findViewById(R.id.button_crash);
crashButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
throw new RuntimeException("Crash!");
}
});

ratingDialogBuilder.showDialogFragment(getSupportFragmentManager());


Expand All @@ -76,6 +60,26 @@ public void onClick(View v) {
if (ratingEmbeddedBuilder.shouldShow()) {
embeddedContainer.addView(ratingEmbeddedBuilder.getView(embeddedContainer));
}


//init buttons
Button crashButton = (Button) findViewById(R.id.button_crash);
crashButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
throw new RuntimeException("Crash!");
}
});

Button resetButton = (Button) findViewById(R.id.button_reset);
resetButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ratingEmbeddedBuilder.reset();
ratingDialogBuilder.reset();
adapterRatingEmbeddedBuilder.reset();
}
});
}

private List<String> generateListItems(int count) {
Expand Down
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "0.1.0"
versionName "0.1.1"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public boolean shouldShow() {
return startCountCondition && startCountWithoutCrashCondition && timesShownCondition;
}

protected void increaseStartCount() {
public void increaseStartCount() {
mPreferences.increaseStartCount();
mPreferences.increaseStartCountWithoutCrash();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public RatingRecyclerViewAdapter(@NonNull RecyclerView.Adapter originalAdapter,
@NonNull RatingEmbeddedBuilder ratingEmbeddedBuilder) {
this.mRatingPlacement = new RatingRecyclerViewPlacement(ratingEmbeddedBuilder, originalAdapter);
this.mOriginalAdapter = originalAdapter;
ratingEmbeddedBuilder.increaseStartCount();
}

@Override
Expand Down

0 comments on commit 29ae020

Please sign in to comment.