Skip to content

Commit

Permalink
Update TravisCI script
Browse files Browse the repository at this point in the history
  • Loading branch information
gsantner committed Oct 29, 2017
1 parent 3cb9418 commit 51e54a0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ env:
global:
- ANDROID_HOME=$HOME/android-sdk
matrix:
- TASK="lintFlavorDefaultDebug --stacktrace"
- TASK="build check --stacktrace"
- TASK="clean lintFlavorDefaultDebug --stacktrace"
- TASK="clean build check -x lint --stacktrace"

script: "./gradlew --no-daemon --parallel $TASK"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![GitHub release](https://img.shields.io/github/tag/gsantner/memetastic.svg)](https://github.com/gsantner/memetastic/releases)
[![Donate](https://img.shields.io/badge/donate-bitcoin-orange.svg)](https://gsantner.github.io/#donate)
[![Donate LiberaPay](https://img.shields.io/badge/donate-liberapay-orange.svg)](https://liberapay.com/gsantner/donate)
[![CircleCI](https://circleci.com/gh/gsantner/memetastic.svg?style=shield)](https://circleci.com/gh/gsantner/memetastic)
[![Build Status](https://travis-ci.org/gsantner/memetastic.svg?branch=master)](https://travis-ci.org/gsantner/memetastic)
[![Translate - with Stringlate](https://img.shields.io/badge/stringlate-translate-green.svg)](https://lonamiwebs.github.io/stringlate/translate?git=https%3A%2F%2Fgithub.com%2Fgsantner%2Fmemetastic.git&name=MemeTastic&web=https%3A%2F%2Fgithub.com%2Fgsantner%2Fmemetastic)
[![Chat - Matrix](https://img.shields.io/badge/chat-on%20matrix-blue.svg)](https://matrix.to/#/#memetastic:matrix.org) [![Chat - FreeNode IRC](https://img.shields.io/badge/chat-on%20irc-blue.svg)](https://kiwiirc.com/client/irc.freenode.net/?nick=memetastic-anon|?#memetastic)

Expand Down
38 changes: 36 additions & 2 deletions app/src/main/java/net/gsantner/opoc/util/ContextUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
Expand All @@ -37,6 +38,7 @@
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
Expand All @@ -52,7 +54,10 @@
import android.text.Spanned;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ForegroundColorSpan;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
Expand All @@ -65,11 +70,12 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Method;
import java.util.Locale;

import static android.graphics.Bitmap.CompressFormat;

@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue", "SpellCheckingInspection", "deprecation", "ObsoleteSdkInt"})
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue", "SpellCheckingInspection", "deprecation", "ObsoleteSdkInt", "ConstantConditions", "UnusedReturnValue"})
public class ContextUtils {
//########################
//## Members, Constructors
Expand Down Expand Up @@ -322,7 +328,7 @@ public void setAppLanguage(String androidLocaleString) {
}

// Find out if color above the given color should be light or dark. true if light
public boolean shouldColorOnTopBeLight(int colorOnBottomInt) {
public boolean shouldColorOnTopBeLight(@ColorInt int colorOnBottomInt) {
return 186 > (((0.299 * Color.red(colorOnBottomInt))
+ ((0.587 * Color.green(colorOnBottomInt))
+ (0.114 * Color.blue(colorOnBottomInt)))));
Expand Down Expand Up @@ -510,4 +516,32 @@ public Bitmap getBitmapFromDrawable(int drawableId) {
}
return bitmap;
}

public ContextUtils tintMenuItems(Menu menu, boolean recurse, @ColorInt int iconColor) {
for (int i = 0; i < menu.size(); i++) {
MenuItem item = menu.getItem(i);
Drawable drawable = item.getIcon();
if (drawable != null) {
drawable.mutate();
drawable.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
}
if (item.hasSubMenu() && recurse) {
tintMenuItems(item.getSubMenu(), recurse, iconColor);
}
}
return this;
}

@SuppressLint("PrivateApi")
public ContextUtils setSubMenuIconsVisiblity(Menu menu, boolean visible) {
if (menu.getClass().getSimpleName().equals("MenuBuilder")) {
try {
Method m = menu.getClass().getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE);
m.setAccessible(true);
m.invoke(menu, visible);
} catch (Exception ignored) {
}
}
return this;
}
}

0 comments on commit 51e54a0

Please sign in to comment.