diff options
37 files changed, 219 insertions, 31 deletions
diff --git a/build.gradle b/build.gradle index 6bd36115..3b765998 100644 --- a/build.gradle +++ b/build.gradle @@ -35,6 +35,7 @@ dependencies { compile 'com.google.zxing:android-integration:3.1.0' compile 'de.measite.minidns:minidns:0.1.3' compile project(':libs:emojicon') + compile project(':libs:colorpicker') } android { diff --git a/libs/colorpicker/.gitignore b/libs/colorpicker/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/libs/colorpicker/.gitignore @@ -0,0 +1 @@ +/build diff --git a/libs/colorpicker/build.gradle b/libs/colorpicker/build.gradle new file mode 100644 index 00000000..1920d0f6 --- /dev/null +++ b/libs/colorpicker/build.gradle @@ -0,0 +1,18 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + minSdkVersion 7 + targetSdkVersion 21 + versionCode 2 + versionName "2.0" + } + buildTypes { + release { + minifyEnabled false + } + } +} diff --git a/libs/colorpicker/proguard-rules.pro b/libs/colorpicker/proguard-rules.pro new file mode 100644 index 00000000..f665b348 --- /dev/null +++ b/libs/colorpicker/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Developer/android-sdk-macosx/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 *; +#} diff --git a/libs/colorpicker/src/main/AndroidManifest.xml b/libs/colorpicker/src/main/AndroidManifest.xml new file mode 100644 index 00000000..e59bd5b5 --- /dev/null +++ b/libs/colorpicker/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest package="yuku.ambilwarna" /> diff --git a/src/main/java/yuku/ambilwarna/AmbilWarnaDialog.java b/libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaDialog.java index e553ed10..5c05e4ec 100644 --- a/src/main/java/yuku/ambilwarna/AmbilWarnaDialog.java +++ b/libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaDialog.java @@ -14,8 +14,6 @@ import android.view.ViewTreeObserver; import android.widget.ImageView; import android.widget.RelativeLayout; -import eu.siacs.conversations.R; - public class AmbilWarnaDialog { public interface OnAmbilWarnaListener { void onCancel(AmbilWarnaDialog dialog); @@ -297,4 +295,4 @@ public class AmbilWarnaDialog { }); viewAlphaOverlay.setBackgroundDrawable(gd); } -}
\ No newline at end of file +} diff --git a/src/main/java/yuku/ambilwarna/AmbilWarnaSquare.java b/libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaSquare.java index 9fb854df..1f0c86e4 100644 --- a/src/main/java/yuku/ambilwarna/AmbilWarnaSquare.java +++ b/libs/colorpicker/src/main/java/yuku/ambilwarna/AmbilWarnaSquare.java @@ -43,4 +43,4 @@ public class AmbilWarnaSquare extends View { color[0] = hue; invalidate(); } -}
\ No newline at end of file +} diff --git a/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPrefWidgetView.java b/libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPrefWidgetView.java index 6da10bb0..7ed4c4e3 100644 --- a/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPrefWidgetView.java +++ b/libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPrefWidgetView.java @@ -31,4 +31,4 @@ public class AmbilWarnaPrefWidgetView extends View { canvas.drawRect(strokeWidth, strokeWidth, rectSize - strokeWidth, rectSize - strokeWidth, paint); } -}
\ No newline at end of file +} diff --git a/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPreference.java b/libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPreference.java index f18ed00c..2c634eb9 100644 --- a/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPreference.java +++ b/libs/colorpicker/src/main/java/yuku/ambilwarna/widget/AmbilWarnaPreference.java @@ -8,8 +8,8 @@ import android.preference.Preference; import android.util.AttributeSet; import android.view.View; -import eu.siacs.conversations.R; import yuku.ambilwarna.AmbilWarnaDialog; +import yuku.ambilwarna.R; public class AmbilWarnaPreference extends Preference { private final boolean supportsAlpha; @@ -131,4 +131,4 @@ public class AmbilWarnaPreference extends Preference { } }; } -}
\ No newline at end of file +} diff --git a/src/main/res/drawable-hdpi/ambilwarna_arrow_down.png b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_down.png Binary files differindex d2aa1b09..d2aa1b09 100644 --- a/src/main/res/drawable-hdpi/ambilwarna_arrow_down.png +++ b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_down.png diff --git a/src/main/res/drawable-hdpi/ambilwarna_arrow_right.png b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_right.png Binary files differindex faf1bd75..faf1bd75 100644 --- a/src/main/res/drawable-hdpi/ambilwarna_arrow_right.png +++ b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_arrow_right.png diff --git a/src/main/res/drawable-hdpi/ambilwarna_cursor.png b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_cursor.png Binary files differindex 28cebc32..28cebc32 100644 --- a/src/main/res/drawable-hdpi/ambilwarna_cursor.png +++ b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_cursor.png diff --git a/src/main/res/drawable-hdpi/ambilwarna_target.png b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_target.png Binary files differindex 6f7bf906..6f7bf906 100644 --- a/src/main/res/drawable-hdpi/ambilwarna_target.png +++ b/libs/colorpicker/src/main/res/drawable-hdpi/ambilwarna_target.png diff --git a/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_down.png b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_down.png Binary files differnew file mode 100644 index 00000000..19d6d4ef --- /dev/null +++ b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_down.png diff --git a/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_right.png b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_right.png Binary files differnew file mode 100644 index 00000000..ace7986b --- /dev/null +++ b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_arrow_right.png diff --git a/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_cursor.png b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_cursor.png Binary files differnew file mode 100644 index 00000000..539eeeb9 --- /dev/null +++ b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_cursor.png diff --git a/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_target.png b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_target.png Binary files differnew file mode 100644 index 00000000..4fdf5977 --- /dev/null +++ b/libs/colorpicker/src/main/res/drawable-ldpi/ambilwarna_target.png diff --git a/src/main/res/drawable-mdpi/ambilwarna_alphacheckered.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_alphacheckered.png Binary files differindex 5ceec214..5ceec214 100644 --- a/src/main/res/drawable-mdpi/ambilwarna_alphacheckered.png +++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_alphacheckered.png diff --git a/src/main/res/drawable-mdpi/ambilwarna_arrow_down.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_down.png Binary files differindex 5f434552..5f434552 100644 --- a/src/main/res/drawable-mdpi/ambilwarna_arrow_down.png +++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_down.png diff --git a/src/main/res/drawable-mdpi/ambilwarna_arrow_right.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_right.png Binary files differindex 23d54619..23d54619 100644 --- a/src/main/res/drawable-mdpi/ambilwarna_arrow_right.png +++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_arrow_right.png diff --git a/src/main/res/drawable-mdpi/ambilwarna_cursor.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_cursor.png Binary files differindex c336e883..c336e883 100644 --- a/src/main/res/drawable-mdpi/ambilwarna_cursor.png +++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_cursor.png diff --git a/src/main/res/drawable-mdpi/ambilwarna_hue.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_hue.png Binary files differindex 09d28397..09d28397 100644 --- a/src/main/res/drawable-mdpi/ambilwarna_hue.png +++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_hue.png diff --git a/src/main/res/drawable-mdpi/ambilwarna_target.png b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_target.png Binary files differindex 56fa0de9..56fa0de9 100644 --- a/src/main/res/drawable-mdpi/ambilwarna_target.png +++ b/libs/colorpicker/src/main/res/drawable-mdpi/ambilwarna_target.png diff --git a/src/main/res/drawable-xhdpi/ambilwarna_arrow_down.png b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_down.png Binary files differindex 592dd7ca..592dd7ca 100644 --- a/src/main/res/drawable-xhdpi/ambilwarna_arrow_down.png +++ b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_down.png diff --git a/src/main/res/drawable-xhdpi/ambilwarna_arrow_right.png b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_right.png Binary files differindex 04f655ad..04f655ad 100644 --- a/src/main/res/drawable-xhdpi/ambilwarna_arrow_right.png +++ b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_arrow_right.png diff --git a/src/main/res/drawable-xhdpi/ambilwarna_cursor.png b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_cursor.png Binary files differindex ddea3167..ddea3167 100644 --- a/src/main/res/drawable-xhdpi/ambilwarna_cursor.png +++ b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_cursor.png diff --git a/src/main/res/drawable-xhdpi/ambilwarna_target.png b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_target.png Binary files differindex bb4b1eb7..bb4b1eb7 100644 --- a/src/main/res/drawable-xhdpi/ambilwarna_target.png +++ b/libs/colorpicker/src/main/res/drawable-xhdpi/ambilwarna_target.png diff --git a/src/main/res/drawable/ambilwarna_alphacheckered_tiled.xml b/libs/colorpicker/src/main/res/drawable/ambilwarna_alphacheckered_tiled.xml index 049f1332..049f1332 100644 --- a/src/main/res/drawable/ambilwarna_alphacheckered_tiled.xml +++ b/libs/colorpicker/src/main/res/drawable/ambilwarna_alphacheckered_tiled.xml diff --git a/libs/colorpicker/src/main/res/layout-land/ambilwarna_dialog.xml b/libs/colorpicker/src/main/res/layout-land/ambilwarna_dialog.xml new file mode 100644 index 00000000..bd4b9089 --- /dev/null +++ b/libs/colorpicker/src/main/res/layout-land/ambilwarna_dialog.xml @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="utf-8"?> + +<RelativeLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/ambilwarna_viewContainer" + android:paddingTop="@dimen/ambilwarna_spacer" + android:paddingRight="@dimen/ambilwarna_spacer" + android:paddingBottom="0dp" + android:paddingLeft="@dimen/ambilwarna_spacer" + android:clipToPadding="false" + android:layout_gravity="center" +> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/ambilwarna_state" + android:orientation="vertical" + android:paddingRight="@dimen/ambilwarna_spacer" + android:gravity="center" + android:layout_centerVertical="true" + > + <FrameLayout + android:layout_width="60dp" + android:layout_height="30dp"> + + <View + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="@drawable/ambilwarna_alphacheckered_tiled" /> + + <View + android:id="@+id/ambilwarna_oldColor" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="#faa" /> + </FrameLayout> + + <ImageView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/ambilwarna_arrow_down" + android:paddingTop="@dimen/ambilwarna_spacer" + android:paddingBottom="@dimen/ambilwarna_spacer" + /> + <FrameLayout + android:layout_width="60dp" + android:layout_height="30dp"> + + <View + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="@drawable/ambilwarna_alphacheckered_tiled" /> + + <View + android:id="@+id/ambilwarna_newColor" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="#aaf" /> + </FrameLayout> + </LinearLayout> + <yuku.ambilwarna.AmbilWarnaSquare + android:id="@+id/ambilwarna_viewSatBri" + android:layout_width="@dimen/ambilwarna_hsvWidth" + android:layout_height="@dimen/ambilwarna_hsvHeight" + android:layout_toRightOf="@id/ambilwarna_state" + android:layerType="software" + /> + <!-- needed because i can't get parent keeping its bottom layout + and its wrap_content height. This view will serve as a bottom spacer. --> + <View + android:layout_width="@dimen/ambilwarna_spacer" + android:layout_height="@dimen/ambilwarna_spacer" + android:layout_below="@id/ambilwarna_viewSatBri" + /> + <ImageView + android:id="@+id/ambilwarna_viewHue" + android:layout_width="@dimen/ambilwarna_hueWidth" + android:layout_height="@dimen/ambilwarna_hsvHeight" + android:layout_toRightOf="@id/ambilwarna_viewSatBri" + android:layout_marginLeft="@dimen/ambilwarna_spacer" + android:src="@drawable/ambilwarna_hue" + android:scaleType="fitXY" + /> + + <ImageView + android:id="@+id/ambilwarna_alphaCheckered" + android:layout_width="@dimen/ambilwarna_hueWidth" + android:layout_height="@dimen/ambilwarna_hsvHeight" + android:layout_marginLeft="@dimen/ambilwarna_spacer" + android:layout_toRightOf="@id/ambilwarna_viewHue" + android:scaleType="fitXY" + android:src="@drawable/ambilwarna_alphacheckered_tiled" /> + + <View + android:id="@+id/ambilwarna_overlay" + android:layout_width="@dimen/ambilwarna_hueWidth" + android:layout_height="@dimen/ambilwarna_hsvHeight" + android:layout_marginLeft="@dimen/ambilwarna_spacer" + android:layout_toRightOf="@id/ambilwarna_viewHue" /> + + <ImageView + android:id="@+id/ambilwarna_cursor" + android:layout_width="9dp" + android:layout_height="9dp" + android:src="@drawable/ambilwarna_cursor" + android:scaleType="matrix" + /> + + <ImageView + android:id="@+id/ambilwarna_alphaCursor" + android:layout_width="9dp" + android:layout_height="9dp" + android:scaleType="matrix" + android:src="@drawable/ambilwarna_cursor" /> + + <ImageView + android:id="@+id/ambilwarna_target" + android:layout_width="15dp" + android:layout_height="15dp" + android:src="@drawable/ambilwarna_target" + android:scaleType="matrix" + /> + + +</RelativeLayout> diff --git a/src/main/res/layout/ambilwarna_dialog.xml b/libs/colorpicker/src/main/res/layout/ambilwarna_dialog.xml index 8a1a403e..8a1a403e 100644 --- a/src/main/res/layout/ambilwarna_dialog.xml +++ b/libs/colorpicker/src/main/res/layout/ambilwarna_dialog.xml diff --git a/libs/colorpicker/src/main/res/layout/ambilwarna_pref_widget.xml b/libs/colorpicker/src/main/res/layout/ambilwarna_pref_widget.xml new file mode 100644 index 00000000..bbab8d95 --- /dev/null +++ b/libs/colorpicker/src/main/res/layout/ambilwarna_pref_widget.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_gravity="center_vertical" + android:layout_marginRight="6dp" + android:focusable="false" + android:clickable="false"> + + <ImageView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:scaleType="fitXY" + android:src="@drawable/ambilwarna_alphacheckered_tiled"/> + + + <yuku.ambilwarna.widget.AmbilWarnaPrefWidgetView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:id="@+id/ambilwarna_pref_widget_box" + /> +</FrameLayout> diff --git a/libs/colorpicker/src/main/res/values-land/dimen.xml b/libs/colorpicker/src/main/res/values-land/dimen.xml new file mode 100644 index 00000000..f1c48326 --- /dev/null +++ b/libs/colorpicker/src/main/res/values-land/dimen.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <dimen name="ambilwarna_hsvWidth">240dp</dimen> + <dimen name="ambilwarna_hsvHeight">120dp</dimen> +</resources>
\ No newline at end of file diff --git a/libs/colorpicker/src/main/res/values-xlarge-land/dimen.xml b/libs/colorpicker/src/main/res/values-xlarge-land/dimen.xml new file mode 100644 index 00000000..1e72cca5 --- /dev/null +++ b/libs/colorpicker/src/main/res/values-xlarge-land/dimen.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <dimen name="ambilwarna_hsvWidth">240dp</dimen> + <dimen name="ambilwarna_hsvHeight">240dp</dimen> +</resources>
\ No newline at end of file diff --git a/libs/colorpicker/src/main/res/values/attrs.xml b/libs/colorpicker/src/main/res/values/attrs.xml new file mode 100644 index 00000000..ee65a5b9 --- /dev/null +++ b/libs/colorpicker/src/main/res/values/attrs.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <declare-styleable name="AmbilWarnaPreference"> + <attr name="supportsAlpha" + format="boolean"/> + </declare-styleable> +</resources> diff --git a/libs/colorpicker/src/main/res/values/dimen.xml b/libs/colorpicker/src/main/res/values/dimen.xml new file mode 100644 index 00000000..92f53a2e --- /dev/null +++ b/libs/colorpicker/src/main/res/values/dimen.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <dimen name="ambilwarna_hsvHeight">240dp</dimen> + <dimen name="ambilwarna_hsvWidth">240dp</dimen> + <dimen name="ambilwarna_hueWidth">30dp</dimen> + <dimen name="ambilwarna_spacer">8dp</dimen> +</resources> diff --git a/settings.gradle b/settings.gradle index ee653b54..7e97c5bd 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -include ':libs:MemorizingTrustManager', ':libs:emojicon' +include ':libs:MemorizingTrustManager', ':libs:emojicon', ':libs:colorpicker' include ':libs:openpgp-api-lib' rootProject.name = 'Conversations' diff --git a/src/main/res/layout/ambilwarna_pref_widget.xml b/src/main/res/layout/ambilwarna_pref_widget.xml deleted file mode 100644 index 2fd69a36..00000000 --- a/src/main/res/layout/ambilwarna_pref_widget.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<FrameLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="24dp" - android:layout_height="24dp" - android:layout_gravity="center_vertical" - android:layout_marginRight="6dp" - android:focusable="false" - android:clickable="false"> - - <ImageView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scaleType="fitXY" - android:src="@drawable/ambilwarna_alphacheckered_tiled"/> - - - <yuku.ambilwarna.widget.AmbilWarnaPrefWidgetView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:id="@+id/ambilwarna_pref_widget_box" - /> -</FrameLayout>
\ No newline at end of file |