diff --git a/.gitmodules b/.gitmodules index 4c1a9e403..e946dca3c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,3 +34,6 @@ path = extern/safeslinger-exchange url = https://github.com/open-keychain/exchange-android ignore = dirty +[submodule "extern/snackbar"] + path = extern/snackbar + url = https://github.com/open-keychain/snackbar diff --git a/OpenKeychain/build.gradle b/OpenKeychain/build.gradle index 97c8a6d5e..b3ab0b3ef 100644 --- a/OpenKeychain/build.gradle +++ b/OpenKeychain/build.gradle @@ -18,7 +18,6 @@ dependencies { compile 'com.google.zxing:core:3.0.1' compile 'com.jpardogo.materialtabstrip:library:1.0.9' compile 'it.neokree:MaterialNavigationDrawer:1.3.1' - compile 'com.nispok:snackbar:2.9.1' compile 'com.getbase:floatingactionbutton:1.8.0' // libs as submodules @@ -34,6 +33,7 @@ dependencies { compile project(':extern:KeybaseLib:Lib') compile project(':extern:TokenAutoComplete:library') compile project(':extern:safeslinger-exchange') + compile project(':extern:snackbar:lib') } // Output of ./gradlew -q calculateChecksums @@ -50,7 +50,7 @@ dependencyVerification { 'com.google.zxing:core:38c49045765281e4c170062fa3f48e4e988629bf985cab850c7497be5eaa72a1', 'com.jpardogo.materialtabstrip:library:c6ef812fba4f74be7dc4a905faa4c2908cba261a94c13d4f96d5e67e4aad4aaa', 'it.neokree:MaterialNavigationDrawer:1174d751a54689fccf53c1fbcdf439745926ae19024f4f1017afb6b29643c57d', - 'com.nispok:snackbar:59dc092a44c877e9ce5f9040c632d99e62d8932b0a4d67ba0ec9e35467d9047c', + // 'com.nispok:snackbar:59dc092a44c877e9ce5f9040c632d99e62d8932b0a4d67ba0ec9e35467d9047c', 'com.getbase:floatingactionbutton:e63966148212e9685afad2370780ea239b6dbd2a06f6a3f919b98882318e6a32', 'com.android.support:support-annotations:fdee2354787ef66b268e75958de3f7f6c4f8f325510a6dac9f49c929f83a63de', 'com.balysv:material-ripple:587f19c1e27f16c7dc67ff9ac73838aa1451086ef05a15cee38bee3e4e1454ae', diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Notify.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Notify.java index 3121e02ef..7e07ed818 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Notify.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Notify.java @@ -37,7 +37,28 @@ import org.sufficientlysecure.keychain.util.FabContainer; */ public class Notify { - public static enum Style {OK, WARN, ERROR} + public static enum Style { + OK, WARN, ERROR; + + public void applyToBar(Snackbar bar) { + + switch (this) { + case OK: + // bar.actionColorResource(R.color.android_green_light); + bar.lineColorResource(R.color.android_green_light); + break; + case WARN: + // bar.textColorResource(R.color.android_orange_light); + bar.lineColorResource(R.color.android_orange_light); + break; + case ERROR: + // bar.textColorResource(R.color.android_red_light); + bar.lineColorResource(R.color.android_red_light); + break; + } + + } + } public static final int LENGTH_INDEFINITE = 0; public static final int LENGTH_LONG = 3500; @@ -54,19 +75,7 @@ public class Notify { snackbar.duration(duration); } - switch (style) { - case OK: - snackbar.actionColorResource(R.color.android_green_light); - break; - - case WARN: - snackbar.textColorResource(R.color.android_orange_light); - break; - - case ERROR: - snackbar.textColorResource(R.color.android_red_light); - break; - } + style.applyToBar(snackbar); if (actionListener != null) { snackbar.actionLabel(actionResId) diff --git a/extern/snackbar b/extern/snackbar new file mode 160000 index 000000000..025ecadc5 --- /dev/null +++ b/extern/snackbar @@ -0,0 +1 @@ +Subproject commit 025ecadc592e591a96fa081265667efc0b0f0e15 diff --git a/settings.gradle b/settings.gradle index bb7db9f86..e15270e49 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,4 +11,5 @@ include ':extern:minidns' include ':extern:KeybaseLib:Lib' include ':extern:TokenAutoComplete:library' include ':extern:safeslinger-exchange' +include ':extern:snackbar:lib' include ':OpenKeychain-Test'