Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;

import com.google.android.material.dialog.MaterialAlertDialogBuilder;
Expand All @@ -59,6 +57,7 @@
import com.owncloud.android.ui.adapter.RichDocumentsTemplateAdapter;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.KeyboardUtils;
import com.owncloud.android.utils.NextcloudServer;
import com.owncloud.android.utils.theme.ViewThemeUtils;

Expand Down Expand Up @@ -90,6 +89,7 @@ public class ChooseRichDocumentsTemplateDialogFragment extends DialogFragment im
@Inject ClientFactory clientFactory;
@Inject ViewThemeUtils viewThemeUtils;
@Inject FileDataStorageManager fileDataStorageManager;
@Inject KeyboardUtils keyboardUtils;
private RichDocumentsTemplateAdapter adapter;
private OCFile parentFolder;
private OwnCloudClient client;
Expand Down Expand Up @@ -128,6 +128,12 @@ public void onStart() {
checkEnablingCreateButton();
}

@Override
public void onResume() {
super.onResume();
keyboardUtils.showKeyboardForEditText(binding.filename);
}

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Expand Down Expand Up @@ -160,7 +166,6 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
binding = ChooseTemplateBinding.inflate(inflater, null, false);
View view = binding.getRoot();

binding.filename.requestFocus();
viewThemeUtils.material.colorTextInputLayout(binding.filenameContainer);

Type type = Type.valueOf(arguments.getString(ARG_TYPE));
Expand Down Expand Up @@ -219,15 +224,7 @@ public void afterTextChanged(Editable s) {

viewThemeUtils.dialog.colorMaterialAlertDialogBackground(activity, builder);

Dialog dialog = builder.create();

Window window = dialog.getWindow();

if (window != null) {
window.setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}

return dialog;
return builder.create();
}

private int getTitle(Type type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.View
import android.view.WindowManager
import android.widget.Button
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
Expand Down Expand Up @@ -59,6 +58,7 @@ import com.owncloud.android.ui.activity.TextEditorWebView
import com.owncloud.android.ui.adapter.TemplateAdapter
import com.owncloud.android.utils.DisplayUtils
import com.owncloud.android.utils.FileStorageUtils
import com.owncloud.android.utils.KeyboardUtils
import com.owncloud.android.utils.theme.ViewThemeUtils
import java.lang.ref.WeakReference
import javax.inject.Inject
Expand All @@ -82,6 +82,9 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem
@Inject
lateinit var viewThemeUtils: ViewThemeUtils

@Inject
lateinit var keyboardUtils: KeyboardUtils

private var adapter: TemplateAdapter? = null
private var parentFolder: OCFile? = null
private var title: String? = null
Expand Down Expand Up @@ -112,6 +115,11 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem
checkEnablingCreateButton()
}

override fun onResume() {
super.onResume()
keyboardUtils.showKeyboardForEditText(binding.filename)
}

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val arguments = arguments ?: throw IllegalArgumentException("Arguments may not be null")
val activity = activity ?: throw IllegalArgumentException("Activity may not be null")
Expand All @@ -131,7 +139,6 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem
_binding = ChooseTemplateBinding.inflate(inflater, null, false)
val view: View = binding.root

binding.filename.requestFocus()
viewThemeUtils.material.colorTextInputLayout(
binding.filenameContainer
)
Expand Down Expand Up @@ -171,10 +178,7 @@ class ChooseTemplateDialogFragment : DialogFragment(), View.OnClickListener, Tem

viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.list.context, builder)

val dialog: Dialog = builder.create()
val window = dialog.window
window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
return dialog
return builder.create()
}

@Suppress("TooGenericExceptionCaught") // legacy code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;
import android.widget.TextView;

Expand All @@ -43,6 +41,7 @@
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.ui.activity.ComponentsGetter;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.KeyboardUtils;
import com.owncloud.android.utils.theme.ViewThemeUtils;

import java.util.List;
Expand All @@ -68,11 +67,15 @@ public class CreateFolderDialogFragment

@Inject FileDataStorageManager fileDataStorageManager;
@Inject ViewThemeUtils viewThemeUtils;
@Inject KeyboardUtils keyboardUtils;


private OCFile mParentFolder;
private Button positiveButton;


private EditBoxDialogBinding binding;

/**
* Public factory method to create new CreateFolderDialogFragment instances.
*
Expand Down Expand Up @@ -102,19 +105,24 @@ public void onStart() {
}
}

@Override
public void onResume() {
super.onResume();
keyboardUtils.showKeyboardForEditText(binding.userInput);
}

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mParentFolder = getArguments().getParcelable(ARG_PARENT_FOLDER);

// Inflate the layout for the dialog
LayoutInflater inflater = requireActivity().getLayoutInflater();
EditBoxDialogBinding binding = EditBoxDialogBinding.inflate(inflater, null, false);
binding = EditBoxDialogBinding.inflate(inflater, null, false);
View view = binding.getRoot();

// Setup layout
binding.userInput.setText("");
binding.userInput.requestFocus();
viewThemeUtils.material.colorTextInputLayout(binding.userInputContainer);

OCFile parentFolder = requireArguments().getParcelable(ARG_PARENT_FOLDER);
Expand Down Expand Up @@ -175,14 +183,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {

viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.userInputContainer.getContext(), builder);

AlertDialog d = builder.create();

Window window = d.getWindow();
if (window != null) {
window.setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}

return d;
return builder.create();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.nextcloud.client.account.User;
Expand Down Expand Up @@ -92,15 +90,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {

viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.getRoot().getContext(), builder);

Dialog dialog = builder.create();

Window window = dialog.getWindow();

if (window != null) {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}

return dialog;
return builder.create();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager.LayoutParams;

import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.nextcloud.client.di.Injectable;
Expand All @@ -36,6 +34,7 @@
import com.owncloud.android.lib.resources.shares.OCShare;
import com.owncloud.android.ui.activity.ComponentsGetter;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.KeyboardUtils;
import com.owncloud.android.utils.theme.ViewThemeUtils;

import javax.inject.Inject;
Expand All @@ -53,6 +52,7 @@ public class NoteDialogFragment extends DialogFragment implements DialogInterfac
private static final String ARG_SHARE = "SHARE";

@Inject ViewThemeUtils viewThemeUtils;
@Inject KeyboardUtils keyboardUtils;

private OCShare share;
private NoteDialogBinding binding;
Expand Down Expand Up @@ -87,6 +87,12 @@ public void onStart() {
alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
}

@Override
public void onResume() {
super.onResume();
keyboardUtils.showKeyboardForEditText(binding.noteText);
}

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Expand All @@ -97,7 +103,6 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {

// Setup layout
binding.noteText.setText(share.getNote());
binding.noteText.requestFocus();
viewThemeUtils.material.colorTextInputLayout(binding.noteContainer);

// Build the dialog
Expand All @@ -109,15 +114,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {

viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.noteContainer.getContext(), builder);

Dialog dialog = builder.create();

Window window = dialog.getWindow();

if (window != null) {
window.setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}

return dialog;
return builder.create();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;

import com.google.android.material.dialog.MaterialAlertDialogBuilder;
Expand All @@ -48,6 +46,7 @@
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.ui.activity.ComponentsGetter;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.KeyboardUtils;
import com.owncloud.android.utils.theme.ViewThemeUtils;

import java.util.List;
Expand All @@ -73,6 +72,7 @@ public class RenameFileDialogFragment

@Inject ViewThemeUtils viewThemeUtils;
@Inject FileDataStorageManager fileDataStorageManager;
@Inject KeyboardUtils keyboardUtils;

private EditBoxDialogBinding binding;
private OCFile mTargetFile;
Expand Down Expand Up @@ -107,6 +107,12 @@ public void onStart() {
}
}

@Override
public void onResume() {
super.onResume();
keyboardUtils.showKeyboardForEditText(binding.userInput);
}

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Expand All @@ -124,7 +130,6 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
int extensionStart = mTargetFile.isFolder() ? -1 : currentName.lastIndexOf('.');
int selectionEnd = extensionStart >= 0 ? extensionStart : currentName.length();
binding.userInput.setSelection(0, selectionEnd);
binding.userInput.requestFocus();

OCFile parentFolder = requireArguments().getParcelable(ARG_PARENT_FOLDER);
List<OCFile> folderContent = fileDataStorageManager.getFolderContent(parentFolder, false);
Expand Down Expand Up @@ -181,14 +186,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {

viewThemeUtils.dialog.colorMaterialAlertDialogBackground(binding.userInputContainer.getContext(), builder);

Dialog d = builder.create();

Window window = d.getWindow();
if (window != null) {
window.setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}

return d;
return builder.create();
}


Expand Down
Loading