From 4c3d42057bcec478b855c8d118943b9940c61367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Carvalho?= Date: Sat, 12 May 2018 14:38:57 +0100 Subject: [PATCH] * Stop using RelativeLayout in favor of ConstraintLayout --- .idea/caches/build_file_checksums.ser | Bin 748 -> 748 bytes .../java/io/mgba/Adapters/GameAdapter.java | 3 +- .../io/mgba/Adapters/SettingsAdapter.java | 5 +- .../mgba/UI/Fragments/Main/GameFragment.java | 3 +- .../io/mgba/UI/Views/GameInformationView.java | 5 +- .../main/res/layout-land/category_element.xml | 38 +++-- .../main/res/layout-land/content_fragment.xml | 20 ++- .../res/layout-land/library_sheet_view.xml | 142 ------------------ app/src/main/res/layout/activity_library.xml | 17 ++- .../res/layout/activity_settings_panel.xml | 11 +- app/src/main/res/layout/category_element.xml | 36 +++-- app/src/main/res/layout/content_fragment.xml | 21 ++- app/src/main/res/layout/game.xml | 12 +- .../main/res/layout/library_sheet_view.xml | 90 ++++++----- 14 files changed, 167 insertions(+), 236 deletions(-) delete mode 100644 app/src/main/res/layout-land/library_sheet_view.xml diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 6e2edc41ed721e6f5e0ed39088acfd576ac89a29..07a55b68df9a380b6a873ddae12807b2ef7c79b3 100644 GIT binary patch delta 32 qcmV+*0N?-Y1?&Zom;_XLiAIr}^pnK_G?S14H31Bh(E%2d5CYugeGIz* delta 32 qcmV+*0N?-Y1?&Zom;_L5#7>c%^pnH^HItA5Gyx2g(E%2d5CYuk=?v`v diff --git a/app/src/main/java/io/mgba/Adapters/GameAdapter.java b/app/src/main/java/io/mgba/Adapters/GameAdapter.java index 4113129..1953c9b 100644 --- a/app/src/main/java/io/mgba/Adapters/GameAdapter.java +++ b/app/src/main/java/io/mgba/Adapters/GameAdapter.java @@ -1,6 +1,7 @@ package io.mgba.Adapters; import android.content.Context; +import android.support.constraint.ConstraintLayout; import android.support.v4.app.Fragment; import android.support.v7.widget.RecyclerView; import android.view.View; @@ -68,7 +69,7 @@ static class ViewHolder extends RecyclerView.ViewHolder { TextView gameTitle; @BindView(R.id.master_container) - RelativeLayout masterContainer; + ConstraintLayout masterContainer; ViewHolder(View itemView) { super(itemView); diff --git a/app/src/main/java/io/mgba/Adapters/SettingsAdapter.java b/app/src/main/java/io/mgba/Adapters/SettingsAdapter.java index f22cc51..2c55ba9 100644 --- a/app/src/main/java/io/mgba/Adapters/SettingsAdapter.java +++ b/app/src/main/java/io/mgba/Adapters/SettingsAdapter.java @@ -1,6 +1,7 @@ package io.mgba.Adapters; import android.content.Context; +import android.support.constraint.ConstraintLayout; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; @@ -44,7 +45,7 @@ public void onClick(View v) { try { onClick.accept(mItem); } catch (Exception e) { - mgba.printLog(TAG, "Cannot execute consumer callable"); + mgba.printLog(TAG, "Cannot execute onClick consumer"); } } @@ -54,7 +55,7 @@ public static class ViewHolder extends RecyclerView.ViewHolder{ @BindView(R.id.setting_title) TextView title; @BindView(R.id.container) - RelativeLayout container; + ConstraintLayout container; public ViewHolder(View view) { super(view); diff --git a/app/src/main/java/io/mgba/UI/Fragments/Main/GameFragment.java b/app/src/main/java/io/mgba/UI/Fragments/Main/GameFragment.java index 7827f25..9b6b25c 100644 --- a/app/src/main/java/io/mgba/UI/Fragments/Main/GameFragment.java +++ b/app/src/main/java/io/mgba/UI/Fragments/Main/GameFragment.java @@ -3,6 +3,7 @@ import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.constraint.ConstraintLayout; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.view.LayoutInflater; @@ -29,7 +30,7 @@ public class GameFragment extends Fragment implements SwipeRefreshLayout.OnRefre private static final String TAG = "BaseFragment"; - @BindView(R.id.no_content_container) protected RelativeLayout noContentView; + @BindView(R.id.no_content_container) protected ConstraintLayout noContentView; @BindView(R.id.content_recyclerView) protected TwoWayView recyclerView; @BindView(R.id.no_content_image) protected ImageView noContentImage; @BindView(R.id.no_content_message) protected TextView noContentMessage; diff --git a/app/src/main/java/io/mgba/UI/Views/GameInformationView.java b/app/src/main/java/io/mgba/UI/Views/GameInformationView.java index 92aec24..2d0f881 100644 --- a/app/src/main/java/io/mgba/UI/Views/GameInformationView.java +++ b/app/src/main/java/io/mgba/UI/Views/GameInformationView.java @@ -4,6 +4,7 @@ import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.constraint.ConstraintLayout; import android.support.design.widget.BottomSheetDialogFragment; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.FloatingActionButton; @@ -36,7 +37,7 @@ public static GameInformationView newInstance(Game game) { } @BindView(R.id.sheet_container) CoordinatorLayout main; - @BindView(R.id.bottomsheet_header) RelativeLayout header; + @BindView(R.id.bottomsheet_header) ConstraintLayout header; @BindView(R.id.gameTitle) TextView title; @BindView(R.id.gameDescription) TextView description; @BindView(R.id.cover) ImageView cover; @@ -45,7 +46,7 @@ public static GameInformationView newInstance(Game game) { @BindView(R.id.savestate_recyclerview) RecyclerView recyclerView; @BindView(R.id.no_content_image) ImageView noContentImage; @BindView(R.id.no_savestate_message) TextView noSavesMessage; - @BindView(R.id.no_savestates_container) RelativeLayout noSavesContainer; + @BindView(R.id.no_savestates_container) ConstraintLayout noSavesContainer; private Game game; diff --git a/app/src/main/res/layout-land/category_element.xml b/app/src/main/res/layout-land/category_element.xml index 7d93488..a3c6f04 100644 --- a/app/src/main/res/layout-land/category_element.xml +++ b/app/src/main/res/layout-land/category_element.xml @@ -1,7 +1,8 @@ - @@ -9,34 +10,45 @@ + android:textSize="16sp" + app:layout_constraintBottom_toBottomOf="@+id/setting_icon" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintHorizontal_bias="0.0" + app:layout_constraintStart_toEndOf="@+id/setting_icon" + app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + android:layout_alignParentBottom="true" + android:layout_marginTop="56dp" + android:background="#cecece" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/setting_icon" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="1.0" /> + \ No newline at end of file diff --git a/app/src/main/res/layout-land/content_fragment.xml b/app/src/main/res/layout-land/content_fragment.xml index 6ab91cf..79779ca 100644 --- a/app/src/main/res/layout-land/content_fragment.xml +++ b/app/src/main/res/layout-land/content_fragment.xml @@ -1,5 +1,6 @@ - + android:src="@drawable/ic_videogame_asset_grey_500_48dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + android:textAppearance="@android:style/TextAppearance.Material.Medium" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/no_content_image" /> + \ No newline at end of file diff --git a/app/src/main/res/layout-land/library_sheet_view.xml b/app/src/main/res/layout-land/library_sheet_view.xml deleted file mode 100644 index da50ef0..0000000 --- a/app/src/main/res/layout-land/library_sheet_view.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_library.xml b/app/src/main/res/layout/activity_library.xml index 231eb7d..8fe8c85 100644 --- a/app/src/main/res/layout/activity_library.xml +++ b/app/src/main/res/layout/activity_library.xml @@ -1,4 +1,4 @@ - + android:layout_height="0dp" + android:layout_below="@+id/tabLayout" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tabLayout" + tools:layout_editor_absoluteX="0dp" /> + app:layout_constraintTop_toBottomOf="@+id/toolbar_container" + app:tabIndicatorColor="@android:color/white" + tools:layout_editor_absoluteX="16dp" /> - + diff --git a/app/src/main/res/layout/activity_settings_panel.xml b/app/src/main/res/layout/activity_settings_panel.xml index 774438b..5fe318f 100644 --- a/app/src/main/res/layout/activity_settings_panel.xml +++ b/app/src/main/res/layout/activity_settings_panel.xml @@ -1,11 +1,16 @@ - + android:layout_height="match_parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + diff --git a/app/src/main/res/layout/category_element.xml b/app/src/main/res/layout/category_element.xml index 7d93488..6971229 100644 --- a/app/src/main/res/layout/category_element.xml +++ b/app/src/main/res/layout/category_element.xml @@ -1,7 +1,8 @@ - @@ -9,34 +10,43 @@ + android:textSize="16sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/setting_icon" + app:layout_constraintTop_toTopOf="parent" /> - \ No newline at end of file + android:layout_alignParentBottom="true" + android:layout_marginTop="56dp" + android:background="#cecece" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/setting_icon" + app:layout_constraintTop_toTopOf="parent" /> + \ No newline at end of file diff --git a/app/src/main/res/layout/content_fragment.xml b/app/src/main/res/layout/content_fragment.xml index ba09c4d..a749d27 100644 --- a/app/src/main/res/layout/content_fragment.xml +++ b/app/src/main/res/layout/content_fragment.xml @@ -2,6 +2,7 @@ - @@ -29,18 +30,24 @@ android:layout_height="@dimen/message_width" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" - android:layout_marginTop="@dimen/no_content_margin_top" - android:src="@drawable/ic_videogame_asset_grey_500_48dp" /> + android:src="@drawable/ic_videogame_asset_grey_500_48dp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + android:textAppearance="@android:style/TextAppearance.Material.Medium" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/no_content_image" /> + \ No newline at end of file diff --git a/app/src/main/res/layout/game.xml b/app/src/main/res/layout/game.xml index fa8e61c..81caa9c 100644 --- a/app/src/main/res/layout/game.xml +++ b/app/src/main/res/layout/game.xml @@ -1,5 +1,6 @@ - - \ No newline at end of file + autofit:layout_constraintBottom_toBottomOf="parent" + autofit:layout_constraintTop_toTopOf="@+id/card_preview" + autofit:minTextSize="14sp" + tools:layout_editor_absoluteX="8dp" /> + \ No newline at end of file diff --git a/app/src/main/res/layout/library_sheet_view.xml b/app/src/main/res/layout/library_sheet_view.xml index 40d8a23..84c55b7 100644 --- a/app/src/main/res/layout/library_sheet_view.xml +++ b/app/src/main/res/layout/library_sheet_view.xml @@ -16,7 +16,7 @@ android:layout_height="match_parent" android:background="@color/white"> - - - @@ -63,12 +60,14 @@ android:layout_height="@dimen/cover_size" android:layout_alignParentStart="true" android:layout_alignParentTop="true" - android:layout_marginStart="@dimen/body_margin" - android:layout_marginTop="@dimen/body_margin" - android:background="@drawable/placeholder" /> - + android:layout_marginStart="12dp" + android:layout_marginTop="12dp" + android:background="@drawable/placeholder" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + - + android:layout_marginTop="@dimen/body_margin" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/savestate_title" /> + android:textSize="14sp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + android:layout_height="0dp" + android:layout_below="@+id/savestate_title" + android:layout_marginTop="@dimen/body_margin" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/savestate_title"> + android:src="@drawable/ic_save_grey_500_48dp" + android:visibility="visible" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_bias="0.19999999" /> - + android:textAppearance="@android:style/TextAppearance.Material.Medium" + android:visibility="visible" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/no_content_image" /> + - +