20
20
21
21
package org .schabi .newpipe ;
22
22
23
- import static org .schabi .newpipe .util .Localization .assureCorrectAppLanguage ;
24
-
25
23
import android .content .BroadcastReceiver ;
26
24
import android .content .Context ;
27
25
import android .content .Intent ;
49
47
import androidx .appcompat .app .ActionBarDrawerToggle ;
50
48
import androidx .appcompat .app .AppCompatActivity ;
51
49
import androidx .core .app .ActivityCompat ;
50
+ import androidx .core .content .ContextCompat ;
52
51
import androidx .core .view .GravityCompat ;
53
52
import androidx .drawerlayout .widget .DrawerLayout ;
54
53
import androidx .fragment .app .Fragment ;
76
75
import org .schabi .newpipe .player .event .OnKeyDownListener ;
77
76
import org .schabi .newpipe .player .helper .PlayerHolder ;
78
77
import org .schabi .newpipe .player .playqueue .PlayQueue ;
78
+ import org .schabi .newpipe .settings .SettingMigrations ;
79
79
import org .schabi .newpipe .settings .UpdateSettingsFragment ;
80
80
import org .schabi .newpipe .util .Constants ;
81
81
import org .schabi .newpipe .util .DeviceUtils ;
@@ -137,6 +137,7 @@ protected void onCreate(final Bundle savedInstanceState) {
137
137
+ "savedInstanceState = [" + savedInstanceState + "]" );
138
138
}
139
139
140
+ Localization .migrateAppLanguageSettingIfNecessary (getApplicationContext ());
140
141
ThemeHelper .setDayNightMode (this );
141
142
ThemeHelper .setTheme (this , ServiceHelper .getSelectedServiceId (this ));
142
143
@@ -153,7 +154,6 @@ protected void onCreate(final Bundle savedInstanceState) {
153
154
}
154
155
}
155
156
156
- assureCorrectAppLanguage (this );
157
157
super .onCreate (savedInstanceState );
158
158
sharedPreferences = PreferenceManager .getDefaultSharedPreferences (this );
159
159
sharedPrefEditor = sharedPreferences .edit ();
@@ -192,7 +192,7 @@ protected void onCreate(final Bundle savedInstanceState) {
192
192
UpdateSettingsFragment .askForConsentToUpdateChecks (this );
193
193
}
194
194
195
- Localization . migrateAppLanguageSettingIfNecessary ( getApplicationContext () );
195
+ SettingMigrations . showUserInfoIfPresent ( this );
196
196
}
197
197
198
198
@ Override
@@ -498,9 +498,8 @@ protected void onDestroy() {
498
498
499
499
@ Override
500
500
protected void onResume () {
501
- assureCorrectAppLanguage (this );
502
501
// Change the date format to match the selected language on resume
503
- Localization .initPrettyTime (Localization .resolvePrettyTime (getApplicationContext () ));
502
+ Localization .initPrettyTime (Localization .resolvePrettyTime ());
504
503
super .onResume ();
505
504
506
505
// Close drawer on return, and don't show animation,
@@ -870,7 +869,8 @@ public void onReceive(final Context context, final Intent intent) {
870
869
};
871
870
final IntentFilter intentFilter = new IntentFilter ();
872
871
intentFilter .addAction (VideoDetailFragment .ACTION_PLAYER_STARTED );
873
- registerReceiver (broadcastReceiver , intentFilter );
872
+ ContextCompat .registerReceiver (this , broadcastReceiver , intentFilter ,
873
+ ContextCompat .RECEIVER_EXPORTED );
874
874
875
875
// If the PlayerHolder is not bound yet, but the service is running, try to bind to it.
876
876
// Once the connection is established, the ACTION_PLAYER_STARTED will be sent.
0 commit comments