Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Add the back button to all the screens #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/src/main/java/com/snatik/matches/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@


import android.graphics.Bitmap;
import android.media.Image;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.snatik.matches.common.Shared;
import com.snatik.matches.engine.Engine;
Expand All @@ -18,6 +21,7 @@
public class MainActivity extends FragmentActivity {

private ImageView mBackgroundImage;
private LinearLayout mBackButton;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -29,6 +33,7 @@ protected void onCreate(Bundle savedInstanceState) {

setContentView(R.layout.activity_main);
mBackgroundImage = (ImageView) findViewById(R.id.background_image);
mBackButton = (LinearLayout) findViewById(R.id.back_button);

Shared.activity = this;
Shared.engine.start();
Expand All @@ -40,7 +45,12 @@ protected void onCreate(Bundle savedInstanceState) {
// set menu
ScreenController.getInstance().openScreen(Screen.MENU);


mBackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}

@Override
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/com/snatik/matches/ui/PopupManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ public static void showPopupSettings() {
imageView.setBackgroundColor(Color.parseColor("#88555555"));
imageView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
imageView.setClickable(true);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
closePopup();
}
});
popupContainer.addView(imageView);

// popup
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
android:id="@+id/background_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
android:scaleType="centerCrop"></ImageView>

<include
android:id="@+id/back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
layout="@layout/back_button"/>

<FrameLayout
android:id="@+id/fragment_container"
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/res/layout/back_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:id="@id/back_button"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_margin="8dp"
android:src="@drawable/button_back">
</ImageView>

</LinearLayout>