99import android .view .WindowManager ;
1010import android .widget .TextView ;
1111
12- import org .apache .commons .lang3 .StringUtils ;
13-
1412import javax .inject .Inject ;
1513
1614import dagger .android .support .DaggerAppCompatActivity ;
@@ -38,23 +36,19 @@ protected void onResume() {
3836 super .onResume ();
3937
4038 SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences (getApplicationContext ());
41- String disclaimerText = sharedPreferences .getString (getString (R .string .serverDisclaimerText ), null );
42- if (disclaimerText == null ) {
43- disclaimerText = "" ;
44- }
45- sharedPreferences .edit ().putString (getString (R .string .disclaimerText ), disclaimerText ).apply ();
4639
47- if (StringUtils .isBlank (sharedPreferences .getString (getString (R .string .disclaimerText ), null ))) {
48- agree (null );
49- } else {
50- TextView disclaimerTitleView = (TextView ) findViewById (R .id .disclaimer_text );
51- disclaimerTitleView .setText (disclaimerText );
52- }
40+ boolean showDisclaimer = sharedPreferences .getBoolean (getString (R .string .serverDisclaimerShow ), false );
5341
54- String disclaimerTitle = sharedPreferences . getString ( getString ( R . string . serverDisclaimerTitle ), null );
55- if ( disclaimerTitle != null ) {
56- TextView disclaimerTitleView = ( TextView ) findViewById (R .id .disclaimer_title );
42+ if ( showDisclaimer ) {
43+ String disclaimerTitle = sharedPreferences . getString ( getString ( R . string . serverDisclaimerTitle ), null );
44+ TextView disclaimerTitleView = findViewById (R .id .disclaimer_title );
5745 disclaimerTitleView .setText (disclaimerTitle );
46+
47+ TextView disclaimerTextView = findViewById (R .id .disclaimer_text );
48+ String disclaimerText = sharedPreferences .getString (getString (R .string .serverDisclaimerText ), null );
49+ disclaimerTextView .setText (disclaimerText );
50+ } else {
51+ agree (null );
5852 }
5953 }
6054
@@ -67,6 +61,7 @@ public void agree(View view) {
6761 if (extras != null ) {
6862 intent .putExtras (extras );
6963 }
64+
7065 startActivity (intent );
7166 finish ();
7267 }
0 commit comments