List of usage examples for android.view View INVISIBLE
int INVISIBLE
To view the source code for android.view View INVISIBLE.
Click Source Link
From source file:com.example.javier.MaterialDesignApp.PlayerActivity.java
@Override public void onText(String text) { if (TextUtils.isEmpty(text)) { subtitleView.setVisibility(View.INVISIBLE); } else {/* w ww . j a v a2 s .c o m*/ subtitleView.setVisibility(View.VISIBLE); subtitleView.setText(text); } }
From source file:ee.ioc.phon.android.speak.RecognizerIntentActivity.java
private void setTvPrompt() { String prompt = getPrompt();/* w w w .ja v a2 s . c o m*/ if (prompt == null || prompt.length() == 0) { mTvPrompt.setVisibility(View.INVISIBLE); } else { mTvPrompt.setText(prompt); mTvPrompt.setVisibility(View.VISIBLE); } }
From source file:com.cryart.sabbathschool.viewmodel.SSReadingViewModel.java
@Override public void onSelectionFinished() { if (ssReadingActivityBinding != null) { ssReadingActivityBinding.ssContextMenu.ssReadingContextMenu.setVisibility(View.INVISIBLE); }/*from w ww.ja v a2s . c o m*/ }
From source file:com.mibr.android.intelligentreminder.INeedToo.java
@Override public Dialog onCreateDialog(int id) { switch (id) { case DIALOG_REMINDER_CONTACTS_SERVICE_FAILED_LICENSING: AlertDialog.Builder buildersvc = new AlertDialog.Builder(this); buildersvc.setMessage(// w ww . j a v a 2 s .com "The Reminder Contact Service add-on that you've got installed is not a licensed version"); buildersvc.setCancelable(false) .setNeutralButton(R.string.msg_cus, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { String[] mailto = { "info@intelligentreminder.com", "" }; Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto); sendIntent.putExtra(Intent.EXTRA_SUBJECT, "".toString()); sendIntent.putExtra(Intent.EXTRA_TEXT, "".toString()); sendIntent.setType("text/plain"); startActivity(Intent.createChooser(sendIntent, "Send EMail...")); } }).setPositiveButton(R.string.msg_register, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (INeedToo.IS_ANDROID_VERSION) { String uri = getString(R.string.indeedtopayforservice); Intent ii3 = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(ii3); } else { Uri uri = Uri.parse( "http://www.amazon.com/gp/mas/dl/android?p=com.mibr.android.remindercontacts"); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } isReminderContactsAvailable = true; iDidReminderContacts = false; } }).setNegativeButton(R.string.msg_cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); AlertDialog alert = buildersvc.create(); return alert; case DOING_SAMPLE_NEEDS_DIALOG: if (allItems == null) { return null; } dialogDoingSamples = new Dialog(this); dialogDoingSamples.setOwnerActivity(this); dialogDoingSamples.setContentView(R.layout.ineedvoiceprogress); dialogDoingSamples.setTitle("Working ..."); ((Button) dialogDoingSamples.findViewById(R.id.needvoiceprogress_cancel)).setEnabled(true); ((Button) dialogDoingSamples.findViewById(R.id.needvoiceprogress_ok)).setEnabled(false); ; // dialogDoingSamples.show(); ArrayList stuff = new ArrayList(); stuff.add(dialogDoingSamples); stuff.add(getApplicationContext()); stuff.add(this); stuff.add(getLocationManager()); stuff.add(getDbAdapter()); stuff.add(allItems.get(whereImAtInAllItems)); stuff.add(new Integer(1)); new NeedByVoiceProgress().execute(stuff); return dialogDoingSamples; case DIALOG_SAMPLES: Dialog aDialog = null; AlertDialog.Builder builder2; LayoutInflater inflater2 = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); View layout2 = inflater2.inflate(R.layout.ineedsamples, (ViewGroup) findViewById(R.id.hijklmnop)); builder2 = new AlertDialog.Builder(this); builder2.setView(layout2); builder2.setTitle("Build Sample Data Set"); builder2.setPositiveButton("Okay", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { allItems = new ArrayList<ArrayList<String>>(); Boolean doit = false; StringBuilder sb = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); StringBuilder sb3 = new StringBuilder(); int cnt = 0; Boolean dw = false; ArrayList<String> jdmatchesSS = null; ; sb.append("I need Print Cartridges description HP 28 and 48 "); if (mWalmart != null && mWalmart.isChecked()) { sb.append(" location Walmart "); dw = true; } if (mWalgreens != null && mWalgreens.isChecked()) { sb.append(" location Walgreens "); dw = true; } if (dw) { // they checked something doit = true; jdmatchesSS = new ArrayList<String>(); jdmatchesSS.add(sb.toString()); allItems.add(jdmatchesSS); cnt++; } if (mSevenEleven != null && mSevenEleven.isChecked()) { sb3.append("I need Energy Drink description Red Bull location 7-Eleven "); ArrayList<String> jdmatches = new ArrayList<String>(); jdmatches.add(sb3.toString()); allItems.add(jdmatches); cnt++; doit = true; } if (mStarbucks != null && mStarbucks.isChecked()) { sb2.append("I need Coffee description French Roast location Starbucks"); ArrayList<String> jdmatches = new ArrayList<String>(); jdmatches.add(sb2.toString()); allItems.add(jdmatches); cnt++; doit = true; } if (doit) { whereImAtInAllItems = 0; INeedToo.this.showDialog(DOING_SAMPLE_NEEDS_DIALOG); } } }); mWalmart = (CheckBox) layout2.findViewById(R.id.BuildWalmart); mWalgreens = (CheckBox) layout2.findViewById(R.id.BuildWalgreens); mSevenEleven = (CheckBox) layout2.findViewById(R.id.Build7Eleven); mStarbucks = (CheckBox) layout2.findViewById(R.id.BuildStarbucks); aDialog = builder2.create(); return aDialog; case DIALOG_SPLASH: /* jdd=new Dialog(mContext); jdd.setContentView(R.layout.ineed2splash); jdd.setTitle("W E L C O M E"); */ AlertDialog.Builder builder; LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.ineed2splashv2, (ViewGroup) findViewById(R.id.ScrollView01lmnop2)); builder = new AlertDialog.Builder(this); builder.setPositiveButton("Okay", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (mWantSample != null) { if (mWantSample.isChecked()) { showDialog(DIALOG_SAMPLES); } } } }); builder.setTitle("W E L C O M E"); if (getDbAdapter().thereAreSomeLocationsOnSystem()) { LinearLayout ll = (LinearLayout) layout.findViewById(R.id.CreateDefaultValues); ll.setVisibility(View.INVISIBLE); } else { mWantSample = (CheckBox) layout.findViewById(R.id.BuildDefaultValues); } builder.setView(layout); jdd = builder.create(); //Button butt=(Button)jdd.findViewById(R.id.Button01); /*butt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { jdd.cancel(); } }); */ break; default: return null; } return jdd; }
From source file:com.easemob.chatui.adapter.MessageAdapter.java
@SuppressLint("NewApi") public View getView(final int position, View convertView, ViewGroup parent) { final EMMessage message = getItem(position); ChatType chatType = message.getChatType(); final ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = createViewByMessage(message, position); if (message.getType() == EMMessage.Type.IMAGE) { try { holder.iv = ((ImageView) convertView.findViewById(R.id.iv_sendPicture)); holder.iv_avatar = (ImageView) convertView.findViewById(R.id.iv_userhead); holder.tv = (TextView) convertView.findViewById(R.id.percentage); holder.pb = (ProgressBar) convertView.findViewById(R.id.progressBar); holder.staus_iv = (ImageView) convertView.findViewById(R.id.msg_status); holder.tv_usernick = (TextView) convertView.findViewById(R.id.tv_userid); } catch (Exception e) { }/*from w w w . ja v a2 s . co m*/ } else if (message.getType() == EMMessage.Type.TXT) { try { holder.pb = (ProgressBar) convertView.findViewById(R.id.pb_sending); holder.staus_iv = (ImageView) convertView.findViewById(R.id.msg_status); holder.iv_avatar = (ImageView) convertView.findViewById(R.id.iv_userhead); // holder.tv = (TextView) convertView.findViewById(R.id.tv_chatcontent); holder.tv_usernick = (TextView) convertView.findViewById(R.id.tv_userid); holder.tvTitle = (TextView) convertView.findViewById(R.id.tvTitle); holder.tvList = (LinearLayout) convertView.findViewById(R.id.ll_layout); } catch (Exception e) { } // ??? if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false) || message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VIDEO_CALL, false)) { holder.iv = (ImageView) convertView.findViewById(R.id.iv_call_icon); holder.tv = (TextView) convertView.findViewById(R.id.tv_chatcontent); } } else if (message.getType() == EMMessage.Type.VOICE) { try { holder.iv = ((ImageView) convertView.findViewById(R.id.iv_voice)); holder.iv_avatar = (ImageView) convertView.findViewById(R.id.iv_userhead); holder.tv = (TextView) convertView.findViewById(R.id.tv_length); holder.pb = (ProgressBar) convertView.findViewById(R.id.pb_sending); holder.staus_iv = (ImageView) convertView.findViewById(R.id.msg_status); holder.tv_usernick = (TextView) convertView.findViewById(R.id.tv_userid); holder.iv_read_status = (ImageView) convertView.findViewById(R.id.iv_unread_voice); } catch (Exception e) { } } else if (message.getType() == EMMessage.Type.LOCATION) { try { holder.iv_avatar = (ImageView) convertView.findViewById(R.id.iv_userhead); holder.tv = (TextView) convertView.findViewById(R.id.tv_location); holder.pb = (ProgressBar) convertView.findViewById(R.id.pb_sending); holder.staus_iv = (ImageView) convertView.findViewById(R.id.msg_status); holder.tv_usernick = (TextView) convertView.findViewById(R.id.tv_userid); } catch (Exception e) { } } else if (message.getType() == EMMessage.Type.VIDEO) { try { holder.iv = ((ImageView) convertView.findViewById(R.id.chatting_content_iv)); holder.iv_avatar = (ImageView) convertView.findViewById(R.id.iv_userhead); holder.tv = (TextView) convertView.findViewById(R.id.percentage); holder.pb = (ProgressBar) convertView.findViewById(R.id.progressBar); holder.staus_iv = (ImageView) convertView.findViewById(R.id.msg_status); holder.size = (TextView) convertView.findViewById(R.id.chatting_size_iv); holder.timeLength = (TextView) convertView.findViewById(R.id.chatting_length_iv); holder.playBtn = (ImageView) convertView.findViewById(R.id.chatting_status_btn); holder.container_status_btn = (LinearLayout) convertView .findViewById(R.id.container_status_btn); holder.tv_usernick = (TextView) convertView.findViewById(R.id.tv_userid); } catch (Exception e) { } } else if (message.getType() == EMMessage.Type.FILE) { try { holder.iv_avatar = (ImageView) convertView.findViewById(R.id.iv_userhead); holder.tv_file_name = (TextView) convertView.findViewById(R.id.tv_file_name); holder.tv_file_size = (TextView) convertView.findViewById(R.id.tv_file_size); holder.pb = (ProgressBar) convertView.findViewById(R.id.pb_sending); holder.staus_iv = (ImageView) convertView.findViewById(R.id.msg_status); holder.tv_file_download_state = (TextView) convertView.findViewById(R.id.tv_file_state); holder.ll_container = (LinearLayout) convertView.findViewById(R.id.ll_file_container); // holder.tv = (TextView) convertView.findViewById(R.id.percentage); } catch (Exception e) { } try { holder.tv_usernick = (TextView) convertView.findViewById(R.id.tv_userid); } catch (Exception e) { } } convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } // ?????? if ((chatType == ChatType.GroupChat || chatType == chatType.ChatRoom) && message.direct == Direct.RECEIVE) { //demousername?nick // holder.tv_usernick.setText(message.getFrom()); /**?userid????*/ HttpUtils httpUtils = new HttpUtils(); MyRequestParams params = new MyRequestParams(); params.addQueryStringParameter("userid", BeewayApplication.getInstance().getmUserid(context)); params.addQueryStringParameter("friendid", message.getFrom()); params.addQueryStringParameter("track", 1 + ""); String url = params.myRequestParams(params); httpUtils.send(HttpRequest.HttpMethod.POST, UrlPools.USER_DETAIL + "?" + url, new RequestCallBack<String>() { @Override public void onSuccess(ResponseInfo<String> responseInfo) { String result = responseInfo.result; UserDetailBean userDetailBean = UserDetailsActivity.paraseUserDetail(result); holder.tv_usernick.setText(userDetailBean.getData().getFriend().getNickname()); } @Override public void onFailure(HttpException e, String s) { LogUtils.e(s); holder.tv_usernick.setText(""); } }); } // ??????textview if (!(chatType == ChatType.GroupChat || chatType == chatType.ChatRoom) && message.direct == Direct.SEND) { holder.tv_ack = (TextView) convertView.findViewById(R.id.tv_ack); holder.tv_delivered = (TextView) convertView.findViewById(R.id.tv_delivered); if (holder.tv_ack != null) { if (message.isAcked) { if (holder.tv_delivered != null) { holder.tv_delivered.setVisibility(View.INVISIBLE); } holder.tv_ack.setVisibility(View.VISIBLE); } else { holder.tv_ack.setVisibility(View.INVISIBLE); // check and display msg delivered ack status if (holder.tv_delivered != null) { if (message.isDelivered) { holder.tv_delivered.setVisibility(View.VISIBLE); } else { holder.tv_delivered.setVisibility(View.INVISIBLE); } } } } } else { // ??group messgae,chatroom message?? if ((message.getType() == EMMessage.Type.TXT || message.getType() == EMMessage.Type.LOCATION) && !message.isAcked && chatType != ChatType.GroupChat && chatType != ChatType.ChatRoom) { // ?? if (!message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false)) { try { EMChatManager.getInstance().ackMessageRead(message.getFrom(), message.getMsgId()); // ?? message.isAcked = true; } catch (Exception e) { e.printStackTrace(); } } } } //? setUserAvatar(message, holder.iv_avatar); switch (message.getType()) { // ??typeitem case IMAGE: // handleImageMessage(message, holder, position, convertView); break; case TXT: // if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false) || message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VIDEO_CALL, false)) // ? handleCallMessage(message, holder, position); else if (((DemoHXSDKHelper) HXSDKHelper.getInstance()).isRobotMenuMessage(message)) //?? handleRobotMenuMessage(message, holder, position); else handleTextMessage(message, holder, position); break; case LOCATION: // ? handleLocationMessage(message, holder, position, convertView); break; case VOICE: // handleVoiceMessage(message, holder, position, convertView); break; case VIDEO: // handleVideoMessage(message, holder, position, convertView); break; case FILE: // handleFileMessage(message, holder, position, convertView); break; default: // not supported } if (message.direct == Direct.SEND) { View statusView = convertView.findViewById(R.id.msg_status); // ?? statusView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // ???alertdialog Intent intent = new Intent(activity, AlertDialog.class); intent.putExtra("msg", activity.getString(R.string.confirm_resend)); intent.putExtra("title", activity.getString(R.string.resend)); intent.putExtra("cancel", true); intent.putExtra("position", position); if (message.getType() == EMMessage.Type.TXT) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_TEXT); else if (message.getType() == EMMessage.Type.VOICE) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_VOICE); else if (message.getType() == EMMessage.Type.IMAGE) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_PICTURE); else if (message.getType() == EMMessage.Type.LOCATION) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_LOCATION); else if (message.getType() == EMMessage.Type.FILE) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_FILE); else if (message.getType() == EMMessage.Type.VIDEO) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_VIDEO); } }); /**???*/ holder.iv_avatar.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(activity, UserDetailsActivity.class); intent.putExtra("friendid", EMChatManager.getInstance().getCurrentUser()); activity.startActivity(intent); } }); } else { final String st = context.getResources().getString(R.string.Into_the_blacklist); if (!((ChatActivity) activity).isRobot && chatType != ChatType.ChatRoom) { // ???? holder.iv_avatar.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { Intent intent = new Intent(activity, AlertDialog.class); intent.putExtra("msg", st); intent.putExtra("cancel", true); intent.putExtra("position", position); activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_ADD_TO_BLACKLIST); return true; } }); /**???*/ holder.iv_avatar.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(activity, UserDetailsActivity.class); intent.putExtra("friendid", message.getFrom()); activity.startActivity(intent); } }); } } TextView timestamp = (TextView) convertView.findViewById(R.id.timestamp); if (position == 0) { timestamp.setText(DateUtils.getTimestampString(new Date(message.getMsgTime()))); timestamp.setVisibility(View.VISIBLE); } else { // ??? EMMessage prevMessage = getItem(position - 1); if (prevMessage != null && DateUtils.isCloseEnough(message.getMsgTime(), prevMessage.getMsgTime())) { timestamp.setVisibility(View.GONE); } else { timestamp.setText(DateUtils.getTimestampString(new Date(message.getMsgTime()))); timestamp.setVisibility(View.VISIBLE); } } return convertView; }
From source file:com.eutectoid.dosomething.picker.PickerFragment.java
void hideActivityCircle() { if (activityCircle != null) { // We use an animation to dim the activity circle; need to clear this or it will remain visible. activityCircle.clearAnimation(); activityCircle.setVisibility(View.INVISIBLE); }/* w w w .jav a 2s . c o m*/ }
From source file:com.money.manager.ex.home.HomeFragment.java
private void addFooterToExpandableListView(double curTotal, double curReconciled) { // manage footer list view if (linearFooter == null) { linearFooter = (LinearLayout) getActivity().getLayoutInflater().inflate(R.layout.item_account_bills, null);/*ww w.ja va 2 s . co m*/ // text view into layout txtFooterSummary = (TextView) linearFooter.findViewById(R.id.textViewItemAccountTotal); txtFooterSummaryReconciled = (TextView) linearFooter .findViewById(R.id.textViewItemAccountTotalReconciled); if (mHideReconciled) { txtFooterSummaryReconciled.setVisibility(View.GONE); } // set text TextView txtTextSummary = (TextView) linearFooter.findViewById(R.id.textViewItemAccountName); txtTextSummary.setText(R.string.summary); // invisible image ImageView imgSummary = (ImageView) linearFooter.findViewById(R.id.imageViewAccountType); imgSummary.setVisibility(View.INVISIBLE); // set color textview txtTextSummary.setTextColor(Color.GRAY); txtFooterSummary.setTextColor(Color.GRAY); if (!mHideReconciled) { txtFooterSummaryReconciled.setTextColor(Color.GRAY); } } // remove footer mExpandableListView.removeFooterView(linearFooter); // set text txtTotalAccounts.setText(mCurrencyService.getBaseCurrencyFormatted(MoneyFactory.fromDouble(curTotal))); txtFooterSummary.setText(txtTotalAccounts.getText()); if (!mHideReconciled) { txtFooterSummaryReconciled .setText(mCurrencyService.getBaseCurrencyFormatted(MoneyFactory.fromDouble(curReconciled))); } // add footer mExpandableListView.addFooterView(linearFooter, null, false); }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventFragment.java
/** * Called when the activity is first created. *//*w ww . j a va 2s . c om*/ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); BugSenseHandler.initAndStartSession(getActivity(), "44a76a8c"); settings = PreferenceManager.getDefaultSharedPreferences(getActivity()); firstLoadHandler = new Handler() { public void handleMessage(Message msg) { //dialog.dismiss(); try { if (EventObject.has("result") && EventObject.getJSONObject("result").getBoolean("success") == true) { EventDetails = EventObject.getJSONObject("result").getJSONArray("event").getJSONObject(0); try { //Log.e("Ack",EventDetails.getString("eventState")); if (EventDetails.getString("eventState").equals("Acknowledged") || EventDetails.getString("eventState").equals("1")) { ackIcon.setImageResource(R.drawable.ic_acknowledged); isAcknowledged = true; } } catch (Exception e) { e.printStackTrace(); BugSenseHandler.sendExceptionMessage("ViewZenossEventFragment", "loadhandler ack image", e); } //Log.e("EventDetails", EventDetails.toString(3)); try { Title.setText(EventDetails.getString("device_title")); } catch (Exception e) { Title.setText("Unknown Device - Event Details"); } try { Component.setText(EventDetails.getString("component")); } catch (Exception e) { Component.setText("Unknown Component"); } try { if (!EventDetails.getString("eventClassKey").equals("")) { EventClass.setText(EventDetails.getString("eventClassKey")); } else { EventClass.setText("Unknown Event Class"); } } catch (Exception e) { EventClass.setText("Unknown Event Class"); } try { //ImageView img = (ImageView) findViewById(R.id.summaryImage); URLImageParser p = new URLImageParser(img, getActivity(), Summary); String summaryText = EventDetails.getString("message"); Spanned htmlSpan = Html.fromHtml(summaryText, p, null); //Log.e("summary",summaryText); summaryText = summaryText.replaceAll("<img\\s*src=('|\")([^'>]+)'\\s*/>", ""); //Log.e("summary2",summaryText); Summary.setText(Html.fromHtml(summaryText, null, null)); //Log.i("Summary", EventDetails.getString("message")); try { Summary.setMovementMethod(LinkMovementMethod.getInstance()); } catch (Exception e) { e.printStackTrace(); BugSenseHandler.sendExceptionMessage("ViewZenossEventFragment", "set Summary MovementMethod", e); //Worth a shot } } catch (Exception e) { e.printStackTrace(); Summary.setText("No Summary available"); } try { FirstTime.setText(EventDetails.getString("firstTime")); } catch (Exception e) { FirstTime.setText("No Start Date Provided"); } try { LastTime.setText(EventDetails.getString("stateChange")); } catch (Exception e) { LastTime.setText("No Recent Date Provided"); } try { EventCount.setText("Count: " + EventDetails.getString("count")); } catch (Exception e) { EventCount.setText("Count: ??"); } try { agent.setText(EventDetails.getString("agent")); } catch (Exception e) { agent.setText("unknown"); } try { JSONArray Log = EventDetails.getJSONArray("log"); int LogEntryCount = Log.length(); if (LogEntryCount == 0) { TextView newLog = new TextView(getActivity()); newLog.setText("No log entries could be found"); LogEntries = new String[1]; LogEntries[0] = "No log entries could be found"; logList.addView(newLog); } else { LogEntries = new String[LogEntryCount]; for (int i = 0; i < LogEntryCount; i++) { LogEntries[i] = "<strong>" + Log.getJSONArray(i).getString(0) + "</strong> wrote " + Log.getJSONArray(i).getString(2) + "\n<br/><strong>At:</strong> " + Log.getJSONArray(i).getString(1); TextView newLog = new TextView(getActivity()); newLog.setText(Html.fromHtml(LogEntries[i])); newLog.setPadding(0, 6, 0, 6); logList.addView(newLog); } } } catch (Exception e) { TextView newLog = new TextView(getActivity()); newLog.setText("No log entries could be found"); newLog.setPadding(0, 6, 0, 6); logList.addView(newLog); } progressbar.setVisibility(View.INVISIBLE); } else { //Log.e("EventObject",EventObject.toString(3)); String errMsg = "."; if (EventObject.has("type") && EventObject.getString("type").equals("exception") && EventObject.has("message")) errMsg = ":\n" + EventObject.getString("message"); Toast.makeText(getActivity(), "There was an error refreshing the Event details from Zenoss" + errMsg, Toast.LENGTH_LONG).show(); } } catch (Exception e) { try { Toast.makeText(getActivity(), "An error was encountered parsing the JSON. An error report has been sent.", Toast.LENGTH_LONG).show(); } catch (Exception e2) { e.printStackTrace(); e2.printStackTrace(); } BugSenseHandler.sendExceptionMessage("ViewZenossEventFragment", "uncaught exception within firstload", e); } } }; }
From source file:cn.ucai.superwechat.adapter.MessageAdapter.java
@SuppressLint("NewApi") public View getView(final int position, View convertView, ViewGroup parent) { final EMMessage message = getItem(position); ChatType chatType = message.getChatType(); final ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = createViewByMessage(message, position); if (message.getType() == EMMessage.Type.IMAGE) { try { holder.iv = ((ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.iv_sendPicture)); holder.iv_avatar = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.iv_userhead); holder.tv = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.percentage); holder.pb = (ProgressBar) convertView.findViewById(cn.ucai.superwechat.R.id.progressBar); holder.staus_iv = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.msg_status); holder.tv_usernick = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_userid); } catch (Exception e) { }// w ww . j a v a2s. c o m } else if (message.getType() == EMMessage.Type.TXT) { try { holder.pb = (ProgressBar) convertView.findViewById(cn.ucai.superwechat.R.id.pb_sending); holder.staus_iv = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.msg_status); holder.iv_avatar = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.iv_userhead); // holder.tv = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_chatcontent); holder.tv_usernick = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_userid); holder.tvTitle = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tvTitle); holder.tvList = (LinearLayout) convertView.findViewById(cn.ucai.superwechat.R.id.ll_layout); } catch (Exception e) { } // ??? if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false) || message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VIDEO_CALL, false)) { holder.iv = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.iv_call_icon); holder.tv = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_chatcontent); } } else if (message.getType() == EMMessage.Type.VOICE) { try { holder.iv = ((ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.iv_voice)); holder.iv_avatar = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.iv_userhead); holder.tv = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_length); holder.pb = (ProgressBar) convertView.findViewById(cn.ucai.superwechat.R.id.pb_sending); holder.staus_iv = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.msg_status); holder.tv_usernick = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_userid); holder.iv_read_status = (ImageView) convertView .findViewById(cn.ucai.superwechat.R.id.iv_unread_voice); } catch (Exception e) { } } else if (message.getType() == EMMessage.Type.LOCATION) { try { holder.iv_avatar = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.iv_userhead); holder.tv = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_location); holder.pb = (ProgressBar) convertView.findViewById(cn.ucai.superwechat.R.id.pb_sending); holder.staus_iv = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.msg_status); holder.tv_usernick = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_userid); } catch (Exception e) { } } else if (message.getType() == EMMessage.Type.VIDEO) { try { holder.iv = ((ImageView) convertView .findViewById(cn.ucai.superwechat.R.id.chatting_content_iv)); holder.iv_avatar = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.iv_userhead); holder.tv = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.percentage); holder.pb = (ProgressBar) convertView.findViewById(cn.ucai.superwechat.R.id.progressBar); holder.staus_iv = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.msg_status); holder.size = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.chatting_size_iv); holder.timeLength = (TextView) convertView .findViewById(cn.ucai.superwechat.R.id.chatting_length_iv); holder.playBtn = (ImageView) convertView .findViewById(cn.ucai.superwechat.R.id.chatting_status_btn); holder.container_status_btn = (LinearLayout) convertView .findViewById(cn.ucai.superwechat.R.id.container_status_btn); holder.tv_usernick = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_userid); } catch (Exception e) { } } else if (message.getType() == EMMessage.Type.FILE) { try { holder.iv_avatar = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.iv_userhead); holder.tv_file_name = (TextView) convertView .findViewById(cn.ucai.superwechat.R.id.tv_file_name); holder.tv_file_size = (TextView) convertView .findViewById(cn.ucai.superwechat.R.id.tv_file_size); holder.pb = (ProgressBar) convertView.findViewById(cn.ucai.superwechat.R.id.pb_sending); holder.staus_iv = (ImageView) convertView.findViewById(cn.ucai.superwechat.R.id.msg_status); holder.tv_file_download_state = (TextView) convertView .findViewById(cn.ucai.superwechat.R.id.tv_file_state); holder.ll_container = (LinearLayout) convertView .findViewById(cn.ucai.superwechat.R.id.ll_file_container); // holder.tv = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.percentage); } catch (Exception e) { } try { holder.tv_usernick = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_userid); } catch (Exception e) { } } convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } // ?????? if ((chatType == ChatType.GroupChat || chatType == ChatType.ChatRoom) && message.direct == EMMessage.Direct.RECEIVE) { //demousername?nick //UserUtils.setAppUserNick(message.getFrom(), holder.tv_usernick); UserUtils.setAppMemberNick(username, message.getFrom(), holder.tv_usernick); } if (message.direct == EMMessage.Direct.SEND) { UserUtils.setCurrentUserNick(holder.tv_usernick); } // ??????textview if (!(chatType == ChatType.GroupChat || chatType == ChatType.ChatRoom) && message.direct == EMMessage.Direct.SEND) { holder.tv_ack = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_ack); holder.tv_delivered = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.tv_delivered); if (holder.tv_ack != null) { if (message.isAcked) { if (holder.tv_delivered != null) { holder.tv_delivered.setVisibility(View.INVISIBLE); } holder.tv_ack.setVisibility(View.VISIBLE); } else { holder.tv_ack.setVisibility(View.INVISIBLE); // check and display msg delivered ack status if (holder.tv_delivered != null) { if (message.isDelivered) { holder.tv_delivered.setVisibility(View.VISIBLE); } else { holder.tv_delivered.setVisibility(View.INVISIBLE); } } } } } else { // ??group messgae,chatroom message?? if ((message.getType() == Type.TXT || message.getType() == Type.LOCATION) && !message.isAcked && chatType != ChatType.GroupChat && chatType != ChatType.ChatRoom) { // ?? if (!message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false)) { try { EMChatManager.getInstance().ackMessageRead(message.getFrom(), message.getMsgId()); // ?? message.isAcked = true; } catch (Exception e) { e.printStackTrace(); } } } } //? setUserAvatar(message, holder.iv_avatar); switch (message.getType()) { // ??typeitem case IMAGE: // handleImageMessage(message, holder, position, convertView); break; case TXT: // if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false) || message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VIDEO_CALL, false)) // ? handleCallMessage(message, holder, position); else if (((DemoHXSDKHelper) HXSDKHelper.getInstance()).isRobotMenuMessage(message)) //?? handleRobotMenuMessage(message, holder, position); else handleTextMessage(message, holder, position); break; case LOCATION: // ? handleLocationMessage(message, holder, position, convertView); break; case VOICE: // handleVoiceMessage(message, holder, position, convertView); break; case VIDEO: // handleVideoMessage(message, holder, position, convertView); break; case FILE: // handleFileMessage(message, holder, position, convertView); break; default: // not supported } if (message.direct == EMMessage.Direct.SEND) { View statusView = convertView.findViewById(cn.ucai.superwechat.R.id.msg_status); // ?? statusView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // ???alertdialog Intent intent = new Intent(activity, AlertDialog.class); intent.putExtra("msg", activity.getString(cn.ucai.superwechat.R.string.confirm_resend)); intent.putExtra("title", activity.getString(cn.ucai.superwechat.R.string.resend)); intent.putExtra("cancel", true); intent.putExtra("position", position); if (message.getType() == EMMessage.Type.TXT) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_TEXT); else if (message.getType() == EMMessage.Type.VOICE) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_VOICE); else if (message.getType() == EMMessage.Type.IMAGE) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_PICTURE); else if (message.getType() == EMMessage.Type.LOCATION) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_LOCATION); else if (message.getType() == EMMessage.Type.FILE) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_FILE); else if (message.getType() == EMMessage.Type.VIDEO) activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_VIDEO); } }); } else { final String st = context.getResources().getString(cn.ucai.superwechat.R.string.Into_the_blacklist); if (!((ChatActivity) activity).isRobot && chatType != ChatType.ChatRoom) { // ???? holder.iv_avatar.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { Intent intent = new Intent(activity, AlertDialog.class); intent.putExtra("msg", st); intent.putExtra("cancel", true); intent.putExtra("position", position); activity.startActivityForResult(intent, ChatActivity.REQUEST_CODE_ADD_TO_BLACKLIST); return true; } }); } } TextView timestamp = (TextView) convertView.findViewById(cn.ucai.superwechat.R.id.timestamp); if (position == 0) { timestamp.setText(DateUtils.getTimestampString(new Date(message.getMsgTime()))); timestamp.setVisibility(View.VISIBLE); } else { // ??? EMMessage prevMessage = getItem(position - 1); if (prevMessage != null && DateUtils.isCloseEnough(message.getMsgTime(), prevMessage.getMsgTime())) { timestamp.setVisibility(View.GONE); } else { timestamp.setText(DateUtils.getTimestampString(new Date(message.getMsgTime()))); timestamp.setVisibility(View.VISIBLE); } } return convertView; }
From source file:com.example.android.wearable.quiz.MainActivity.java
/** * Removes quiz status views (i.e. the views describing the status of each question). *///from w ww .ja v a 2 s .co m private void clearQuizStatus() { questionsContainer.removeAllViews(); quizStatus.setVisibility(View.INVISIBLE); quizButtons.setVisibility(View.INVISIBLE); setHasQuestionBeenAsked(false); mFutureQuestions.clear(); mQuestionIndex = 0; mNumCorrect = 0; mNumIncorrect = 0; mNumSkipped = 0; }