3
3
import android .app .ActivityManager ;
4
4
import android .content .Context ;
5
5
import android .content .Intent ;
6
+ import android .content .SharedPreferences ;
7
+ import android .graphics .Color ;
6
8
import android .net .Uri ;
7
9
import android .os .Bundle ;
8
10
import android .os .Handler ;
9
11
import android .os .Vibrator ;
12
+ import android .view .View ;
13
+ import android .view .Window ;
14
+ import android .view .WindowManager ;
10
15
import android .widget .Button ;
11
16
import android .widget .TextView ;
12
17
import android .widget .Toast ;
20
25
import com .google .firebase .auth .FirebaseUser ;
21
26
import com .mikhaellopez .circularimageview .CircularImageView ;
22
27
28
+ import static com .aaxena .takenotes .MyName .SHARED_PREFS ;
29
+ import static com .aaxena .takenotes .MyName .TEXT ;
30
+
23
31
public class UserInfo extends AppCompatActivity {
24
32
CircularImageView photo ;
25
33
TextView username ;
@@ -32,6 +40,31 @@ protected void onCreate(Bundle savedInstanceState) {
32
40
super .onCreate (savedInstanceState );
33
41
setContentView (R .layout .activity_user_info );
34
42
43
+ Window window = getWindow ();
44
+ window .addFlags (WindowManager .LayoutParams .FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS );
45
+ window .setStatusBarColor (Color .parseColor ("#1389cd" ));
46
+
47
+ Button change_name = findViewById (R .id .chng_name );
48
+ TextView user_save_name = findViewById (R .id .saving_name );
49
+ SharedPreferences sharedPreferences = getSharedPreferences (SHARED_PREFS , MODE_PRIVATE );
50
+ String saving_as = sharedPreferences .getString (TEXT , "" );
51
+ if (saving_as .isEmpty ()){
52
+ user_save_name .setText (R .string .tap_to_save_name );
53
+ change_name .setOnClickListener (view -> {
54
+ Vibrator v2 = (Vibrator ) getSystemService (Context .VIBRATOR_SERVICE );
55
+ v2 .vibrate (20 );
56
+ Intent toName = new Intent (UserInfo .this ,MyName .class );
57
+ startActivity (toName );
58
+ overridePendingTransition (android .R .anim .fade_in , android .R .anim .fade_out );
59
+ finish ();
60
+ });
61
+ }
62
+ else {
63
+ user_save_name .setText (saving_as );
64
+ change_name .setVisibility (View .INVISIBLE );
65
+ }
66
+
67
+
35
68
Button abt_dev = findViewById (R .id .abt_dev );
36
69
abt_dev .setOnClickListener (v -> {
37
70
Vibrator dev_vibe = (Vibrator ) getSystemService (Context .VIBRATOR_SERVICE );
0 commit comments