Java Code Examples for android.widget.ImageButton#setVisibility()
The following examples show how to use
android.widget.ImageButton#setVisibility() .
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: MapActivity.java From OpenMapKitAndroid with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void toggleMoveNodeMode() { final ImageButton moveNodeModeBtn = (ImageButton)findViewById(R.id.moveNodeModeBtn); final ImageButton moveNodeMarkerBtn = (ImageButton)findViewById(R.id.moveNodeMarkerBtn); final Button moveNodeBtn = (Button)findViewById(R.id.moveNodeBtn); if (moveNodeMode) { moveNodeMarkerBtn.setVisibility(View.GONE); moveNodeBtn.setVisibility(View.GONE); moveNodeModeBtn.setBackground(getResources().getDrawable(R.drawable.roundedbutton)); showSelectedMarker(); } else { moveNodeMarkerBtn.setVisibility(View.VISIBLE); moveNodeBtn.setVisibility(View.VISIBLE); moveNodeModeBtn.setBackground(getResources().getDrawable(R.drawable.roundedbutton_orange)); hideSelectedMarker(); proportionMapAndList(100, 0); } moveNodeMode = !moveNodeMode; }
Example 2
Source File: EBrowserWindow.java From appcan-android with GNU Lesser General Public License v3.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void showButtonIcon(ImageButton Image, String iconPath) { if(""!=iconPath && null!=iconPath){ String IconImg=iconPath; IconImg=IconImg.substring(BUtility.F_Widget_RES_SCHEMA .length()); IconImg = BUtility.F_Widget_RES_path + IconImg; Bitmap leftIconImgBitmap =((EBrowserActivity)mContext).getImage(IconImg); if(null!=IconImg){ BitmapDrawable bitmapDrawable = new BitmapDrawable(getResources(), leftIconImgBitmap); if(null!=bitmapDrawable){ Image.setBackground(bitmapDrawable); } } }else{ Image.setVisibility(GONE); } }
Example 3
Source File: AddAddressBitpieColdHDAccountViewFragment.java From bither-android with Apache License 2.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_add_address_hot_hd_account_view, container, false); TextView label = v.findViewById(R.id.tv_account_label); label.setText(R.string.bitpie_add_hd_account_view_label); TextView btnQr = v.findViewById(R.id.btn_qr); btnQr.setText(R.string.bitpie_add_hd_account_seed_qr_code); TextView btnPhrase = v.findViewById(R.id.btn_phrase); btnPhrase.setText(R.string.bitpie_add_hd_account_seed_qr_phrase); ImageButton ibtnInfo = v.findViewById(R.id.ibtn_info); ibtnInfo.setOnClickListener(bitpieColdInfoClick); ibtnInfo.setVisibility(View.VISIBLE); btnQr.setOnClickListener(this); btnPhrase.setOnClickListener(this); return v; }
Example 4
Source File: X8RightIconForMapController.java From FimiX8-RE with MIT License | 6 votes |
public void switch2Map(boolean isShow) { int i = 8; if (!this.mX8AiModeState.isAiModeStateReady()) { int i2; ImageButton imageButton = this.imbLocation; if (isShow) { i2 = 8; } else { i2 = 0; } imageButton.setVisibility(i2); LinearLayout linearLayout = this.vSetHomePoint; if (!isShow) { i = 0; } linearLayout.setVisibility(i); } }
Example 5
Source File: LocationActivity.java From Conquer with Apache License 2.0 | 5 votes |
@Override public void initTitleBar(ViewGroup rl_title, TextView tv_title, ImageButton ib_back, ImageButton ib_right, View shadow) { tv_title.setText("我的位置"); ib_back.setImageResource(R.drawable.ic_clear_white_24dp); ib_right.setVisibility(0); ib_right.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { gotoChatPage(); } }); }
Example 6
Source File: GeneralItemsAdapter.java From CommonUtils with Apache License 2.0 | 5 votes |
@SuppressLint("ViewHolder") @Override public View getView(final int position, View convertView, ViewGroup parent) { convertView = inflater.inflate(R.layout.item_deletable, parent, false); final E item = getItem(position); LinearLayout texts = (LinearLayout) ((ViewGroup) convertView).getChildAt(0); TextView primary = (TextView) texts.getChildAt(0); primary.setText(item.getPrimaryText()); TextView secondary = (TextView) texts.getChildAt(1); String secondaryText = item.getSecondaryText(); if (secondaryText == null) { secondary.setVisibility(View.GONE); } else { secondary.setVisibility(View.VISIBLE); secondary.setText(secondaryText); } ImageButton delete = (ImageButton) ((ViewGroup) convertView).getChildAt(1); if (listener == null) { delete.setVisibility(View.GONE); } else { delete.setVisibility(View.VISIBLE); delete.setOnClickListener(v -> { listener.delete(item); items.remove(position); notifyDataSetChanged(); }); } return convertView; }
Example 7
Source File: RecoveryActivity.java From Recovery with Apache License 2.0 | 5 votes |
private void setDisplayHomeAsUpEnabled(boolean enabled) { if (getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(enabled); final ImageButton navButton = (ImageButton) Reflect.on(Toolbar.class).field("mNavButtonView").get(mToolbar); if (navButton != null) { if (enabled) { navButton.setVisibility(View.VISIBLE); } else { navButton.setVisibility(View.GONE); } } invalidateOptionsMenu(); }
Example 8
Source File: BitherQRCodeActivity.java From bither-android with Apache License 2.0 | 5 votes |
private void initView() { findViewById(R.id.ibtn_cancel).setOnClickListener(new IBackClickListener()); ivSeparator = (ImageView) findViewById(R.id.iv_separator); btnSwitch = (ImageButton) findViewById(R.id.ibtn_switch); btnSwitch.setOnClickListener(switchClickListener); pager = (ViewPager) findViewById(R.id.pager); tvTitle = (TextView) findViewById(R.id.tv_title); tvFirstAddress = findViewById(R.id.tv_first_address); llFirstAddress = findViewById(R.id.ll_first_address); mTouchView.addIgnoreView(pager); if (hasOldQRCode) { ivSeparator.setVisibility(View.VISIBLE); btnSwitch.setVisibility(View.VISIBLE); } else { ivSeparator.setVisibility(View.INVISIBLE); btnSwitch.setVisibility(View.INVISIBLE); } if (signMessageType == QRCodeBitpieColdSignMessage.SignMessageType.LoginSign) { if (AddressManager.getInstance().hasBitpieHDAccountCold()) { tvFirstAddress.setText(AddressManager.getInstance().getBitpieHDAccountCold().getFirstAddressFromDb()); llFirstAddress.setVisibility(View.VISIBLE); } } adapter = new QRFragmentPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter); pager.setOffscreenPageLimit(1); refresh(); }
Example 9
Source File: InfoButtonListPreferencePref.java From vinyl-cast with MIT License | 5 votes |
@Override public void onBindViewHolder(PreferenceViewHolder holder) { super.onBindViewHolder(holder); mView = holder.itemView; ImageButton infoButton = mView.findViewById(R.id.pref_image_button); if (mShowInfoButton) { infoButton.setVisibility(View.VISIBLE); } else { infoButton.setVisibility(View.GONE); } infoButton.setOnClickListener(imageButtonClickListener); }
Example 10
Source File: MyHomeChangeListener.java From YiBo with Apache License 2.0 | 5 votes |
private void updateHeader(ViewChangeEvent changeEvent) { TextView tvTitle = (TextView)context.findViewById(R.id.tvTitle); LocalAccount account = changeEvent.getAccount(); ListView lvMicroBlog = (ListView)context.findViewById(R.id.lvMicroBlog); if (lvMicroBlog == null) { return; } BaseAdapter adapter = AdapterUtil.getAdapter(lvMicroBlog.getAdapter()); String title = ""; if (adapter instanceof MyHomeListAdapter) { if (account.getUser() != null) { title += account.getUser().getScreenName() + "@"; } title += account.getServiceProvider().getSpName(); } else if (adapter instanceof GroupStatusesListAdapter) { GroupStatusesListAdapter statusesListAdapter = (GroupStatusesListAdapter)adapter; Group group = statusesListAdapter.getGroup(); title = group.getName(); } tvTitle.setText(title); View llHeaderBase = ((Activity)context).findViewById(R.id.llHeaderBase); llHeaderBase.setVisibility(View.VISIBLE); View llHeaderMessage = ((Activity)context).findViewById(R.id.llHeaderMessage); llHeaderMessage.setVisibility(View.GONE); ImageButton ibProfileImage = (ImageButton) context.findViewById(R.id.ibProfileImage); ibProfileImage.setVisibility(View.VISIBLE); ImageButton ibGroup = (ImageButton) context.findViewById(R.id.ibGroup); ibGroup.setVisibility(View.VISIBLE); ImageButton ibEdit = (ImageButton) context.findViewById(R.id.ibEdit); ibEdit.setVisibility(View.VISIBLE); ibEdit.setOnClickListener(editStatusClickListner); }
Example 11
Source File: FairySearchView.java From FairySearchView with Apache License 2.0 | 5 votes |
private void showOrHideClearButton(ImageButton button,boolean isShow,String text){ if(isShow&&!TextUtils.isEmpty(text)){ button.setVisibility(VISIBLE); }else{ button.setVisibility(GONE); } }
Example 12
Source File: MediaController.java From 365browser with Apache License 2.0 | 4 votes |
private void initControllerView() { mPauseButton = (ImageButton) findViewById(R.id.pause); if (mPauseButton != null) { mPauseButton.requestFocus(); mPauseButton.setOnClickListener(mPauseListener); } mFfwdButton = (ImageButton) findViewById(R.id.ffwd); if (mFfwdButton != null) { mFfwdButton.setOnClickListener(mFfwdListener); mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE); } mRewButton = (ImageButton) findViewById(R.id.rew); if (mRewButton != null) { mRewButton.setOnClickListener(mRewListener); mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE); } // By default these are hidden. They will be enabled when setPrevNextListeners() is called mNextButton = (ImageButton) findViewById(R.id.next); if (mNextButton != null && !mListenersSet) { mNextButton.setVisibility(View.GONE); } mPrevButton = (ImageButton) findViewById(R.id.prev); if (mPrevButton != null && !mListenersSet) { mPrevButton.setVisibility(View.GONE); } mProgressGroup = (ViewGroup) findViewById(R.id.mediacontroller_progress_container); if (mProgressGroup != null) { mProgressBar = (SeekBar) mProgressGroup.findViewById(R.id.mediacontroller_progress_bar); if (mProgressBar != null) { mProgressBar.setOnSeekBarChangeListener(mSeekListener); mProgressBar.setMax(1000); } } mEndTime = (TextView) findViewById(R.id.time); mCurrentTime = (TextView) findViewById(R.id.time_current); mFormatBuilder = new StringBuilder(); mFormatter = new Formatter(mFormatBuilder, Locale.getDefault()); installPrevNextListeners(); }
Example 13
Source File: UniversalMediaController.java From LLApp with Apache License 2.0 | 4 votes |
private void initControllerView(View v) { mTitleLayout = v.findViewById(R.id.title_part); mControlLayout = v.findViewById(R.id.control_layout); loadingLayout = (ViewGroup) v.findViewById(R.id.loading_layout); errorLayout = (ViewGroup) v.findViewById(R.id.error_layout); mTurnButton = (ImageButton) v.findViewById(R.id.turn_button); mScaleButton = (ImageButton) v.findViewById(R.id.scale_button); mCenterPlayButton = v.findViewById(R.id.center_play_btn); mBackButton = v.findViewById(R.id.back_btn); if (mTurnButton != null) { mTurnButton.requestFocus(); mTurnButton.setOnClickListener(mPauseListener); } if (mScalable) { if (mScaleButton != null) { mScaleButton.setVisibility(VISIBLE); mScaleButton.setOnClickListener(mScaleListener); } } else { if (mScaleButton != null) { mScaleButton.setVisibility(GONE); } } if (mCenterPlayButton != null) {//重新开始播放 mCenterPlayButton.setOnClickListener(mCenterPlayListener); } if (mBackButton != null) {//返回按钮仅在全屏状态下可见 mBackButton.setOnClickListener(mBackListener); } View bar = v.findViewById(R.id.seekbar); mProgress = (ProgressBar) bar; if (mProgress != null) { if (mProgress instanceof SeekBar) { SeekBar seeker = (SeekBar) mProgress; seeker.setOnSeekBarChangeListener(mSeekListener); } mProgress.setMax(1000); } mEndTime = (TextView) v.findViewById(R.id.duration); mCurrentTime = (TextView) v.findViewById(R.id.has_played); mTitle = (TextView) v.findViewById(R.id.title); mFormatBuilder = new StringBuilder(); mFormatter = new Formatter(mFormatBuilder, Locale.getDefault()); }
Example 14
Source File: LineCreateFeatureToolGroup.java From geopaparazzi with GNU General Public License v3.0 | 4 votes |
public void initUI() { LinearLayout parent = EditManager.INSTANCE.getToolsLayout(); parent.removeAllViews(); Context context = parent.getContext(); IEditableLayer editLayer = EditManager.INSTANCE.getEditLayer(); int padding = 2; if (editLayer != null) { gpsStreamButton = new ImageButton(context); gpsStreamButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); gpsStreamButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_gps_stream_24dp)); gpsStreamButton.setPadding(0, padding, 0, padding); gpsStreamButton.setOnTouchListener(this); gpsStreamButton.setOnLongClickListener(this); gpsStreamButton.setOnClickListener(this); parent.addView(gpsStreamButton); addVertexButton = new ImageButton(context); addVertexButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); addVertexButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_add_vertex_24dp)); addVertexButton.setPadding(0, padding, 0, padding); addVertexButton.setOnTouchListener(this); addVertexButton.setOnClickListener(this); parent.addView(addVertexButton); addVertexByTapButton = new ImageButton(context); addVertexByTapButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); addVertexByTapButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_add_vertex_tap_24dp)); addVertexByTapButton.setPadding(0, padding, 0, padding); addVertexByTapButton.setOnTouchListener(this); addVertexByTapButton.setOnClickListener(this); parent.addView(addVertexByTapButton); undoButton = new ImageButton(context); undoButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); undoButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_undo_24dp)); undoButton.setPadding(0, padding, 0, padding); undoButton.setOnTouchListener(this); undoButton.setOnClickListener(this); parent.addView(undoButton); commitButton = new ImageButton(context); commitButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); commitButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_commit_24dp)); commitButton.setPadding(0, padding, 0, padding); commitButton.setOnTouchListener(this); commitButton.setOnClickListener(this); commitButton.setVisibility(View.GONE); parent.addView(commitButton); } }
Example 15
Source File: LineMainEditingToolGroup.java From geopaparazzi with GNU General Public License v3.0 | 4 votes |
public void initUI() { LinearLayout parent = EditManager.INSTANCE.getToolsLayout(); Context context = parent.getContext(); IEditableLayer editLayer = EditManager.INSTANCE.getEditLayer(); int padding = 2; if (editLayer != null) { createFeatureButton = new ImageButton(context); createFeatureButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); createFeatureButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_create_line_24dp)); createFeatureButton.setPadding(0, padding, 0, padding); createFeatureButton.setOnClickListener(this); createFeatureButton.setOnTouchListener(this); parent.addView(createFeatureButton); selectEditableButton = new ImageButton(context); selectEditableButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); selectEditableButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_select_editable_24dp)); selectEditableButton.setPadding(0, padding, 0, padding); selectEditableButton.setOnClickListener(this); selectEditableButton.setOnTouchListener(this); parent.addView(selectEditableButton); } selectAllButton = new ImageButton(context); selectAllButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); Tool activeTool = EditManager.INSTANCE.getActiveTool(); if (activeTool instanceof InfoTool) { selectAllButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_select_all_active_24dp)); } else { selectAllButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_select_all_24dp)); } selectAllButton.setPadding(0, padding, 0, padding); selectAllButton.setOnClickListener(this); selectAllButton.setOnTouchListener(this); parent.addView(selectAllButton); if (editLayer != null) { undoButton = new ImageButton(context); undoButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); undoButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_undo_24dp)); undoButton.setPadding(0, padding, 0, padding); undoButton.setOnTouchListener(this); undoButton.setOnClickListener(this); parent.addView(undoButton); undoButton.setVisibility(View.GONE); commitButton = new ImageButton(context); commitButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); commitButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_commit_24dp)); commitButton.setPadding(0, padding, 0, padding); commitButton.setOnTouchListener(this); commitButton.setOnClickListener(this); parent.addView(commitButton); commitButton.setVisibility(View.GONE); } }
Example 16
Source File: AccountChooserDialog.java From 365browser with Apache License 2.0 | 4 votes |
private ArrayAdapter<Credential> generateAccountsArrayAdapter( Context context, Credential[] credentials) { return new ArrayAdapter<Credential>(context, 0 /* resource */, credentials) { @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater inflater = LayoutInflater.from(getContext()); convertView = inflater.inflate(R.layout.account_chooser_dialog_item, parent, false); } convertView.setTag(position); Credential credential = getItem(position); ImageView avatarView = (ImageView) convertView.findViewById(R.id.profile_image); Bitmap avatar = credential.getAvatar(); if (avatar != null) { avatarView.setImageBitmap(avatar); } else { avatarView.setImageResource(R.drawable.account_management_no_picture); } TextView mainNameView = (TextView) convertView.findViewById(R.id.main_name); TextView secondaryNameView = (TextView) convertView.findViewById(R.id.secondary_name); if (credential.getFederation().isEmpty()) { // Not federated credentials case if (credential.getDisplayName().isEmpty()) { mainNameView.setText(credential.getUsername()); secondaryNameView.setVisibility(View.GONE); } else { mainNameView.setText(credential.getDisplayName()); secondaryNameView.setText(credential.getUsername()); secondaryNameView.setVisibility(View.VISIBLE); } } else { mainNameView.setText(credential.getUsername()); secondaryNameView.setText(credential.getFederation()); secondaryNameView.setVisibility(View.VISIBLE); } ImageButton pslInfoButton = (ImageButton) convertView.findViewById(R.id.psl_info_btn); final String originUrl = credential.getOriginUrl(); if (!originUrl.isEmpty()) { pslInfoButton.setVisibility(View.VISIBLE); pslInfoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showTooltip( view, UrlFormatter.formatUrlForSecurityDisplay( originUrl, true /* showScheme */), R.layout.material_tooltip); } }); } return convertView; } }; }
Example 17
Source File: ClanUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
/** * 初始化签到按钮 */ public static void initSignIn(Context context, ImageButton signIn) { signIn.setVisibility((isUseSignIn(context) && AppSPUtils.isLogined(context)) ? View.VISIBLE : View.GONE); }
Example 18
Source File: MediaController.java From V.FlyoutTest with MIT License | 4 votes |
private void initControllerView() { mPauseButton = (ImageButton) findViewById(R.id.pause); if (mPauseButton != null) { mPauseButton.requestFocus(); mPauseButton.setOnClickListener(mPauseListener); } mFfwdButton = (ImageButton) findViewById(R.id.ffwd); if (mFfwdButton != null) { mFfwdButton.setOnClickListener(mFfwdListener); mFfwdButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE); } mRewButton = (ImageButton) findViewById(R.id.rew); if (mRewButton != null) { mRewButton.setOnClickListener(mRewListener); mRewButton.setVisibility(mUseFastForward ? View.VISIBLE : View.GONE); } // By default these are hidden. They will be enabled when setPrevNextListeners() is called mNextButton = (ImageButton) findViewById(R.id.next); if (mNextButton != null && !mListenersSet) { mNextButton.setVisibility(View.GONE); } mPrevButton = (ImageButton) findViewById(R.id.prev); if (mPrevButton != null && !mListenersSet) { mPrevButton.setVisibility(View.GONE); } mProgress = (ProgressBar) findViewById(R.id.mediacontroller_progress); if (mProgress != null) { if (mProgress instanceof SeekBar) { SeekBar seeker = (SeekBar) mProgress; seeker.setOnSeekBarChangeListener(mSeekListener); } mProgress.setMax(1000); } mEndTime = (TextView) findViewById(R.id.time); mCurrentTime = (TextView) findViewById(R.id.time_current); mFormatBuilder = new StringBuilder(); mFormatter = new Formatter(mFormatBuilder, Locale.getDefault()); installPrevNextListeners(); }
Example 19
Source File: LineOnSelectionToolGroup.java From geopaparazzi with GNU General Public License v3.0 | 4 votes |
public void initUI() { LinearLayout parent = EditManager.INSTANCE.getToolsLayout(); parent.removeAllViews(); Context context = parent.getContext(); IEditableLayer editLayer = EditManager.INSTANCE.getEditLayer(); int padding = 2; if (editLayer != null) { deleteFeatureButton = new ImageButton(context); deleteFeatureButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); deleteFeatureButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_delete_line_feature_24dp)); deleteFeatureButton.setPadding(0, padding, 0, padding); deleteFeatureButton.setOnTouchListener(this); deleteFeatureButton.setOnClickListener(this); parent.addView(deleteFeatureButton); // copyFeatureButton = new ImageButton(context); // copyFeatureButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, // LayoutParams.WRAP_CONTENT)); // copyFeatureButton.setBackground(context.getDrawable(R.drawable.editing_copy_geoms)); // copyFeatureButton.setPadding(0, padding, 0, padding); // copyFeatureButton.setOnTouchListener(this); // copyFeatureButton.setOnClickListener(this); // parent.addView(copyFeatureButton); continueLineFeatureButton = new ImageButton(context); continueLineFeatureButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); continueLineFeatureButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_continue_line_24dp)); continueLineFeatureButton.setPadding(0, padding, 0, padding); continueLineFeatureButton.setOnClickListener(this); continueLineFeatureButton.setOnTouchListener(this); parent.addView(continueLineFeatureButton); editAttributesButton = new ImageButton(context); editAttributesButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); editAttributesButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_view_attributes_24dp)); editAttributesButton.setPadding(0, padding, 0, padding); editAttributesButton.setOnTouchListener(this); editAttributesButton.setOnClickListener(this); parent.addView(editAttributesButton); undoButton = new ImageButton(context); undoButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); undoButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_undo_24dp)); undoButton.setPadding(0, padding, 0, padding); undoButton.setOnTouchListener(this); undoButton.setOnClickListener(this); parent.addView(undoButton); commitButton = new ImageButton(context); commitButton.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); commitButton.setBackground(Compat.getDrawable(context, R.drawable.ic_editing_commit_24dp)); commitButton.setPadding(0, padding, 0, padding); commitButton.setOnTouchListener(this); commitButton.setOnClickListener(this); parent.addView(commitButton); commitButton.setVisibility(View.GONE); } }
Example 20
Source File: ConversationActivity.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
private void initializeViews() { titleView = findViewById(R.id.conversation_title_view); buttonToggle = ViewUtil.findById(this, R.id.button_toggle); sendButton = ViewUtil.findById(this, R.id.send_button); attachButton = ViewUtil.findById(this, R.id.attach_button); composeText = ViewUtil.findById(this, R.id.embedded_text_editor); charactersLeft = ViewUtil.findById(this, R.id.space_left); emojiDrawerStub = ViewUtil.findStubById(this, R.id.emoji_drawer_stub); attachmentKeyboardStub = ViewUtil.findStubById(this, R.id.attachment_keyboard_stub); unblockButton = ViewUtil.findById(this, R.id.unblock_button); inviteButton = ViewUtil.findById(this, R.id.invite_button); registerButton = ViewUtil.findById(this, R.id.register_button); container = ViewUtil.findById(this, R.id.layout_container); reminderView = ViewUtil.findStubById(this, R.id.reminder_stub); unverifiedBannerView = ViewUtil.findStubById(this, R.id.unverified_banner_stub); groupShareProfileView = ViewUtil.findStubById(this, R.id.group_share_profile_view_stub); quickAttachmentToggle = ViewUtil.findById(this, R.id.quick_attachment_toggle); inlineAttachmentToggle = ViewUtil.findById(this, R.id.inline_attachment_container); inputPanel = ViewUtil.findById(this, R.id.bottom_panel); panelParent = ViewUtil.findById(this, R.id.conversation_activity_panel_parent); searchNav = ViewUtil.findById(this, R.id.conversation_search_nav); messageRequestBottomView = ViewUtil.findById(this, R.id.conversation_activity_message_request_bottom_bar); reactionOverlay = ViewUtil.findById(this, R.id.conversation_reaction_scrubber); ImageButton quickCameraToggle = ViewUtil.findById(this, R.id.quick_camera_toggle); ImageButton inlineAttachmentButton = ViewUtil.findById(this, R.id.inline_attachment_button); container.addOnKeyboardShownListener(this); inputPanel.setListener(this); inputPanel.setMediaListener(this); attachmentManager = new AttachmentManager(this, this); audioRecorder = new AudioRecorder(this); typingTextWatcher = new TypingStatusTextWatcher(); SendButtonListener sendButtonListener = new SendButtonListener(); ComposeKeyPressedListener composeKeyPressedListener = new ComposeKeyPressedListener(); composeText.setOnEditorActionListener(sendButtonListener); composeText.setCursorPositionChangedListener(this); attachButton.setOnClickListener(new AttachButtonListener()); attachButton.setOnLongClickListener(new AttachButtonLongClickListener()); sendButton.setOnClickListener(sendButtonListener); sendButton.setEnabled(true); sendButton.addOnTransportChangedListener((newTransport, manuallySelected) -> { calculateCharactersRemaining(); updateLinkPreviewState(); composeText.setTransport(newTransport); buttonToggle.getBackground().setColorFilter(newTransport.getBackgroundColor(), PorterDuff.Mode.MULTIPLY); buttonToggle.getBackground().invalidateSelf(); if (manuallySelected) recordTransportPreference(newTransport); }); titleView.setOnClickListener(v -> handleConversationSettings()); titleView.setOnLongClickListener(v -> handleDisplayQuickContact()); unblockButton.setOnClickListener(v -> handleUnblock()); inviteButton.setOnClickListener(v -> handleInviteLink()); registerButton.setOnClickListener(v -> handleRegisterForSignal()); composeText.setOnKeyListener(composeKeyPressedListener); composeText.addTextChangedListener(composeKeyPressedListener); composeText.setOnEditorActionListener(sendButtonListener); composeText.setOnClickListener(composeKeyPressedListener); composeText.setOnFocusChangeListener(composeKeyPressedListener); if (Camera.getNumberOfCameras() > 0) { quickCameraToggle.setVisibility(View.VISIBLE); quickCameraToggle.setOnClickListener(new QuickCameraToggleListener()); } else { quickCameraToggle.setVisibility(View.GONE); } searchNav.setEventListener(this); inlineAttachmentButton.setOnClickListener(v -> handleAddAttachment()); reactionOverlay.setOnReactionSelectedListener(this); }