From 1e5d70cfd881652a7675fdb44358a41714e77df1 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Wed, 28 Oct 2020 09:13:55 +0800 Subject: Fix some issues in toolbars. --- .../Activity/CommentFullMarkdownActivity.java | 16 ++++++++++++++++ .../infinityforreddit/Activity/GiveAwardActivity.java | 15 +++++++++++++++ 2 files changed, 31 insertions(+) (limited to 'app/src/main') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentFullMarkdownActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentFullMarkdownActivity.java index 0cf15283..9d8f1f6f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentFullMarkdownActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/CommentFullMarkdownActivity.java @@ -12,6 +12,7 @@ import android.text.TextPaint; import android.text.style.ClickableSpan; import android.text.style.SuperscriptSpan; import android.text.util.Linkify; +import android.view.MenuItem; import android.view.View; import android.view.Window; import android.view.WindowManager; @@ -87,6 +88,11 @@ public class CommentFullMarkdownActivity extends BaseActivity { applyCustomTheme(); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + setTitle(" "); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) { mSlidrInterface = Slidr.attach(this); } @@ -232,6 +238,16 @@ public class CommentFullMarkdownActivity extends BaseActivity { markwonAdapter.notifyDataSetChanged(); } + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } + + return false; + } + @Override protected SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/GiveAwardActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/GiveAwardActivity.java index 803743aa..9b8fec82 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/GiveAwardActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/GiveAwardActivity.java @@ -8,10 +8,12 @@ import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.view.LayoutInflater; +import android.view.MenuItem; import android.view.View; import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.NonNull; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.recyclerview.widget.LinearLayoutManager; @@ -85,6 +87,9 @@ public class GiveAwardActivity extends BaseActivity { applyCustomTheme(); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) { Slidr.attach(this); } @@ -177,6 +182,16 @@ public class GiveAwardActivity extends BaseActivity { recyclerView.setAdapter(adapter); } + @Override + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if (item.getItemId() == android.R.id.home) { + finish(); + return true; + } + + return false; + } + @Override protected SharedPreferences getDefaultSharedPreferences() { return mSharedPreferences; -- cgit v1.2.3