fixed some activities where the wrong languages would be set

This commit is contained in:
bopol 2020-01-10 15:50:15 +01:00
parent b32935a1b0
commit 8f46432391
8 changed files with 21 additions and 8 deletions

View file

@ -119,7 +119,6 @@ public class MainActivity extends AppCompatActivity {
ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this));
changeAppLanguage(getAppLocale(getApplicationContext()), getResources());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

View file

@ -68,6 +68,7 @@ public class AboutActivity extends AppCompatActivity {
changeAppLanguage(getAppLocale(getApplicationContext()), getResources());
super.onCreate(savedInstanceState);
ThemeHelper.setTheme(this);
this.setTitle(getString(R.string.title_activity_about));
setContentView(R.layout.activity_about);

View file

@ -58,6 +58,8 @@ import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.ThemeHelper;
import static org.schabi.newpipe.player.helper.PlayerHelper.getTimeString;
import static org.schabi.newpipe.util.Localization.changeAppLanguage;
import static org.schabi.newpipe.util.Localization.getAppLocale;
/**
@ -115,7 +117,7 @@ public final class BackgroundPlayer extends Service {
notificationManager = ((NotificationManager) getSystemService(NOTIFICATION_SERVICE));
lockManager = new LockManager(this);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
changeAppLanguage(getAppLocale(getApplicationContext()), getResources());
ThemeHelper.setTheme(this);
basePlayerImpl = new BasePlayerImpl(this);
basePlayerImpl.setup();

View file

@ -93,6 +93,8 @@ import static org.schabi.newpipe.util.AnimationUtils.Type.SCALE_AND_ALPHA;
import static org.schabi.newpipe.util.AnimationUtils.Type.SLIDE_AND_ALPHA;
import static org.schabi.newpipe.util.AnimationUtils.animateRotation;
import static org.schabi.newpipe.util.AnimationUtils.animateView;
import static org.schabi.newpipe.util.Localization.changeAppLanguage;
import static org.schabi.newpipe.util.Localization.getAppLocale;
import static org.schabi.newpipe.util.StateSaver.KEY_SAVED_STATE;
/**
@ -123,6 +125,7 @@ public final class MainVideoPlayer extends AppCompatActivity
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
changeAppLanguage(getAppLocale(getApplicationContext()), getResources());
super.onCreate(savedInstanceState);
if (DEBUG) Log.d(TAG, "onCreate() called with: savedInstanceState = [" + savedInstanceState + "]");
defaultPreferences = PreferenceManager.getDefaultSharedPreferences(this);
@ -190,6 +193,7 @@ public final class MainVideoPlayer extends AppCompatActivity
@Override
protected void onResume() {
if (DEBUG) Log.d(TAG, "onResume() called");
changeAppLanguage(getAppLocale(getApplicationContext()), getResources());
super.onResume();
if (globalScreenOrientationLocked()) {
@ -220,6 +224,7 @@ public final class MainVideoPlayer extends AppCompatActivity
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
changeAppLanguage(getAppLocale(getApplicationContext()), getResources());
if (playerImpl.isSomePopupMenuVisible()) {
playerImpl.getQualityPopupMenu().dismiss();
@ -364,8 +369,8 @@ public final class MainVideoPlayer extends AppCompatActivity
}
private boolean globalScreenOrientationLocked() {
// 1: Screen orientation changes using acelerometer
// 0: Screen orientatino is locked
// 1: Screen orientation changes using accelerometer
// 0: Screen orientation is locked
return !(android.provider.Settings.System.getInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 1);
}

View file

@ -80,6 +80,8 @@ import static org.schabi.newpipe.player.BasePlayer.STATE_PLAYING;
import static org.schabi.newpipe.player.VideoPlayer.DEFAULT_CONTROLS_DURATION;
import static org.schabi.newpipe.player.VideoPlayer.DEFAULT_CONTROLS_HIDE_TIME;
import static org.schabi.newpipe.util.AnimationUtils.animateView;
import static org.schabi.newpipe.util.Localization.changeAppLanguage;
import static org.schabi.newpipe.util.Localization.getAppLocale;
/**
* Service Popup Player implementing VideoPlayer
@ -142,6 +144,7 @@ public final class PopupVideoPlayer extends Service {
@Override
public void onCreate() {
changeAppLanguage(getAppLocale(getApplicationContext()), getResources());
windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
notificationManager = ((NotificationManager) getSystemService(NOTIFICATION_SERVICE));

View file

@ -46,6 +46,8 @@ import java.util.List;
import static org.schabi.newpipe.player.helper.PlayerHelper.formatPitch;
import static org.schabi.newpipe.player.helper.PlayerHelper.formatSpeed;
import static org.schabi.newpipe.util.Localization.changeAppLanguage;
import static org.schabi.newpipe.util.Localization.getAppLocale;
public abstract class ServicePlayerActivity extends AppCompatActivity
implements PlayerEventListener, SeekBar.OnSeekBarChangeListener,
@ -116,6 +118,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
changeAppLanguage(getAppLocale(getApplicationContext()), getResources());
super.onCreate(savedInstanceState);
ThemeHelper.setTheme(this);
setContentView(R.layout.activity_player_queue_control);

View file

@ -46,6 +46,9 @@ import java.util.List;
import java.util.TimeZone;
import java.util.Vector;
import static org.schabi.newpipe.util.Localization.changeAppLanguage;
import static org.schabi.newpipe.util.Localization.getAppLocale;
/*
* Created by Christian Schabesberger on 24.10.15.
*
@ -171,6 +174,7 @@ public class ErrorActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
changeAppLanguage(getAppLocale(getApplicationContext()), getResources());
super.onCreate(savedInstanceState);
ThemeHelper.setTheme(this);
setContentView(R.layout.activity_error);

View file

@ -209,10 +209,6 @@ public class Localization {
}
private static PrettyTime getPrettyTime() {
// If pretty time's Locale is different, init again with the new one.
// if (!prettyTime.getLocale().equals(Locale.getDefault())) {
// initPrettyTime();
// }
return prettyTime;
}