firstTime argument in onShowDialog method
This commit is contained in:
parent
0170c3bb6a
commit
a52bc5f5e4
@ -34,7 +34,7 @@ public abstract class BaseDialogFragment extends DialogFragment {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
|
public AlertDialog onCreateDialog(@Nullable final Bundle savedInstanceState) {
|
||||||
final Preferences.Gui.Theme theme = Preferences.Gui.getTheme(preferences);
|
final Preferences.Gui.Theme theme = Preferences.Gui.getTheme(preferences);
|
||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
@ -47,13 +47,13 @@ public abstract class BaseDialogFragment extends DialogFragment {
|
|||||||
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onShow(DialogInterface d) {
|
public void onShow(DialogInterface d) {
|
||||||
onShowDialog(dialog);
|
onShowDialog(dialog, savedInstanceState == null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onShowDialog(@NonNull AlertDialog dialog) {
|
protected void onShowDialog(@NonNull AlertDialog dialog, boolean firstTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void onPrepareDialog(@NonNull AlertDialog.Builder builder);
|
protected abstract void onPrepareDialog(@NonNull AlertDialog.Builder builder);
|
||||||
|
@ -157,11 +157,13 @@ public class EditFunctionFragment extends BaseDialogFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onShowDialog(@NonNull AlertDialog dialog) {
|
protected void onShowDialog(@NonNull AlertDialog dialog, boolean firstTime) {
|
||||||
super.onShowDialog(dialog);
|
super.onShowDialog(dialog, firstTime);
|
||||||
|
|
||||||
|
if (firstTime) {
|
||||||
nameView.selectAll();
|
nameView.selectAll();
|
||||||
showIme(nameView);
|
showIme(nameView);
|
||||||
|
}
|
||||||
|
|
||||||
final Button ok = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
final Button ok = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||||
ok.setOnClickListener(new View.OnClickListener() {
|
ok.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -167,11 +167,13 @@ public class EditVariableFragment extends BaseDialogFragment implements Calculat
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onShowDialog(@NonNull AlertDialog dialog) {
|
protected void onShowDialog(@NonNull AlertDialog dialog, boolean firstTime) {
|
||||||
super.onShowDialog(dialog);
|
super.onShowDialog(dialog, firstTime);
|
||||||
|
|
||||||
|
if (firstTime) {
|
||||||
nameView.selectAll();
|
nameView.selectAll();
|
||||||
showIme(nameView);
|
showIme(nameView);
|
||||||
|
}
|
||||||
|
|
||||||
final Button ok = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
final Button ok = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
||||||
ok.setOnClickListener(new View.OnClickListener() {
|
ok.setOnClickListener(new View.OnClickListener() {
|
||||||
|
Loading…
Reference in New Issue
Block a user