Skip to content

Commit

Permalink
* Stop using RelativeLayout in favor of ConstraintLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
Andr3Carvalh0 committed May 12, 2018
1 parent c8b6f40 commit 4c3d420
Show file tree
Hide file tree
Showing 14 changed files with 167 additions and 236 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
3 changes: 2 additions & 1 deletion app/src/main/java/io/mgba/Adapters/GameAdapter.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/io/mgba/Adapters/SettingsAdapter.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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");
}
}

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/io/mgba/UI/Views/GameInformationView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;

Expand Down
38 changes: 25 additions & 13 deletions app/src/main/res/layout-land/category_element.xml
Original file line number Diff line number Diff line change
@@ -1,42 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="56dp">

<ImageView
android:id="@+id/setting_icon"
android:layout_width="52dp"
android:layout_height="24dp"
android:layout_height="0dp"
android:layout_above="@+id/separator"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="-52dp"
android:layout_toStartOf="@+id/setting_title"
android:scaleType="center"
android:tint="@color/about_libraries_primary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_palette_black_24dp" />

<TextView
android:id="@+id/setting_title"
android:layout_width="match_parent"
android:layout_height="@dimen/icon_settings_size"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/margin_start_separator_settings"
android:layout_marginStart="8dp"
android:paddingTop="2dp"
android:text="Lisbon"
android:textSize="16sp" />
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" />

<View
android:id="@+id/separator"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginEnd="4dp"
android:layout_marginStart="@dimen/margin_start_separator_settings"
android:background="#cecece" />
</RelativeLayout>
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" />
</android.support.constraint.ConstraintLayout>
20 changes: 14 additions & 6 deletions app/src/main/res/layout-land/content_fragment.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
Expand All @@ -16,7 +17,7 @@
app:twowayview_numRows="5"/>
</android.support.v4.widget.SwipeRefreshLayout>

<RelativeLayout
<android.support.constraint.ConstraintLayout
android:id="@+id/no_content_container"
android:layout_width="match_parent"

Expand All @@ -27,17 +28,24 @@
android:layout_width="@dimen/message_width"
android:layout_height="@dimen/message_width"
android:layout_centerInParent="true"
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" />

<TextView
android:id="@+id/no_content_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/no_content_image"
android:layout_alignStart="@+id/no_content_image"
android:layout_below="@+id/no_content_image"
android:layout_alignStart="@+id/no_content_image"
android:layout_alignEnd="@+id/no_content_image"
android:text="@string/no_games"
android:textAlignment="center"
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
</RelativeLayout>
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" />
</android.support.constraint.ConstraintLayout>
</FrameLayout>
142 changes: 0 additions & 142 deletions app/src/main/res/layout-land/library_sheet_view.xml

This file was deleted.

17 changes: 11 additions & 6 deletions app/src/main/res/layout/activity_library.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
<android.support.constraint.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
Expand Down Expand Up @@ -30,20 +30,25 @@
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/tabLayout" />
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" />

<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="@+id/toolbar_container"
android:layout_alignParentStart="true"
android:background="@color/colorPrimary"
android:elevation="@dimen/default_elevation"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:tabIndicatorColor="@android:color/white" />
app:layout_constraintTop_toBottomOf="@+id/toolbar_container"
app:tabIndicatorColor="@android:color/white"
tools:layout_editor_absoluteX="16dp" />

</RelativeLayout>
</android.support.constraint.ConstraintLayout>

Loading

0 comments on commit 4c3d420

Please sign in to comment.