mirror of https://codeberg.org/gitnex/GitNex.git
54 lines
1.5 KiB
Java
54 lines
1.5 KiB
Java
package org.mian.gitnex.fragments;
|
|
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
|
import org.mian.gitnex.databinding.BottomSheetAdminUsersBinding;
|
|
|
|
/**
|
|
* Author M M Arif
|
|
*/
|
|
|
|
public class BottomSheetAdminUsersFragment extends BottomSheetDialogFragment {
|
|
|
|
private BottomSheetAdminUsersFragment.BottomSheetListener bmListener;
|
|
|
|
@Nullable
|
|
@Override
|
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
|
|
BottomSheetAdminUsersBinding bottomSheetAdminUsersBinding = BottomSheetAdminUsersBinding.inflate(inflater, container, false);
|
|
|
|
bottomSheetAdminUsersBinding.createNewUser.setOnClickListener(v1 -> {
|
|
|
|
bmListener.onButtonClicked("newUser");
|
|
dismiss();
|
|
|
|
});
|
|
|
|
return bottomSheetAdminUsersBinding.getRoot();
|
|
}
|
|
|
|
public interface BottomSheetListener {
|
|
void onButtonClicked(String text);
|
|
}
|
|
|
|
@Override
|
|
public void onAttach(@NonNull Context context) {
|
|
super.onAttach(context);
|
|
|
|
try {
|
|
bmListener = (BottomSheetAdminUsersFragment.BottomSheetListener) context;
|
|
}
|
|
catch (ClassCastException e) {
|
|
throw new ClassCastException(context.toString() + " must implement BottomSheetListener");
|
|
}
|
|
}
|
|
|
|
}
|