Repository: matrixxun/MaterialBadgeTextView
Branch: master
Commit: c5a27e8243e9
Files: 41
Total size: 53.8 KB
Directory structure:
gitextract_gblrfzec/
├── .gitattributes
├── .gitignore
├── MaterialBadgeTextView/
│ ├── .gitignore
│ ├── apk/
│ │ └── app-debug.apk
│ ├── app/
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src/
│ │ ├── androidTest/
│ │ │ └── java/
│ │ │ └── sample/
│ │ │ └── badgeview/
│ │ │ └── starry/
│ │ │ └── matrixxun/
│ │ │ └── com/
│ │ │ └── materialbadgetextview/
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java/
│ │ │ │ └── sample/
│ │ │ │ └── badgeview/
│ │ │ │ └── starry/
│ │ │ │ └── matrixxun/
│ │ │ │ └── com/
│ │ │ │ └── materialbadgetextview/
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── MainActivityFragment.java
│ │ │ └── res/
│ │ │ ├── layout/
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── content_main.xml
│ │ │ │ └── fragment_main.xml
│ │ │ ├── menu/
│ │ │ │ └── menu_main.xml
│ │ │ ├── values/
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ ├── values-v21/
│ │ │ │ └── styles.xml
│ │ │ └── values-w820dp/
│ │ │ └── dimens.xml
│ │ └── test/
│ │ └── java/
│ │ └── sample/
│ │ └── badgeview/
│ │ └── starry/
│ │ └── matrixxun/
│ │ └── com/
│ │ └── materialbadgetextview/
│ │ └── ExampleUnitTest.java
│ ├── build.gradle
│ ├── gradle/
│ │ └── wrapper/
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradle.properties
│ ├── gradlew
│ ├── gradlew.bat
│ ├── library/
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src/
│ │ ├── androidTest/
│ │ │ └── java/
│ │ │ └── com/
│ │ │ └── matrixxun/
│ │ │ └── starry/
│ │ │ └── badgetextview/
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main/
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── java/
│ │ │ │ └── com/
│ │ │ │ └── matrixxun/
│ │ │ │ └── starry/
│ │ │ │ └── badgetextview/
│ │ │ │ ├── MaterialBadgeTextView.java
│ │ │ │ └── MenuItemBadge.java
│ │ │ └── res/
│ │ │ ├── layout/
│ │ │ │ └── menu_action_item_badge.xml
│ │ │ └── values/
│ │ │ ├── attrs.xml
│ │ │ └── strings.xml
│ │ └── test/
│ │ └── java/
│ │ └── com/
│ │ └── matrixxun/
│ │ └── starry/
│ │ └── badgetextview/
│ │ └── ExampleUnitTest.java
│ └── settings.gradle
└── README.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitattributes
================================================
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
================================================
FILE: .gitignore
================================================
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
*.pubxml
*.publishproj
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
#############
## Windows detritus
#############
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac crap
.DS_Store
#############
## Python
#############
*.py[cod]
# Packages
*.egg
*.egg-info
dist/
build/
eggs/
parts/
var/
sdist/
develop-eggs/
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg
================================================
FILE: MaterialBadgeTextView/.gitignore
================================================
*.iml
.gradle
/local.properties
/**/.idea
.DS_Store
/build
/captures
.externalNativeBuild
================================================
FILE: MaterialBadgeTextView/app/.gitignore
================================================
/build
================================================
FILE: MaterialBadgeTextView/app/build.gradle
================================================
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "sample.badgeview.starry.matrixxun.com.materialbadgetextview"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile project(':library')
testCompile 'junit:junit:4.12'
}
================================================
FILE: MaterialBadgeTextView/app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\000_Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: MaterialBadgeTextView/app/src/androidTest/java/sample/badgeview/starry/matrixxun/com/materialbadgetextview/ExampleInstrumentedTest.java
================================================
package sample.badgeview.starry.matrixxun.com.materialbadgetextview;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see Testing documentation
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("sample.badgeview.starry.matrixxun.com.materialbadgetextview", appContext.getPackageName());
}
}
================================================
FILE: MaterialBadgeTextView/app/src/main/AndroidManifest.xml
================================================
================================================
FILE: MaterialBadgeTextView/app/src/main/java/sample/badgeview/starry/matrixxun/com/materialbadgetextview/MainActivity.java
================================================
package sample.badgeview.starry.matrixxun.com.materialbadgetextview;
import android.graphics.Color;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import com.matrixxun.starry.badgetextview.MenuItemBadge;
public class MainActivity extends AppCompatActivity {
private boolean showRedIcon = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
MenuItem menuItemNewFeature = menu.findItem(R.id.menu_new_feature);
MenuItemBadge.update(this, menuItemNewFeature, new MenuItemBadge.Builder()
.iconDrawable(ContextCompat.getDrawable(this, R.drawable.ic_account_my_order_md))
.iconTintColor(Color.WHITE)
.textBackgroundColor(Color.parseColor("#EF4738"))
.textColor(Color.WHITE));
MenuItem menuItemNotification = menu.findItem(R.id.menu_notification);
MenuItemBadge.update(this, menuItemNotification, new MenuItemBadge.Builder()
.iconDrawable(ContextCompat.getDrawable(this, R.drawable.ic_notification_md))
.iconTintColor(Color.WHITE)
.textBackgroundColor(Color.parseColor("#36B100"))
.textColor(Color.WHITE));
MenuItemBadge.getBadgeTextView(menuItemNotification).setBadgeCount("5");
MenuItem menuItemMessage = menu.findItem(R.id.menu_message);
MenuItemBadge.update(this, menuItemMessage, new MenuItemBadge.Builder()
.iconDrawable(ContextCompat.getDrawable(this, R.drawable.ic_email_md))
.iconTintColor(Color.WHITE)
.textBackgroundColor(Color.parseColor("#EF4738"))
.textColor(Color.WHITE));
MenuItemBadge.getBadgeTextView(menuItemMessage).setBadgeCount(999);
MenuItem menuItemShopCart = menu.findItem(R.id.menu_shopcart);
MenuItemBadge.update(this, menuItemShopCart, new MenuItemBadge.Builder()
.iconDrawable(ContextCompat.getDrawable(this, R.drawable.ic_shopping_cart_md))
.iconTintColor(Color.WHITE)
.textBackgroundColor(Color.parseColor("#FB8C00"))
.textColor(Color.WHITE));
MenuItemBadge.getBadgeTextView(menuItemShopCart).setText("New");
return true;
}
private void toggleRedIconInNewFeatureMenu(MenuItem menuItemNewFeature) {
showRedIcon = !showRedIcon;
if (showRedIcon) {
MenuItemBadge.getBadgeTextView(menuItemNewFeature).setHighLightMode(true);
} else {
MenuItemBadge.getBadgeTextView(menuItemNewFeature).clearHighLightMode();
}
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem menuItemNewFeature = menu.findItem(R.id.menu_new_feature);
toggleRedIconInNewFeatureMenu(menuItemNewFeature);
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
} else if (id == R.id.menu_message) {
Toast.makeText(this, "Click Message Menu!", Toast.LENGTH_LONG).show();
return true;
} else if (id == R.id.menu_shopcart) {
Toast.makeText(this, "Click ShopCart Menu!", Toast.LENGTH_LONG).show();
return true;
} else if (id == R.id.menu_new_feature) {
Toast.makeText(this, "Toggle Red Icon in New Feature Menu!", Toast.LENGTH_LONG).show();
//noinspection RestrictedApi
invalidateOptionsMenu();
return true;
}
return super.onOptionsItemSelected(item);
}
}
================================================
FILE: MaterialBadgeTextView/app/src/main/java/sample/badgeview/starry/matrixxun/com/materialbadgetextview/MainActivityFragment.java
================================================
package sample.badgeview.starry.matrixxun.com.materialbadgetextview;
import android.graphics.Color;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.matrixxun.starry.badgetextview.MaterialBadgeTextView;
/**
* A placeholder fragment containing a simple view.
*/
public class MainActivityFragment extends Fragment {
private MaterialBadgeTextView just_new_feature;
public MainActivityFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_main, container, false);
just_new_feature = (MaterialBadgeTextView)view.findViewById(R.id.just_new_feature);
just_new_feature.setHighLightMode();
TextView test_text = (MaterialBadgeTextView)view.findViewById(R.id.test_text);
test_text.setBackgroundColor(Color.parseColor("#987aef"));
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
}
================================================
FILE: MaterialBadgeTextView/app/src/main/res/layout/activity_main.xml
================================================
================================================
FILE: MaterialBadgeTextView/app/src/main/res/layout/content_main.xml
================================================
================================================
FILE: MaterialBadgeTextView/app/src/main/res/layout/fragment_main.xml
================================================
================================================
FILE: MaterialBadgeTextView/app/src/main/res/menu/menu_main.xml
================================================
================================================
FILE: MaterialBadgeTextView/app/src/main/res/values/colors.xml
================================================
#3F51B5
#303F9F
#FF4081
================================================
FILE: MaterialBadgeTextView/app/src/main/res/values/dimens.xml
================================================
16dp
16dp
16dp
================================================
FILE: MaterialBadgeTextView/app/src/main/res/values/strings.xml
================================================
MaterialBadgeTextView
Settings
New Feature
Notification
Message
Shop Cart
================================================
FILE: MaterialBadgeTextView/app/src/main/res/values/styles.xml
================================================
================================================
FILE: MaterialBadgeTextView/app/src/main/res/values-v21/styles.xml
================================================
================================================
FILE: MaterialBadgeTextView/app/src/main/res/values-w820dp/dimens.xml
================================================
64dp
================================================
FILE: MaterialBadgeTextView/app/src/test/java/sample/badgeview/starry/matrixxun/com/materialbadgetextview/ExampleUnitTest.java
================================================
package sample.badgeview.starry.matrixxun.com.materialbadgetextview;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see Testing documentation
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
================================================
FILE: MaterialBadgeTextView/build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: MaterialBadgeTextView/gradle/wrapper/gradle-wrapper.properties
================================================
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
================================================
FILE: MaterialBadgeTextView/gradle.properties
================================================
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
================================================
FILE: MaterialBadgeTextView/gradlew
================================================
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
================================================
FILE: MaterialBadgeTextView/gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: MaterialBadgeTextView/library/.gitignore
================================================
/build
================================================
FILE: MaterialBadgeTextView/library/build.gradle
================================================
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.0'
testCompile 'junit:junit:4.12'
}
================================================
FILE: MaterialBadgeTextView/library/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\000_Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: MaterialBadgeTextView/library/src/androidTest/java/com/matrixxun/starry/badgetextview/ExampleInstrumentedTest.java
================================================
package com.matrixxun.starry.badgetextview;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see Testing documentation
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.matrixxun.starry.badgetextview.test", appContext.getPackageName());
}
}
================================================
FILE: MaterialBadgeTextView/library/src/main/AndroidManifest.xml
================================================
================================================
FILE: MaterialBadgeTextView/library/src/main/java/com/matrixxun/starry/badgetextview/MaterialBadgeTextView.java
================================================
package com.matrixxun.starry.badgetextview;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.RadialGradient;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.os.Build;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
/**
* Created by matrixxun on 2016/8/30.
*/
public class MaterialBadgeTextView extends TextView {
private static final int DEFAULT_FILL_TYPE = 0;
private int backgroundColor;
private int borderColor;
private float borderWidth;
private float borderAlpha;
private int ctType;
private static final float SHADOW_RADIUS = 3.5f;
private static final int FILL_SHADOW_COLOR = 0x55000000;
private static final int KEY_SHADOW_COLOR = 0x55000000;
private static final float X_OFFSET = 0f;
private static final float Y_OFFSET = 1.75f;
private float density;
private int mShadowRadius;
private int shadowYOffset;
private int shadowXOffset;
private int basePadding;
private int diffWH;
private boolean isHighLightMode;
public MaterialBadgeTextView(final Context context) {
this(context, null);
}
public MaterialBadgeTextView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public MaterialBadgeTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
setGravity(Gravity.CENTER);
density = getContext().getResources().getDisplayMetrics().density;
mShadowRadius = (int) (density * SHADOW_RADIUS);
shadowYOffset = (int) (density * Y_OFFSET);
shadowXOffset = (int) (density * X_OFFSET);
basePadding = (mShadowRadius * 2);
float textHeight = getTextSize();
float textWidth = textHeight / 4;
diffWH = (int) (Math.abs(textHeight - textWidth) / 2);
int horizontalPadding = basePadding + diffWH;
setPadding(horizontalPadding, basePadding, horizontalPadding, basePadding);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MaterialBadgeTextView);
backgroundColor = typedArray.getColor(R.styleable.MaterialBadgeTextView_android_background, Color.WHITE);
borderColor = typedArray.getColor(R.styleable.MaterialBadgeTextView_mbtv_border_color, Color.TRANSPARENT);
borderWidth = typedArray.getDimension(R.styleable.MaterialBadgeTextView_mbtv_border_width, 0);
borderAlpha = typedArray.getFloat(R.styleable.MaterialBadgeTextView_mbtv_border_alpha, 1);
ctType = typedArray.getInt(R.styleable.MaterialBadgeTextView_mbtv_type, DEFAULT_FILL_TYPE);
typedArray.recycle();
}
@Override
protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
super.onTextChanged(text, start, lengthBefore, lengthAfter);
/** 纯色小红点模式下若有文本需要从无变为有, 要归位view的大小.*/
String strText = text==null?"":text.toString().trim();
if(isHighLightMode && !"".equals(strText)){
ViewGroup.LayoutParams lp = getLayoutParams();
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
setLayoutParams(lp);
isHighLightMode = false;
}
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
refreshBackgroundDrawable(w, h);
}
private void refreshBackgroundDrawable(int targetWidth, int targetHeight) {
if (targetWidth <= 0 || targetHeight <= 0) {
return;
}
CharSequence text = getText();
if (text == null) {
return;
}
if (text.length() == 1) {/**第一种背景是一个正圆形, 当文本为个位数字时 */
int max = Math.max(targetWidth, targetHeight);
ShapeDrawable circle;
final int diameter = max - (2 * mShadowRadius);
OvalShape oval = new OvalShadow(mShadowRadius, diameter);
circle = new ShapeDrawable(oval);
ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, circle.getPaint());
circle.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR);
circle.getPaint().setColor(backgroundColor);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN) {
setBackgroundDrawable(circle);
} else {
setBackground(circle);
}
} else if (text.length() > 1) {/**第二种背景是上下两边为直线的椭圆, 当文本长度大于1时 */
SemiCircleRectDrawable sr = new SemiCircleRectDrawable();
ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, sr.getPaint());
sr.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR);
sr.getPaint().setColor(backgroundColor);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
setBackground(sr);
} else {
setBackgroundDrawable(sr);
}
} else {
/** 第三种情况就是text="", 即文本长度为0, 因为无任何文本, 则对当前的TextView背景不做任何更新,
* 但是有时候我们需要一个无字的纯色小圆形,用来表达强调.这种情况因为要重新设置View的大小, 所以不在这里表现, 请使用另外一个方法setHighLightMode()来完成.
*/
}
}
public void setBadgeCount(String count){
setBadgeCount(count, false);
}
public void setBadgeCount(String count, boolean goneWhenZero) {
int temp = -1;
try {
temp = Integer.parseInt(count);
} catch (Exception e) {
}
if (temp != -1) {
setBadgeCount(temp, goneWhenZero);
}
}
public void setBadgeCount(int count){
setBadgeCount(count, true);
}
public void setBadgeCount(int count, boolean goneWhenZero){
if(count >0 && count <= 99){
setText(String.valueOf(count));
setVisibility(View.VISIBLE);
}else if(count >99){
setText("99+");
setVisibility(View.VISIBLE);
}else if(count <= 0){
setText("0");
if(goneWhenZero){
setVisibility(View.GONE);
}else{
setVisibility(View.VISIBLE);
}
}
}
/**
* 明确的展现一个无任何文本的红色圆点,
* 主要是通过设置文本setText("")触发onTextChanged(), 再连锁触发onSizeChanged()最后更新了背景.
*/
public void setHighLightMode(){
setHighLightMode(false);
}
public void clearHighLightMode(){
isHighLightMode = false;
setBadgeCount(0);
}
/**
*
* @param isDisplayInToolbarMenu
*/
public void setHighLightMode(boolean isDisplayInToolbarMenu){
isHighLightMode = true;
ViewGroup.LayoutParams params = getLayoutParams();
params.width = dp2px(getContext(), 8);
params.height = params.width;
if(isDisplayInToolbarMenu && params instanceof FrameLayout.LayoutParams){
((FrameLayout.LayoutParams)params).topMargin=dp2px(getContext(), 8);
((FrameLayout.LayoutParams)params).rightMargin=dp2px(getContext(), 8);
}
setLayoutParams(params);
ShapeDrawable drawable = new ShapeDrawable(new OvalShape());
ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, drawable.getPaint());
drawable.getPaint().setColor(backgroundColor);
drawable.getPaint().setAntiAlias(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
setBackground(drawable);
} else {
setBackgroundDrawable(drawable);
}
setText("");
setVisibility(View.VISIBLE);
}
public void setBackgroundColor(int color){
backgroundColor = color;
refreshBackgroundDrawable(getWidth(), getHeight());
}
private class OvalShadow extends OvalShape {
private RadialGradient mRadialGradient;
private Paint mShadowPaint;
private int mCircleDiameter;
public OvalShadow(int shadowRadius, int circleDiameter) {
super();
mShadowPaint = new Paint();
mShadowRadius = shadowRadius;
mCircleDiameter = circleDiameter;
mRadialGradient = new RadialGradient(mCircleDiameter / 2, mCircleDiameter / 2,
mShadowRadius, new int[]{
FILL_SHADOW_COLOR, Color.TRANSPARENT
}, null, Shader.TileMode.CLAMP);
mShadowPaint.setShader(mRadialGradient);
}
@Override
public void draw(Canvas canvas, Paint paint) {
final int viewWidth = MaterialBadgeTextView.this.getWidth();
final int viewHeight = MaterialBadgeTextView.this.getHeight();
canvas.drawCircle(viewWidth / 2, viewHeight / 2, (mCircleDiameter / 2 + mShadowRadius), mShadowPaint);
canvas.drawCircle(viewWidth / 2, viewHeight / 2, (mCircleDiameter / 2), paint);
}
}
class SemiCircleRectDrawable extends Drawable {
private final Paint mPaint;
private RectF rectF;
public Paint getPaint() {
return mPaint;
}
public SemiCircleRectDrawable() {
mPaint = new Paint();
mPaint.setAntiAlias(true);
}
@Override
public void setBounds(int left, int top, int right, int bottom) {
super.setBounds(left, top, right, bottom);
if (rectF == null) {
rectF = new RectF(left + diffWH, top + mShadowRadius+4, right - diffWH, bottom - mShadowRadius-4);
} else {
rectF.set(left + diffWH, top + mShadowRadius+4, right - diffWH, bottom - mShadowRadius-4);
}
}
@Override
public void draw(Canvas canvas) {
float R = (float)(rectF.bottom * 0.4);
if (rectF.right < rectF.bottom) {
R = (float)(rectF.right * 0.4);
}
canvas.drawRoundRect(rectF, R, R, mPaint);
}
@Override
public void setAlpha(int alpha) {
mPaint.setAlpha(alpha);
}
@Override
public void setColorFilter(ColorFilter colorFilter) {
mPaint.setColorFilter(colorFilter);
}
@Override
public int getOpacity() {
return PixelFormat.TRANSPARENT;
}
}
public static int dp2px(Context context, float dpValue) {
try {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
} catch (Exception e) {
return (int) (dpValue + 0.5f);
}
}
}
================================================
FILE: MaterialBadgeTextView/library/src/main/java/com/matrixxun/starry/badgetextview/MenuItemBadge.java
================================================
package com.matrixxun.starry.badgetextview;
import android.app.Activity;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.view.Display;
import android.view.Gravity;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
import static android.util.TypedValue.applyDimension;
/**
* @author donghua.xdh
*/
public class MenuItemBadge {
public static class Builder{
public int textBackgroundColor; // TRANSPARENT = 0;
public int textColor; // TRANSPARENT = 0;
public int iconTintColor; // TRANSPARENT = 0;
private Drawable iconDrawable;
public Builder(){
}
public Builder textBackgroundColor(int textBackgroundColor){
this.textBackgroundColor = textBackgroundColor;
return this;
}
public Builder textColor(int textColor){
this.textColor = textColor;
return this;
}
public Builder iconTintColor(int iconTintColor){
this.iconTintColor = iconTintColor;
return this;
}
public Builder iconDrawable(Drawable iconDrawable){
this.iconDrawable = iconDrawable;
return this;
}
}
// public static void update(final MenuItem menu, int badgeCount) {
// update(null,menu, null, String.valueOf(formatNumber(badgeCount,true)));
// }
public static void update(final Activity activity, final MenuItem menu, MenuItemBadge.Builder builder) {
update(activity, menu, builder, null);
}
public static void update(final Activity activity, final MenuItem menu, MenuItemBadge.Builder builder, final ActionItemBadgeListener listener) {
if (menu == null) return;
FrameLayout badge;
MaterialBadgeTextView badgeTextView;
ImageView imageView;
badge = (FrameLayout) menu.getActionView();
badgeTextView = (MaterialBadgeTextView) badge.findViewById(R.id.menu_badge);
imageView = (ImageView) badge.findViewById(R.id.menu_badge_icon);
//Display icon in ImageView
if(imageView != null && builder != null){
if (builder.iconDrawable !=null) {
imageView.setImageDrawable(builder.iconDrawable);
}
if ( builder.iconTintColor != Color.TRANSPARENT) {
imageView.setColorFilter(builder.iconTintColor);
}
}
if (badgeTextView != null && builder != null && builder.textBackgroundColor != Color.TRANSPARENT) {
badgeTextView.setBackgroundColor(builder.textBackgroundColor);
}
if (badgeTextView != null && builder != null && builder.textColor != Color.TRANSPARENT) {
badgeTextView.setTextColor(builder.textColor);
}
//Bind onOptionsItemSelected to the activity
if (activity != null) {
badge.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean consumed = false;
if (listener != null) {
consumed = listener.onOptionsItemSelected(menu);
}
if (!consumed) {
activity.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, menu);
}
}
});
badge.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Display display = activity.getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
Toast toast = Toast.makeText(activity, menu.getTitle(), Toast.LENGTH_SHORT);
toast.setGravity(Gravity.TOP, width / 5, convertDpToPx(activity, 48));
toast.show();
return true;
}
});
}
menu.setVisible(true);
}
public static MaterialBadgeTextView getBadgeTextView(MenuItem menu) {
if (menu == null) {
return null;
}
FrameLayout badge = (FrameLayout) menu.getActionView();
MaterialBadgeTextView badgeView = (MaterialBadgeTextView) badge.findViewById(R.id.menu_badge);
return badgeView;
}
/**
* hide the given menu item
*
* @param menu
*/
public static void hide(MenuItem menu) {
menu.setVisible(false);
}
public interface ActionItemBadgeListener {
boolean onOptionsItemSelected(MenuItem menu);
}
public static int convertDpToPx(Context context, float dp) {
return (int) applyDimension(COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics());
}
public static void setBackgroundCompat(View v, Drawable d) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
v.setBackgroundDrawable(d);
} else {
v.setBackground(d);
}
}
public static String formatNumber(int value,boolean limitLength) {
if (value < 0) {
return "-" + formatNumber(-value, limitLength);
} else if (value < 100) {
return Long.toString(value);
} else {
return "99+";
}
}
}
================================================
FILE: MaterialBadgeTextView/library/src/main/res/layout/menu_action_item_badge.xml
================================================
================================================
FILE: MaterialBadgeTextView/library/src/main/res/values/attrs.xml
================================================
================================================
FILE: MaterialBadgeTextView/library/src/main/res/values/strings.xml
================================================
MaterialBadgeTextViewLibrary
================================================
FILE: MaterialBadgeTextView/library/src/test/java/com/matrixxun/starry/badgetextview/ExampleUnitTest.java
================================================
package com.matrixxun.starry.badgetextview;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see Testing documentation
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
================================================
FILE: MaterialBadgeTextView/settings.gradle
================================================
include ':app', ':library'
================================================
FILE: README.md
================================================
[]()
# MaterialBadgeTextView
As the name describes, This "MaterialBadgeTextView" is an Android library that provides a reformed textview for Badge. A Badge is a colored circle with an inserted number which are displayed at the top-right conner of the icons, it often plays a role of showing new messages or new features in IM apps such as **Facebook Messager, WhatsApp, WeChat**, and forth.
## Features
1. Material Design style - it provides a default shadow like FAB(Floating Action Bar)
2. Easy to use - you can just use it as a normal TextView
3. Really Lite - only ONE java class, no resource file
4. Support MenuAction in Toolbar
If you use mac OS X, you must have seen this image:
## Demo Screen Capture
## Usage
| Code | Badge |
| :----- | :------ |
| **`setBadgeCount(0,true)`** | the TextView is blank |
| **`setBadgeCount(0,false)`** |  |
| **`setBadgeCount(3)`** |  |
| **`setBadgeCount(68)`** |  |
| **`setBadgeCount(101)`** |  |
| **`setBadgeCount(99999)`** |  |
| **`setHighLightMode()`** |  |
| **`setText("")`** | the TextView is blank |
| **`setText("Hello World!")`** |  |
| **`setText("10999999976")`** |  |
## Compat
API level 9+ supported
## Example
See example code here on Github. You can also see it live downloading [this apk](https://raw.githubusercontent.com/matrixxun/MaterialBadgeTextView/master/MaterialBadgeTextView/apk/app-debug.apk)
License
--------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.