From 0cab3fa8b5dfa4ad46ba90a37354c8d4ba25a2de Mon Sep 17 00:00:00 2001 From: Boris Timofeev Date: Fri, 1 Sep 2017 23:25:59 +0300 Subject: [PATCH] placed content in the center of the screen on tablets --- .../ui/activity/FilePickerActivity.java | 7 +++++-- .../main/res/layout/activity_file_picker.xml | 19 +++++++++++++++---- app/src/main/res/layout/fragment_about.xml | 5 ++++- .../main/res/layout/fragment_changelog.xml | 5 ++++- app/src/main/res/layout/fragment_faq.xml | 5 ++++- app/src/main/res/values-night/colors.xml | 1 - app/src/main/res/values-w600dp/dimens.xml | 17 +++++++++++++++++ app/src/main/res/values-w820dp/dimens.xml | 16 +++++++++++++--- app/src/main/res/values/dimens.xml | 9 +++++---- app/src/main/res/values/styles.xml | 6 +++--- 10 files changed, 70 insertions(+), 20 deletions(-) create mode 100644 app/src/main/res/values-w600dp/dimens.xml diff --git a/app/src/main/java/org/emunix/unipatcher/ui/activity/FilePickerActivity.java b/app/src/main/java/org/emunix/unipatcher/ui/activity/FilePickerActivity.java index 1ee6da8..f301128 100644 --- a/app/src/main/java/org/emunix/unipatcher/ui/activity/FilePickerActivity.java +++ b/app/src/main/java/org/emunix/unipatcher/ui/activity/FilePickerActivity.java @@ -29,6 +29,7 @@ import android.os.Environment; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.CardView; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; @@ -63,6 +64,7 @@ public class FilePickerActivity extends AppCompatActivity implements FilePickerA private RecyclerView list; private FilePickerAdapter listAdapter; private TextView permissionErrorText; + private CardView card; private TextView crc32; private TextView md5; @@ -104,6 +106,7 @@ public class FilePickerActivity extends AppCompatActivity implements FilePickerA permissionErrorText = (TextView) findViewById(R.id.empty_view); list = (RecyclerView) findViewById(R.id.list); + card = (CardView) findViewById(R.id.card); try { list.setHasFixedSize(true); } catch (NullPointerException e) {/* TODO log */} @@ -274,11 +277,11 @@ public class FilePickerActivity extends AppCompatActivity implements FilePickerA private void showPermissionError(boolean on) { if (on) { - list.setVisibility(View.GONE); + card.setVisibility(View.GONE); permissionErrorText.setVisibility(View.VISIBLE); } else { permissionErrorText.setVisibility(View.GONE); - list.setVisibility(View.VISIBLE); + card.setVisibility(View.VISIBLE); } } diff --git a/app/src/main/res/layout/activity_file_picker.xml b/app/src/main/res/layout/activity_file_picker.xml index a57acaa..0da88e8 100644 --- a/app/src/main/res/layout/activity_file_picker.xml +++ b/app/src/main/res/layout/activity_file_picker.xml @@ -2,6 +2,7 @@ - + card_view:cardBackgroundColor="@color/colorCardBackground"> + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index bf44e81..d431a0b 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -10,8 +10,11 @@ android:id="@+id/mainLayout" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginLeft="@dimen/content_left_margin" + android:layout_marginRight="@dimen/content_right_margin" android:orientation="vertical" - android:padding="16dp"> + android:paddingTop="8dp" + android:paddingBottom="8dp"> + android:layout_marginLeft="@dimen/content_left_margin" + android:layout_marginRight="@dimen/content_right_margin" + android:paddingTop="8dp" + android:paddingBottom="8dp"> + android:layout_marginLeft="@dimen/content_left_margin" + android:layout_marginRight="@dimen/content_right_margin" + android:paddingTop="8dp" + android:paddingBottom="8dp"> #cccccc #4b4b4b #393939 - #393939 @color/colorCardHeaderText \ No newline at end of file diff --git a/app/src/main/res/values-w600dp/dimens.xml b/app/src/main/res/values-w600dp/dimens.xml new file mode 100644 index 0000000..91a38e6 --- /dev/null +++ b/app/src/main/res/values-w600dp/dimens.xml @@ -0,0 +1,17 @@ + + + 64dp + 24dp + + 16dp + 64dp + 64dp + 64dp + 64dp + + 2dp + 2dp + 8dp + 8dp + 1dp + diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml index c9aaa29..fc31e4c 100644 --- a/app/src/main/res/values-w820dp/dimens.xml +++ b/app/src/main/res/values-w820dp/dimens.xml @@ -1,7 +1,17 @@ - 64dp + 32dp + + 16dp + 192dp + 192dp + 192dp + 192dp + + 2dp + 2dp + 8dp + 8dp + 1dp diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 75df8e5..f34b0a8 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -1,6 +1,5 @@ - 16dp 160dp 16dp @@ -12,9 +11,11 @@ 16dp 16dp - 8dp - 16dp - 16dp + 8dp + 16dp + 16dp + 0dp + 0dp 2dp 2dp diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 943df13..9f6870f 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -23,9 +23,9 @@ vertical match_parent wrap_content - @dimen/screen_top_padding - @dimen/screen_left_padding - @dimen/screen_right_padding + @dimen/content_top_margin + @dimen/content_left_margin + @dimen/content_right_margin