use of androidx.appcompat.widget.AppCompatButton in project simperium-android by Simperium.
the class LoginBottomSheetDialogFragment method onCreateView.
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View layout = inflater.inflate(R.layout.sheet_login, null);
AppCompatButton buttonEmail = layout.findViewById(R.id.button_email);
buttonEmail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mLoginSheetListener.onLoginSheetEmailClicked();
}
});
AppCompatButton buttonOther = layout.findViewById(R.id.button_other);
buttonOther.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mLoginSheetListener.onLoginSheetOtherClicked();
}
});
if (getDialog() != null) {
getDialog().setContentView(layout);
// Set peek height to full height of view (i.e. set STATE_EXPANDED) to avoid buttons
// being off screen when bottom sheet is shown.
getDialog().setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
BottomSheetDialog bottomSheetDialog = (BottomSheetDialog) dialogInterface;
FrameLayout bottomSheet = bottomSheetDialog.findViewById(com.google.android.material.R.id.design_bottom_sheet);
if (bottomSheet != null) {
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet);
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
behavior.setSkipCollapsed(true);
}
}
});
}
return super.onCreateView(inflater, container, savedInstanceState);
}
use of androidx.appcompat.widget.AppCompatButton in project android by owncloud.
the class ExpandableUploadListAdapter method getGroupView.
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
// force group to stay unfolded
ExpandableListView listView = (ExpandableListView) parent;
listView.expandGroup(groupPosition);
listView.setGroupIndicator(null);
UploadGroup group = (UploadGroup) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mParentActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.upload_list_group, null);
// Allow or disallow touches with other visible windows
convertView.setFilterTouchesWhenObscured(PreferenceUtils.shouldDisallowTouchesWithOtherVisibleWindows(mParentActivity));
}
TextView tvGroupName = convertView.findViewById(R.id.uploadListGroupName);
TextView tvFileCount = convertView.findViewById(R.id.textViewFileCount);
AppCompatButton clear = convertView.findViewById(R.id.uploadListGroupButtonClear);
AppCompatButton retry = convertView.findViewById(R.id.uploadListGroupButtonRetry);
int stringResFileCount = group.getGroupCount() == 1 ? R.string.uploads_view_group_file_count_single : R.string.uploads_view_group_file_count;
String fileCountText = String.format(mParentActivity.getString(stringResFileCount), group.getGroupCount());
tvGroupName.setText(group.getGroupName());
tvFileCount.setText(fileCountText);
if (group.name.equals(mParentActivity.getString(R.string.uploads_view_group_failed_uploads))) {
clear.setVisibility(View.VISIBLE);
clear.setText(mParentActivity.getString(R.string.action_upload_clear));
clear.setOnClickListener(v -> mOptionsInUploadListClickListener.onClick(UploadListFragment.OptionsInUploadList.CLEAR_FAILED));
retry.setVisibility(View.VISIBLE);
retry.setText(mParentActivity.getString(R.string.action_upload_retry));
retry.setOnClickListener(v -> mOptionsInUploadListClickListener.onClick(UploadListFragment.OptionsInUploadList.RETRY_FAILED));
} else if (group.name.equals(mParentActivity.getString(R.string.uploads_view_group_finished_uploads))) {
clear.setVisibility(View.VISIBLE);
clear.setText(mParentActivity.getString(R.string.action_upload_clear));
clear.setOnClickListener(v -> mOptionsInUploadListClickListener.onClick(UploadListFragment.OptionsInUploadList.CLEAR_SUCCESSFUL));
retry.setVisibility(View.GONE);
} else {
clear.setVisibility(View.GONE);
retry.setVisibility(View.GONE);
}
return convertView;
}
Aggregations