Skip to content

Commit

Permalink
Merge pull request #103 from hotchemi/revert-86-master
Browse files Browse the repository at this point in the history
Revert "Updated gradle and switch to support AlertDialog"
  • Loading branch information
Shintaro Katafuchi committed Apr 10, 2016
2 parents ea0b4dd + f351fa9 commit 5c26749
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 33 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle:1.3.0'
}
}

Expand Down
7 changes: 1 addition & 6 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 9
targetSdkVersion 23
}
}

dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
5 changes: 0 additions & 5 deletions library/src/main/java/hotchemi/android/rate/AppRate.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@ public AppRate setStoreType(StoreType appstore) {
return this;
}

public AppRate setDialogStyle(int resourceId) {
options.setDialogStyle(resourceId);
return this;
}

public void monitor() {
if (isFirstLaunch(context)) {
setInstallDate(context);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package hotchemi.android.rate;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AlertDialog;
import android.view.View;

import static hotchemi.android.rate.IntentHelper.createIntentForAmazonAppstore;
Expand All @@ -19,7 +19,7 @@ private DialogManager() {
}

static Dialog create(final Context context, final DialogOptions options) {
AlertDialog.Builder builder = getDialogBuilder(context, options.getDialogStyleResId());
AlertDialog.Builder builder = getDialogBuilder(context);
builder.setMessage(options.getMessageText(context));

if (options.shouldShowTitle()) builder.setTitle(options.getTitleText(context));
Expand Down
12 changes: 1 addition & 11 deletions library/src/main/java/hotchemi/android/rate/DialogOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ final class DialogOptions {

private int textNegativeResId = R.string.rate_dialog_no;

private int dialogStyleResId = 0;

private String titleText = null;

private String messageText = null;
Expand Down Expand Up @@ -80,7 +78,7 @@ public StoreType getStoreType() {
return storeType;
}

public void setStoreType(StoreType appstore) {
public void setStoreType( StoreType appstore ) {
storeType = appstore;
}

Expand Down Expand Up @@ -194,12 +192,4 @@ public String getNegativeText(Context context) {
public void setNegativeText(String negativeText) {
this.negativeText = negativeText;
}

public void setDialogStyle(int dialogStyleResId) {
this.dialogStyleResId = dialogStyleResId;
}

public int getDialogStyleResId() {
return this.dialogStyleResId;
}
}
12 changes: 5 additions & 7 deletions library/src/main/java/hotchemi/android/rate/Utils.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package hotchemi.android.rate;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.os.Build;
import android.support.v7.app.AlertDialog;

final class Utils {

Expand All @@ -18,18 +18,16 @@ static boolean isLollipop() {
return Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP || Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1;
}

static int getDialogTheme(int defaultStyle) {
// TODO: CustomLollipopDialogStyle parent could be switched to AppCompat
return defaultStyle == 0 && isLollipop() ? R.style.CustomLollipopDialogStyle : defaultStyle;
static int getDialogTheme() {
return isLollipop() ? R.style.CustomLollipopDialogStyle : 0;
}

@SuppressLint("NewApi")
static AlertDialog.Builder getDialogBuilder(Context context, int defaultStyle) {
static AlertDialog.Builder getDialogBuilder(Context context) {
if (underHoneyComb()) {
// TODO: verify need for this with support.v7.app.AlertDialog
return new AlertDialog.Builder(context);
} else {
return new AlertDialog.Builder(context, getDialogTheme(defaultStyle));
return new AlertDialog.Builder(context, getDialogTheme());
}
}

Expand Down

0 comments on commit 5c26749

Please sign in to comment.