mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 05:35:39 +03:00
Use dynamic titles
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
cdc611a71e
commit
3253e1356f
5 changed files with 22 additions and 7 deletions
|
@ -165,7 +165,7 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
|
|||
builder.setView(view)
|
||||
.setPositiveButton(R.string.create, null)
|
||||
.setNeutralButton(R.string.common_cancel, null)
|
||||
.setTitle(R.string.select_template);
|
||||
.setTitle(getTitle(type));
|
||||
Dialog dialog = builder.create();
|
||||
|
||||
Window window = dialog.getWindow();
|
||||
|
@ -177,6 +177,18 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
|
|||
return dialog;
|
||||
}
|
||||
|
||||
private int getTitle(Type type) {
|
||||
if (type == Type.DOCUMENT) {
|
||||
return R.string.create_new_document;
|
||||
} else if (type == Type.SPREADSHEET) {
|
||||
return R.string.create_new_spreadsheet;
|
||||
} else if (type == Type.PRESENTATION) {
|
||||
return R.string.create_new_presentation;
|
||||
}
|
||||
|
||||
return R.string.select_template;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
|
|
@ -81,6 +81,7 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
|
|||
|
||||
private static final String ARG_PARENT_FOLDER = "PARENT_FOLDER";
|
||||
private static final String ARG_CREATOR = "CREATOR";
|
||||
private static final String ARG_HEADLINE = "HEADLINE";
|
||||
private static final String TAG = ChooseTemplateDialogFragment.class.getSimpleName();
|
||||
private static final String DOT = ".";
|
||||
|
||||
|
@ -99,11 +100,12 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
|
|||
|
||||
ChooseTemplateBinding binding;
|
||||
|
||||
public static ChooseTemplateDialogFragment newInstance(OCFile parentFolder, Creator creator) {
|
||||
public static ChooseTemplateDialogFragment newInstance(OCFile parentFolder, Creator creator, String headline) {
|
||||
ChooseTemplateDialogFragment frag = new ChooseTemplateDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable(ARG_PARENT_FOLDER, parentFolder);
|
||||
args.putParcelable(ARG_CREATOR, creator);
|
||||
args.putString(ARG_HEADLINE, headline);
|
||||
frag.setArguments(args);
|
||||
return frag;
|
||||
}
|
||||
|
@ -139,6 +141,7 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
|
|||
|
||||
parentFolder = arguments.getParcelable(ARG_PARENT_FOLDER);
|
||||
creator = arguments.getParcelable(ARG_CREATOR);
|
||||
String headline = arguments.getString(ARG_HEADLINE, getString(R.string.select_template));
|
||||
|
||||
// Inflate the layout for the dialog
|
||||
LayoutInflater inflater = requireActivity().getLayoutInflater();
|
||||
|
@ -187,7 +190,7 @@ public class ChooseTemplateDialogFragment extends DialogFragment implements View
|
|||
builder.setView(view)
|
||||
.setPositiveButton(R.string.create, null)
|
||||
.setNeutralButton(R.string.common_cancel, null)
|
||||
.setTitle(R.string.select_template);
|
||||
.setTitle(headline);
|
||||
Dialog dialog = builder.create();
|
||||
|
||||
Window window = dialog.getWindow();
|
||||
|
|
|
@ -65,7 +65,7 @@ public interface OCFileListBottomSheetActions {
|
|||
/**
|
||||
* open template selection for creator @link Creator
|
||||
*/
|
||||
void showTemplate(Creator creator);
|
||||
void showTemplate(Creator creator, String headline);
|
||||
|
||||
/**
|
||||
* open editor for rich workspace
|
||||
|
|
|
@ -121,7 +121,7 @@ public class OCFileListBottomSheetDialog extends BottomSheetDialog {
|
|||
getContext()));
|
||||
|
||||
creatorView.setOnClickListener(v -> {
|
||||
actions.showTemplate(creator);
|
||||
actions.showTemplate(creator, creatorViewBinding.creatorName.getText().toString());
|
||||
dismiss();
|
||||
});
|
||||
|
||||
|
|
|
@ -565,8 +565,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void showTemplate(Creator creator) {
|
||||
ChooseTemplateDialogFragment.newInstance(mFile, creator).show(requireActivity().getSupportFragmentManager(),
|
||||
public void showTemplate(Creator creator, String headline) {
|
||||
ChooseTemplateDialogFragment.newInstance(mFile, creator, headline).show(requireActivity().getSupportFragmentManager(),
|
||||
DIALOG_CREATE_DOCUMENT);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue