22
33import android .annotation .SuppressLint ;
44import android .app .AlarmManager ;
5+ import android .app .LocaleManager ;
56import android .app .Notification ;
67import android .app .PendingIntent ;
78import android .content .ComponentName ;
3435import androidx .appcompat .app .AppCompatDelegate ;
3536import androidx .appcompat .widget .AppCompatSpinner ;
3637import androidx .constraintlayout .widget .ConstraintLayout ;
38+ import androidx .core .os .LocaleListCompat ;
3739import androidx .drawerlayout .widget .DrawerLayout ;
3840import androidx .fragment .app .Fragment ;
3941import androidx .fragment .app .FragmentManager ;
@@ -158,6 +160,7 @@ protected void onCreate(Bundle savedInstanceState) {
158160 Global .setColorTheme (this , global_prefs .getString ("theme_color" , "blue" ), getWindow ());
159161 Global .setInterfaceFont (this );
160162 isDarkTheme = global_prefs .getBoolean ("dark_theme" , false );
163+
161164 notifMan = new NotificationManager (this , true , true , true , "" );
162165 if (savedInstanceState == null ) {
163166 Bundle extras = getIntent ().getExtras ();
@@ -176,6 +179,7 @@ protected void onCreate(Bundle savedInstanceState) {
176179 protected void attachBaseContext (Context newBase ) {
177180 Locale languageType = OvkApplication .getLocale (newBase );
178181 super .attachBaseContext (LocaleContextWrapper .wrap (newBase , languageType ));
182+ Global .setPerAppLanguage (this );
179183 }
180184
181185 private void createFragments () {
@@ -839,13 +843,15 @@ private void receiveState(int message, Bundle data) {
839843 || message == HandlerMessages .WALL_AVATARS
840844 || message == HandlerMessages .WALL_ATTACHMENTS ) {
841845 if (selectedFragment == newsfeedFragment ) {
842- if (message == HandlerMessages .NEWSFEED_AVATARS ) {
843- newsfeedFragment .newsfeedAdapter .setAvatarLoadState (true );
844- } else {
845- newsfeedFragment .newsfeedAdapter .setPhotoLoadState (true );
846- newsfeedFragment .disableLoadState ();
846+ if (newsfeedFragment .newsfeedAdapter != null ) {
847+ if (message == HandlerMessages .NEWSFEED_AVATARS ) {
848+ newsfeedFragment .newsfeedAdapter .setAvatarLoadState (true );
849+ } else {
850+ newsfeedFragment .newsfeedAdapter .setPhotoLoadState (true );
851+ newsfeedFragment .disableLoadState ();
852+ }
853+ newsfeedFragment .refreshAdapter ();
847854 }
848- newsfeedFragment .refreshAdapter ();
849855 } else if (selectedFragment == profileFragment ) {
850856 if (profileFragment .getWallAdapter () == null ) {
851857 profileFragment .createWallAdapter (this , wall .getWallItems ());
@@ -1163,7 +1169,7 @@ public void openCommunityPage(int position) {
11631169 }
11641170 }
11651171
1166- private ServiceConnection lpConnection = new ServiceConnection () {
1172+ private final ServiceConnection lpConnection = new ServiceConnection () {
11671173 public void onServiceConnected (ComponentName className , IBinder service ) {
11681174 LongPollService .LongPollBinder binder = (LongPollService .LongPollBinder ) service ;
11691175 longPollService = binder .getService ();
0 commit comments