Back button for media picker item fragment.

This commit is contained in:
Anton Chekulaev 2020-09-18 14:26:33 +10:00
parent c9db8c6fc9
commit 1411c03a7f
2 changed files with 7 additions and 3 deletions

View File

@ -21,7 +21,6 @@ import android.annotation.TargetApi;
import androidx.appcompat.app.ActionBar;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelProviders;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;

View File

@ -1,5 +1,6 @@
package org.thoughtcrime.securesms.mediasend;
import androidx.appcompat.app.ActionBar;
import androidx.lifecycle.ViewModelProviders;
import android.content.Context;
import android.content.res.Configuration;
@ -166,8 +167,12 @@ public class MediaPickerItemFragment extends Fragment implements MediaPickerItem
}
private void initToolbar(Toolbar toolbar) {
((AppCompatActivity) requireActivity()).setSupportActionBar(toolbar);
((AppCompatActivity) requireActivity()).getSupportActionBar().setTitle(folderTitle);
AppCompatActivity activity = (AppCompatActivity) requireActivity();
activity.setSupportActionBar(toolbar);
ActionBar actionBar = activity.getSupportActionBar();
actionBar.setTitle(folderTitle);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
toolbar.setNavigationOnClickListener(v -> requireActivity().onBackPressed());
}