Merge "[SuwLib] Add support annotations"
This commit is contained in:
commit
07e92e75c5
|
@ -12,6 +12,8 @@ LOCAL_RESOURCE_DIR := \
|
|||
$(LOCAL_PATH)/main/res \
|
||||
$(LOCAL_PATH)/platform/res
|
||||
LOCAL_SDK_VERSION := current
|
||||
LOCAL_SHARED_ANDROID_LIBRARIES := \
|
||||
android-support-annotations
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, main/src platform/src)
|
||||
|
||||
include $(BUILD_STATIC_JAVA_LIBRARY)
|
||||
|
@ -32,6 +34,7 @@ LOCAL_RESOURCE_DIR := \
|
|||
LOCAL_SDK_VERSION := current
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, main/src eclair-mr1/src)
|
||||
LOCAL_SHARED_ANDROID_LIBRARIES := \
|
||||
android-support-annotations \
|
||||
android-support-v4 \
|
||||
android-support-v7-appcompat
|
||||
|
||||
|
@ -54,6 +57,7 @@ LOCAL_RESOURCE_DIR := \
|
|||
LOCAL_SDK_VERSION := current
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, main/src eclair-mr1/src full-support/src)
|
||||
LOCAL_SHARED_ANDROID_LIBRARIES := \
|
||||
android-support-annotations \
|
||||
android-support-v4 \
|
||||
android-support-v7-appcompat \
|
||||
android-support-v7-recyclerview
|
||||
|
|
|
@ -31,6 +31,7 @@ ext {
|
|||
// }
|
||||
//
|
||||
deps = [
|
||||
'support-annotations': project(':support-annotations'),
|
||||
'support-appcompat-v7': project(':support-appcompat-v7'),
|
||||
'support-recyclerview-v7': project(':support-recyclerview-v7')
|
||||
]
|
||||
|
|
|
@ -22,6 +22,7 @@ import android.graphics.PorterDuff;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.Button;
|
||||
|
||||
|
@ -129,7 +130,7 @@ public class NavigationBarButton extends Button {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean setState(int[] stateSet) {
|
||||
public boolean setState(@NonNull int[] stateSet) {
|
||||
boolean needsInvalidate = super.setState(stateSet);
|
||||
boolean needsInvalidateForState = updateState();
|
||||
return needsInvalidate || needsInvalidateForState;
|
||||
|
|
|
@ -32,6 +32,7 @@ import android.graphics.PorterDuffXfermode;
|
|||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.android.setupwizardlib.annotations.VisibleForTesting;
|
||||
|
||||
|
@ -103,7 +104,7 @@ public class GlifPatternDrawable extends Drawable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
public void draw(@NonNull Canvas canvas) {
|
||||
final Rect bounds = getBounds();
|
||||
int drawableWidth = bounds.width();
|
||||
int drawableHeight = bounds.height();
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.content.Context;
|
|||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.support.annotation.StyleableRes;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.View;
|
||||
|
@ -55,14 +56,17 @@ public class NavigationBar extends LinearLayout implements View.OnClickListener
|
|||
R.attr.suwNavBarTheme,
|
||||
android.R.attr.colorForeground,
|
||||
android.R.attr.colorBackground });
|
||||
int theme = attributes.getResourceId(0, 0);
|
||||
@StyleableRes int suwNavBarTheme = 0;
|
||||
@StyleableRes int colorForeground = 1;
|
||||
@StyleableRes int colorBackground = 2;
|
||||
int theme = attributes.getResourceId(suwNavBarTheme, 0);
|
||||
if (theme == 0) {
|
||||
// Compare the value of the foreground against the background color to see if current
|
||||
// theme is light-on-dark or dark-on-light.
|
||||
float[] foregroundHsv = new float[3];
|
||||
float[] backgroundHsv = new float[3];
|
||||
Color.colorToHSV(attributes.getColor(1, 0), foregroundHsv);
|
||||
Color.colorToHSV(attributes.getColor(2, 0), backgroundHsv);
|
||||
Color.colorToHSV(attributes.getColor(colorForeground, 0), foregroundHsv);
|
||||
Color.colorToHSV(attributes.getColor(colorBackground, 0), backgroundHsv);
|
||||
boolean isDarkBg = foregroundHsv[2] > backgroundHsv[2];
|
||||
theme = isDarkBg ? R.style.SuwNavBarThemeDark : R.style.SuwNavBarThemeLight;
|
||||
}
|
||||
|
|
|
@ -25,11 +25,7 @@ android {
|
|||
// Platform version that will not include the compatibility libraries
|
||||
platform {
|
||||
minSdkVersion 21
|
||||
}
|
||||
|
||||
// Compatibility build that provides the L layout for SDK versions ICS+
|
||||
icsCompat {
|
||||
minSdkVersion 14
|
||||
dependencies {
|
||||
// Read the dependencies from the "deps" map in the extra properties.
|
||||
//
|
||||
|
@ -47,6 +43,15 @@ android {
|
|||
// deps = ['project-name': 'com.example.group:project-name:1.0.0']
|
||||
// }
|
||||
//
|
||||
platformCompile deps['support-annotations']
|
||||
}
|
||||
}
|
||||
|
||||
// Compatibility build that provides the L layout for SDK versions ICS+
|
||||
icsCompat {
|
||||
minSdkVersion 14
|
||||
dependencies {
|
||||
icsCompatCompile deps['support-annotations']
|
||||
icsCompatCompile deps['support-appcompat-v7']
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +60,7 @@ android {
|
|||
eclairMr1Compat {
|
||||
minSdkVersion 7
|
||||
dependencies {
|
||||
eclairMr1CompatCompile deps['support-annotations']
|
||||
eclairMr1CompatCompile deps['support-appcompat-v7']
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +70,7 @@ android {
|
|||
fullSupport {
|
||||
minSdkVersion 7
|
||||
dependencies {
|
||||
fullSupportCompile deps['support-annotations']
|
||||
fullSupportCompile deps['support-appcompat-v7']
|
||||
fullSupportCompile deps['support-recyclerview-v7']
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ ext {
|
|||
// }
|
||||
//
|
||||
deps = [
|
||||
'support-annotations': 'com.android.support:support-annotations:23.4.0',
|
||||
'support-appcompat-v7': 'com.android.support:appcompat-v7:23.4.0',
|
||||
'support-recyclerview-v7': 'com.android.support:recyclerview-v7:23.4.0'
|
||||
]
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.res.Configuration;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.InputQueue;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -60,6 +61,7 @@ public class MockWindow extends Window {
|
|||
throw new UnsupportedOperationException("Unexpected method call on mock");
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public LayoutInflater getLayoutInflater() {
|
||||
throw new UnsupportedOperationException("Unexpected method call on mock");
|
||||
|
|
Loading…
Reference in a new issue