fixed tablet mode option on 7 inch tablets
This commit is contained in:
parent
bb59fdd684
commit
998f6db124
|
@ -34,8 +34,8 @@ android {
|
||||||
applicationId "org.mariotaku.twidere"
|
applicationId "org.mariotaku.twidere"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 282
|
versionCode 283
|
||||||
versionName '3.4.20'
|
versionName '3.4.21'
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
||||||
buildConfigField 'boolean', 'LEAK_CANARY_ENABLED', 'Boolean.parseBoolean("true")'
|
buildConfigField 'boolean', 'LEAK_CANARY_ENABLED', 'Boolean.parseBoolean("true")'
|
||||||
|
|
|
@ -1228,8 +1228,7 @@ public final class Utils implements Constants {
|
||||||
*/
|
*/
|
||||||
public static boolean isScreenTablet(@NonNull Context context) {
|
public static boolean isScreenTablet(@NonNull Context context) {
|
||||||
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
||||||
final float mw = Math.min(metrics.widthPixels / metrics.density, metrics.heightPixels / metrics.density);
|
return metrics.widthPixels / metrics.density >= 600;
|
||||||
return mw >= 600;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -870,7 +870,7 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||||
|
|
||||||
|
|
||||||
fun hasMultiColumns(): Boolean {
|
fun hasMultiColumns(): Boolean {
|
||||||
if (!Utils.isScreenTablet(this)) return false
|
if (!Utils.isDeviceTablet(this) || !Utils.isScreenTablet(this)) return false
|
||||||
if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
if (resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
return preferences.getBoolean("multi_column_tabs_landscape", resources.getBoolean(R.bool.default_multi_column_tabs_land))
|
return preferences.getBoolean("multi_column_tabs_landscape", resources.getBoolean(R.bool.default_multi_column_tabs_land))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue