List of usage examples for android.widget TextView setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:android.support.v7.widget.SuggestionsAdapter.java
private void setViewText(TextView v, CharSequence text) { // Set the text even if it's null, since we need to clear any previous text. v.setText(text);/*from w w w . j a va 2s . c om*/ if (TextUtils.isEmpty(text)) { v.setVisibility(View.GONE); } else { v.setVisibility(View.VISIBLE); } }
From source file:com.cerema.cloud2.ui.fragment.ShareFileFragment.java
/** * {@inheritDoc}/* w w w . j ava2s . c o m*/ */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log_OC.d(TAG, "onCreateView"); // Inflate the layout for this fragment View view = inflater.inflate(R.layout.share_file_layout, container, false); // Setup layout // Image ImageView icon = (ImageView) view.findViewById(R.id.shareFileIcon); icon.setImageResource(MimetypeIconUtil.getFileTypeIconId(mFile.getMimetype(), mFile.getFileName())); if (mFile.isImage()) { String remoteId = String.valueOf(mFile.getRemoteId()); Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(remoteId); if (thumbnail != null) { icon.setImageBitmap(thumbnail); } } // Name TextView fileNameHeader = (TextView) view.findViewById(R.id.shareFileName); fileNameHeader.setText(getResources().getString(R.string.share_file, mFile.getFileName())); // Size TextView size = (TextView) view.findViewById(R.id.shareFileSize); if (mFile.isFolder()) { size.setVisibility(View.GONE); } else { size.setText(DisplayUtils.bytesToHumanReadable(mFile.getFileLength())); } // Add User Button Button addUserGroupButton = (Button) view.findViewById(R.id.addUserButton); addUserGroupButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { boolean shareWithUsersEnable = AccountUtils.hasSearchUsersSupport(mAccount); if (shareWithUsersEnable) { // Show Search Fragment mListener.showSearchUsersAndGroups(); } else { String message = getString(R.string.share_sharee_unavailable); Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show(); } } }); // Set listener for user actions on switch for sharing/unsharing via link initShareViaLinkListener(view); // Set listener for user actions on expiration date initExpirationListener(view); // Set listener for user actions on password initPasswordListener(view); // Set listener for user actions on edit permission initEditPermissionListener(view); return view; }
From source file:com.android.mms.rcs.FavoriteDetailAdapter.java
@Override public Object instantiateItem(ViewGroup view, int position) { mCursor.moveToPosition(position);//w w w . j a v a 2 s . c o m View content = mInflater.inflate(R.layout.message_detail_content, view, false); TextView bodyText = (TextView) content.findViewById(R.id.textViewBody); LinearLayout mLinearLayout = (LinearLayout) content.findViewById(R.id.other_type_layout); mMsgType = mCursor.getInt(mCursor.getColumnIndex(FavoriteMessageProvider.FavoriteMessage.MSG_TYPE)); if (mMsgType == RcsUtils.RCS_MSG_TYPE_TEXT) { initTextMsgView(bodyText); } else { bodyText.setVisibility(View.GONE); mLinearLayout.setVisibility(View.VISIBLE); ImageView imageView = (ImageView) mLinearLayout.findViewById(R.id.image_view); TextView textView = (TextView) mLinearLayout.findViewById(R.id.type_text_view); if (mMsgType != RcsUtils.RCS_MSG_TYPE_CAIYUNFILE) { imageView.setOnClickListener(mOnClickListener); } if (mMsgType == RcsUtils.RCS_MSG_TYPE_IMAGE) { initImageMsgView(mLinearLayout); showContentFileSize(textView); mContentType = "image/*"; } else if (mMsgType == RcsUtils.RCS_MSG_TYPE_AUDIO) { imageView.setImageResource(R.drawable.rcs_voice); showContentFileSize(textView); mContentType = "audio/*"; } else if (mMsgType == RcsUtils.RCS_MSG_TYPE_VIDEO) { String thumbPath = mCursor.getString( mCursor.getColumnIndexOrThrow(FavoriteMessageProvider.FavoriteMessage.THUMBNAIL)); Bitmap bitmap = BitmapFactory.decodeFile(thumbPath); imageView.setImageBitmap(bitmap); showContentFileSize(textView); mContentType = "video/*"; } else if (mMsgType == RcsUtils.RCS_MSG_TYPE_MAP) { imageView.setImageResource(R.drawable.rcs_map); String body = mCursor .getString(mCursor.getColumnIndexOrThrow(FavoriteMessageProvider.FavoriteMessage.CONTENT)); textView.setText(body); mContentType = "map/*"; } else if (mMsgType == RcsUtils.RCS_MSG_TYPE_VCARD) { textView.setVisibility(View.GONE); initVcardMagView(mLinearLayout); mContentType = "text/x-vCard"; } else if (mMsgType == RcsUtils.RCS_MSG_TYPE_PAID_EMO) { String messageBody = mCursor .getString(mCursor.getColumnIndex(FavoriteMessageProvider.FavoriteMessage.FILE_NAME)); String[] body = messageBody.split(","); RcsEmojiStoreUtil.getInstance().loadImageAsynById(imageView, body[0], RcsEmojiStoreUtil.EMO_STATIC_FILE); } else { bodyText.setVisibility(View.VISIBLE); mLinearLayout.setVisibility(View.GONE); initTextMsgView(bodyText); } } TextView detailsText = (TextView) content.findViewById(R.id.textViewDetails); detailsText.setText(getTextMessageDetails(mContext, mCursor, true)); view.addView(content); return content; }
From source file:com.zion.htf.ui.fragment.ArtistSoundcloudFragment.java
private void setErrorMessage(String message) { ProgressBar progressBar = (ProgressBar) this.view.findViewById(R.id.progressBar); progressBar.setVisibility(0 == message.length() ? View.VISIBLE : View.GONE); TextView messageTextView = (TextView) this.view.findViewById(R.id.message); if (null == messageTextView) { ViewStub stub = (ViewStub) this.view.findViewById(R.id.empty_view_stub); if (null != stub) stub.inflate();//from w w w. ja v a 2 s . c o m messageTextView = (TextView) this.view.findViewById(R.id.message); } messageTextView.setVisibility(View.VISIBLE); messageTextView.setText(message); }
From source file:com.example.zf_android.activity.MerchantEdit.java
@Override protected void onActivityResult(final int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != RESULT_OK) { return;/* w ww .j a va 2s.c o m*/ } String value = ""; if (data != null) { value = data.getStringExtra("value"); } switch (requestCode) { case TYPE_1: merchantEntity.setTitle(value); tv1.setText(value); break; case TYPE_2: merchantEntity.setLegalPersonName(value); tv2.setText(value); break; case TYPE_3: merchantEntity.setLegalPersonCardId(value); tv3.setText(value); break; case TYPE_4: merchantEntity.setBusinessLicenseNo(value); tv4.setText(value); break; case TYPE_5: merchantEntity.setTaxRegisteredNo(value); tv5.setText(value); break; case TYPE_6: merchantEntity.setOrganizationCodeNo(value); tv6.setText(value); break; case TYPE_7: Province province = (Province) data.getSerializableExtra(Constants.CityIntent.SELECTED_PROVINCE); City city = (City) data.getSerializableExtra(Constants.CityIntent.SELECTED_CITY); if (province == null || city == null) { merchantEntity.setCityId(0); tv7.setText(""); } else { merchantEntity.setCityId(city.getId()); tv7.setText(province.getName() + city.getName()); } break; case TYPE_KHYH: merchantEntity.setAccountBankName(value); tvkhyh.setText(value); break; case TYPE_8: merchantEntity.setBankOpenAccount(value); tv8.setText(value); break; case REQUEST_UPLOAD_IMAGE: case REQUEST_TAKE_PHOTO: { final LinearLayout layout = linearLayout.get(MerchantEdit.this.type); final Handler handler = new Handler() { private int type; @Override public void handleMessage(Message msg) { this.type = MerchantEdit.this.type; if (msg.what == 1) { // CommonUtil.toastShort(MerchantEdit.this, // (String) msg.obj); layout.setClickable(false); layout.findViewById(R.id.imgView).setVisibility(View.VISIBLE); layout.findViewById(R.id.textView).setVisibility(View.GONE); String url = (String) msg.obj; layout.setClickable(true); switch (type) { case TYPE_10: merchantEntity.setCardIdFrontPhotoPath(url); break; case TYPE_11: merchantEntity.setCardIdBackPhotoPath(url); break; case TYPE_12: merchantEntity.setBodyPhotoPath(url); break; case TYPE_13: merchantEntity.setLicenseNoPicPath(url); break; case TYPE_14: merchantEntity.setTaxNoPicPath(url); break; case TYPE_15: merchantEntity.setOrgCodeNoPicPath(url); break; case TYPE_16: merchantEntity.setAccountPicPath(url); break; default: break; } } else { CommonUtil.toastShort(MerchantEdit.this, getString(R.string.toast_upload_failed)); layout.setClickable(true); } } }; if (null != layout) { ImageView imgView = (ImageView) layout.findViewById(R.id.imgView); TextView textView = (TextView) layout.findViewById(R.id.textView); imgView.setVisibility(View.GONE); textView.setVisibility(View.VISIBLE); textView.setText(getString(R.string.apply_uploading)); layout.setClickable(false); } new Thread() { @Override public void run() { String realPath = ""; if (requestCode == REQUEST_TAKE_PHOTO) { realPath = photoPath; } else { Uri uri = data.getData(); if (uri != null) { realPath = Tools.getRealPathFromURI(MerchantEdit.this, uri); } } if (TextUtils.isEmpty(realPath)) { handler.sendEmptyMessage(0); return; } CommonUtil.uploadFile(realPath, "img", new CommonUtil.OnUploadListener() { @Override public void onSuccess(String result) { try { JSONObject jo = new JSONObject(result); String url = jo.getString("result"); Message msg = new Message(); msg.what = 1; msg.obj = url; handler.sendMessage(msg); } catch (JSONException e) { handler.sendEmptyMessage(0); } } @Override public void onFailed(String message) { handler.sendEmptyMessage(0); } }); } }.start(); break; } default: break; } }
From source file:android.melbournehistorymap.MapsActivity.java
public void hideTile(View view) { TextView fab = (TextView) findViewById(R.id.fab); FloatingActionButton shareIcon = (FloatingActionButton) findViewById(R.id.shareIcon); //show small tile smallTile.setVisibility(View.VISIBLE); fab.setVisibility(View.VISIBLE); //hide big tile expandedTile.setVisibility(View.GONE); shareIcon.setVisibility(View.GONE); //unlock the map mMap.getUiSettings().setAllGesturesEnabled(true); //enable mapicon from being clickable TextView mapIcon = (TextView) findViewById(R.id.iconMap); mapIcon.setClickable(true);//from w w w . ja va 2 s .co m }
From source file:android.melbournehistorymap.MapsActivity.java
public void expandTile(View view) { // Toast.makeText(MapsActivity.this, "Expand", Toast.LENGTH_SHORT).show(); TextView fab = (TextView) findViewById(R.id.fab); FloatingActionButton shareIcon = (FloatingActionButton) findViewById(R.id.shareIcon); //hide small tile smallTile.setVisibility(View.GONE); fab.setVisibility(View.GONE); //show big tile expandedTile.setVisibility(View.VISIBLE); shareIcon.setVisibility(View.VISIBLE); //lock the map mMap.getUiSettings().setAllGesturesEnabled(false); //Reset ScrollView to top ScrollView scrollView = (ScrollView) findViewById(R.id.scrollViewDesc); scrollView.fullScroll(View.FOCUS_UP); //disable mapicon from being clickable TextView mapIcon = (TextView) findViewById(R.id.iconMap); mapIcon.setClickable(false);//from ww w . ja v a 2 s.co m }
From source file:brostore.maquillage.custom.PagerSlidingTabStrip.java
private void addCustomTextTab(final int position, String title) { LinearLayout conteneur = new LinearLayout(getContext()); LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); conteneur.setOrientation(LinearLayout.HORIZONTAL); conteneur.setGravity(Gravity.CENTER); TextView tab = new TextView(getContext()); TextView tabCust = new TextView(getContext()); //tabCust.setBackgroundResource(R.drawable.live_nombre); tabCust.setGravity(Gravity.CENTER);/*from www. j a va2 s.c o m*/ tabCust.setTextColor(Color.WHITE); tabCust.setTypeface(tabTypeface); tabCust.setTextSize(11); tabCust.setVisibility(View.GONE); int fiveDip = Utils.convertDpToPixel(5, getResources()); tabCust.setPadding(fiveDip, 0, fiveDip, 0); tabCust.setText("0"); tab.setText(title); tab.setGravity(Gravity.CENTER); tab.setSingleLine(); conteneur.addView(tab, param); param.leftMargin = Utils.convertDpToPixel(10, getResources()); conteneur.addView(tabCust, param); addTab(position, conteneur); }
From source file:com.grarak.kerneladiutor.views.recyclerview.customcontrols.CodeView.java
@Override public void onCreateView(final View view) { mTitleView = (TextView) view.findViewById(R.id.title); mSummaryView = (TextView) view.findViewById(R.id.summary); mRequiredText = (TextView) view.findViewById(R.id.required_text); mCodeView = (TextView) view.findViewById(R.id.code); mTestButtonView = (AppCompatButton) view.findViewById(R.id.test_button); mOutputParent = view.findViewById(R.id.output_parent); TextView outputTitle = (TextView) view.findViewById(R.id.output_title); final View progress = view.findViewById(R.id.progress); final TextView outputTextView = (TextView) view.findViewById(R.id.output); view.setOnClickListener(new View.OnClickListener() { @Override//from w w w . ja v a2 s.c o m public void onClick(View v) { if (mScriptThread != null) return; if (getOnItemClickListener() != null) { getOnItemClickListener().onClick(CodeView.this); } } }); mTestButtonView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mScriptThread != null) return; mOutputParent.setVisibility(View.VISIBLE); outputTextView.setVisibility(View.GONE); progress.setVisibility(View.VISIBLE); mScriptThread = new Thread(new Runnable() { @Override public void run() { mOutput = RootUtils.runScript(mCode.toString()); ((Activity) view.getContext()).runOnUiThread(new Runnable() { @Override public void run() { progress.setVisibility(View.GONE); outputTextView.setVisibility(View.VISIBLE); outputTextView.setText(mOutput); mScriptThread = null; if (mOnTestListener != null) { mOnTestListener.onTestResult(CodeView.this, mOutput); } } }); } }); mScriptThread.start(); } }); if (Utils.DARK_THEME) { mTitleView.setTextColor(ContextCompat.getColor(view.getContext(), R.color.white)); outputTitle.setTextColor(ContextCompat.getColor(view.getContext(), R.color.white)); } super.onCreateView(view); }
From source file:com.cw.litenote.operation.audio.AudioPlayer_page.java
private void showAudioPanel(AppCompatActivity act, boolean enable) { // System.out.println("AudioPlayer_page / _showAudioPanel / enable = " + enable); View audio_panel = act.findViewById(R.id.audio_panel); if (audio_panel != null) { TextView audio_panel_title_textView = (TextView) audio_panel.findViewById(R.id.audio_panel_title); SeekBar seekBarProgress = (SeekBar) audio_panel.findViewById(R.id.audioPanel_seek_bar); // show audio panel if (enable) { audio_panel.setVisibility(View.VISIBLE); audio_panel_title_textView.setVisibility(View.VISIBLE); // set footer message with audio name String audioStr = Audio_manager.getAudioStringAt(Audio_manager.mAudioPos); audio_panel_title_textView.setText(Util.getDisplayNameByUriString(audioStr, act)); // show audio playing item number TextView audioPanel_audio_number = (TextView) audio_panel .findViewById(R.id.audioPanel_audio_number); String message = act.getResources().getString(R.string.menu_button_play) + "#" + (Audio_manager.mAudioPos + 1); audioPanel_audio_number.setText(message); seekBarProgress.setVisibility(View.VISIBLE); } else {/*ww w.j a v a 2s . c o m*/ audio_panel.setVisibility(View.GONE); } } }