mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-26 22:31:16 +00:00
Improving content margin on tablets and using support library dimensions for everything possible.
Ref #404.
This commit is contained in:
parent
11ab6cee57
commit
dda0e48fda
9 changed files with 24 additions and 23 deletions
|
@ -4,13 +4,6 @@ import android.app.Activity;
|
|||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.DrawableContainer.DrawableContainerState;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -18,7 +11,6 @@ import android.support.v7.widget.SwitchCompat;
|
|||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -44,7 +36,6 @@ import com.nutomic.syncthingandroid.syncthing.SyncthingService;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static android.os.Build.VERSION_CODES.LOLLIPOP;
|
||||
import static android.support.v4.view.MarginLayoutParamsCompat.setMarginEnd;
|
||||
import static android.support.v4.view.MarginLayoutParamsCompat.setMarginStart;
|
||||
import static android.view.Gravity.CENTER_VERTICAL;
|
||||
|
@ -366,8 +357,11 @@ public class FolderFragment extends Fragment
|
|||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(WRAP_CONTENT, dp(48, getActivity()));
|
||||
// 72dp margin to align with dividers
|
||||
// 4dp additional margin to align with the rest of the items
|
||||
setMarginStart(params, dp(72 + 4, getActivity()));
|
||||
setMarginEnd(params, dp(16 + 4, getActivity()));
|
||||
int dividerInset = getResources().getDimensionPixelOffset(R.dimen.material_divider_inset);
|
||||
int contentInset = getResources().getDimensionPixelOffset(R.dimen.abc_action_bar_content_inset_material);
|
||||
int textPadding = dp(4, getActivity());
|
||||
setMarginStart(params, dividerInset + textPadding);
|
||||
setMarginEnd(params, contentInset + textPadding);
|
||||
TextView emptyView = new TextView(mDevicesContainer.getContext());
|
||||
emptyView.setGravity(CENTER_VERTICAL);
|
||||
emptyView.setText(R.string.devices_list_empty);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:insetLeft="72dp">
|
||||
android:insetLeft="@dimen/material_divider_inset">
|
||||
<shape>
|
||||
<solid android:color="@color/divider" />
|
||||
<size android:height="1px" />
|
||||
|
|
|
@ -80,9 +80,8 @@
|
|||
android:id="@+id/versioningKeep"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:text="0"
|
||||
android:layout_marginEnd="@dimen/abc_action_bar_content_inset_material"
|
||||
android:layout_marginRight="@dimen/abc_action_bar_content_inset_material"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||
tools:ignore="HardcodedText" />
|
||||
</LinearLayout>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
style="@style/Widget.Syncthing.TextView.Label.DeviceList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginLeft="72dp"
|
||||
android:layout_marginStart="72dp"
|
||||
android:layout_marginLeft="@dimen/material_divider_inset"
|
||||
android:layout_marginStart="@dimen/material_divider_inset"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
|
||||
tools:ignore="RtlHardcoded,RtlSymmetry" />
|
|
@ -4,8 +4,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingLeft="@dimen/abc_action_bar_content_inset_material"
|
||||
android:paddingRight="@dimen/abc_action_bar_content_inset_material"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingLeft="@dimen/abc_action_bar_content_inset_material"
|
||||
android:paddingRight="@dimen/abc_action_bar_content_inset_material"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<TextView
|
||||
|
|
4
src/main/res/values-sw600dp/dimens.xml
Normal file
4
src/main/res/values-sw600dp/dimens.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="material_divider_inset">80dp</dimen>
|
||||
</resources>
|
4
src/main/res/values/dimens.xml
Normal file
4
src/main/res/values/dimens.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="material_divider_inset">72dp</dimen>
|
||||
</resources>
|
|
@ -22,8 +22,8 @@
|
|||
<item name="android:gravity">start|center_vertical</item>
|
||||
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Body1</item>
|
||||
<item name="android:textColor">?attr/editTextColor</item>
|
||||
<item name="android:paddingLeft">16dp</item>
|
||||
<item name="android:paddingRight">16dp</item>
|
||||
<item name="android:paddingLeft">@dimen/abc_action_bar_content_inset_material</item>
|
||||
<item name="android:paddingRight">@dimen/abc_action_bar_content_inset_material</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Syncthing.TextView.Label.DeviceList">
|
||||
|
|
Loading…
Reference in a new issue