Skip to content

Commit 09468f0

Browse files
committed
Fixed Settings back button
1 parent c97cb47 commit 09468f0

File tree

9 files changed

+254
-230
lines changed

9 files changed

+254
-230
lines changed
0 Bytes
Binary file not shown.

app/.idea/workspace.xml

Lines changed: 225 additions & 217 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ dependencies {
4747
compile 'com.github.QuadFlask:colorpicker:0.0.13'
4848

4949
compile 'com.google.firebase:firebase-storage:15.0.2'
50-
compile 'com.google.firebase:firebase-auth:15.0.0'
50+
compile 'com.google.firebase:firebase-auth:15.1.0'
5151
compile 'com.google.android.gms:play-services-auth:15.0.0'
5252
compile 'com.google.android.gms:play-services-games:15.0.0'
5353
compile 'com.google.firebase:firebase-messaging:15.0.2'
5454
compile 'com.google.firebase:firebase-database:15.0.0'
55-
compile 'com.google.firebase:firebase-perf:15.0.0'
55+
compile 'com.google.firebase:firebase-perf:15.1.0'
5656
compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
5757
transitive = true
5858
}

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
android:theme="@style/AppTheme">
5757
<intent-filter>
5858
<action android:name="android.intent.action.MAIN" />
59-
6059
<category android:name="android.intent.category.LAUNCHER" />
6160
</intent-filter>
6261
</activity>

app/src/main/java/com/example/caden/drawingtest/DrawingActivity.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,7 @@ public void nextImage(View v) {
740740
mStorageRef.getBytes(FIVE_HUNDRED_KILOBYTE).addOnSuccessListener(bytes -> {
741741
SharedData.imgData = bytes;
742742
clear(v);
743-
}).addOnFailureListener(exception -> {
744-
});
743+
}).addOnFailureListener(exception -> {});
745744
}
746-
747745
}
748746
}

app/src/main/java/com/example/caden/drawingtest/RVHistoryAdapter.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
package com.example.caden.drawingtest;
22

33
import android.graphics.Bitmap;
4+
import android.graphics.Color;
45
import android.support.v7.widget.RecyclerView;
56
import android.util.SparseArray;
67
import android.view.LayoutInflater;
78
import android.view.View;
89
import android.view.ViewGroup;
910
import android.widget.ImageView;
11+
import android.widget.LinearLayout;
1012
import android.widget.TextView;
1113

1214
import java.util.ArrayList;
1315
import java.util.List;
1416
import java.util.Locale;
17+
import java.util.Random;
1518

1619
public class RVHistoryAdapter extends RecyclerView.Adapter<RVHistoryAdapter.HistoryViewHolder> {
1720

1821
private List<Wurm> wurms;
1922
private SparseArray<Bitmap> bmps;
23+
private static String[] colors =
24+
{"#009688", "#8BC34A", "#FFEB3B", "#FFC107", "#03A9F4", "#795548", "#9C27B0", "#00BCD4"};
25+
private static Random rand = new Random();
2026

2127
RVHistoryAdapter() {
2228
this.wurms = new ArrayList<>();
@@ -58,13 +64,16 @@ public int getItemCount() {
5864

5965
static class HistoryViewHolder extends RecyclerView.ViewHolder {
6066

67+
private LinearLayout llHistory;
6168
private ImageView ivHistory;
6269
private TextView tvDateTime;
6370
private TextView tvFileName;
6471
private TextView tvItemNo;
6572

6673
HistoryViewHolder(View itemView) {
6774
super(itemView);
75+
llHistory = itemView.findViewById(R.id.ll_history);
76+
llHistory.setBackgroundColor(Color.parseColor(colors[rand.nextInt(colors.length)]));
6877
ivHistory = itemView.findViewById(R.id.iv_history);
6978
tvDateTime = itemView.findViewById(R.id.tv_date_time);
7079
tvFileName = itemView.findViewById(R.id.tv_file_name);

app/src/main/java/com/example/caden/drawingtest/SettingsActivity.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ protected void onCreate(Bundle savedInstanceState) {
6868
user = FirebaseAuth.getInstance().getCurrentUser();
6969
getFragmentManager().beginTransaction().replace(android.R.id.content,
7070
new WurmPrefFragment()).commit();
71+
7172
ActionBar actionBar = getSupportActionBar();
7273
if (actionBar != null) {
7374
actionBar.setDisplayHomeAsUpEnabled(true);
@@ -82,15 +83,12 @@ protected void onCreate(Bundle savedInstanceState) {
8283
}
8384

8485
@Override
85-
public boolean onMenuItemSelected(int featureId, MenuItem item) {
86-
int id = item.getItemId();
87-
if (id == android.R.id.home) {
88-
if (!super.onMenuItemSelected(featureId, item)) {
89-
NavUtils.navigateUpFromSameTask(this);
90-
}
86+
public boolean onOptionsItemSelected(MenuItem item) {
87+
if (item.getItemId() == android.R.id.home) {
88+
onBackPressed();
9189
return true;
9290
}
93-
return super.onMenuItemSelected(featureId, item);
91+
return super.onOptionsItemSelected(item);
9492
}
9593

9694
@Override

app/src/main/res/layout/activity_history.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:tools="http://schemas.android.com/tools"
66
android:layout_width="match_parent"
77
android:layout_height="match_parent"
8+
android:background="#607D8B"
89
tools:context=".HistoryActivity">
910
<android.support.v7.widget.RecyclerView
1011
android:id="@+id/rv_history"

app/src/main/res/layout/item_history_row.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@
2222
android:layout_width="match_parent"
2323
android:layout_height="wrap_content">
2424

25+
<LinearLayout
26+
android:id="@+id/ll_history"
27+
android:layout_width="match_parent"
28+
android:layout_height="wrap_content"
29+
android:background="#FFEB3B"
30+
android:minHeight="3dp"
31+
android:orientation="horizontal"
32+
app:layout_constraintEnd_toEndOf="parent"
33+
app:layout_constraintStart_toStartOf="parent"
34+
app:layout_constraintTop_toTopOf="parent" />
35+
2536
<ImageView
2637
android:id="@+id/iv_history"
2738
android:layout_width="128dp"

0 commit comments

Comments
 (0)