Search in sources :

Example 1 with MultipleAccountsBinding

use of com.owncloud.android.databinding.MultipleAccountsBinding in project android by nextcloud.

the class MultipleAccountsDialog method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Activity activity = getActivity();
    if (activity == null) {
        throw new IllegalArgumentException("Activity may not be null");
    }
    // Inflate the layout for the dialog
    LayoutInflater inflater = activity.getLayoutInflater();
    MultipleAccountsBinding binding = MultipleAccountsBinding.inflate(inflater, null, false);
    final ReceiveExternalFilesActivity parent = (ReceiveExternalFilesActivity) getActivity();
    AlertDialog.Builder builder = new AlertDialog.Builder(parent);
    UserListAdapter adapter = new UserListAdapter(parent, accountManager, getAccountListItems(), this, false, false);
    binding.list.setHasFixedSize(true);
    binding.list.setLayoutManager(new LinearLayoutManager(activity));
    binding.list.setAdapter(adapter);
    builder.setView(binding.getRoot()).setTitle(R.string.common_choose_account);
    Dialog dialog = builder.create();
    Window window = dialog.getWindow();
    if (window != null) {
        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    }
    return dialog;
}
Also used : AlertDialog(androidx.appcompat.app.AlertDialog) Window(android.view.Window) AlertDialog(androidx.appcompat.app.AlertDialog) Dialog(android.app.Dialog) LayoutInflater(android.view.LayoutInflater) ReceiveExternalFilesActivity(com.owncloud.android.ui.activity.ReceiveExternalFilesActivity) Activity(android.app.Activity) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) ReceiveExternalFilesActivity(com.owncloud.android.ui.activity.ReceiveExternalFilesActivity) MultipleAccountsBinding(com.owncloud.android.databinding.MultipleAccountsBinding) UserListAdapter(com.owncloud.android.ui.adapter.UserListAdapter) NonNull(androidx.annotation.NonNull)

Aggregations

Activity (android.app.Activity)1 Dialog (android.app.Dialog)1 LayoutInflater (android.view.LayoutInflater)1 Window (android.view.Window)1 NonNull (androidx.annotation.NonNull)1 AlertDialog (androidx.appcompat.app.AlertDialog)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 MultipleAccountsBinding (com.owncloud.android.databinding.MultipleAccountsBinding)1 ReceiveExternalFilesActivity (com.owncloud.android.ui.activity.ReceiveExternalFilesActivity)1 UserListAdapter (com.owncloud.android.ui.adapter.UserListAdapter)1