4
4
import android .app .NotificationManager ;
5
5
import android .app .PendingIntent ;
6
6
import android .content .Intent ;
7
+ import android .graphics .Color ;
7
8
import android .os .Bundle ;
8
9
import android .support .v7 .app .AppCompatActivity ;
9
10
import android .support .v7 .app .NotificationCompat ;
10
- import android .util .Log ;
11
+ import android .widget .Button ;
12
+ import android .widget .TextView ;
11
13
12
14
import no .agens .androidtweakslibrary .activities .TweakStoreActivity ;
13
15
import no .agens .androidtweakslibrary .interfaces .TweaksBindingBoolean ;
@@ -28,23 +30,46 @@ protected void onCreate(Bundle savedInstanceState) {
28
30
tweakStore .setTweaks (MyTweaks .tweaks );
29
31
tweakStore .setEnabled (true );
30
32
31
- boolean tweak1Value = tweakStore .getValue (MyTweaks .darkTheme );
32
- Log .d ("LOG" , "tweak1Value " + tweak1Value );
33
+ final Button button = (Button ) findViewById (R .id .my_button );
34
+ final TextView textView = (TextView ) findViewById (R .id .my_textView );
35
+
36
+ tweakStore .bind (MyTweaks .greenButton , new TweaksBindingBoolean () {
33
37
34
- tweakStore .bind (MyTweaks .bigFonts , new TweaksBindingBoolean () {
35
38
@ Override
36
- public void value (Boolean value ) {
37
- Log .d ("LOG" , "tweak2Value " + value );
39
+ public void value (boolean value ) {
40
+ if (value ) {
41
+ button .setBackgroundResource (R .drawable .button_teal );
42
+ button .setTextColor (Color .BLACK );
43
+ } else {
44
+ button .setBackgroundResource (R .drawable .button_navy );
45
+ }
38
46
}
39
47
});
40
48
41
- showNotification ();
49
+ tweakStore .bind (MyTweaks .uppercase , new TweaksBindingBoolean () {
50
+
51
+ @ Override
52
+ public void value (boolean value ) {
53
+ if (value ) {
54
+ textView .setAllCaps (true );
55
+ } else {
56
+ textView .setAllCaps (false );
57
+ }
58
+ }
59
+ });
60
+
61
+ if (tweakStore .isEnabled ()) {
62
+ showNotification ();
63
+ }
42
64
}
43
65
44
66
@ Override
45
67
protected void onResume () {
46
68
super .onResume ();
47
- showNotification ();
69
+
70
+ if (tweakStore .isEnabled ()) {
71
+ showNotification ();
72
+ }
48
73
}
49
74
50
75
@ Override
0 commit comments