mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-25 22:18:00 +01:00
scale up the sizes properly for tablets
This commit is contained in:
parent
a6afe1e45a
commit
4ab90d0e08
7 changed files with 57 additions and 11 deletions
|
@ -1,13 +1,20 @@
|
|||
package com.simplemobiletools.gallery;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Display;
|
||||
import android.view.KeyCharacterMap;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.Window;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.Toast;
|
||||
|
@ -46,9 +53,28 @@ public class Utils {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static boolean hasNavBar(Resources res) {
|
||||
int id = res.getIdentifier("config_showNavigationBar", "bool", "android");
|
||||
return id > 0 && res.getBoolean(id);
|
||||
public static boolean hasNavBar(Activity act) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
Display display = act.getWindowManager().getDefaultDisplay();
|
||||
|
||||
DisplayMetrics realDisplayMetrics = new DisplayMetrics();
|
||||
display.getRealMetrics(realDisplayMetrics);
|
||||
|
||||
int realHeight = realDisplayMetrics.heightPixels;
|
||||
int realWidth = realDisplayMetrics.widthPixels;
|
||||
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
display.getMetrics(displayMetrics);
|
||||
|
||||
int displayHeight = displayMetrics.heightPixels;
|
||||
int displayWidth = displayMetrics.widthPixels;
|
||||
|
||||
return (realWidth - displayWidth) > 0 || (realHeight - displayHeight) > 0;
|
||||
} else {
|
||||
boolean hasMenuKey = ViewConfiguration.get(act).hasPermanentMenuKey();
|
||||
boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
|
||||
return !hasMenuKey && !hasBackKey;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasStoragePermission(Context cxt) {
|
||||
|
|
|
@ -103,15 +103,16 @@ public class VideoFragment extends ViewPagerFragment
|
|||
final int height = Utils.getNavBarHeight(res);
|
||||
final int left = mTimeHolder.getPaddingLeft();
|
||||
final int top = mTimeHolder.getPaddingTop();
|
||||
final int right = mTimeHolder.getPaddingRight();
|
||||
final int bottom = mTimeHolder.getPaddingBottom();
|
||||
int right = mTimeHolder.getPaddingRight();
|
||||
int bottom = mTimeHolder.getPaddingBottom();
|
||||
|
||||
if (Utils.hasNavBar(res)) {
|
||||
if (Utils.hasNavBar(getActivity())) {
|
||||
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
mTimeHolder.setPadding(left, top, right, bottom + height);
|
||||
bottom += height;
|
||||
} else {
|
||||
mTimeHolder.setPadding(left, top, right + height, bottom);
|
||||
right += height;
|
||||
}
|
||||
mTimeHolder.setPadding(left, top, right, bottom);
|
||||
}
|
||||
|
||||
mCurrTimeView = (TextView) view.findViewById(R.id.video_curr_time);
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/undo_delete"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_width="@dimen/undo_size"
|
||||
android:layout_height="@dimen/undo_size"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:padding="@dimen/undo_padding"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_height="@dimen/tmb_shadow_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="#55000000"
|
||||
android:paddingBottom="4dp"
|
||||
|
|
14
app/src/main/res/values-sw600dp/dimens.xml
Normal file
14
app/src/main/res/values-sw600dp/dimens.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<resources>
|
||||
<dimen name="dir_tmb_size">200dp</dimen>
|
||||
<dimen name="medium_tmb_size">150dp</dimen>
|
||||
<dimen name="play_outline_size">60dp</dimen>
|
||||
<dimen name="play_outline_size_big">240dp</dimen>
|
||||
<dimen name="undo_padding">16dp</dimen>
|
||||
<dimen name="timer_padding">32dp</dimen>
|
||||
<dimen name="social_padding">12dp</dimen>
|
||||
<dimen name="social_logo">50dp</dimen>
|
||||
<dimen name="tmb_shadow_height">60dp</dimen>
|
||||
<dimen name="undo_size">64dp</dimen>
|
||||
|
||||
<dimen name="normal_text_size">18sp</dimen>
|
||||
</resources>
|
|
@ -8,4 +8,8 @@
|
|||
<dimen name="timer_padding">24dp</dimen>
|
||||
<dimen name="social_padding">8dp</dimen>
|
||||
<dimen name="social_logo">40dp</dimen>
|
||||
<dimen name="tmb_shadow_height">50dp</dimen>
|
||||
<dimen name="undo_size">56dp</dimen>
|
||||
|
||||
<dimen name="normal_text_size">14sp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="actionBarStyle">@style/AppTheme.ActionBarStyle</item>
|
||||
<item name="android:textSize">@dimen/normal_text_size</item>
|
||||
</style>
|
||||
|
||||
<style name="FullScreenTheme.Base" parent="AppTheme">
|
||||
|
|
Loading…
Reference in a new issue