33import android .app .ActivityManager ;
44import android .content .Context ;
55import android .content .Intent ;
6+ import android .content .SharedPreferences ;
7+ import android .graphics .Color ;
68import android .net .Uri ;
79import android .os .Bundle ;
810import android .os .Handler ;
911import android .os .Vibrator ;
12+ import android .view .View ;
13+ import android .view .Window ;
14+ import android .view .WindowManager ;
1015import android .widget .Button ;
1116import android .widget .TextView ;
1217import android .widget .Toast ;
2025import com .google .firebase .auth .FirebaseUser ;
2126import com .mikhaellopez .circularimageview .CircularImageView ;
2227
28+ import static com .aaxena .takenotes .MyName .SHARED_PREFS ;
29+ import static com .aaxena .takenotes .MyName .TEXT ;
30+
2331public class UserInfo extends AppCompatActivity {
2432 CircularImageView photo ;
2533 TextView username ;
@@ -32,6 +40,31 @@ protected void onCreate(Bundle savedInstanceState) {
3240 super .onCreate (savedInstanceState );
3341 setContentView (R .layout .activity_user_info );
3442
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+
3568 Button abt_dev = findViewById (R .id .abt_dev );
3669 abt_dev .setOnClickListener (v -> {
3770 Vibrator dev_vibe = (Vibrator ) getSystemService (Context .VIBRATOR_SERVICE );
0 commit comments