Java Code Examples for androidx.appcompat.widget.AppCompatImageButton#setOnClickListener()
The following examples show how to use
androidx.appcompat.widget.AppCompatImageButton#setOnClickListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainNavigationDrawer.java From onpc with GNU General Public License v3.0 | 6 votes |
private void updateItem(@NonNull final MenuItem m, final @DrawableRes int iconId, final String title, final ButtonListener editListener) { if (m.getActionView() != null && m.getActionView() instanceof LinearLayout) { final LinearLayout l = (LinearLayout)m.getActionView(); ((AppCompatImageView) l.findViewWithTag("ICON")).setImageResource(iconId); ((AppCompatTextView)l.findViewWithTag("TEXT")).setText(title); final AppCompatImageButton editBtn = l.findViewWithTag("EDIT"); if (editListener != null) { editBtn.setVisibility(View.VISIBLE); editBtn.setOnClickListener(v -> editListener.onEditItem()); Utils.setButtonEnabled(activity, editBtn, true); } else { editBtn.setVisibility(View.GONE); } } m.setVisible(true); }
Example 2
Source File: IntroduceActivity.java From Mysplash with GNU Lesser General Public License v3.0 | 6 votes |
private void initWidget() { AppCompatImageButton backBtn = findViewById(R.id.activity_introduce_backBtn); backBtn.setOnClickListener(v -> finishSelf(true)); if (introduceModelList.size() <= 1) { findViewById(R.id.activity_introduce_buttonBar).setVisibility(View.GONE); } setBottomButtonStyle(0); initPage(); InkPageIndicator indicator = findViewById(R.id.activity_introduce_indicator); if (introduceModelList.size() <= 1) { indicator.setAlpha(0f); } else { indicator.setViewPager(viewPager); indicator.setAlpha(1f); } }
Example 3
Source File: FrequencyButtonView.java From SmartPack-Kernel-Manager with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateView(View view) { AppCompatImageButton refresh = view.findViewById(R.id.frequency_refresh); AppCompatImageButton reset = view.findViewById(R.id.frequency_reset); AppCompatImageButton restore = view.findViewById(R.id.frequency_restore); refresh.setOnClickListener(v -> { rotate(v, false); if (mRefreshListener != null) { mRefreshListener.onClick(v); } }); reset.setOnClickListener(v -> { rotate(v, true); if (mResetListener != null) { mResetListener.onClick(v); } }); restore.setOnClickListener(v -> { rotate(v, true); if (mRestoreListener != null) { mRestoreListener.onClick(v); } }); setFullSpan(true); super.onCreateView(view); }
Example 4
Source File: FrequencyButtonView.java From MTweaks-KernelAdiutorMOD with GNU General Public License v3.0 | 5 votes |
@Override public void onCreateView(View view) { AppCompatImageButton refresh = view.findViewById(R.id.frequency_refresh); AppCompatImageButton reset = view.findViewById(R.id.frequency_reset); AppCompatImageButton restore = view.findViewById(R.id.frequency_restore); refresh.setOnClickListener(v -> { rotate(v, false); if (mRefreshListener != null) { mRefreshListener.onClick(v); } }); reset.setOnClickListener(v -> { rotate(v, true); if (mResetListener != null) { mResetListener.onClick(v); } }); restore.setOnClickListener(v -> { rotate(v, true); if (mRestoreListener != null) { mRestoreListener.onClick(v); } }); setFullSpan(true); super.onCreateView(view); }
Example 5
Source File: ApplicationsDialogPreferenceFragmentX.java From PhoneProfilesPlus with Apache License 2.0 | 5 votes |
@Override protected void onBindDialogView(View view) { super.onBindDialogView(view); AppCompatImageButton addButton = view.findViewById(R.id.applications_pref_dlg_add); TooltipCompat.setTooltipText(addButton, getString(R.string.applications_pref_dlg_add_button_tooltip)); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext()); applicationsListView = view.findViewById(R.id.applications_pref_dlg_listview); //applicationsListView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL)); applicationsListView.setLayoutManager(layoutManager); applicationsListView.setHasFixedSize(true); linlaProgress = view.findViewById(R.id.applications_pref_dlg_linla_progress); rellaDialog = view.findViewById(R.id.applications_pref_dlg_rella_dialog); listAdapter = new ApplicationsDialogPreferenceAdapterX(prefContext, preference, this); // added touch helper for drag and drop items ItemTouchHelper.Callback callback = new ItemTouchHelperCallback(listAdapter, false, false); itemTouchHelper = new ItemTouchHelper(callback); itemTouchHelper.attachToRecyclerView(applicationsListView); addButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { preference.startEditor(null); } }); refreshListView(false); }
Example 6
Source File: UpdateChannelActivity.java From SmartFlasher with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_updatechannel); mCardView = findViewById(R.id.updatechannel_card); AppCompatImageButton mBack = findViewById(R.id.back_button); mBack.setOnClickListener(v -> onBackPressed()); AppCompatImageButton mSave = findViewById(R.id.save_button); mSave.setOnClickListener(v -> { if (Utils.checkWriteStoragePermission(this)) { if (mKernelNameHint.getText() != null && !mKernelNameHint.getText().toString().equals("") && mKernelVersionHint.getText() != null && !mKernelVersionHint.getText().toString().equals("") && mDownloadLinkHint.getText() != null && !mDownloadLinkHint.getText().toString().equals("")) { saveUpdateChannel(); } else { Utils.snackbar(mCardView, getString(R.string.update_channel_create_abort)); } } else { ActivityCompat.requestPermissions(this, new String[]{ Manifest.permission.WRITE_EXTERNAL_STORAGE},1); Utils.snackbar(mCardView, getString(R.string.permission_denied_write_storage)); } }); AppCompatTextView mClearAll = findViewById(R.id.clear_all); mClearAll.setOnClickListener(v -> { if (isTextEntered()) { new Dialog(this) .setMessage(getString(R.string.clear_all_summary) + " " + getString(R.string.sure_question)) .setNegativeButton(getString(R.string.cancel), (dialog1, id1) -> { }) .setPositiveButton(getString(R.string.yes), (dialog1, id1) -> { clearAll(); }) .show(); } else { Utils.snackbar(mCardView, getString(R.string.clear_all_abort_message)); } }); mKernelNameHint = findViewById(R.id.kernel_name_hint); mKernelVersionHint = findViewById(R.id.kernel_version_hint); mDownloadLinkHint = findViewById(R.id.download_link_hint); mChangelogHint = findViewById(R.id.changelog_hint); mSHA1Hint = findViewById(R.id.sha1_hint); mSupportHint = findViewById(R.id.support_hint); mDonationHint = findViewById(R.id.donation_link_hint); }
Example 7
Source File: UpdateChannelActivity.java From SmartPack-Kernel-Manager with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_updatechannel); mCardView = findViewById(R.id.updatechannel_card); AppCompatImageButton mBack = findViewById(R.id.back_button); mBack.setOnClickListener(v -> onBackPressed()); AppCompatImageButton mSave = findViewById(R.id.save_button); mSave.setOnClickListener(v -> { if (mKernelNameHint.getText() != null && !mKernelNameHint.getText().toString().equals("") && mKernelVersionHint.getText() != null && !mKernelVersionHint.getText().toString().equals("") && mDownloadLinkHint.getText() != null && !mDownloadLinkHint.getText().toString().equals("")) { saveUpdateChannel(); } else { Utils.snackbar(mCardView, getString(R.string.submit_failed)); } }); AppCompatTextView mClearAll = findViewById(R.id.clear_all); mClearAll.setOnClickListener(v -> { if (isTextEntered()) { new Dialog(this) .setMessage(getString(R.string.clear_all_summary) + " " + getString(R.string.sure_question)) .setNegativeButton(getString(R.string.cancel), (dialog1, id1) -> { }) .setPositiveButton(getString(R.string.yes), (dialog1, id1) -> { clearAll(); }) .show(); } else { Utils.snackbar(mCardView, getString(R.string.clear_message)); } }); mKernelNameHint = findViewById(R.id.kernel_name_hint); mKernelVersionHint = findViewById(R.id.kernel_version_hint); mDownloadLinkHint = findViewById(R.id.download_link_hint); mChangelogHint = findViewById(R.id.changelog_hint); mSHA1Hint = findViewById(R.id.sha1_hint); mSupportHint = findViewById(R.id.support_hint); mDonationHint = findViewById(R.id.donation_link_hint); }