List of usage examples for android.widget TextView setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:fm.smart.r1.ItemActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ExceptionHandler.register(this); // could check here to see if this was suspended for login and go // straight to add_item ... setContentView(R.layout.item);//from w ww.jav a 2 s.c o m TextView cue_and_pronunciation = (TextView) findViewById(R.id.cue_and_pronunciation); cue_and_pronunciation.setText(item.cue_text); // TODO handle case where // item is null? TextView cue_part_of_speech = (TextView) findViewById(R.id.cue_part_of_speech); if (!TextUtils.equals(item.part_of_speech, "None")) { cue_part_of_speech.setText(item.part_of_speech); } else { cue_part_of_speech.setVisibility(View.INVISIBLE); } TextView response_and_pronunciation = (TextView) findViewById(R.id.response_and_pronunciation); response_and_pronunciation.setText(item.children[0][0]); TextView response_part_of_speech = (TextView) findViewById(R.id.response_part_of_speech); if (item.type != null && item.type.equals("meaning")) { item.type = "Translation"; } response_part_of_speech.setText(item.type); response_part_of_speech.setVisibility(View.INVISIBLE); ImageView cue_sound = (ImageView) findViewById(R.id.cue_sound); try { setSound(cue_sound, item.cue_sound_url, this, R.id.cue_sound, (String) item.item_node.getString("id"), item.cue_text); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } ImageView response_sound = (ImageView) findViewById(R.id.response_sound); try { setSound(response_sound, item.response_sound_url, this, R.id.response_sound, (String) item.item_node.getString("id"), item.response_node.getJSONObject("content").getString("text")); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } EfficientAdapter adapter = new EfficientAdapter(ItemActivity.this, item.sentence_vector); cache = new Cache(adapter); setListAdapter(adapter); if (adapter.getCount() == 0 && !ItemActivity.shown_toast) { Toast t = Toast.makeText(this, "Know a good example? Click the menu button to add one", 250); t.setGravity(Gravity.CENTER, 0, 0); t.show(); ItemActivity.shown_toast = true; } // notify(); }
From source file:com.gh4a.IssueActivity.java
private void fillData() { new LoadCommentsTask(this).execute(); Typeface boldCondensed = getApplicationContext().boldCondensed; ListView lvComments = (ListView) findViewById(R.id.list_view); // set details inside listview header LayoutInflater infalter = getLayoutInflater(); LinearLayout mHeader = (LinearLayout) infalter.inflate(R.layout.issue_header, lvComments, false); mHeader.setClickable(false);/*from w w w . ja va2s.c o m*/ lvComments.addHeaderView(mHeader, null, false); RelativeLayout rlComment = (RelativeLayout) findViewById(R.id.rl_comment); if (!isAuthorized()) { rlComment.setVisibility(View.GONE); } TextView tvCommentTitle = (TextView) mHeader.findViewById(R.id.comment_title); mCommentAdapter = new CommentAdapter(IssueActivity.this, new ArrayList<Comment>(), mIssue.getNumber(), mIssue.getState(), mRepoOwner, mRepoName); lvComments.setAdapter(mCommentAdapter); ImageView ivGravatar = (ImageView) mHeader.findViewById(R.id.iv_gravatar); aq.id(R.id.iv_gravatar).image(GravatarUtils.getGravatarUrl(mIssue.getUser().getGravatarId()), true, false, 0, 0, aq.getCachedImage(R.drawable.default_avatar), AQuery.FADE_IN); ivGravatar.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { getApplicationContext().openUserInfoActivity(IssueActivity.this, mIssue.getUser().getLogin(), null); } }); TextView tvExtra = (TextView) mHeader.findViewById(R.id.tv_extra); TextView tvState = (TextView) mHeader.findViewById(R.id.tv_state); TextView tvTitle = (TextView) mHeader.findViewById(R.id.tv_title); TextView tvDescTitle = (TextView) mHeader.findViewById(R.id.desc_title); tvDescTitle.setTypeface(getApplicationContext().boldCondensed); tvDescTitle.setTextColor(Color.parseColor("#0099cc")); tvCommentTitle.setTypeface(getApplicationContext().boldCondensed); tvCommentTitle.setTextColor(Color.parseColor("#0099cc")); tvCommentTitle .setText(getResources().getString(R.string.issue_comments) + " (" + mIssue.getComments() + ")"); TextView tvDesc = (TextView) mHeader.findViewById(R.id.tv_desc); tvDesc.setMovementMethod(LinkMovementMethod.getInstance()); TextView tvMilestone = (TextView) mHeader.findViewById(R.id.tv_milestone); ImageView ivComment = (ImageView) findViewById(R.id.iv_comment); if (Gh4Application.THEME == R.style.DefaultTheme) { ivComment.setImageResource(R.drawable.social_send_now_dark); } ivComment.setBackgroundResource(R.drawable.abs__list_selector_holo_dark); ivComment.setPadding(5, 2, 5, 2); ivComment.setOnClickListener(this); tvExtra.setText(mIssue.getUser().getLogin() + "\n" + pt.format(mIssue.getCreatedAt())); tvState.setTextColor(Color.WHITE); if ("closed".equals(mIssue.getState())) { tvState.setBackgroundResource(R.drawable.default_red_box); tvState.setText("C\nL\nO\nS\nE\nD"); } else { tvState.setBackgroundResource(R.drawable.default_green_box); tvState.setText("O\nP\nE\nN"); } tvTitle.setText(mIssue.getTitle()); tvTitle.setTypeface(boldCondensed); boolean showInfoBox = false; if (mIssue.getAssignee() != null) { showInfoBox = true; TextView tvAssignee = (TextView) mHeader.findViewById(R.id.tv_assignee); tvAssignee.setText(mIssue.getAssignee().getLogin() + " is assigned"); tvAssignee.setVisibility(View.VISIBLE); tvAssignee.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { getApplicationContext().openUserInfoActivity(IssueActivity.this, mIssue.getAssignee().getLogin(), null); } }); ImageView ivAssignee = (ImageView) mHeader.findViewById(R.id.iv_assignee); aq.id(R.id.iv_assignee).image(GravatarUtils.getGravatarUrl(mIssue.getAssignee().getGravatarId()), true, false, 0, 0, aq.getCachedImage(R.drawable.default_avatar), AQuery.FADE_IN); ivAssignee.setVisibility(View.VISIBLE); ivAssignee.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { getApplicationContext().openUserInfoActivity(IssueActivity.this, mIssue.getAssignee().getLogin(), null); } }); } if (mIssue.getMilestone() != null) { showInfoBox = true; tvMilestone.setText( getResources().getString(R.string.issue_milestone) + ": " + mIssue.getMilestone().getTitle()); } else { tvMilestone.setVisibility(View.GONE); } String body = mIssue.getBodyHtml(); if (!StringUtils.isBlank(body)) { HttpImageGetter imageGetter = new HttpImageGetter(this); body = HtmlUtils.format(body).toString(); imageGetter.bind(tvDesc, body, mIssue.getNumber()); } LinearLayout llLabels = (LinearLayout) findViewById(R.id.ll_labels); List<Label> labels = mIssue.getLabels(); if (labels != null && !labels.isEmpty()) { showInfoBox = true; for (Label label : labels) { TextView tvLabel = new TextView(this); tvLabel.setSingleLine(true); tvLabel.setText(label.getName()); tvLabel.setTextAppearance(this, R.style.default_text_small); tvLabel.setBackgroundColor(Color.parseColor("#" + label.getColor())); tvLabel.setPadding(5, 2, 5, 2); int r = Color.red(Color.parseColor("#" + label.getColor())); int g = Color.green(Color.parseColor("#" + label.getColor())); int b = Color.blue(Color.parseColor("#" + label.getColor())); if (r + g + b < 383) { tvLabel.setTextColor(getResources().getColor(android.R.color.primary_text_dark)); } else { tvLabel.setTextColor(getResources().getColor(android.R.color.primary_text_light)); } llLabels.addView(tvLabel); View v = new View(this); v.setLayoutParams(new LayoutParams(5, LayoutParams.WRAP_CONTENT)); llLabels.addView(v); } } else { llLabels.setVisibility(View.GONE); } TextView tvPull = (TextView) mHeader.findViewById(R.id.tv_pull); if (mIssue.getPullRequest() != null && mIssue.getPullRequest().getDiffUrl() != null) { showInfoBox = true; tvPull.setVisibility(View.VISIBLE); tvPull.setOnClickListener(this); } if (!showInfoBox) { RelativeLayout rl = (RelativeLayout) mHeader.findViewById(R.id.info_box); rl.setVisibility(View.GONE); } }
From source file:com.example.isse.weatherapp.ui.WeatherListActivity.java
private void updateEmptyView() { TextView tv = (TextView) findViewById(R.id.recyclerview_weather_empty); if (tv != null) { boolean isEmpty = mCursorAdapter.getItemCount() == 0; if (isEmpty) { int message; if (!Utility.isConnected(mContext)) { //network is not available message = R.string.empty_list_no_network; } else { //network is available but still doesn't fetch data message = R.string.empty_weather_list; }/* ww w .j ava 2s. c om*/ tv.setText(message); tv.setVisibility(View.VISIBLE); } else { tv.setVisibility(View.GONE); } } }
From source file:com.hybris.mobile.adapter.AddressAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.selectable_row, parent, false); TextView textView = (TextView) rowView.findViewById(android.R.id.text1); TextView textTitle = (TextView) rowView.findViewById(R.id.textTitle); String strName = ""; CartDeliveryAddress address = addresses.get(position); if (StringUtils.isNotBlank(address.getLine1())) { strName = address.getLine1();/*from w w w. j ava2 s . c o m*/ } if (StringUtils.isNotBlank(address.getLine2())) { strName = strName + "\n" + address.getLine2(); } if (StringUtils.isNotBlank(address.getTown())) { strName = strName + "\n" + address.getTown(); } if (StringUtils.isNotBlank(address.getPostalCode())) { strName = strName + "\n" + address.getPostalCode(); } if (address.getCountry() != null) { strName = strName + "\n" + address.getCountry().getName(); } textTitle.setText(address.getTitle() + " " + address.getFirstName() + " " + address.getLastName()); textTitle.setVisibility(View.VISIBLE); textView.setText(strName); return rowView; }
From source file:com.cerema.cloud2.ui.fragment.ShareFileFragment.java
private void updateListOfUserGroups() { // Update list of users/groups // TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed mUserGroupsAdapter = new ShareUserListAdapter(getActivity(), R.layout.share_user_item, mPrivateShares, this); // Show data/* w ww . j ava 2 s .c om*/ TextView noShares = (TextView) getView().findViewById(R.id.shareNoUsers); ListView usersList = (ListView) getView().findViewById(R.id.shareUsersList); if (mPrivateShares.size() > 0) { noShares.setVisibility(View.GONE); usersList.setVisibility(View.VISIBLE); usersList.setAdapter(mUserGroupsAdapter); setListViewHeightBasedOnChildren(usersList); } else { noShares.setVisibility(View.VISIBLE); usersList.setVisibility(View.GONE); } // Set Scroll to initial position ScrollView scrollView = (ScrollView) getView().findViewById(R.id.shareScroll); scrollView.scrollTo(0, 0); }
From source file:com.google.samples.apps.iosched.session.SessionDetailFragment.java
private void updateTimeBasedUi(SessionDetailModel data) { // Show "Live streamed" for all live-streamed sessions that aren't currently going on. mLiveStreamVideocamIconAndText// w w w.j ava2 s .c om .setVisibility(data.hasLiveStream() && !data.isSessionOngoing() ? View.VISIBLE : View.GONE); if (data.hasLiveStream() && data.hasSessionStarted()) { // Show the play button and text only once the session starts. mLiveStreamVideocamIconAndText.setVisibility(View.VISIBLE); if (data.isSessionOngoing()) { mLiveStreamPlayIconAndText.setText(getString(R.string.session_watch_live)); } else { mLiveStreamPlayIconAndText.setText(getString(R.string.session_watch)); // TODO: implement Replay. } } else { mLiveStreamPlayIconAndText.setVisibility(View.GONE); } // If the session is done, hide the FAB, and show the "Give feedback" card. if (data.isSessionReadyForFeedback()) { mAddScheduleButton.setVisibility(View.INVISIBLE); if (!data.hasFeedback() && data.isInScheduleWhenSessionFirstLoaded() && !sDismissedFeedbackCard.contains(data.getSessionId())) { showGiveFeedbackCard(data); } } String timeHint = ""; if (TimeUtils.hasConferenceEnded(getContext())) { // No time hint to display. timeHint = ""; } else if (data.hasSessionEnded()) { timeHint = getString(R.string.time_hint_session_ended); } else if (data.isSessionOngoing()) { long minutesAgo = data.minutesSinceSessionStarted(); if (minutesAgo > 1) { timeHint = getString(R.string.time_hint_started_min, minutesAgo); } else { timeHint = getString(R.string.time_hint_started_just); } } else { long minutesUntilStart = data.minutesUntilSessionStarts(); if (minutesUntilStart > 0 && minutesUntilStart <= SessionDetailConstants.HINT_TIME_BEFORE_SESSION_MIN) { if (minutesUntilStart > 1) { timeHint = getString(R.string.time_hint_about_to_start_min, minutesUntilStart); } else { timeHint = getString(R.string.time_hint_about_to_start_shortly, minutesUntilStart); } } } final TextView timeHintView = (TextView) getActivity().findViewById(R.id.time_hint); if (!TextUtils.isEmpty(timeHint)) { timeHintView.setVisibility(View.VISIBLE); timeHintView.setText(timeHint); } else { timeHintView.setVisibility(View.GONE); } }
From source file:com.csipsimple.ui.favorites.FavAdapter.java
@Override public void bindView(View view, final Context context, Cursor cursor) { ContentValues cv = new ContentValues(); DatabaseUtils.cursorRowToContentValues(cursor, cv); int type = ContactsWrapper.TYPE_CONTACT; if (cv.containsKey(ContactsWrapper.FIELD_TYPE)) { type = cv.getAsInteger(ContactsWrapper.FIELD_TYPE); }//from w w w . jav a 2 s. c o m showViewForType(view, type); if (type == ContactsWrapper.TYPE_GROUP) { // Get views TextView tv = (TextView) view.findViewById(R.id.header_text); ImageView icon = (ImageView) view.findViewById(R.id.header_icon); PresenceStatusSpinner presSpinner = (PresenceStatusSpinner) view .findViewById(R.id.header_presence_spinner); // Get datas SipProfile acc = new SipProfile(cursor); final Long profileId = cv.getAsLong(BaseColumns._ID); final String groupName = acc.android_group; final String displayName = acc.display_name; final String wizard = acc.wizard; final boolean publishedEnabled = (acc.publish_enabled == 1); final String domain = acc.getDefaultDomain(); // Bind datas to view tv.setText(displayName); icon.setImageResource(WizardUtils.getWizardIconRes(wizard)); presSpinner.setProfileId(profileId); // Extra menu view if not already set ViewGroup menuViewWrapper = (ViewGroup) view.findViewById(R.id.header_cfg_spinner); MenuCallback newMcb = new MenuCallback(context, profileId, groupName, domain, publishedEnabled); MenuBuilder menuBuilder; if (menuViewWrapper.getTag() == null) { final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); ActionMenuPresenter mActionMenuPresenter = new ActionMenuPresenter(mContext); mActionMenuPresenter.setReserveOverflow(true); menuBuilder = new MenuBuilder(context); menuBuilder.setCallback(newMcb); MenuInflater inflater = new MenuInflater(context); inflater.inflate(R.menu.fav_menu, menuBuilder); menuBuilder.addMenuPresenter(mActionMenuPresenter); ActionMenuView menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(menuViewWrapper); UtilityWrapper.getInstance().setBackgroundDrawable(menuView, null); menuViewWrapper.addView(menuView, layoutParams); menuViewWrapper.setTag(menuBuilder); } else { menuBuilder = (MenuBuilder) menuViewWrapper.getTag(); menuBuilder.setCallback(newMcb); } menuBuilder.findItem(R.id.share_presence).setTitle( publishedEnabled ? R.string.deactivate_presence_sharing : R.string.activate_presence_sharing); menuBuilder.findItem(R.id.set_sip_data).setVisible(!TextUtils.isEmpty(groupName)); } else if (type == ContactsWrapper.TYPE_CONTACT) { ContactInfo ci = ContactsWrapper.getInstance().getContactInfo(context, cursor); ci.userData = cursor.getPosition(); // Get views TextView tv = (TextView) view.findViewById(R.id.contact_name); QuickContactBadge badge = (QuickContactBadge) view.findViewById(R.id.quick_contact_photo); TextView statusText = (TextView) view.findViewById(R.id.status_text); ImageView statusImage = (ImageView) view.findViewById(R.id.status_icon); // Bind if (ci.contactId != null) { tv.setText(ci.displayName); badge.assignContactUri(ci.callerInfo.contactContentUri); ContactsAsyncHelper.updateImageViewWithContactPhotoAsync(context, badge.getImageView(), ci.callerInfo, R.drawable.ic_contact_picture_holo_dark); statusText.setVisibility(ci.hasPresence ? View.VISIBLE : View.GONE); statusText.setText(ci.status); statusImage.setVisibility(ci.hasPresence ? View.VISIBLE : View.GONE); statusImage.setImageResource(ContactsWrapper.getInstance().getPresenceIconResourceId(ci.presence)); } View v; v = view.findViewById(R.id.contact_view); v.setTag(ci); v.setOnClickListener(mPrimaryActionListener); v = view.findViewById(R.id.secondary_action_icon); v.setTag(ci); v.setOnClickListener(mSecondaryActionListener); } else if (type == ContactsWrapper.TYPE_CONFIGURE) { // We only bind if it's the correct type View v = view.findViewById(R.id.configure_view); v.setOnClickListener(this); ConfigureObj cfg = new ConfigureObj(); cfg.profileId = cv.getAsLong(BaseColumns._ID); v.setTag(cfg); } }
From source file:com.fututel.ui.favorites.FavAdapter.java
@Override public void bindView(View view, final Context context, Cursor cursor) { ContentValues cv = new ContentValues(); DatabaseUtils.cursorRowToContentValues(cursor, cv); int type = ContactsWrapper.TYPE_CONTACT; if (cv.containsKey(ContactsWrapper.FIELD_TYPE)) { type = cv.getAsInteger(ContactsWrapper.FIELD_TYPE); }// w ww.j a va 2s.c om showViewForType(view, type); if (type == ContactsWrapper.TYPE_GROUP) { // Get views TextView tv = (TextView) view.findViewById(R.id.header_text); ImageView icon = (ImageView) view.findViewById(R.id.header_icon); PresenceStatusSpinner presSpinner = (PresenceStatusSpinner) view .findViewById(R.id.header_presence_spinner); // Get datas SipProfile acc = new SipProfile(cursor); final Long profileId = cv.getAsLong(BaseColumns._ID); final String groupName = acc.android_group; final String displayName = acc.display_name; final String wizard = acc.wizard; final boolean publishedEnabled = (acc.publish_enabled == 1); final String domain = acc.getDefaultDomain(); // Bind datas to view tv.setText(displayName); icon.setImageResource(WizardUtils.getWizardIconRes(wizard)); presSpinner.setProfileId(profileId); // Extra menu view if not already set ViewGroup menuViewWrapper = (ViewGroup) view.findViewById(R.id.header_cfg_spinner); MenuCallback newMcb = new MenuCallback(context, profileId, groupName, domain, publishedEnabled); MenuBuilder menuBuilder; if (menuViewWrapper.getTag() == null) { final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); ActionMenuPresenter mActionMenuPresenter = new ActionMenuPresenter(mContext); mActionMenuPresenter.setReserveOverflow(true); menuBuilder = new MenuBuilder(context); menuBuilder.setCallback(newMcb); MenuInflater inflater = new MenuInflater(context); inflater.inflate(R.menu.fav_menu, menuBuilder); menuBuilder.addMenuPresenter(mActionMenuPresenter); ActionMenuView menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(menuViewWrapper); UtilityWrapper.getInstance().setBackgroundDrawable(menuView, null); menuViewWrapper.addView(menuView, layoutParams); menuViewWrapper.setTag(menuBuilder); } else { menuBuilder = (MenuBuilder) menuViewWrapper.getTag(); menuBuilder.setCallback(newMcb); } menuBuilder.findItem(R.id.share_presence).setTitle( publishedEnabled ? R.string.deactivate_presence_sharing : R.string.activate_presence_sharing); menuBuilder.findItem(R.id.set_sip_data).setVisible(!TextUtils.isEmpty(groupName)); } else if (type == ContactsWrapper.TYPE_CONTACT) { ContactInfo ci = ContactsWrapper.getInstance().getContactInfo(context, cursor); ci.userData = cursor.getPosition(); // Get views TextView tv = (TextView) view.findViewById(R.id.contact_name); QuickContactBadge badge = (QuickContactBadge) view.findViewById(R.id.quick_contact_photo); TextView statusText = (TextView) view.findViewById(R.id.status_text); ImageView statusImage = (ImageView) view.findViewById(R.id.status_icon); // Bind if (ci.contactId != null) { tv.setText(ci.displayName); badge.assignContactUri(ci.callerInfo.contactContentUri); ContactsAsyncHelper.updateImageViewWithContactPhotoAsync(context, badge.getImageView(), ci.callerInfo, R.drawable.ic_contact_picture_holo_light); statusText.setVisibility(ci.hasPresence ? View.VISIBLE : View.GONE); statusText.setText(ci.status); statusImage.setVisibility(ci.hasPresence ? View.VISIBLE : View.GONE); statusImage.setImageResource(ContactsWrapper.getInstance().getPresenceIconResourceId(ci.presence)); } View v; v = view.findViewById(R.id.contact_view); v.setTag(ci); v.setOnClickListener(mPrimaryActionListener); v = view.findViewById(R.id.secondary_action_icon); v.setTag(ci); v.setOnClickListener(mSecondaryActionListener); } else if (type == ContactsWrapper.TYPE_CONFIGURE) { // We only bind if it's the correct type View v = view.findViewById(R.id.configure_view); v.setOnClickListener(this); ConfigureObj cfg = new ConfigureObj(); cfg.profileId = cv.getAsLong(BaseColumns._ID); v.setTag(cfg); } }
From source file:co.taqat.call.StatusFragment.java
private void displayMediaStats(LinphoneCallParams params, LinphoneCallStats stats, PayloadType media, View layout, TextView title, TextView codec, TextView dl, TextView ul, TextView ice, TextView ip, TextView senderLossRate, TextView receiverLossRate, TextView enc, TextView dec, TextView videoResolutionSent, TextView videoResolutionReceived, boolean isVideo) { Context ctxt = LinphoneActivity.instance(); if (stats != null) { layout.setVisibility(View.VISIBLE); title.setVisibility(TextView.VISIBLE); if (media != null) { String mime = media.getMime(); if (LinphoneManager.getLc().openH264Enabled() && media.getMime().equals("H264") && LinphoneManager.getInstance().getOpenH264DownloadHelper().isCodecFound()) { mime = "OpenH264"; }/*w ww. j a va2s.c o m*/ formatText(codec, ctxt.getString(R.string.call_stats_codec), mime + " / " + (media.getRate() / 1000) + "kHz"); } formatText(enc, ctxt.getString(R.string.call_stats_encoder_name), stats.getEncoderName(media)); formatText(dec, ctxt.getString(R.string.call_stats_decoder_name), stats.getDecoderName(media)); formatText(dl, ctxt.getString(R.string.call_stats_download), String.valueOf((int) stats.getDownloadBandwidth()) + " kbits/s"); formatText(ul, ctxt.getString(R.string.call_stats_upload), String.valueOf((int) stats.getUploadBandwidth()) + " kbits/s"); formatText(ice, ctxt.getString(R.string.call_stats_ice), stats.getIceState().toString()); formatText(ip, ctxt.getString(R.string.call_stats_ip), (stats.getIpFamilyOfRemote() == LinphoneAddressFamily.INET_6.getInt()) ? "IpV6" : (stats.getIpFamilyOfRemote() == LinphoneAddressFamily.INET.getInt()) ? "IpV4" : "Unknown"); formatText(senderLossRate, ctxt.getString(R.string.call_stats_sender_loss_rate), new DecimalFormat("##.##").format(stats.getSenderLossRate()) + "%"); formatText(receiverLossRate, ctxt.getString(R.string.call_stats_receiver_loss_rate), new DecimalFormat("##.##").format(stats.getReceiverLossRate()) + "%"); if (isVideo) { formatText(videoResolutionSent, ctxt.getString(R.string.call_stats_video_resolution_sent), "\u2191 " + params.getSentVideoSize().toDisplayableString()); formatText(videoResolutionReceived, ctxt.getString(R.string.call_stats_video_resolution_received), "\u2193 " + params.getReceivedVideoSize().toDisplayableString()); } } else { layout.setVisibility(View.GONE); title.setVisibility(TextView.GONE); } layout.setVisibility(View.GONE); title.setVisibility(TextView.GONE); }
From source file:at.alladin.rmbt.android.adapter.result.RMBTResultPagerAdapter.java
/** * //w ww. ja va2 s. c o m * @param view */ private void displayResult(View view, LayoutInflater inflater, ViewGroup vg) { /* final Button shareButton = (Button) view.findViewById(R.id.resultButtonShare); if (shareButton != null) shareButton.setEnabled(false); */ //final LinearLayout measurementLayout = (LinearLayout) view.findViewById(R.id.resultMeasurementList); measurementLayout = (LinearLayout) view.findViewById(R.id.resultMeasurementList); measurementLayout.setVisibility(View.GONE); final LinearLayout resultLayout = (LinearLayout) view.findViewById(R.id.result_layout); resultLayout.setVisibility(View.INVISIBLE); final LinearLayout netLayout = (LinearLayout) view.findViewById(R.id.resultNetList); netLayout.setVisibility(View.GONE); final TextView measurementHeader = (TextView) view.findViewById(R.id.resultMeasurement); measurementHeader.setVisibility(View.GONE); final TextView netHeader = (TextView) view.findViewById(R.id.resultNet); netHeader.setVisibility(View.GONE); final TextView emptyView = (TextView) view.findViewById(R.id.infoText); emptyView.setVisibility(View.GONE); final float scale = activity.getResources().getDisplayMetrics().density; final ProgressBar progessBar = (ProgressBar) view.findViewById(R.id.progressBar); if (testResult != null && testResult.length() > 0) { JSONObject resultListItem; try { resultListItem = testResult.getJSONObject(0); openTestUuid = resultListItem.optString("open_test_uuid"); if (graphView != null) { graphView.setOpenTestUuid(openTestUuid); graphView.initialize(graphViewEndTaskListener); } JSONObject testResultItem; try { testResultItem = testResult.getJSONObject(0); if (testResultItem.has("geo_lat") && testResultItem.has("geo_long") && !hasMap) { hasMap = true; if (dataChangedListener != null) { dataChangedListener.onChange(false, true, "HAS_MAP"); } notifyDataSetChanged(); } else if (!testResultItem.has("geo_lat") && !testResultItem.has("geo_long") && hasMap) { System.out.println("hasMap = " + hasMap); hasMap = false; if (dataChangedListener != null) { dataChangedListener.onChange(true, false, "HAS_MAP"); } notifyDataSetChanged(); } } catch (JSONException e) { hasMap = false; e.printStackTrace(); } if (completeListener != null) { completeListener.onComplete(OnCompleteListener.DATA_LOADED, this); } final JSONArray measurementArray = resultListItem.getJSONArray("measurement"); final JSONArray netArray = resultListItem.getJSONArray("net"); final int leftRightDiv = Helperfunctions.dpToPx(0, scale); final int topBottomDiv = Helperfunctions.dpToPx(0, scale); final int heightDiv = Helperfunctions.dpToPx(1, scale); for (int i = 0; i < measurementArray.length(); i++) { final View measurementItemView = inflater.inflate(R.layout.classification_list_item, vg, false); final JSONObject singleItem = measurementArray.getJSONObject(i); final TextView itemTitle = (TextView) measurementItemView .findViewById(R.id.classification_item_title); itemTitle.setText(singleItem.getString("title")); final ImageView itemClassification = (ImageView) measurementItemView .findViewById(R.id.classification_item_color); itemClassification.setImageResource( Helperfunctions.getClassificationColor(singleItem.getInt("classification"))); itemClassification.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { activity.showHelp(R.string.url_help_result, false); } }); final TextView itemValue = (TextView) measurementItemView .findViewById(R.id.classification_item_value); itemValue.setText(singleItem.getString("value")); measurementLayout.addView(measurementItemView); final View divider = new View(activity); divider.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, heightDiv, 1)); divider.setPadding(leftRightDiv, topBottomDiv, leftRightDiv, topBottomDiv); divider.setBackgroundResource(R.drawable.bg_trans_light_10); measurementLayout.addView(divider); measurementLayout.invalidate(); } for (int i = 0; i < netArray.length(); i++) { final JSONObject singleItem = netArray.getJSONObject(i); addResultListItem(singleItem.getString("title"), singleItem.optString("value", null), netLayout); } addQoSResultItem(); } catch (final JSONException e) { e.printStackTrace(); } progessBar.setVisibility(View.GONE); emptyView.setVisibility(View.GONE); resultLayout.setVisibility(View.VISIBLE); measurementHeader.setVisibility(View.VISIBLE); netHeader.setVisibility(View.VISIBLE); measurementLayout.setVisibility(View.VISIBLE); netLayout.setVisibility(View.VISIBLE); } else { Log.i(DEBUG_TAG, "LEERE LISTE"); progessBar.setVisibility(View.GONE); emptyView.setVisibility(View.VISIBLE); emptyView.setText(activity.getString(R.string.error_no_data)); emptyView.invalidate(); } }