Skip to content

Commit

Permalink
Merge pull request #2 from naman14/buildfix
Browse files Browse the repository at this point in the history
build fixes
  • Loading branch information
naman14 authored Oct 29, 2016
2 parents b9102ed + 2b59455 commit 58ad06d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 70 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 2 additions & 6 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
61 changes: 5 additions & 56 deletions library/src/main/java/com/afollestad/appthemeengine/ATE.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -298,66 +292,21 @@ 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();
}
}
});
}

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() {
}
Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<resources>

<dimen name="ate_circleview_border">1dp</dimen>
<dimen name="md_preference_content_inset">16dp</dimen>

</resources>
8 changes: 2 additions & 6 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}

0 comments on commit 58ad06d

Please sign in to comment.