Search in sources :

Example 6 with AppCompatButton

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);
}
Also used : BottomSheetDialog(com.google.android.material.bottomsheet.BottomSheetDialog) BottomSheetBehavior(com.google.android.material.bottomsheet.BottomSheetBehavior) DialogInterface(android.content.DialogInterface) FrameLayout(android.widget.FrameLayout) View(android.view.View) AppCompatButton(androidx.appcompat.widget.AppCompatButton) Nullable(androidx.annotation.Nullable)

Example 7 with AppCompatButton

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;
}
Also used : OnDatatransferProgressListener(com.owncloud.android.lib.common.network.OnDatatransferProgressListener) Observer(java.util.Observer) ImageButton(android.widget.ImageButton) ThumbnailsCacheManager(com.owncloud.android.datamodel.ThumbnailsCacheManager) Arrays(java.util.Arrays) DateUtils(android.text.format.DateUtils) ProgressBar(android.widget.ProgressBar) Uri(android.net.Uri) ImageView(android.widget.ImageView) OCFile(com.owncloud.android.datamodel.OCFile) PreferenceUtils(com.owncloud.android.utils.PreferenceUtils) BaseExpandableListAdapter(android.widget.BaseExpandableListAdapter) CancelUploadWithIdUseCase(com.owncloud.android.usecases.CancelUploadWithIdUseCase) View(android.view.View) DisplayUtils(com.owncloud.android.utils.DisplayUtils) PREF__CAMERA_UPLOADS_DEFAULT_PATH(com.owncloud.android.db.PreferenceManager.PREF__CAMERA_UPLOADS_DEFAULT_PATH) DataSetObserver(android.database.DataSetObserver) RetryUploadFromContentUriUseCase(com.owncloud.android.usecases.RetryUploadFromContentUriUseCase) TransferRequester(com.owncloud.android.files.services.TransferRequester) Account(android.accounts.Account) UploadStatus(com.owncloud.android.datamodel.UploadsStorageManager.UploadStatus) AppCompatButton(androidx.appcompat.widget.AppCompatButton) ViewGroup(android.view.ViewGroup) Timber(timber.log.Timber) OCUpload(com.owncloud.android.datamodel.OCUpload) TextView(android.widget.TextView) OwnCloudAccount(com.owncloud.android.lib.common.OwnCloudAccount) MainApp(com.owncloud.android.MainApp) DocumentFile(androidx.documentfile.provider.DocumentFile) UploadResult(com.owncloud.android.db.UploadResult) FileUploader(com.owncloud.android.files.services.FileUploader) Snackbar(com.google.android.material.snackbar.Snackbar) R(com.owncloud.android.R) MimetypeIconUtil(com.owncloud.android.utils.MimetypeIconUtil) Context(android.content.Context) FileActivity(com.owncloud.android.ui.activity.FileActivity) UploadsStorageManager(com.owncloud.android.datamodel.UploadsStorageManager) WorkManager(androidx.work.WorkManager) UploadListFragment(com.owncloud.android.ui.fragment.UploadListFragment) WeakReference(java.lang.ref.WeakReference) LayoutInflater(android.view.LayoutInflater) AccountUtils(com.owncloud.android.authentication.AccountUtils) File(java.io.File) OptionsInUploadListClickListener(com.owncloud.android.ui.fragment.OptionsInUploadListClickListener) Bitmap(android.graphics.Bitmap) ExpandableListView(android.widget.ExpandableListView) Comparator(java.util.Comparator) Observable(java.util.Observable) OnClickListener(android.view.View.OnClickListener) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) ExpandableListView(android.widget.ExpandableListView) AppCompatButton(androidx.appcompat.widget.AppCompatButton)

Aggregations

AppCompatButton (androidx.appcompat.widget.AppCompatButton)7 Context (android.content.Context)4 View (android.view.View)4 Uri (android.net.Uri)2 LayoutInflater (android.view.LayoutInflater)2 Button (android.widget.Button)2 EditText (android.widget.EditText)2 TextView (android.widget.TextView)2 Nullable (androidx.annotation.Nullable)2 R (com.amaze.filemanager.R)2 Account (android.accounts.Account)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 DataSetObserver (android.database.DataSetObserver)1 Bitmap (android.graphics.Bitmap)1 Color (android.graphics.Color)1 Typeface (android.graphics.Typeface)1 FingerprintManager (android.hardware.fingerprint.FingerprintManager)1 AsyncTask (android.os.AsyncTask)1