List of usage examples for android.widget TextView setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:sjizl.com.FileUploadTest2.java
@SuppressLint("NewApi") @Override/* w ww . j a v a 2 s.c om*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.fileuploadtest2); //ac_image_grid TextView textView2_under_title; final ImageLoader imageLoader = ImageLoader.getInstance(); imageLoader.init(ImageLoaderConfiguration.createDefault(getApplicationContext())); progressBar_hole = (ProgressBar) findViewById(R.id.progressBar_hole); progressBar_hole.setVisibility(View.INVISIBLE); right_lin = (LinearLayout) findViewById(R.id.right_lin); middle_lin = (LinearLayout) findViewById(R.id.middle_lin); //right_lin.setBackgroundColor(Color.BLUE); right_lin = (LinearLayout) findViewById(R.id.right_lin); left_lin1 = (LinearLayout) findViewById(R.id.left_lin1); left_lin3 = (LinearLayout) findViewById(R.id.left_lin3); left_lin4 = (LinearLayout) findViewById(R.id.left_lin4); middle_lin = (LinearLayout) findViewById(R.id.middle_lin); textView2_under_title = (TextView) findViewById(R.id.textView2_under_title); ((LinearLayout) textView2_under_title.getParent()).removeView(textView2_under_title); textView2_under_title.setVisibility(View.GONE); ImageView imageView2_dashboard = (ImageView) findViewById(R.id.imageView2_dashboard); if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } Button upload_photo0 = (Button) findViewById(R.id.upload_photo0); Button upload_photo1 = (Button) findViewById(R.id.upload_photo1); Button upload_photo2 = (Button) findViewById(R.id.upload_photo2); upload_photo0.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "UploadActivity!", Toast.LENGTH_LONG).show(); Intent dashboard = new Intent(getApplicationContext(), UploadActivity.class); startActivity(dashboard); } }); upload_photo1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "FileChooserExampleActivity!", Toast.LENGTH_LONG).show(); Intent dashboard = new Intent(getApplicationContext(), FileChooserExampleActivity.class); startActivity(dashboard); } }); upload_photo2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "FileChooserExampleActivity!", Toast.LENGTH_LONG).show(); Intent dashboard = new Intent(getApplicationContext(), FileChooserExampleActivity.class); startActivity(dashboard); } }); final ImageView left_button; left_button = (ImageView) findViewById(R.id.imageView1_back); Brows(); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { //startImagePagerActivity(position); Intent dashboard = new Intent(getApplicationContext(), ProfileActivity.class); dashboard.putExtra("user", naam); dashboard.putExtra("user_foto", foto); dashboard.putExtra("user_foto_num", foto_num); startActivity(dashboard); } }); CommonUtilities u = new CommonUtilities(); u.setHeaderConrols(getApplicationContext(), this, right_lin, left_lin3, left_lin4, left_lin1, left_button); ; }
From source file:net.naonedbus.card.impl.CommentairesCard.java
private View createView(final LayoutInflater inflater, final ViewGroup root, final Commentaire commentaire) { final View view = inflater.inflate(R.layout.card_item_commentaire, root, false); final TextView itemTitle = (TextView) view.findViewById(R.id.itemTitle); final TextView itemDate = (TextView) view.findViewById(R.id.itemTime); final TextView itemDescription = (TextView) view.findViewById(R.id.itemDescription); String title = ""; if (NaonedbusClient.NAONEDBUS.name().equals(commentaire.getSource())) { if (commentaire.getArret() == null && commentaire.getSens() == null && commentaire.getLigne() == null) { title = view.getContext().getString(R.string.commentaire_tout); } else {/*w w w. j a v a 2 s. c o m*/ if (commentaire.getArret() != null) { title = commentaire.getArret().getNomArret() + " "; } if (commentaire.getSens() != null) { title = title + "\u2192 " + commentaire.getSens().text; } } } else { title = getString(CommentaireFomatter.getTitleResId(commentaire.getSource())); } itemDescription.setText(commentaire.getMessage(), BufferType.SPANNABLE); itemDate.setText(commentaire.getDelay()); if (title.trim().length() == 0) { itemTitle.setVisibility(View.GONE); } else { itemTitle.setVisibility(View.VISIBLE); itemTitle.setText(title.trim()); } view.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { final Bundle bundle = new Bundle(); bundle.putParcelable(CommentaireDetailDialogFragment.PARAM_COMMENTAIRE, commentaire); final DialogFragment dialogFragment = new CommentaireDetailDialogFragment(); dialogFragment.setArguments(bundle); dialogFragment.show(getFragmentManager(), "CommentaireDetailFragment"); } }); return view; }
From source file:com.flipzu.flipzu.Player.java
private void setLiveVisible(boolean visible) { ImageView live_v = (ImageView) findViewById(R.id.livetag); ImageView live_vb = (ImageView) findViewById(R.id.livetag_bottom); TextView time_str = (TextView) findViewById(R.id.time_str); if (visible) { int color = Color.parseColor("#FFFFFF"); updateBanner("", color); live_v.setVisibility(View.VISIBLE); live_vb.setVisibility(View.VISIBLE); time_str.setVisibility(View.INVISIBLE); findViewById(R.id.seekbar).setVisibility(View.INVISIBLE); } else {// w w w . jav a 2 s.co m live_v.setVisibility(View.INVISIBLE); live_vb.setVisibility(View.INVISIBLE); // time_str.setVisibility(View.VISIBLE); } }
From source file:fr.bmartel.android.iotf.app.NotificationActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_notifications); initNv();//from www . ja v a 2s .c om String filterList = sharedpreferences.getString(StorageConst.STORAGE_FILTER_LIST, "[]"); try { JSONArray filterListObj = new JSONArray(filterList); for (int i = 0; i < filterListObj.length(); i++) { JSONObject item = (JSONObject) filterListObj.get(i); if (item.has(StorageConst.STORAGE_NOTIFICATION_BODY) && item.has(StorageConst.STORAGE_NOTIFICATION_MESSAGE)) { messageBodyFilterList .add(new NotificationFilter(item.getString(StorageConst.STORAGE_NOTIFICATION_BODY), item.getString(StorageConst.STORAGE_NOTIFICATION_MESSAGE))); } } } catch (JSONException e) { e.printStackTrace(); } fragmentManager = getSupportFragmentManager(); final TextView noNotificationTv = (TextView) findViewById(R.id.no_notification_tv); IotSingleton.getInstance(this).setInternalCb(new IMessageCallback() { @Override public void connectionLost(Throwable cause) { if (!IotSingleton.getInstance(NotificationActivity.this).isAutoReconnect()) { Toast.makeText(NotificationActivity.this, "disconnected from server", Toast.LENGTH_SHORT) .show(); finish(); } } @Override public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception { final IncomingMessage message = new IncomingMessage(new Date(), topic.substring(topic.indexOf("id/") + 6, topic.indexOf("/evt")), new String(mqttMessage.getPayload())); if (init) { init = false; runOnUiThread(new Runnable() { @Override public void run() { noNotificationTv.setVisibility(View.GONE); notificationListview.setVisibility(View.VISIBLE); initListview(); } }); } notificationItems.add(0, message); runOnUiThread(new Runnable() { @Override public void run() { notificationAdapter.notifyDataSetChanged(); for (int i = 0; i < messageBodyFilterList.size(); i++) { if (message.getMessage().contains(messageBodyFilterList.get(i).getFilter())) { Log.i(TAG, "launch phone notification : filter found in message body"); triggerNotification(messageBodyFilterList.get(i).getNotificationMessage()); return; } } } }); } @Override public void deliveryComplete(IMqttDeliveryToken messageToken) { } @Override public void onConnectionSuccess(IMqttToken token) { } @Override public void onConnectionFailure(IMqttToken token, Throwable cause) { } @Override public void onDisconnectionSuccess(IMqttToken token) { Toast.makeText(NotificationActivity.this, "disconnected from server", Toast.LENGTH_SHORT).show(); finish(); } @Override public void onDisconnectionFailure(IMqttToken token, Throwable cause) { } }); notificationListview = (ListView) findViewById(R.id.notification_list); }
From source file:com.orbar.pxdemo.ImageView.FivePXImageFragment.java
private void loadImageDetails(View rootView) { TextView ratingContent = (TextView) rootView.findViewById(R.id.rating); ratingContent.setText("" + (mFiveZeroZeroImageBean.getRating())); TextView highestRatingContent = (TextView) rootView.findViewById(R.id.highest_rating); highestRatingContent.setText("" + mFiveZeroZeroImageBean.getHighestRating()); TextView viewsContent = (TextView) rootView.findViewById(R.id.views); viewsContent.setText(Integer.toString(mFiveZeroZeroImageBean.getTimesViewed())); TextView descriptionContent = (TextView) rootView.findViewById(R.id.description); descriptionContent.setText(mFiveZeroZeroImageBean.getDescription()); TextView cameraContent = (TextView) rootView.findViewById(R.id.camera_content); cameraContent.setText(mFiveZeroZeroImageBean.getCamera()); TextView focalLengthContent = (TextView) rootView.findViewById(R.id.focal_length_content); focalLengthContent.setText(mFiveZeroZeroImageBean.getFocalLength()); TextView shutterSpeedContent = (TextView) rootView.findViewById(R.id.shutter_speed_content); shutterSpeedContent.setText(mFiveZeroZeroImageBean.getShutterSpeed()); TextView isoContent = (TextView) rootView.findViewById(R.id.iso_content); isoContent.setText(mFiveZeroZeroImageBean.getIso()); TextView categotyContent = (TextView) rootView.findViewById(R.id.category_content); categotyContent.setText(Category.forValue(mFiveZeroZeroImageBean.getCategory()).toString()); TextView apertureContent = (TextView) rootView.findViewById(R.id.aperture_content); apertureContent.setText(mFiveZeroZeroImageBean.getAperture()); TextView uploadedAtContent = (TextView) rootView.findViewById(R.id.uploaded_content); uploadedAtContent.setText(mFiveZeroZeroImageBean.getCreatedAt()); TextView takenAtoContent = (TextView) rootView.findViewById(R.id.taken_content); takenAtoContent.setText(mFiveZeroZeroImageBean.getTakenAt()); TextView licenseContent = (TextView) rootView.findViewById(R.id.license_content); licenseContent.setText(License.forValue(mFiveZeroZeroImageBean.getLicenseType()).toString()); TextView locationContent = (TextView) rootView.findViewById(R.id.location_content); if (mFiveZeroZeroImageBean.getLocation() != null) { locationContent.setText(mFiveZeroZeroImageBean.getLocation()); } else {/*from w w w . j a v a2 s. c o m*/ locationContent.setText(null); locationContent.setVisibility(View.GONE); } if (mFiveZeroZeroImageBean.getLatitude() != null && mFiveZeroZeroImageBean.getLatitude() != null) { setupMap(mFiveZeroZeroImageBean.getLatitude(), mFiveZeroZeroImageBean.getLongitude(), mFiveZeroZeroImageBean.getName(), mFiveZeroZeroImageBean.getDescription()); } else { View mapView = rootView.findViewById(R.id.map); mapView.setVisibility(View.GONE); } // when logged in - highlight images that are "Liked" (voted) if (mFiveZeroZeroImageBean.isVoted()) { imageLikes.setBackgroundResource(R.drawable.ic_background_like); } else { imageLikes.setBackgroundResource(R.drawable.ic_background); } // when logged in - highlight images that are "favorited" if (mFiveZeroZeroImageBean.isFavorited()) { imageFavorites.setBackgroundResource(R.drawable.ic_background_fav); } else { imageFavorites.setBackgroundResource(R.drawable.ic_background); } }
From source file:com.grarak.kerneladiutor.views.recyclerview.downloads.DownloadKernelView.java
@Override public void onCreateView(View view) { super.onCreateView(view); if (mDownloadDrawable == null) { mDownloadDrawable = ContextCompat.getDrawable(view.getContext(), R.drawable.ic_download); DrawableCompat.setTint(mDownloadDrawable, Color.WHITE); }//ww w . j av a 2s . c om if (mCancelDrawable == null) { mCancelDrawable = ContextCompat.getDrawable(view.getContext(), R.drawable.ic_cancel); DrawableCompat.setTint(mCancelDrawable, Color.WHITE); } final TextView title = (TextView) view.findViewById(R.id.title); TextView summary = (TextView) view.findViewById(R.id.summary); TextView changelog = (TextView) view.findViewById(R.id.changelog); mDownloadSection = view.findViewById(R.id.downloadSection); mProgressParent = view.findViewById(R.id.progressParent); mProgressText = (TextView) view.findViewById(R.id.progressText); mProgressBar = (ProgressBar) view.findViewById(R.id.progressbar); mFabButton = (FloatingActionButton) view.findViewById(R.id.fab_button); mCheckMD5 = view.findViewById(R.id.checkmd5); mMismatchMD5 = view.findViewById(R.id.md5_mismatch); mInstallButton = view.findViewById(R.id.install); final CharSequence titleText = Utils.htmlFrom(mDownload.getName()); title.setText(titleText); title.setMovementMethod(LinkMovementMethod.getInstance()); String description = mDownload.getDescription(); if (description != null) { summary.setText(Utils.htmlFrom(description)); summary.setMovementMethod(LinkMovementMethod.getInstance()); } else { summary.setVisibility(View.GONE); } List<String> changelogs = mDownload.getChangelogs(); if (changelogs.size() > 0) { StringBuilder stringBuilder = new StringBuilder(); for (String change : changelogs) { if (stringBuilder.length() == 0) { stringBuilder.append("\u2022").append(" ").append(change); } else { stringBuilder.append("<br>").append("\u2022").append(" ").append(change); } } changelog.setText(Utils.htmlFrom(stringBuilder.toString())); changelog.setMovementMethod(LinkMovementMethod.getInstance()); } else { changelog.setVisibility(View.GONE); } mMismatchMD5.setVisibility(View.GONE); mInstallButton.setVisibility(View.GONE); if (mCheckMD5Task == null) { mDownloadSection.setVisibility(View.VISIBLE); mCheckMD5.setVisibility(View.GONE); } mProgressParent.setVisibility(mDownloadTask == null ? View.INVISIBLE : View.VISIBLE); mFabButton.setImageDrawable(mDownloadTask == null ? mDownloadDrawable : mCancelDrawable); mFabButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View view) { if (mDownloadTask == null) { mFabButton.setImageDrawable(mCancelDrawable); mProgressParent.setVisibility(View.VISIBLE); mMismatchMD5.setVisibility(View.GONE); mInstallButton.setVisibility(View.GONE); mProgressBar.setProgress(0); mProgressText.setText(""); mProgressBar.setIndeterminate(true); mDownloadTask = new DownloadTask(mActvity, new DownloadTask.OnDownloadListener() { private int mPercentage; @Override public void onUpdate(int currentSize, int totalSize) { int percentage = Math.round(currentSize * 100f / totalSize); if (mPercentage != percentage) { mPercentage = percentage; mProgressBar.setIndeterminate(false); double current = Utils.roundTo2Decimals(currentSize / 1024D / 1024D); double total = Utils.roundTo2Decimals(totalSize / 1024D / 1024D); mProgressBar.setProgress(mPercentage); mProgressText.setText(view.getContext().getString(R.string.downloading_counting, String.valueOf(current), String.valueOf(total)) + view.getContext().getString(R.string.mb)); } } @Override public void onSuccess(String path) { mFabButton.setImageDrawable(mDownloadDrawable); mProgressParent.setVisibility(View.INVISIBLE); mDownloadTask = null; checkMD5(mDownload.getMD5sum(), path, mDownload.getInstallMethod()); } @Override public void onCancel() { mFabButton.setImageDrawable(mDownloadDrawable); mProgressParent.setVisibility(View.INVISIBLE); mMismatchMD5.setVisibility(View.GONE); mDownloadTask = null; } @Override public void onFailure(String error) { Utils.toast(view.getContext().getString(R.string.download_error, titleText), view.getContext()); mFabButton.setImageDrawable(mDownloadDrawable); mProgressParent.setVisibility(View.INVISIBLE); mDownloadTask = null; } }, Utils.getInternalDataStorage() + "/downloads/" + titleText.toString() + ".zip"); mDownloadTask.execute(mDownload.getUrl()); } else { mFabButton.setImageDrawable(mDownloadDrawable); mProgressParent.setVisibility(View.INVISIBLE); mDownloadTask.cancel(); mDownloadTask = null; } } }); }
From source file:fm.smart.r1.activity.CreateItemActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ExceptionHandler.register(this); setContentView(R.layout.create_item); final Intent queryIntent = getIntent(); Bundle extras = queryIntent.getExtras(); list_id = (String) extras.get("list_id"); cue = (String) extras.get("cue"); response = (String) extras.get("response"); cue_language = (String) extras.get("cue_language"); response_language = (String) extras.get("response_language"); character_cue = (String) extras.get("character_cue"); character_response = (String) extras.get("character_response"); pos = (String) extras.get("pos"); Button button = (Button) findViewById(R.id.create_item_submit); button.setOnClickListener(this); TextView cue_text = (TextView) findViewById(R.id.cue); if (!TextUtils.isEmpty(cue)) { cue_text.setText(cue);//from w w w .j av a 2 s . com } TextView response_text = (TextView) findViewById(R.id.response); if (!TextUtils.isEmpty(response)) { response_text.setText(response); } TextView cue_character_text = (TextView) findViewById(R.id.cue_character); if (!TextUtils.isEmpty(character_cue)) { cue_character_text.setText(character_cue); } TextView response_character_text = (TextView) findViewById(R.id.response_character); if (!TextUtils.isEmpty(character_response)) { response_character_text.setText(character_response); } TextView cue_legend = (TextView) findViewById(R.id.create_item_cue_legend); cue_legend.setText(Utils.INV_LANGUAGE_MAP.get(cue_language) + " Term"); TextView response_legend = (TextView) findViewById(R.id.create_item_response_legend); response_legend.setText(Utils.INV_LANGUAGE_MAP.get(response_language) + " Term"); TextView cue_character_textView = (TextView) findViewById(R.id.create_item_cue_character); cue_character_textView.setText(Utils.INV_LANGUAGE_MAP.get(cue_language) + " Character Text"); TextView response_character_textView = (TextView) findViewById(R.id.create_item_response_character); response_character_textView.setText(Utils.INV_LANGUAGE_MAP.get(response_language) + " Character Text"); List<String> pos_list = new Vector<String>(Utils.POS_MAP.keySet()); Collections.sort(pos_list); ArrayAdapter<String> pos_adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, pos_list); // .simple_spinner_item Spinner pos_textView = (Spinner) findViewById(R.id.pos); pos_textView.setAdapter(pos_adapter); if (!TextUtils.isEmpty(pos)) { pos_textView.setSelection(pos_list.indexOf(pos)); } else { pos_textView.setSelection(pos_list.indexOf("Noun")); } EditText cue_character_input_textView = (EditText) findViewById(R.id.cue_character); if (!Utils.isIdeographicLanguage(Main.search_lang)) { cue_character_textView.setVisibility(View.GONE); cue_character_input_textView.setVisibility(View.GONE); } else if (!TextUtils.isEmpty(character_cue)) { cue_character_input_textView.setText(character_cue); } EditText response_character_input_textView = (EditText) findViewById(R.id.response_character); if (!Utils.isIdeographicLanguage(Main.result_lang)) { response_character_textView.setVisibility(View.GONE); response_character_input_textView.setVisibility(View.GONE); } else if (!TextUtils.isEmpty(character_response)) { response_character_input_textView.setText(character_response); } }
From source file:cat.wuyingren.rorhelper.fragments.dialogs.ManageSenatorDialogFragment.java
@NonNull @Override// w w w . j a v a2s . com public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); final View v = inflater.inflate(R.layout.dialog_managesenator, null); final TextView randomKillTitle = (TextView) v.findViewById(R.id.managesenator_randomTitle); final ToggleButton randomKillButton = (ToggleButton) v.findViewById(R.id.managesenator_randomToggle); final LinearLayout selectors = (LinearLayout) v.findViewById(R.id.managesenator_selectors); dataSource = MainActivity.getDataSource(); context = MainActivity.getContext(); currentGameId = getArguments().getLong(ARG_GAMEID); killMode = getArguments().getBoolean(ARG_MODE); statesman = getArguments().getBoolean(ARG_TYPE); result.setKill(killMode); result.setStatesman(statesman); final Spinner senatorSpinner = (Spinner) v.findViewById(R.id.managesenator_senatorSpinner); randomKillButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { result.setRandomKill(isChecked); if (isChecked) { selectors.setVisibility(View.GONE); } else { selectors.setVisibility(View.VISIBLE); } } }); if (!killMode) { randomKillTitle.setVisibility(View.GONE); randomKillButton.setVisibility(View.GONE); String[] keys = getArguments().getStringArray(ARG_ARRAY); ArrayList<String> values = getArguments().getStringArrayList(ARG_VALUES); /*ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(MainActivity.getContext(), android.R.layout.simple_spinner_item, keys);*/ SenatorAdapter adapter = new SenatorAdapter(MainActivity.getContext(), android.R.layout.simple_spinner_item, keys, values); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); senatorSpinner.setAdapter(adapter); } else { randomKillTitle.setVisibility(View.VISIBLE); randomKillButton.setVisibility(View.VISIBLE); } senatorSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { result.setSenatorID(parent.getSelectedItem().toString()); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); final Spinner factionSpinner = SystemUtils.configureSpinner(v, R.id.managesenator_factionSpinner, R.array.faction_nameID); factionSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { long factionID = dataSource.getFactionId(currentGameId, getResources().getStringArray(R.array.faction_nameID)[position]); result.setFactionID(factionID); if (killMode) { ArrayList<Senator> senators = dataSource.getAllSenatorsOfFaction(factionID); Iterator<Senator> ite = senators.iterator(); ArrayList<CharSequence> array = new ArrayList<CharSequence>(); ArrayList<String> values = new ArrayList<String>(); while (ite.hasNext()) { Senator s = ite.next(); array.add(String.valueOf(s.getId())); values.add(String.valueOf(s.getName())); } String[] keys = new String[array.size()]; keys = array.toArray(keys); //ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(context, android.R.layout.simple_spinner_item, array); SenatorAdapter adapter = new SenatorAdapter(context, android.R.layout.simple_spinner_item, keys, values); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); senatorSpinner.setAdapter(adapter); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); builder.setView(v).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mListener.onManageSenatorDialogPositiveClick(result); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { getDialog().cancel(); } }); String stringA, stringB; if (killMode) { stringA = getString(R.string.dialog_managesenator_kill_title); } else { stringA = getString(R.string.dialog_managesenator_title); } if (statesman) { stringB = getString(R.string.statesman); } else { stringB = getString(R.string.senator); } builder.setTitle(stringA + " " + stringB); return builder.create(); }
From source file:com.hybris.mobile.activity.CheckoutActivity.java
private void updateUI() { CartDeliveryAddress address = controller.getCart().getDeliveryAddress(); //delivery address section String strList = ""; TextView addressView = (TextView) findViewById(R.id.lbl_addressView); TextView deliveryView = (TextView) findViewById(R.id.lbl_deliveryMethod); TextView paymentView = (TextView) findViewById(R.id.lbl_paymentDetails); if (address != null) { String firstName = address.getFirstName(); String lastName = address.getLastName(); String title = address.getTitle(); strList = "<b>" + strList + title + " " + firstName + " " + lastName + "</b>"; strList += StringUtils.isNotBlank(address.getLine1()) ? "<br />" + address.getLine1() : ""; strList += StringUtils.isNotBlank(address.getLine2()) ? "<br />" + address.getLine2() : ""; strList += StringUtils.isNotBlank(address.getTown()) ? "<br />" + address.getTown() : ""; strList += StringUtils.isNotBlank(address.getPostalCode()) ? "<br />" + address.getPostalCode() : ""; strList += (address.getCountry() != null && StringUtils.isNotBlank(address.getCountry().getName())) ? "<br />" + address.getCountry().getName() : ""; addressView.setText(Html.fromHtml(strList)); ((TextView) findViewById(R.id.textView1)).setTextColor(colorStepDone); ((TextView) findViewById(R.id.textView3)).setTextColor(colorStepCurrent); deliveryView.setVisibility(View.VISIBLE); ((ImageButton) findViewById(R.id.imageButtonDeliveryAddress)).setImageResource(R.drawable.accept); ((ImageButton) findViewById(R.id.imageButtonDeliveryMethod)).setVisibility(View.VISIBLE); }//from www . j a va2 s . c o m //delivery mode section CartDeliveryMode deliveryMode = controller.getCart().getDeliveryMode(); if (deliveryMode != null) { strList = "<b>" + deliveryMode.getName() + "</b><br />" + deliveryMode.getDescription() + "<br />" + deliveryMode.getDeliveryCost().getFormattedValue(); deliveryView.setText(Html.fromHtml(strList)); ((TextView) findViewById(R.id.textView3)).setTextColor(colorStepDone); ((TextView) findViewById(R.id.textView4)).setTextColor(colorStepCurrent); paymentView.setVisibility(View.VISIBLE); ((ImageButton) findViewById(R.id.imageButtonDeliveryMethod)).setImageResource(R.drawable.accept); ((ImageButton) findViewById(R.id.imageButtonPaymentDetails)).setVisibility(View.VISIBLE); } //payment section CartPaymentInfo payment = controller.getCart().getPaymentInfo(); if (payment != null) { String accountHolderName = payment.getAccountHolderName(); String cardType = payment.getCardType().getName(); String cardNumber = payment.getCardNumber(); strList = "<b>" + accountHolderName + "<b> <br />" + cardNumber + "<br />" + cardType; paymentView.setText(Html.fromHtml(strList)); ((TextView) findViewById(R.id.textView4)).setTextColor(colorStepDone); ((ImageButton) findViewById(R.id.imageButtonPaymentDetails)).setImageResource(R.drawable.accept); } TextView items = (TextView) findViewById(R.id.textView5); items.setText(controller.getCart().getTotalItems() + " " + getString(R.string.items_label)); TextView subtotal = (TextView) findViewById(R.id.lbl_subTotal); subtotal.setText(controller.getCart().getSubTotal().getFormattedValue()); TextView discounts = (TextView) findViewById(R.id.lbl_totalDiscounts); discounts.setText( getString(R.string.discount, controller.getCart().getTotalDiscounts().getFormattedValue())); TextView totaltax = (TextView) findViewById(R.id.lbl_totalTax); totaltax.setText(controller.getCart().getTotalTax().getFormattedValue()); TextView totalprice = (TextView) findViewById(R.id.lbl_totalPrice); totalprice.setText(controller.getCart().getTotalPrice().getFormattedValue()); boolean stepsComplete = address != null && deliveryMode != null && payment != null; RelativeLayout containerTerms = (RelativeLayout) findViewById(R.id.containerTerms); containerTerms.setVisibility(stepsComplete ? View.VISIBLE : View.GONE); CheckBox checkBoxTerms = (CheckBox) findViewById(R.id.checkBoxTerms); boolean readyToConfirm = stepsComplete && checkBoxTerms.isChecked(); findViewById(R.id.buttonConfirmOrder).setEnabled(readyToConfirm); }
From source file:com.cw.litenote.page.Page_recycler.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Bundle args = getArguments();//from w w w . ja v a 2s .c o m page_pos = args.getInt("page_pos"); page_tableId = args.getInt("page_table_id"); System.out.println("Page_recycler / _onCreateView / page_tableId = " + page_tableId); View rootView = inflater.inflate(R.layout.recycler_view_frag, container, false); act = MainAct.mAct; recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerView); TextView blankView = rootView.findViewById(R.id.blankPage); // LinearLayoutManager is used here, this will layout the elements in a similar fashion // to the way ListView would layout elements. The RecyclerView.LayoutManager defines how // elements are laid out. layoutMgr = new LinearLayoutManager(getActivity()); int scrollPosition = 0; // If a layout manager has already been set, get current scroll position. if (recyclerView.getLayoutManager() != null) { scrollPosition = ((LinearLayoutManager) recyclerView.getLayoutManager()) .findFirstCompletelyVisibleItemPosition(); } layoutMgr = new LinearLayoutManager(getActivity()); recyclerView.setLayoutManager(layoutMgr); recyclerView.scrollToPosition(scrollPosition); UilCommon.init(); fillData(); TabsHost.showFooter(MainAct.mAct); ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(itemAdapter); itemTouchHelper = new ItemTouchHelper(callback); itemTouchHelper.attachToRecyclerView(recyclerView); if ((itemAdapter != null) && (itemAdapter.getItemCount() == 0)) { //todo bug: Attempt to invoke interface method 'int android.database.Cursor.getCount()' on a null object reference blankView.setVisibility(View.VISIBLE); recyclerView.setVisibility(View.GONE); } else { blankView.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); } return rootView; }