Skip to content

Commit

Permalink
fix: Back button in SettingsActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
deltazefiro committed Feb 10, 2024
1 parent 38571a7 commit ad3bfb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.os.Bundle;
import android.widget.Toolbar;

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
Expand All @@ -10,6 +11,8 @@
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen;

import com.google.android.material.appbar.MaterialToolbar;

import java.util.Objects;

import deltazero.amarok.AmarokActivity;
Expand Down Expand Up @@ -45,6 +48,8 @@ protected void onCreate(Bundle savedInstanceState) {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true);

MaterialToolbar toolbar = findViewById(R.id.settings_tb_toolbar);
toolbar.setNavigationOnClickListener(v -> finish());
}

@Override
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
android:fitsSystemWindows="true">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/settings_tb_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_back"
Expand Down

0 comments on commit ad3bfb5

Please sign in to comment.