Assigned
Status Update
Comments
yt...@gmail.com <yt...@gmail.com> #2
I face with the same problem. I have different pageMargin in landscape and portrait and when viewpager is scrolled for the more than first position, after rotating device it is shifted.
I beleive the problem is inside onSizeChanged that is called after onConfigurationChanged, it has following code:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
w always not equals oldw when changing orientation, so recomputeScrollPosition is called, but whit the same values for margin and oldMargin.
This should be fixed.
I beleive the problem is inside onSizeChanged that is called after onConfigurationChanged, it has following code:
if (w != oldw) {
recomputeScrollPosition(w, oldw, mPageMargin, mPageMargin);
}
w always not equals oldw when changing orientation, so recomputeScrollPosition is called, but whit the same values for margin and oldMargin.
This should be fixed.
yt...@gmail.com <yt...@gmail.com> #3
[Comment deleted]
yt...@gmail.com <yt...@gmail.com> #4
I found the same problem in suport library v4, wrong align happens only when ViewPager has a page margin > 0.
Description
Version used: 1.6.1 stable
Devices/Android versions reproduced on: Many
If this is a bug in the library, we would appreciate if you could attach:
- It was recorded in Firebase. But I could not reproduce it.
As this looks like an issue with Locales, here's my code to switch locales in my Settings fragment. Just to be sure its ok.
findPreference<ListPreference>("language_pref")?.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _: Preference, newValue: Any ->
try {
val appLocale = if (newValue == "default") {
LocaleListCompat.getEmptyLocaleList()
} else {
LocaleListCompat.forLanguageTags(newValue as String)
}
AppCompatDelegate.setApplicationLocales(appLocale)
} catch (ex: Exception) {
ex.printStackTrace()
}
true
}
This is the stack trace
Fatal Exception: java.lang.SecurityException: setApplicationLocales: Neither user 10183 nor current process has android.permission.CHANGE_CONFIGURATION.
at android.os.Parcel.createExceptionOrNull(Parcel.java:3022)
at android.os.Parcel.createException(Parcel.java:3006)
at android.os.Parcel.readException(Parcel.java:2989)
at android.os.Parcel.readException(Parcel.java:2931)
at android.app.ILocaleManager$Stub$Proxy.setApplicationLocales(ILocaleManager.java:174)
at android.app.LocaleManager.setApplicationLocales(LocaleManager.java:104)
at android.app.LocaleManager.setApplicationLocales(LocaleManager.java:74)
at androidx.appcompat.app.AppCompatDelegate$Api33Impl.localeManagerSetApplicationLocales(AppCompatDelegate.java:1068)
at androidx.appcompat.app.AppLocalesStorageHelper.syncLocalesToFramework(AppLocalesStorageHelper.java:187)
at androidx.appcompat.app.AppCompatDelegate.lambda$syncRequestedAndStoredLocales$1(AppCompatDelegate.java:914)
at androidx.appcompat.app.AppLocalesStorageHelper$SerialExecutor.lambda$execute$0(AppLocalesStorageHelper.java:235)
at java.lang.Thread.run(Thread.java:1033)