externalize zxing lib, fix gradle build
@ -24,6 +24,7 @@ dependencies {
|
||||
compile project(':libraries:ActionBarSherlock')
|
||||
compile project(':libraries:HtmlTextView')
|
||||
compile project(':libraries:StickyListHeaders:library')
|
||||
compile project(':libraries:zxing')
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -12,3 +12,4 @@ target=android-19
|
||||
android.library.reference.1=../libraries/ActionBarSherlock
|
||||
android.library.reference.2=../libraries/HtmlTextView
|
||||
android.library.reference.3=../libraries/StickyListHeaders/library
|
||||
android.library.reference.4=../libraries/zxing
|
||||
|
@ -90,7 +90,7 @@ public class KeyViewActivity extends SherlockFragmentActivity implements CreateN
|
||||
Intent intent = getIntent();
|
||||
mDataUri = intent.getData();
|
||||
if (mDataUri == null) {
|
||||
Log.e(Constants.TAG, "Intent data missing. Should be Uri of app!");
|
||||
Log.e(Constants.TAG, "Intent data missing. Should be Uri of key!");
|
||||
finish();
|
||||
return;
|
||||
} else {
|
||||
|
@ -28,8 +28,9 @@ Android Studio is currently not supported or recommended!
|
||||
1. File -> Import -> Android -> Existing Android Code Into Workspace, choose "libraries/ActionBarSherlock"
|
||||
2. File -> Import -> Android -> Existing Android Code Into Workspace, choose "libraries/HtmlTextView"
|
||||
3. File -> Import -> Android -> Existing Android Code Into Workspace, choose "libraries/StickyListHeaders/library"
|
||||
4. File -> Import -> Android -> Existing Android Code Into Workspace, choose "OpenPGP-Keychain"
|
||||
5. OpenPGP-Kechain can now be build
|
||||
4. File -> Import -> Android -> Existing Android Code Into Workspace, choose "libraries/zxing"
|
||||
5. File -> Import -> Android -> Existing Android Code Into Workspace, choose "OpenPGP-Keychain"
|
||||
6. OpenPGP-Kechain can now be build
|
||||
|
||||
# Keychain API
|
||||
|
||||
|
@ -1,24 +0,0 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.6.+'
|
||||
}
|
||||
}
|
||||
|
||||
def isReleaseBuild() {
|
||||
return version.contains("SNAPSHOT") == false
|
||||
}
|
||||
|
||||
allprojects {
|
||||
version = VERSION_NAME
|
||||
group = GROUP
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'android-reporting'
|
Before Width: | Height: | Size: 280 KiB |
@ -1,6 +0,0 @@
|
||||
#Tue Nov 19 08:36:06 CET 2013
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-all.zip
|
164
libraries/StickyListHeaders/gradlew
vendored
@ -1,164 +0,0 @@
|
||||
#!/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
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# 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\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
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"`
|
||||
|
||||
# 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 "$@"
|
90
libraries/StickyListHeaders/gradlew.bat
vendored
@ -1,90 +0,0 @@
|
||||
@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
|
@ -12,5 +12,3 @@ android {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/eaa6b5404b7594e6c23b884fdc5795f545db55dd/gradle-mvn-push.gradle'
|
||||
|
@ -1,27 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="se.emilsjolander.stickylistheaders"
|
||||
android:versionCode="2"
|
||||
android:versionName="2.0">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="7"
|
||||
android:targetSdkVersion="18" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
|
||||
android:supportsRtl="true">
|
||||
<activity
|
||||
android:name=".TestActivity"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 14 KiB |
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item android:state_pressed="true" android:drawable="@color/header_pressed" />
|
||||
<item android:drawable="@color/header_normal" />
|
||||
|
||||
</selector>
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/header_selector" >
|
||||
|
||||
<se.emilsjolander.stickylistheaders.views.UnderlineTextView
|
||||
android:id="@+id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|left"
|
||||
android:padding="5dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="17sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<TextView android:text="@string/app_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="700dip"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
|
||||
</FrameLayout>
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<TextView android:text="@string/app_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dip"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
|
||||
</FrameLayout>
|
@ -1,114 +0,0 @@
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<se.emilsjolander.stickylistheaders.StickyListHeadersListView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:drawSelectorOnTop="true"
|
||||
android:padding="16dp"
|
||||
android:scrollbarStyle="outsideOverlay"
|
||||
android:fastScrollEnabled="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/empty"
|
||||
android:textSize="30sp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/left_drawer"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:padding="5dp"
|
||||
android:scrollbars="none"
|
||||
android:clickable="true"
|
||||
android:background="@android:color/white">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<se.emilsjolander.stickylistheaders.views.UnderlineTextView
|
||||
style="@style/MenuSectionHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|left"
|
||||
android:text="@string/actions"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/restore_list"
|
||||
android:id="@+id/restore_button"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/update_list"
|
||||
android:id="@+id/update_button"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:id="@+id/clear_button"
|
||||
android:text="@string/clear_list"/>
|
||||
|
||||
<se.emilsjolander.stickylistheaders.views.UnderlineTextView
|
||||
style="@style/MenuSectionHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|left"
|
||||
android:text="@string/options"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/sticky_header"
|
||||
android:id="@+id/sticky_checkBox"
|
||||
android:checked="true"/>
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/fade_header"
|
||||
android:id="@+id/fade_checkBox"
|
||||
android:checked="true"/>
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/draw_behind_header"
|
||||
android:id="@+id/draw_behind_checkBox"
|
||||
android:checked="true"/>
|
||||
|
||||
<CheckBox
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/fast_scroll"
|
||||
android:id="@+id/fast_scroll_checkBox"
|
||||
android:checked="true"/>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</android.support.v4.widget.DrawerLayout>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingBottom="20dp"
|
||||
android:paddingTop="20dp" />
|
@ -1,230 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string-array name="countries">
|
||||
|
||||
<item>Afghanistan</item>
|
||||
<item>Albania</item>
|
||||
<item>Algeria</item>
|
||||
<item>Andorra</item>
|
||||
<item>Angola</item>
|
||||
<item>Antigua & Barbuda</item>
|
||||
<item>Argentina</item>
|
||||
<item>Armenia</item>
|
||||
<item>Australia</item>
|
||||
<item>Austria</item>
|
||||
<item>Azerbaijan</item>
|
||||
|
||||
<item>Bahamas</item>
|
||||
<item>Bahrain</item>
|
||||
<item>Bangladesh</item>
|
||||
<item>Barbados</item>
|
||||
<item>Belarus</item>
|
||||
<item>Belgium</item>
|
||||
<item>Belize</item>
|
||||
<item>Benin</item>
|
||||
<item>Bhutan</item>
|
||||
<item>Bolivia</item>
|
||||
<item>Bosnia and Herzegovina</item>
|
||||
<item>Botswana</item>
|
||||
<item>Brazil</item>
|
||||
<item>Brunei</item>
|
||||
<item>Bulgaria</item>
|
||||
<item>Burkina Faso</item>
|
||||
<item>Burma</item>
|
||||
<item>Burundi</item>
|
||||
|
||||
<item>Cambodia</item>
|
||||
<item>Cameroon</item>
|
||||
<item>Canada</item>
|
||||
<item>Cape Verde</item>
|
||||
<item>Central African Republic</item>
|
||||
<item>Chad</item>
|
||||
<item>Chile</item>
|
||||
<item>China</item>
|
||||
<item>Colombia</item>
|
||||
<item>Comoros</item>
|
||||
<item>Congo, Democratic Republic of the</item>
|
||||
<item>Congo, Republic of the</item>
|
||||
<item>Costa Rica</item>
|
||||
<item>Cote d\'voire</item>
|
||||
<item>Croatia</item>
|
||||
<item>Cuba</item>
|
||||
<item>Cyprus</item>
|
||||
<item>Czech Republic</item>
|
||||
|
||||
<item>Denmark</item>
|
||||
<item>Djibouti</item>
|
||||
<item>Dominica</item>
|
||||
<item>Dominican Republic</item>
|
||||
|
||||
<item>Ecuador</item>
|
||||
<item>Egypt</item>
|
||||
<item>El Salvador</item>
|
||||
<item>Equatorial Guinea</item>
|
||||
<item>Eritrea</item>
|
||||
<item>Estonia</item>
|
||||
<item>Ethiopia</item>
|
||||
|
||||
<item>Fiji</item>
|
||||
<item>Finland</item>
|
||||
<item>France</item>
|
||||
|
||||
<item>Gabon</item>
|
||||
<item>Gambia, The</item>
|
||||
<item>Georgia</item>
|
||||
<item>Ghana</item>
|
||||
<item>Greece</item>
|
||||
<item>Grenada</item>
|
||||
<item>Guatemala</item>
|
||||
<item>Guinea</item>
|
||||
<item>Guinea-Bissau</item>
|
||||
<item>Guyana</item>
|
||||
|
||||
<item>Haiti</item>
|
||||
<item>Holy See</item>
|
||||
<item>Honduras</item>
|
||||
<item>Hong Kong</item>
|
||||
<item>Hungary</item>
|
||||
|
||||
<item>Iceland</item>
|
||||
<item>India</item>
|
||||
<item>Indonesia</item>
|
||||
<item>Iran</item>
|
||||
<item>Iraq</item>
|
||||
<item>Ireland</item>
|
||||
<item>Israel</item>
|
||||
<item>Italy</item>
|
||||
|
||||
<item>Jamaica</item>
|
||||
<item>Japan</item>
|
||||
<item>Jordan</item>
|
||||
|
||||
<item>Kazakhstan</item>
|
||||
<item>Kenya</item>
|
||||
<item>Kiribati</item>
|
||||
<item>Korea, North</item>
|
||||
<item>Korea, South</item>
|
||||
<item>Kosovo</item>
|
||||
<item>Kuwait</item>
|
||||
<item>Kyrgyzstan</item>
|
||||
|
||||
<item>Laos</item>
|
||||
<item>Latvia</item>
|
||||
<item>Lebanon</item>
|
||||
<item>Lesotho</item>
|
||||
<item>Liberia</item>
|
||||
<item>Libya</item>
|
||||
<item>Liechtenstein</item>
|
||||
<item>Lithuania</item>
|
||||
<item>Luxembourg</item>
|
||||
|
||||
<item>Macau</item>
|
||||
<item>Macedonia</item>
|
||||
<item>Madagascar</item>
|
||||
<item>Malawi</item>
|
||||
<item>Malaysia</item>
|
||||
<item>Maldives</item>
|
||||
<item>Mali</item>
|
||||
<item>Malta</item>
|
||||
<item>Marshall Islands</item>
|
||||
<item>Mauritania</item>
|
||||
<item>Mauritius</item>
|
||||
<item>Mexico</item>
|
||||
<item>Micronesia</item>
|
||||
<item>Moldova</item>
|
||||
<item>Monaco</item>
|
||||
<item>Mongolia</item>
|
||||
<item>Montenegro</item>
|
||||
<item>Morocco</item>
|
||||
<item>Mozambique</item>
|
||||
|
||||
<item>Namibia</item>
|
||||
<item>Nauru</item>
|
||||
<item>Nepal</item>
|
||||
<item>Netherlands</item>
|
||||
<item>Netherlands Antilles</item>
|
||||
<item>New Zealand</item>
|
||||
<item>Nicaragua</item>
|
||||
<item>Niger</item>
|
||||
<item>Nigeria</item>
|
||||
<item>North Korea</item>
|
||||
<item>Norway</item>
|
||||
|
||||
<item>Oman</item>
|
||||
|
||||
<item>Pakistan</item>
|
||||
<item>Palau</item>
|
||||
<item>Palestinian Territories</item>
|
||||
<item>Panama</item>
|
||||
<item>Papua New Guinea</item>
|
||||
<item>Paraguay</item>
|
||||
<item>Peru</item>
|
||||
<item>Philippines</item>
|
||||
<item>Poland</item>
|
||||
<item>Portugal</item>
|
||||
|
||||
<item>Qatar</item>
|
||||
|
||||
<item>Romania</item>
|
||||
<item>Russia</item>
|
||||
<item>Rwanda</item>
|
||||
|
||||
<item>Saint Kitts and Nevis</item>
|
||||
<item>Saint Lucia</item>
|
||||
<item>Saint Vincent and the Grenadines</item>
|
||||
<item>Samoa</item>
|
||||
<item>San Marino</item>
|
||||
<item>Sao Tome and Principe</item>
|
||||
<item>Saudi Arabia</item>
|
||||
<item>Senegal</item>
|
||||
<item>Serbia</item>
|
||||
<item>Seychelles</item>
|
||||
<item>Sierra Leone</item>
|
||||
<item>Singapore</item>
|
||||
<item>Slovakia</item>
|
||||
<item>Slovenia</item>
|
||||
<item>Solomon Islands</item>
|
||||
<item>Somalia</item>
|
||||
<item>South Africa</item>
|
||||
<item>South Korea</item>
|
||||
<item>South Sudan</item>
|
||||
<item>Spain</item>
|
||||
<item>Sri Lanka</item>
|
||||
<item>Sudan</item>
|
||||
<item>Suriname</item>
|
||||
<item>Swaziland</item>
|
||||
<item>Sweden</item>
|
||||
<item>Switzerland</item>
|
||||
<item>Syria</item>
|
||||
|
||||
<item>Taiwan</item>
|
||||
<item>Tajikistan</item>
|
||||
<item>Tanzania</item>
|
||||
<item>Thailand </item>
|
||||
<item>Timor-Leste</item>
|
||||
<item>Togo</item>
|
||||
<item>Tonga</item>
|
||||
<item>Trinidad and Tobago</item>
|
||||
<item>Tunisia</item>
|
||||
<item>Turkey</item>
|
||||
<item>Turkmenistan</item>
|
||||
<item>Tuvalu</item>
|
||||
|
||||
<item>Uganda</item>
|
||||
<item>Ukraine</item>
|
||||
<item>United Arab Emirates</item>
|
||||
<item>United Kingdom</item>
|
||||
<item>Uruguay</item>
|
||||
<item>Uzbekistan</item>
|
||||
|
||||
<item>Vanuatu</item>
|
||||
<item>Venezuela</item>
|
||||
<item>Vietnam</item>
|
||||
|
||||
<item>Yemen</item>
|
||||
|
||||
<item>Zambia</item>
|
||||
<item>Zimbabwe</item>
|
||||
</string-array>
|
||||
</resources>
|
@ -1,7 +0,0 @@
|
||||
<resources>
|
||||
|
||||
<color name="header_normal">#ffe74c3c</color>
|
||||
<color name="header_pressed">#ffc0392b</color>
|
||||
<color name="menu_section_header">#FFDDDDDD</color>
|
||||
|
||||
</resources>
|
@ -1,20 +0,0 @@
|
||||
<resources>
|
||||
|
||||
<string name="app_name">StickyListHeaders Sample</string>
|
||||
<string name="restore">Restore</string>
|
||||
<string name="update">Update</string>
|
||||
<string name="clear">Clear</string>
|
||||
<string name="empty">Empty Adapter</string>
|
||||
<string name="drawer_open">Drawer Open</string>
|
||||
<string name="drawer_close">Drawer Close</string>
|
||||
<string name="options">OPTIONS</string>
|
||||
<string name="actions">ACTIONS</string>
|
||||
<string name="restore_list">Restore list</string>
|
||||
<string name="update_list">Update list</string>
|
||||
<string name="clear_list">Clear list</string>
|
||||
<string name="sticky_header">Sticky header</string>
|
||||
<string name="fade_header">Fade header</string>
|
||||
<string name="draw_behind_header">Draw behind header</string>
|
||||
<string name="fast_scroll">Fast scroll</string>
|
||||
|
||||
</resources>
|
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="MenuSectionHeader">
|
||||
<item name="android:padding">5dp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:textColor">@color/menu_section_header</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
</style>
|
||||
</resources>
|
@ -1,169 +0,0 @@
|
||||
package se.emilsjolander.stickylistheaders;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ActionBarDrawerToggle;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.*;
|
||||
|
||||
/**
|
||||
* @author Emil Sjölander
|
||||
*/
|
||||
public class TestActivity extends ActionBarActivity implements
|
||||
AdapterView.OnItemClickListener, StickyListHeadersListView.OnHeaderClickListener,
|
||||
StickyListHeadersListView.OnStickyHeaderOffsetChangedListener {
|
||||
|
||||
private TestBaseAdapter mAdapter;
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ActionBarDrawerToggle mDrawerToggle;
|
||||
private boolean fadeHeader = true;
|
||||
|
||||
private StickyListHeadersListView stickyList;
|
||||
|
||||
private Button restoreButton;
|
||||
private Button updateButton;
|
||||
private Button clearButton;
|
||||
|
||||
private CheckBox stickyCheckBox;
|
||||
private CheckBox fadeCheckBox;
|
||||
private CheckBox drawBehindCheckBox;
|
||||
private CheckBox fastScrollCheckBox;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
mAdapter = new TestBaseAdapter(this);
|
||||
|
||||
stickyList = (StickyListHeadersListView) findViewById(R.id.list);
|
||||
stickyList.setOnItemClickListener(this);
|
||||
stickyList.setOnHeaderClickListener(this);
|
||||
stickyList.setOnStickyHeaderOffsetChangedListener(this);
|
||||
// mStickyList.addHeaderView(inflater.inflate(R.layout.list_header, null));
|
||||
// mStickyList.addFooterView(inflater.inflate(R.layout.list_footer, null));
|
||||
stickyList.setEmptyView(findViewById(R.id.empty));
|
||||
stickyList.setDrawingListUnderStickyHeader(true);
|
||||
stickyList.setAreHeadersSticky(true);
|
||||
stickyList.setAdapter(mAdapter);
|
||||
|
||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
mDrawerToggle = new ActionBarDrawerToggle(
|
||||
this, /* host Activity */
|
||||
mDrawerLayout, /* DrawerLayout object */
|
||||
R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */
|
||||
R.string.drawer_open, /* "open drawer" description */
|
||||
R.string.drawer_close /* "close drawer" description */
|
||||
);
|
||||
|
||||
// Set the drawer toggle as the DrawerListener
|
||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
|
||||
restoreButton = (Button) findViewById(R.id.restore_button);
|
||||
restoreButton.setOnClickListener(buttonListener);
|
||||
updateButton = (Button) findViewById(R.id.update_button);
|
||||
updateButton.setOnClickListener(buttonListener);
|
||||
clearButton = (Button) findViewById(R.id.clear_button);
|
||||
clearButton.setOnClickListener(buttonListener);
|
||||
|
||||
stickyCheckBox = (CheckBox) findViewById(R.id.sticky_checkBox);
|
||||
stickyCheckBox.setOnCheckedChangeListener(checkBoxListener);
|
||||
fadeCheckBox = (CheckBox) findViewById(R.id.fade_checkBox);
|
||||
fadeCheckBox.setOnCheckedChangeListener(checkBoxListener);
|
||||
drawBehindCheckBox = (CheckBox) findViewById(R.id.draw_behind_checkBox);
|
||||
drawBehindCheckBox.setOnCheckedChangeListener(checkBoxListener);
|
||||
fastScrollCheckBox = (CheckBox) findViewById(R.id.fast_scroll_checkBox);
|
||||
fastScrollCheckBox.setOnCheckedChangeListener(checkBoxListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
// Sync the toggle state after onRestoreInstanceState has occurred.
|
||||
mDrawerToggle.syncState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (mDrawerToggle.onOptionsItemSelected(item)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
CompoundButton.OnCheckedChangeListener checkBoxListener = new CompoundButton.OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
switch (buttonView.getId()) {
|
||||
case R.id.sticky_checkBox:
|
||||
stickyList.setAreHeadersSticky(isChecked);
|
||||
break;
|
||||
case R.id.fade_checkBox:
|
||||
fadeHeader = isChecked;
|
||||
break;
|
||||
case R.id.draw_behind_checkBox:
|
||||
stickyList.setDrawingListUnderStickyHeader(isChecked);
|
||||
break;
|
||||
case R.id.fast_scroll_checkBox:
|
||||
stickyList.setFastScrollEnabled(isChecked);
|
||||
stickyList.setFastScrollAlwaysVisible(isChecked);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
View.OnClickListener buttonListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.restore_button:
|
||||
mAdapter.restore();
|
||||
break;
|
||||
case R.id.update_button:
|
||||
mAdapter.notifyDataSetChanged();
|
||||
break;
|
||||
case R.id.clear_button:
|
||||
mAdapter.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position,
|
||||
long id) {
|
||||
Toast.makeText(this, "Item " + position + " clicked!",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHeaderClick(StickyListHeadersListView l, View header,
|
||||
int itemPosition, long headerId, boolean currentlySticky) {
|
||||
Toast.makeText(this, "Header " + headerId + " currentlySticky ? " + currentlySticky,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public void onStickyHeaderOffsetChanged(StickyListHeadersListView l, View header, int offset) {
|
||||
if (fadeHeader && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
header.setAlpha(1 - (offset / (float) header.getMeasuredHeight()));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,169 +0,0 @@
|
||||
package se.emilsjolander.stickylistheaders;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.SectionIndexer;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* @author Emil Sjölander
|
||||
*/
|
||||
public class TestBaseAdapter extends BaseAdapter implements
|
||||
StickyListHeadersAdapter, SectionIndexer {
|
||||
|
||||
private final Context mContext;
|
||||
private String[] mCountries;
|
||||
private int[] mSectionIndices;
|
||||
private Character[] mSectionLetters;
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
public TestBaseAdapter(Context context) {
|
||||
mContext = context;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mCountries = context.getResources().getStringArray(R.array.countries);
|
||||
mSectionIndices = getSectionIndices();
|
||||
mSectionLetters = getSectionLetters();
|
||||
}
|
||||
|
||||
private int[] getSectionIndices() {
|
||||
ArrayList<Integer> sectionIndices = new ArrayList<Integer>();
|
||||
char lastFirstChar = mCountries[0].charAt(0);
|
||||
sectionIndices.add(0);
|
||||
for (int i = 1; i < mCountries.length; i++) {
|
||||
if (mCountries[i].charAt(0) != lastFirstChar) {
|
||||
lastFirstChar = mCountries[i].charAt(0);
|
||||
sectionIndices.add(i);
|
||||
}
|
||||
}
|
||||
int[] sections = new int[sectionIndices.size()];
|
||||
for (int i = 0; i < sectionIndices.size(); i++) {
|
||||
sections[i] = sectionIndices.get(i);
|
||||
}
|
||||
return sections;
|
||||
}
|
||||
|
||||
private Character[] getSectionLetters() {
|
||||
Character[] letters = new Character[mSectionIndices.length];
|
||||
for (int i = 0; i < mSectionIndices.length; i++) {
|
||||
letters[i] = mCountries[mSectionIndices[i]].charAt(0);
|
||||
}
|
||||
return letters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mCountries.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return mCountries[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder holder;
|
||||
|
||||
if (convertView == null) {
|
||||
holder = new ViewHolder();
|
||||
convertView = mInflater.inflate(R.layout.test_list_item_layout, parent, false);
|
||||
holder.text = (TextView) convertView.findViewById(R.id.text);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
holder.text.setText(mCountries[position]);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getHeaderView(int position, View convertView, ViewGroup parent) {
|
||||
HeaderViewHolder holder;
|
||||
|
||||
if (convertView == null) {
|
||||
holder = new HeaderViewHolder();
|
||||
convertView = mInflater.inflate(R.layout.header, parent, false);
|
||||
holder.text = (TextView) convertView.findViewById(R.id.text1);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (HeaderViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
// set header text as first char in name
|
||||
CharSequence headerChar = mCountries[position].subSequence(0, 1);
|
||||
holder.text.setText(headerChar);
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remember that these have to be static, postion=1 should always return
|
||||
* the same Id that is.
|
||||
*/
|
||||
@Override
|
||||
public long getHeaderId(int position) {
|
||||
// return the first character of the country as ID because this is what
|
||||
// headers are based upon
|
||||
return mCountries[position].subSequence(0, 1).charAt(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPositionForSection(int section) {
|
||||
if (section >= mSectionIndices.length) {
|
||||
section = mSectionIndices.length - 1;
|
||||
} else if (section < 0) {
|
||||
section = 0;
|
||||
}
|
||||
return mSectionIndices[section];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSectionForPosition(int position) {
|
||||
for (int i = 0; i < mSectionIndices.length; i++) {
|
||||
if (position < mSectionIndices[i]) {
|
||||
return i - 1;
|
||||
}
|
||||
}
|
||||
return mSectionIndices.length - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getSections() {
|
||||
return mSectionLetters;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
mCountries = new String[0];
|
||||
mSectionIndices = new int[0];
|
||||
mSectionLetters = new Character[0];
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void restore() {
|
||||
mCountries = mContext.getResources().getStringArray(R.array.countries);
|
||||
mSectionIndices = getSectionIndices();
|
||||
mSectionLetters = getSectionLetters();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
class HeaderViewHolder {
|
||||
TextView text;
|
||||
}
|
||||
|
||||
class ViewHolder {
|
||||
TextView text;
|
||||
}
|
||||
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package se.emilsjolander.stickylistheaders.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* @author Eric Frohnhoefer
|
||||
*/
|
||||
public class UnderlineTextView extends TextView {
|
||||
private final Paint mPaint = new Paint();
|
||||
private int mUnderlineHeight = 0;
|
||||
|
||||
public UnderlineTextView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public UnderlineTextView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public UnderlineTextView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
private void init(Context context, AttributeSet attrs) {
|
||||
Resources r = getResources();
|
||||
mUnderlineHeight = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, r.getDisplayMetrics());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPadding(int left, int top, int right, int bottom) {
|
||||
super.setPadding(left, top, right, bottom + mUnderlineHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
|
||||
// Draw the underline the same color as the text
|
||||
mPaint.setColor(getTextColors().getDefaultColor());
|
||||
canvas.drawRect(0, getHeight() - mUnderlineHeight, getWidth(), getHeight(), mPaint);
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
include 'library'
|
||||
include 'sample'
|
11
libraries/zxing/AndroidManifest.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.google.zxing"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
android:targetSdkVersion="19" />
|
||||
|
||||
</manifest>
|
@ -1,13 +1,4 @@
|
||||
apply plugin: 'android'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
compile project(':library')
|
||||
compile 'com.android.support:appcompat-v7:19.0.+'
|
||||
compile 'com.android.support:support-v4:19.0.0'
|
||||
}
|
||||
apply plugin: 'android-library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 19
|
@ -12,4 +12,4 @@
|
||||
|
||||
# Project target.
|
||||
target=android-19
|
||||
android.library.reference.1=../library
|
||||
android.library=true
|