Simplification, dialog fragment for quick setup

This commit is contained in:
M66B
2019-07-01 16:27:22 +02:00
parent 44fa9c4ce0
commit 53a71bd632
19 changed files with 90 additions and 160 deletions

View File

@@ -21,8 +21,6 @@ package eu.faircode.email;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -30,18 +28,15 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import static android.app.Activity.RESULT_CANCELED;
import static android.app.Activity.RESULT_OK;
public class FragmentDialogFolder extends DialogFragment {
public class FragmentDialogFolder extends DialogFragmentEx {
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
@@ -76,8 +71,7 @@ public class FragmentDialogFolder extends DialogFragment {
folders = new ArrayList<>();
long account = args.getLong("account");
AdapterFolder adapter = new AdapterFolder(
getContext(), getActivity(),
AdapterFolder adapter = new AdapterFolder(getContext(), getActivity(),
account, false, new AdapterFolder.IFolderSelectedListener() {
@Override
public void onFolderSelected(TupleFolderEx folder) {
@@ -108,21 +102,6 @@ public class FragmentDialogFolder extends DialogFragment {
return new AlertDialog.Builder(getContext())
.setTitle(title)
.setView(dview)
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
sendResult(RESULT_CANCELED);
}
})
.create();
}
private void sendResult(int result) {
Fragment target = getTargetFragment();
if (target != null) {
Intent data = new Intent();
data.putExtra("args", getArguments());
target.onActivityResult(getTargetRequestCode(), result, data);
}
}
}