mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2025-10-04 18:29:26 +02:00
Use ActivityCompat.recreate().
This commit is contained in:
parent
0ced9ba799
commit
807e4d4af9
3 changed files with 7 additions and 7 deletions
|
@ -50,6 +50,7 @@ import androidx.appcompat.app.ActionBar;
|
|||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
@ -218,7 +219,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
toggleServices();
|
||||
}
|
||||
if (lastService != ServiceHelper.getSelectedServiceId(MainActivity.this)) {
|
||||
new Handler(Looper.getMainLooper()).post(MainActivity.this::recreate);
|
||||
ActivityCompat.recreate(MainActivity.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -497,10 +498,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
Log.d(TAG, "Theme has changed, recreating activity...");
|
||||
}
|
||||
sharedPreferences.edit().putBoolean(Constants.KEY_THEME_CHANGE, false).apply();
|
||||
// https://stackoverflow.com/questions/10844112/
|
||||
// Briefly, let the activity resume
|
||||
// properly posting the recreate call to end of the message queue
|
||||
new Handler(Looper.getMainLooper()).post(MainActivity.this::recreate);
|
||||
ActivityCompat.recreate(this);
|
||||
}
|
||||
|
||||
if (sharedPreferences.getBoolean(Constants.KEY_MAIN_PAGE_CHANGE, false)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue