From 2b59455dd5d80061bfe585b71c919e9600a18add Mon Sep 17 00:00:00 2001 From: naman14 Date: Sat, 29 Oct 2016 07:11:30 +0530 Subject: [PATCH] build fixes --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- library/build.gradle | 8 +-- .../com/afollestad/appthemeengine/ATE.java | 61 ++----------------- library/src/main/res/values/dimens.xml | 1 + sample/build.gradle | 8 +-- 6 files changed, 12 insertions(+), 70 deletions(-) diff --git a/build.gradle b/build.gradle index 00d4011..3b0e234 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.0.0-alpha3' + classpath 'com.android.tools.build:gradle:1.5.0' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f23df6e..c25cec5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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-2.8-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip diff --git a/library/build.gradle b/library/build.gradle index db06a69..ba2b697 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -24,10 +24,6 @@ android { dependencies { compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' - compile('com.github.afollestad.material-dialogs:core:0.8.5.3@aar') { - transitive = true - } - compile('com.github.afollestad.material-dialogs:commons:0.8.5.3@aar') { - transitive = true - } + compile 'com.afollestad.material-dialogs:core:0.9.0.2' + compile 'com.afollestad.material-dialogs:commons:0.9.0.2' } \ No newline at end of file diff --git a/library/src/main/java/com/afollestad/appthemeengine/ATE.java b/library/src/main/java/com/afollestad/appthemeengine/ATE.java index ec21255..16266f9 100644 --- a/library/src/main/java/com/afollestad/appthemeengine/ATE.java +++ b/library/src/main/java/com/afollestad/appthemeengine/ATE.java @@ -18,24 +18,18 @@ import android.support.v4.widget.DrawerLayout; import android.support.v7.app.AppCompatActivity; import android.support.v7.view.menu.BaseMenuPresenter; -import android.support.v7.view.menu.ListMenuItemView; -import android.support.v7.view.menu.MenuPopupHelper; import android.support.v7.widget.ActionMenuView; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.View; import android.view.ViewGroup; -import android.view.ViewTreeObserver; import android.view.Window; -import android.widget.CheckBox; import android.widget.ListView; -import android.widget.RadioButton; import com.afollestad.appthemeengine.customizers.ATEActivityThemeCustomizer; import com.afollestad.appthemeengine.customizers.ATETaskDescriptionCustomizer; import com.afollestad.appthemeengine.processors.Processor; -import com.afollestad.appthemeengine.util.TintHelper; import com.afollestad.appthemeengine.util.Util; import com.afollestad.appthemeengine.views.PreMadeView; import com.afollestad.materialdialogs.internal.ThemeSingleton; @@ -298,13 +292,13 @@ public void run() { BaseMenuPresenter presenter = (BaseMenuPresenter) f2.get(actionMenuView); Field f3 = presenter.getClass().getDeclaredField("mOverflowPopup"); f3.setAccessible(true); - MenuPopupHelper overflowMenuPopupHelper = (MenuPopupHelper) f3.get(presenter); - setTintForMenuPopupHelper(activity, overflowMenuPopupHelper, key); +// MenuPopupHelper overflowMenuPopupHelper = (MenuPopupHelper) f3.get(presenter); +// setTintForMenuPopupHelper(activity, overflowMenuPopupHelper, key); Field f4 = presenter.getClass().getDeclaredField("mActionButtonPopup"); f4.setAccessible(true); - MenuPopupHelper subMenuPopupHelper = (MenuPopupHelper) f4.get(presenter); - setTintForMenuPopupHelper(activity, subMenuPopupHelper, key); +// MenuPopupHelper subMenuPopupHelper = (MenuPopupHelper) f4.get(presenter); +// setTintForMenuPopupHelper(activity, subMenuPopupHelper, key); } catch (Exception e) { e.printStackTrace(); } @@ -312,52 +306,7 @@ public void run() { }); } - private static void setTintForMenuPopupHelper(final @NonNull Activity context, @Nullable MenuPopupHelper menuPopupHelper, final @Nullable String key) { - if (menuPopupHelper != null) { - final ListView listView = menuPopupHelper.getPopup().getListView(); - listView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - try { - Field checkboxField = ListMenuItemView.class.getDeclaredField("mCheckBox"); - checkboxField.setAccessible(true); - Field radioButtonField = ListMenuItemView.class.getDeclaredField("mRadioButton"); - radioButtonField.setAccessible(true); - - final boolean isDark = !Util.isColorLight(Util.resolveColor(context, android.R.attr.windowBackground)); - - for (int i = 0; i < listView.getChildCount(); i++) { - View v = listView.getChildAt(i); - if (!(v instanceof ListMenuItemView)) continue; - ListMenuItemView iv = (ListMenuItemView) v; - - CheckBox check = (CheckBox) checkboxField.get(iv); - if (check != null) { - TintHelper.setTint(check, Config.accentColor(context, key), isDark); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) - check.setBackground(null); - } - - RadioButton radioButton = (RadioButton) radioButtonField.get(iv); - if (radioButton != null) { - TintHelper.setTint(radioButton, Config.accentColor(context, key), isDark); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) - radioButton.setBackground(null); - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - listView.getViewTreeObserver().removeOnGlobalLayoutListener(this); - } else { - //noinspection deprecation - listView.getViewTreeObserver().removeGlobalOnLayoutListener(this); - } - } - }); - } - } + private ATE() { } diff --git a/library/src/main/res/values/dimens.xml b/library/src/main/res/values/dimens.xml index 6de3840..79f54c5 100644 --- a/library/src/main/res/values/dimens.xml +++ b/library/src/main/res/values/dimens.xml @@ -2,5 +2,6 @@ 1dp + 16dp \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index 7cc76cc..77d8b8c 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -33,12 +33,8 @@ android { dependencies { compile 'com.android.support:appcompat-v7:23.1.1' - compile('com.github.afollestad.material-dialogs:core:0.8.5.3@aar') { - transitive = true - } - compile('com.github.afollestad.material-dialogs:commons:0.8.5.3@aar') { - transitive = true - } + compile 'com.afollestad.material-dialogs:core:0.9.0.2' + compile 'com.afollestad.material-dialogs:commons:0.9.0.2' compile 'com.android.support:design:23.1.1' compile project(path: ':library') }