Java Code Examples for android.widget.TextView#setVisibility()
The following examples show how to use
android.widget.TextView#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: Preference.java From MDPreference with Apache License 2.0 | 6 votes |
@SuppressLint("MissingSuperCall") @Override protected void onBindView(View view) { CharSequence title = getTitle(); titleText = (TextView) view.findViewById(R.id.title); titleText.setText(title); titleText.setVisibility(!isEmpty(title) ? VISIBLE : GONE); titleText.setTypeface(Typefaces.getRobotoRegular(getContext())); CharSequence summary = getSummary(); summaryText = (TextView) view.findViewById(R.id.summary); summaryText.setText(summary); summaryText.setVisibility(!isEmpty(summary) ? VISIBLE : GONE); summaryText.setTypeface(Typefaces.getRobotoRegular(getContext())); if (icon == null && iconResId > 0) { icon = getContext().getResources().getDrawable(iconResId); } imageView = (ImageView) view.findViewById(R.id.icon); imageView.setImageDrawable(icon); imageView.setVisibility(icon != null ? VISIBLE : GONE); imageFrame = view.findViewById(R.id.icon_frame); imageFrame.setVisibility(icon != null ? VISIBLE : GONE); }
Example 2
Source File: OperationDialog.java From Common with Apache License 2.0 | 6 votes |
@Override protected void initView(View rootView) { initRecyclerList(rootView, R.id.rv_list, LinearLayoutManager.VERTICAL); TextView tvCancel = (TextView) rootView.findViewById(R.id.tv_cancel); TextView tvTitle = (TextView) rootView.findViewById(R.id.tv_title); View vLineTop = rootView.findViewById(R.id.line_top); if (!TextUtils.isEmpty(mTitle)) { tvTitle.setVisibility(View.VISIBLE); tvTitle.setText(mTitle); vLineTop.setVisibility(View.VISIBLE); } else { tvTitle.setVisibility(View.GONE); vLineTop.setVisibility(View.GONE); } tvCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onItemClick(-1, null); } }); }
Example 3
Source File: PinyinAdapter.java From weixin with Apache License 2.0 | 6 votes |
@Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.cgt_layout_addressbook_group_item, null); // 禁止伸展 convertView.setClickable(true);//设置是否可以点击伸展 } TextView mTv_addressbook_group_item = (TextView) convertView.findViewById(R.id.cgt_tv_addressbook_group_item); if (groupPosition == 0) { mTv_addressbook_group_item.setText("↑"); mTv_addressbook_group_item.setVisibility(View.GONE); } else { mTv_addressbook_group_item.setText(mAssortPinyinList.getFirstChar(mAssortPinyinList.getHashList().getValueThroughIndexAndKey(groupPosition, 0))); mTv_addressbook_group_item.setVisibility(View.VISIBLE); } convertView.setTag(R.id.cgt_tv_addressbook_content, groupPosition); convertView.setTag(R.id.cgt_tv_addressbook_group_item, -1); return convertView; }
Example 4
Source File: MyReviewAdapter.java From tysq-android with GNU General Public License v3.0 | 6 votes |
/** * 设置被回复的内容 */ private void setCommentedContent(MyCommentListResp.CommentInfoBean data, TextView tvContent, ImageView ivContent) { if (data.getCommentedId() == 0) { tvContent.setVisibility(View.GONE); ivContent.setVisibility(View.GONE); return; } tvContent.setVisibility(View.VISIBLE); ivContent.setVisibility(View.VISIBLE); String commentedName = data.getCommentedName(); String respondContent = data.getRespondContent(); SpannableStringBuilder builder = new SpannableStringBuilder(); builder.append(commentedName); builder.append(":"); builder.append(respondContent); tvContent.setText(builder); }
Example 5
Source File: RemindEditDialog.java From AssistantBySDK with Apache License 2.0 | 5 votes |
@Override protected void initTaskView(LinearLayout llTaskContainer) { View taskView = LayoutInflater.from(mContext).inflate(R.layout.remind_edit_dialog, null); contentText=(EditText) taskView.findViewById(R.id.red_content); timeText=(TextView) taskView.findViewById(R.id.red_time); dateText=(TextView) taskView.findViewById(R.id.red_date); frText=(TextView) taskView.findViewById(R.id.red_fr); taskView.findViewById(R.id.red_close).setOnClickListener(this); taskView.findViewById(R.id.red_cancel).setOnClickListener(this); taskView.findViewById(R.id.red_confirm).setOnClickListener(this); timeText.setOnClickListener(this); dateText.setOnClickListener(this); frText.setOnClickListener(this); if(remind!=null){ fr=remind.getFrequency(); dt=new SimpleDate(remind.getRtime()); dd.setTimeInMillis(remind.getRdate().getTime()); contentText.setText(remind.getContent()); } timeText.setText(dt.toString()); if(aheads==null){ dateText.setText(sf.format(new Date(dd.getTimeInMillis()))); frText.setText(AssistUtils.translateRemindFrequency(fr,dd)); } else{ taskView.findViewById(R.id.red_date_box).setVisibility(View.GONE); TextView msgT=(TextView)taskView.findViewById(R.id.red_msg); msgT.setText(msg); msgT.setVisibility(View.VISIBLE); } llTaskContainer.addView(taskView); }
Example 6
Source File: GankAdapter.java From gank with GNU General Public License v3.0 | 5 votes |
private void showCategory(boolean show, TextView tvCategory) { if (show) { tvCategory.setVisibility(View.VISIBLE); } else { tvCategory.setVisibility(View.GONE); } }
Example 7
Source File: UIUtils.java From OpenXiaomiScale with Apache License 2.0 | 5 votes |
public static void bmiLayoutVisibility (final Activity activity, final SharedPreferences preference) { boolean isBmiEnabled = preference.getBoolean("settingsBMICalculation", false); TextView bmiLabelTextView = (TextView) activity.findViewById(R.id.bmiLabelText); TextView bmiValueTextView = (TextView) activity.findViewById(R.id.bmiValueText); TextView bmiInformationTextView = (TextView) activity.findViewById(R.id.bmiInformationText); if ( isBmiEnabled ) { bmiValueTextView.setText(""); bmiInformationTextView.setText(""); bmiLabelTextView.setVisibility(View.VISIBLE); bmiValueTextView.setVisibility(View.VISIBLE); bmiInformationTextView.setVisibility(View.VISIBLE); } else { bmiValueTextView.setText(""); bmiInformationTextView.setText(""); bmiLabelTextView.setVisibility(View.GONE); bmiValueTextView.setVisibility(View.GONE); bmiInformationTextView.setVisibility(View.GONE); } }
Example 8
Source File: ZenThreadsAdapter.java From zen4android with MIT License | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { try { if (convertView == null) { convertView = mLayoutInflater.inflate(R.layout.zen_thread_item, null); } ZenThreadData data = array.get(position); TextView title = (TextView)convertView.findViewById(R.id.zen_thread_title); TextView date = (TextView)convertView.findViewById(R.id.zen_thread_date); TextView author = (TextView)convertView.findViewById(R.id.zen_thread_author); TextView replies = (TextView)convertView.findViewById(R.id.zen_thread_replies); TextView lights = (TextView)convertView.findViewById(R.id.zen_thread_light); title.setText(data.subject); date.setText(data.postdate); author.setText(data.author); int replyNum = Integer.parseInt(data.replies); int color = colorForReplies(replyNum); replies.setBackgroundResource(color); replies.setText(data.replies); if( Integer.parseInt(data.lights) > 0) { lights.setVisibility(View.VISIBLE); lights.setText(data.lights); } else { lights.setVisibility(View.INVISIBLE); } return convertView; } catch (Exception e) { e.printStackTrace(); } return null; }
Example 9
Source File: DetailedConversationAdapter.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void showAttachmentIconAndText(TextView attachedFile, final Message message, final String mimeType) { String fileName = ""; if (message.getFileMetas() == null && message.getFilePaths() != null) { fileName = message.getFilePaths().get(0).substring(message.getFilePaths().get(0).lastIndexOf("/") + 1); } else if (message.getFileMetas() != null) { fileName = message.getFileMetas().getName(); } attachedFile.setTextColor(message.isTypeOutbox() ? Color.parseColor(alCustomizationSettings.getSentMessageTextColor()) : Color.parseColor(alCustomizationSettings.getReceivedMessageTextColor())); attachedFile.setText(fileName); attachedFile.setVisibility(View.VISIBLE); attachedFile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { if (message.isAttachmentDownloaded()) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); Uri outputUri; if (Utils.hasNougat()) { outputUri = ALFileProvider.getUriForFile(context, Utils.getMetaDataValue(context, MobiComKitConstants.PACKAGE_NAME) + ".applozic.provider", new File(message.getFilePaths().get(0))); } else { outputUri = Uri.fromFile(new File(message.getFilePaths().get(0))); } intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); if (intent.resolveActivity(context.getPackageManager()) != null) { intent.setDataAndType(outputUri, mimeType); activityContext.startActivity(intent); } else { Toast.makeText(context, R.string.info_app_not_found_to_open_file, Toast.LENGTH_LONG).show(); } } } catch (Exception e) { Utils.printLog(context, TAG, "No application found to open this file"); } } }); }
Example 10
Source File: FootballLeagueAPIActivity.java From styT with Apache License 2.0 | 5 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(context).inflate(R.layout.view_footballleague_list_item, parent, false); } TextView tvName = (TextView) convertView.findViewById(R.id.tvName); View llInfo = convertView.findViewById(R.id.llInfo); TextView tvLeagueTypeCn = (TextView) convertView.findViewById(R.id.tvLeagueTypeCn); TextView tvMaxRound = (TextView) convertView.findViewById(R.id.tvMaxRound); TextView tvSeason = (TextView) convertView.findViewById(R.id.tvSeason); Map<String, Object> item = getItem(position); if (showName(position)) { tvName.setVisibility(View.VISIBLE); llInfo.setVisibility(View.VISIBLE); tvName.setText(String.valueOf(item.get("name"))); tvLeagueTypeCn.setText(String.valueOf(item.get("leagueTypeCn"))); tvMaxRound.setText(String.valueOf(item.get("maxRound"))); tvSeason.setText(String.valueOf(item.get("season"))); } else { tvName.setVisibility(View.GONE); llInfo.setVisibility(View.GONE); } TextView tvTeamNameCn = (TextView) convertView.findViewById(R.id.tvTeamNameCn); TextView tvTeamLogoUrl = (TextView) convertView.findViewById(R.id.tvTeamLogoUrl); tvTeamNameCn.setText(String.valueOf(item.get("teamNameCn"))); tvTeamLogoUrl.setText(String.valueOf(item.get("teamLogoUrl"))); return convertView; }
Example 11
Source File: SurveyStepLayout.java From ResearchStack with Apache License 2.0 | 5 votes |
public void initStepLayout() { LogExt.i(getClass(), "initStepLayout()"); container = (LinearLayout) findViewById(R.id.rsb_survey_content_container); TextView title = (TextView) findViewById(R.id.rsb_survey_title); TextView summary = (TextView) findViewById(R.id.rsb_survey_text); SubmitBar submitBar = (SubmitBar) findViewById(R.id.rsb_submit_bar); submitBar.setPositiveAction(v -> onNextClicked()); if (questionStep != null) { if (!TextUtils.isEmpty(questionStep.getTitle())) { title.setVisibility(View.VISIBLE); title.setText(questionStep.getTitle()); } if (!TextUtils.isEmpty(questionStep.getText())) { summary.setVisibility(View.VISIBLE); summary.setText(Html.fromHtml(questionStep.getText())); summary.setMovementMethod(new TextViewLinkHandler() { @Override public void onLinkClick(String url) { String path = ResourcePathManager.getInstance(). generateAbsolutePath(ResourcePathManager.Resource.TYPE_HTML, url); Intent intent = ViewWebDocumentActivity.newIntentForPath(getContext(), questionStep.getTitle(), path); getContext().startActivity(intent); } }); } if (questionStep.isOptional()) { submitBar.setNegativeTitle(R.string.rsb_step_skip); submitBar.setNegativeAction(v -> onSkipClicked()); } else { submitBar.getNegativeActionView().setVisibility(View.GONE); } } }
Example 12
Source File: FoldersAdapter.java From syncthing-android with Mozilla Public License 2.0 | 5 votes |
private void setTextOrHide(TextView view, String text) { if (TextUtils.isEmpty(text)) { view.setVisibility(GONE); } else { view.setText(text); view.setVisibility(VISIBLE); } }
Example 13
Source File: SelectDialog.java From ImagePicker with Apache License 2.0 | 5 votes |
private void initViews() { DialogAdapter dialogAdapter=new DialogAdapter(mName); ListView dialogList=(ListView) findViewById(R.id.dialog_list); dialogList.setOnItemClickListener(this); dialogList.setAdapter(dialogAdapter); mMBtn_Cancel = (Button) findViewById(R.id.mBtn_Cancel); mTv_Title = (TextView) findViewById(R.id.mTv_Title); mMBtn_Cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if(mCancelListener != null){ mCancelListener.onCancelClick(v); } dismiss(); } }); if(!TextUtils.isEmpty(mTitle) && mTv_Title != null){ mTv_Title.setVisibility(View.VISIBLE); mTv_Title.setText(mTitle); }else{ mTv_Title.setVisibility(View.GONE); } }
Example 14
Source File: DeviceInformationListAdapter.java From androiddevice.info with GNU General Public License v2.0 | 4 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if(null == view){ view = mInflater.inflate(R.layout.editable_list_item, parent, false); } KeyValuePair pair = getItem(position); if(null != pair){ TextView key = ((TextView)view.findViewById(android.R.id.text1)); key.setText(pair.key); key.setTextColor(mWhiteColor); final TextView value = ((TextView)view.findViewById(android.R.id.text2)); final TextView editable = ((TextView)view.findViewById(R.id.editable)); if(pair.isEditable){ value.setVisibility(View.GONE); editable.setVisibility(View.VISIBLE); if(null != mDeviceName && mDeviceName.length() > 0) { editable.setText(mDeviceName); } } else { value.setVisibility(View.VISIBLE); editable.setVisibility(View.GONE); value.setText(pair.valueString); value.setTextColor(mGreyColor); value.setMaxLines(10); value.setEllipsize(TextUtils.TruncateAt.END); } //details.setVisibility(TextView.GONE); // ((TextView)view.findViewById(android.R.id.text1)).setOnClickListener(new View.OnClickListener() { // private TextView detailsItem = details; // @Override // public void onClick(View view) { // if(detailsItem.getVisibility() == TextView.VISIBLE) { // detailsItem.setVisibility(TextView.GONE); // } else if(detailsItem.getVisibility() == TextView.GONE) { // detailsItem.setVisibility(TextView.VISIBLE); // } // } // }); } return view; }
Example 15
Source File: FloatingActionMenu.java From dttv-android with GNU General Public License v3.0 | 4 votes |
/** * Sets the layout of the ViewGroup dependent on the number of menu items as well as menu direction. */ @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { System.out.println("onLayout:" + changed); if (changed) { int right = r - getPaddingRight(); int bottom = b - getPaddingBottom(); int top = bottom - mMenuButton.getMeasuredHeight(); mMenuButton.layout(right - mMenuButton.getMeasuredWidth(), top, right, bottom); int dw = (mMenuButton.getMeasuredWidth() - mIcon.getMeasuredWidth()) / 2; int dh = (mMenuButton.getMeasuredHeight() - mIcon.getMeasuredHeight()) / 2; mIcon.layout(right - mIcon.getMeasuredWidth() - dw, bottom - mIcon.getMeasuredHeight() - dh, right - dw, bottom - dh); if (isCircle) { if (mMenuItems.size() < 2) { Log.e("onLayout", "Floating Action Buttons must more then one!"); return; } double angle = Math.PI/2d/(mMenuItems.size() - 1); for (int i = 0; i < mMenuItems.size(); i++) { FloatingActionButton itemFB = mMenuItems.get(i); int fbWidth = itemFB.getMeasuredWidth(); int fbHeight = itemFB.getMeasuredHeight(); if (0 != multipleOfFB) { mRadius = (int) (fbWidth * multipleOfFB); } int itemDw = (mMenuButton.getMeasuredWidth() - fbWidth) / 2; int itemDh = (mMenuButton.getMeasuredHeight() - fbHeight) / 2; int itemX = (int) (mRadius*Math.cos(i*angle)); int itemY = (int) (mRadius*Math.sin(i*angle)); itemFB.layout(right - itemX - fbWidth - itemDw, bottom - itemY - fbHeight - itemDh, right - itemX - itemDw, bottom - itemY - itemDh); if (!animating) { if (!mOpen) { itemFB.setTranslationY(mMenuButton.getTop() - itemFB.getTop()); itemFB.setTranslationX(mMenuButton.getLeft() - itemFB.getLeft()); itemFB.setVisibility(GONE); } else { itemFB.setTranslationY(0); itemFB.setTranslationX(0); itemFB.setVisibility(VISIBLE); } } } } else { for (int i = 0; i < mMenuItems.size(); i++) { FloatingActionButton item = mMenuItems.get(i); TextView label = mMenuItemLabels.get(i); label.setBackgroundResource(R.drawable.rounded_corners); bottom = top -= mItemGap; top -= item.getMeasuredHeight(); int width = item.getMeasuredWidth(); int d = (mMenuButton.getMeasuredWidth() - width) / 2; item.layout(right - width - d, top, right - d, bottom); d = (item.getMeasuredHeight() - label.getMeasuredHeight()) / 2; label.layout(item.getLeft() - label.getMeasuredWidth() - 50, item.getTop() + d, item.getLeft(), item.getTop() + d + label.getMeasuredHeight()); if (!animating) { if (!mOpen) { item.setTranslationY(mMenuButton.getTop() - item.getTop()); item.setVisibility(GONE); label.setVisibility(GONE); } else { item.setTranslationY(0); item.setVisibility(VISIBLE); label.setVisibility(VISIBLE); } } } } if (!animating && getBackground() != null) { if (!mOpen) { getBackground().setAlpha(0); } else { getBackground().setAlpha(0xff); } } } }
Example 16
Source File: ExamScheduleFragment.java From utexas-utilities with Apache License 2.0 | 4 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View vg = inflater.inflate(R.layout.exam_schedule_fragment_layout, container, false); progressLayout = (LinearLayout) vg.findViewById(R.id.examschedule_progressbar_ll); examListview = (ListView) vg.findViewById(R.id.examschedule_listview); errorLayout = vg.findViewById(R.id.examschedule_error); errorTextView = (TextView) vg.findViewById(R.id.tv_failure); if (savedInstanceState != null) { switch (loadStatus) { case NOT_STARTED: // defaults should suffice break; case LOADING: progressLayout.setVisibility(View.VISIBLE); errorLayout.setVisibility(View.GONE); examListview.setVisibility(View.GONE); break; case SUCCEEDED: progressLayout.setVisibility(View.GONE); errorLayout.setVisibility(View.GONE); examListview.setVisibility(View.VISIBLE); break; case FAILED: progressLayout.setVisibility(View.GONE); errorLayout.setVisibility(View.VISIBLE); examListview.setVisibility(View.GONE); break; } } if (!utdAuthCookie.hasCookieBeenSet()) { progressLayout.setVisibility(View.GONE); errorTextView.setText(getString(R.string.login_first)); errorTextView.setVisibility(View.VISIBLE); } else if (loadStatus == LoadStatus.NOT_STARTED && mApp.getCachedTask(TASK_TAG) == null){ loadStatus = LoadStatus.LOADING; prepareToLoad(); FetchExamDataTask task = new FetchExamDataTask(TASK_TAG); task.execute(false); } else { setupAdapter(); } return vg; }
Example 17
Source File: InstructionStepLayout.java From ResearchStack with Apache License 2.0 | 4 votes |
private void initializeStep() { if (step != null) { // Set Title if (!TextUtils.isEmpty(step.getTitle())) { TextView title = (TextView) findViewById(R.id.rsb_intruction_title); title.setVisibility(View.VISIBLE); title.setText(step.getTitle()); } // Set Summary if (!TextUtils.isEmpty(step.getText())) { TextView summary = (TextView) findViewById(R.id.rsb_intruction_text); summary.setVisibility(View.VISIBLE); summary.setText(Html.fromHtml(step.getText())); summary.setMovementMethod(new TextViewLinkHandler() { @Override public void onLinkClick(String url) { String path = ResourcePathManager.getInstance(). generateAbsolutePath(ResourcePathManager.Resource.TYPE_HTML, url); Intent intent = ViewWebDocumentActivity.newIntentForPath(getContext(), step.getTitle(), path); getContext().startActivity(intent); } }); } // Set Next / Skip SubmitBar submitBar = (SubmitBar) findViewById(R.id.rsb_submit_bar); submitBar.setPositiveTitle(R.string.rsb_next); submitBar.setPositiveAction(v -> callbacks.onSaveStep(StepCallbacks.ACTION_NEXT, step, null)); if (step.isOptional()) { submitBar.setNegativeTitle(R.string.rsb_step_skip); submitBar.setNegativeAction(v -> { if (callbacks != null) { callbacks.onSaveStep(StepCallbacks.ACTION_NEXT, step, null); } }); } else { submitBar.getNegativeActionView().setVisibility(View.GONE); } } }
Example 18
Source File: PassCodeActivity.java From Cirrus_depricated with GNU General Public License v2.0 | 4 votes |
/** * Initializes the activity. * * An intent with a valid ACTION is expected; if none is found, an * {@link IllegalArgumentException} will be thrown. * * @param savedInstanceState Previously saved state - irrelevant in this case */ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.passcodelock); getWindow().setDimAmount(0.9f); //getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND); mBCancel = (Button) findViewById(R.id.cancel); mPassCodeHdr = (TextView) findViewById(R.id.header); mPassCodeHdrExplanation = (TextView) findViewById(R.id.explanation); mPassCodeEditTexts[0] = (EditText) findViewById(R.id.txt0); mPassCodeEditTexts[0].requestFocus(); getWindow().setSoftInputMode( android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); mPassCodeEditTexts[1] = (EditText) findViewById(R.id.txt1); mPassCodeEditTexts[2] = (EditText) findViewById(R.id.txt2); mPassCodeEditTexts[3] = (EditText) findViewById(R.id.txt3); if (ACTION_CHECK.equals(getIntent().getAction())) { /// this is a pass code request; the user has to input the right value mPassCodeHdr.setText(R.string.pass_code_enter_pass_code); mPassCodeHdrExplanation.setVisibility(View.INVISIBLE); setCancelButtonEnabled(false); // no option to cancel } else if (ACTION_REQUEST_WITH_RESULT.equals(getIntent().getAction())) { if (savedInstanceState != null) { mConfirmingPassCode = savedInstanceState.getBoolean(PassCodeActivity.KEY_CONFIRMING_PASSCODE); mPassCodeDigits = savedInstanceState.getStringArray(PassCodeActivity.KEY_PASSCODE_DIGITS); } if(mConfirmingPassCode){ //the app was in the passcodeconfirmation requestPassCodeConfirmation(); }else{ /// pass code preference has just been activated in Preferences; // will receive and confirm pass code value mPassCodeHdr.setText(R.string.pass_code_configure_your_pass_code); //mPassCodeHdr.setText(R.string.pass_code_enter_pass_code); // TODO choose a header, check iOS mPassCodeHdrExplanation.setVisibility(View.VISIBLE); setCancelButtonEnabled(true); } } else if (ACTION_CHECK_WITH_RESULT.equals(getIntent().getAction())) { /// pass code preference has just been disabled in Preferences; // will confirm user knows pass code, then remove it mPassCodeHdr.setText(R.string.pass_code_remove_your_pass_code); mPassCodeHdrExplanation.setVisibility(View.INVISIBLE); setCancelButtonEnabled(true); } else { throw new IllegalArgumentException("A valid ACTION is needed in the Intent passed to " + TAG); } setTextListeners(); }
Example 19
Source File: SetFavoriteMapActivity.java From AssistantBySDK with Apache License 2.0 | 4 votes |
/** * 设置"目的地"地址 **/ private void setEnd(final TextView tipsView, final TextView confirmView, final BaiduAddress ad, boolean update) { if (update) { if (ad.getRemark() != null && ad.getRemark().equals("目的地")) { new CommonDialog(SetFavoriteMapActivity.this, "清除确认", "您确定要清除目的地位置:" + ad.getName() + "?", "取消", "确定") .setOnConfirmListener(new CommonDialog.OnConfirmListener() { @Override public void onConfirm() { confirmView.setText("设为目的地"); tipsView.setVisibility(View.GONE); ad.setRemark(null); ad.setFavoritedTime(null); ad.setSynced(false); mAppConfig.endAddress = null; mNaviDao.insertAddress(ad); updateCode = NaviSetPointPresenter.Msg.UPDATE_END; //Toast.makeText(SetFavoriteMapActivity.this, "清除成功", Toast.LENGTH_SHORT).show(); Snackbar.make(mAmosfPoiList, "清除成功", Snackbar.LENGTH_SHORT).show(); mNaviDao.sync(); onFinish(); } }).show(); } else { BaiduAddress endAddr = new BaiduAddress(); mNaviDao.removeHomeOrCompany("目的地"); endAddr.reset(ad); endAddr.setRemark("目的地"); endAddr.setId(null); endAddr.setFavoritedTime(null); tipsView.setText("已设为目的地"); tipsView.setVisibility(View.VISIBLE); confirmView.setText("清空"); mNaviDao.insertAddress(endAddr); mAppConfig.endAddress = endAddr; updateCode = NaviSetPointPresenter.Msg.UPDATE_END; onFinish(); } } else { if (ad.getRemark() != null && ad.getRemark().equals("目的地")) { tipsView.setText("已设为目的地"); tipsView.setVisibility(View.VISIBLE); confirmView.setText("清空"); } else { confirmView.setText("设为目的地"); tipsView.setVisibility(View.GONE); } } }
Example 20
Source File: SyncFragment.java From SteamGifts with MIT License | 3 votes |
public void onSyncDetailsLoaded(String xsrfToken, String lastSyncTime) { this.xsrfToken = xsrfToken; getView().findViewById(R.id.sync_now).setEnabled(true); TextView lastSyncView = (TextView) getView().findViewById(R.id.sync_time); lastSyncView.setVisibility(lastSyncTime == null ? View.GONE : View.VISIBLE); lastSyncView.setText(lastSyncTime); }