use top line in snackbar for status indication

This commit is contained in:
Vincent Breitmoser 2015-03-22 16:55:46 +01:00
parent c7efaacc9d
commit 8b4388e1a2
5 changed files with 30 additions and 16 deletions

3
.gitmodules vendored
View File

@ -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

View File

@ -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',

View File

@ -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)

1
extern/snackbar vendored Submodule

@ -0,0 +1 @@
Subproject commit 025ecadc592e591a96fa081265667efc0b0f0e15

View File

@ -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'