List of usage examples for android.widget TextView setMovementMethod
public final void setMovementMethod(MovementMethod movement)
From source file:com.mobicage.rogerthat.registration.RegistrationActivity2.java
@Override protected void onServiceBound() { T.UI();/* www .j a v a2 s. c o m*/ if (mNotYetProcessedIntent != null) { processIntent(mNotYetProcessedIntent); mNotYetProcessedIntent = null; } setContentView(R.layout.registration2); //Apply Fonts TextUtils.overrideFonts(this, findViewById(android.R.id.content)); final Typeface faTypeFace = Typeface.createFromAsset(getAssets(), "FontAwesome.ttf"); final int[] visibleLogos; final int[] goneLogos; if (AppConstants.FULL_WIDTH_HEADERS) { visibleLogos = FULL_WIDTH_ROGERTHAT_LOGOS; goneLogos = NORMAL_WIDTH_ROGERTHAT_LOGOS; View viewFlipper = findViewById(R.id.registration_viewFlipper); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) viewFlipper.getLayoutParams(); params.setMargins(0, 0, 0, 0); } else { visibleLogos = NORMAL_WIDTH_ROGERTHAT_LOGOS; goneLogos = FULL_WIDTH_ROGERTHAT_LOGOS; } for (int id : visibleLogos) findViewById(id).setVisibility(View.VISIBLE); for (int id : goneLogos) findViewById(id).setVisibility(View.GONE); handleScreenOrientation(getResources().getConfiguration().orientation); ScrollView rc = (ScrollView) findViewById(R.id.registration_container); Resources resources = getResources(); if (CloudConstants.isRogerthatApp()) { rc.setBackgroundColor(resources.getColor(R.color.mc_page_dark)); } else { rc.setBackgroundColor(resources.getColor(R.color.mc_homescreen_background)); } TextView rogerthatWelcomeTextView = (TextView) findViewById(R.id.rogerthat_welcome); TextView tosTextView = (TextView) findViewById(R.id.registration_tos); Typeface FONT_THIN_ITALIC = Typeface.createFromAsset(getAssets(), "fonts/lato_light_italic.ttf"); tosTextView.setTypeface(FONT_THIN_ITALIC); tosTextView.setTextColor(ContextCompat.getColor(RegistrationActivity2.this, R.color.mc_words_color)); Button agreeBtn = (Button) findViewById(R.id.registration_agree_tos); TextView tvRegistration = (TextView) findViewById(R.id.registration); tvRegistration.setText(getString(R.string.registration_city_app_sign_up, getString(R.string.app_name))); mEnterEmailAutoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.registration_enter_email); if (CloudConstants.isEnterpriseApp()) { rogerthatWelcomeTextView .setText(getString(R.string.rogerthat_welcome_enterprise, getString(R.string.app_name))); tosTextView.setVisibility(View.GONE); agreeBtn.setText(R.string.start_registration); mEnterEmailAutoCompleteTextView.setHint(R.string.registration_enter_email_hint_enterprise); } else { rogerthatWelcomeTextView .setText(getString(R.string.registration_welcome_text, getString(R.string.app_name))); tosTextView.setText(Html.fromHtml( "<a href=\"" + CloudConstants.TERMS_OF_SERVICE_URL + "\">" + tosTextView.getText() + "</a>")); tosTextView.setMovementMethod(LinkMovementMethod.getInstance()); agreeBtn.setText(R.string.registration_btn_agree_tos); mEnterEmailAutoCompleteTextView.setHint(R.string.registration_enter_email_hint); } agreeBtn.getBackground().setColorFilter(Message.GREEN_BUTTON_COLOR, PorterDuff.Mode.MULTIPLY); agreeBtn.setOnClickListener(new SafeViewOnClickListener() { @Override public void safeOnClick(View v) { sendRegistrationStep(RegistrationWizard2.REGISTRATION_STEP_AGREED_TOS); mWiz.proceedToNextPage(); } }); initLocationUsageStep(faTypeFace); View.OnClickListener emailLoginListener = new View.OnClickListener() { @Override public void onClick(View v) { sendRegistrationStep(RegistrationWizard2.REGISTRATION_STEP_EMAIL_LOGIN); mWiz.proceedToNextPage(); } }; findViewById(R.id.login_via_email).setOnClickListener(emailLoginListener); Button facebookButton = (Button) findViewById(R.id.login_via_fb); View.OnClickListener facebookLoginListener = new View.OnClickListener() { @Override public void onClick(View v) { // Check network connectivity if (!mService.getNetworkConnectivityManager().isConnected()) { UIUtils.showNoNetworkDialog(RegistrationActivity2.this); return; } sendRegistrationStep(RegistrationWizard2.REGISTRATION_STEP_FACEBOOK_LOGIN); FacebookUtils.ensureOpenSession(RegistrationActivity2.this, AppConstants.PROFILE_SHOW_GENDER_AND_BIRTHDATE ? Arrays.asList("email", "user_friends", "user_birthday") : Arrays.asList("email", "user_friends"), PermissionType.READ, new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { if (session != Session.getActiveSession()) { session.removeCallback(this); return; } if (exception != null) { session.removeCallback(this); if (!(exception instanceof FacebookOperationCanceledException)) { L.bug("Facebook SDK error during registration", exception); AlertDialog.Builder builder = new AlertDialog.Builder( RegistrationActivity2.this); builder.setMessage(R.string.error_please_try_again); builder.setPositiveButton(R.string.rogerthat, null); AlertDialog dialog = builder.create(); dialog.show(); } } else if (session.isOpened()) { session.removeCallback(this); if (session.getPermissions().contains("email")) { registerWithAccessToken(session.getAccessToken()); } else { AlertDialog.Builder builder = new AlertDialog.Builder( RegistrationActivity2.this); builder.setMessage(R.string.facebook_registration_email_missing); builder.setPositiveButton(R.string.rogerthat, null); AlertDialog dialog = builder.create(); dialog.show(); } } } }, false); } ; }; facebookButton.setOnClickListener(facebookLoginListener); final Button getAccountsButton = (Button) findViewById(R.id.get_accounts); if (configureEmailAutoComplete()) { // GET_ACCOUNTS permission is granted getAccountsButton.setVisibility(View.GONE); } else { getAccountsButton.setTypeface(faTypeFace); getAccountsButton.setOnClickListener(new SafeViewOnClickListener() { @Override public void safeOnClick(View v) { ActivityCompat.requestPermissions(RegistrationActivity2.this, new String[] { Manifest.permission.GET_ACCOUNTS }, PERMISSION_REQUEST_GET_ACCOUNTS); } }); } mEnterPinEditText = (EditText) findViewById(R.id.registration_enter_pin); mEnterPinEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { if (s.length() == PIN_LENGTH) onPinEntered(); } }); Button requestNewPinButton = (Button) findViewById(R.id.registration_request_new_pin); requestNewPinButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mWiz.setEmail(null); hideNotification(); mWiz.reInit(); mWiz.goBackToPrevious(); mEnterEmailAutoCompleteTextView.setText(""); } }); mWiz = RegistrationWizard2.getWizard(mService); mWiz.setFlipper((ViewFlipper) findViewById(R.id.registration_viewFlipper)); setFinishHandler(); addAgreeTOSHandler(); addIBeaconUsageHandler(); addChooseLoginMethodHandler(); addEnterPinHandler(); mWiz.run(); mWiz.setDeviceId(Installation.id(this)); handleEnterEmail(); if (mWiz.getBeaconRegions() != null && mBeaconManager == null) { bindBeaconManager(); } if (CloudConstants.USE_GCM_KICK_CHANNEL && GoogleServicesUtils.checkPlayServices(this, true)) { GoogleServicesUtils.registerGCMRegistrationId(mService, new GCMRegistrationIdFoundCallback() { @Override public void idFound(String registrationId) { mGCMRegistrationId = registrationId; } }); } }
From source file:com.android.calendar.EventInfoFragment.java
private void updateEvent(View view) { if (mEventCursor == null || view == null) { return;//w w w. j a v a 2 s . co m } Context context = view.getContext(); if (context == null) { return; } String eventName = mEventCursor.getString(EVENT_INDEX_TITLE); if (eventName == null || eventName.length() == 0) { eventName = getActivity().getString(R.string.no_title_label); } // 3rd parties might not have specified the start/end time when firing the // Events.CONTENT_URI intent. Update these with values read from the db. if (mStartMillis == 0 && mEndMillis == 0) { mStartMillis = mEventCursor.getLong(EVENT_INDEX_DTSTART); mEndMillis = mEventCursor.getLong(EVENT_INDEX_DTEND); if (mEndMillis == 0) { String duration = mEventCursor.getString(EVENT_INDEX_DURATION); if (!TextUtils.isEmpty(duration)) { try { Duration d = new Duration(); d.parse(duration); long endMillis = mStartMillis + d.getMillis(); if (endMillis >= mStartMillis) { mEndMillis = endMillis; } else { Log.d(TAG, "Invalid duration string: " + duration); } } catch (DateException e) { Log.d(TAG, "Error parsing duration string " + duration, e); } } if (mEndMillis == 0) { mEndMillis = mStartMillis; } } } mAllDay = mEventCursor.getInt(EVENT_INDEX_ALL_DAY) != 0; String location = mEventCursor.getString(EVENT_INDEX_EVENT_LOCATION); String description = mEventCursor.getString(EVENT_INDEX_DESCRIPTION); String rRule = mEventCursor.getString(EVENT_INDEX_RRULE); String eventTimezone = mEventCursor.getString(EVENT_INDEX_EVENT_TIMEZONE); mHeadlines.setBackgroundColor(mCurrentColor); // What if (eventName != null) { setTextCommon(view, R.id.title, eventName); } // When // Set the date and repeats (if any) String localTimezone = Utils.getTimeZone(mActivity, mTZUpdater); Resources resources = context.getResources(); String displayedDatetime = Utils.getDisplayedDatetime(mStartMillis, mEndMillis, System.currentTimeMillis(), localTimezone, mAllDay, context); String displayedTimezone = null; if (!mAllDay) { displayedTimezone = Utils.getDisplayedTimezone(mStartMillis, localTimezone, eventTimezone); } // Display the datetime. Make the timezone (if any) transparent. if (displayedTimezone == null) { setTextCommon(view, R.id.when_datetime, displayedDatetime); } else { int timezoneIndex = displayedDatetime.length(); displayedDatetime += " " + displayedTimezone; SpannableStringBuilder sb = new SpannableStringBuilder(displayedDatetime); ForegroundColorSpan transparentColorSpan = new ForegroundColorSpan( resources.getColor(R.color.event_info_headline_transparent_color)); sb.setSpan(transparentColorSpan, timezoneIndex, displayedDatetime.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE); setTextCommon(view, R.id.when_datetime, sb); } // Display the repeat string (if any) String repeatString = null; if (!TextUtils.isEmpty(rRule)) { EventRecurrence eventRecurrence = new EventRecurrence(); eventRecurrence.parse(rRule); Time date = new Time(localTimezone); date.set(mStartMillis); if (mAllDay) { date.timezone = Time.TIMEZONE_UTC; } eventRecurrence.setStartDate(date); repeatString = EventRecurrenceFormatter.getRepeatString(mContext, resources, eventRecurrence, true); } if (repeatString == null) { view.findViewById(R.id.when_repeat).setVisibility(View.GONE); } else { setTextCommon(view, R.id.when_repeat, repeatString); } // Organizer view is setup in the updateCalendar method // Where if (location == null || location.trim().length() == 0) { setVisibilityCommon(view, R.id.where, View.GONE); } else { final TextView textView = mWhere; if (textView != null) { textView.setAutoLinkMask(0); textView.setText(location.trim()); try { textView.setText(Utils.extendedLinkify(textView.getText().toString(), true)); // Linkify.addLinks() sets the TextView movement method if it finds any links. // We must do the same here, in case linkify by itself did not find any. // (This is cloned from Linkify.addLinkMovementMethod().) MovementMethod mm = textView.getMovementMethod(); if ((mm == null) || !(mm instanceof LinkMovementMethod)) { if (textView.getLinksClickable()) { textView.setMovementMethod(LinkMovementMethod.getInstance()); } } } catch (Exception ex) { // unexpected Log.e(TAG, "Linkification failed", ex); } textView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { try { return v.onTouchEvent(event); } catch (ActivityNotFoundException e) { // ignore return true; } } }); } } // Description if (description != null && description.length() != 0) { mDesc.setText(description); } // Launch Custom App if (Utils.isJellybeanOrLater()) { updateCustomAppButton(); } }
From source file:org.uguess.android.sysinfo.SiragonManager.java
@Override public boolean onOptionsItemSelected(MenuItem item) { final Activity ctx = getActivity(); if (item.getItemId() == MI_PREFERENCE) { Intent it = new Intent(ctx, InfoSettings.class); it.putExtra(PREF_KEY_SHOW_INFO_ICON, Util.getBooleanOption(ctx, PSTORE_SYSINFOMANAGER, PREF_KEY_SHOW_INFO_ICON)); it.putExtra(PREF_KEY_SHOW_TASK_ICON, Util.getBooleanOption(ctx, PSTORE_SYSINFOMANAGER, PREF_KEY_SHOW_TASK_ICON)); it.putExtra(PREF_KEY_AUTO_START_ICON, Util.getBooleanOption(ctx, PSTORE_SYSINFOMANAGER, PREF_KEY_AUTO_START_ICON, false)); it.putExtra(PREF_KEY_DEFAULT_SERVER, Util.getStringOption(ctx, PSTORE_SYSINFOMANAGER, PREF_KEY_DEFAULT_SERVER, null)); it.putExtra(PREF_KEY_DEFAULT_EMAIL, Util.getStringOption(ctx, PSTORE_SYSINFOMANAGER, PREF_KEY_DEFAULT_EMAIL, null)); it.putExtra(PREF_KEY_DEFAULT_TAB, Util.getIntOption(ctx, PSTORE_SYSINFOMANAGER, PREF_KEY_DEFAULT_TAB, 0)); it.putExtra(PREF_KEY_WIDGET_DISABLED, Util.getStringOption(ctx, PSTORE_SYSINFOMANAGER, PREF_KEY_WIDGET_DISABLED, null)); startActivityForResult(it, 2);//w ww. j a v a2 s .c o m return true; } else if (item.getItemId() == MI_HELP) { Intent it = new Intent(Intent.ACTION_VIEW); String target = "http://www.siragon.com.ve"; //$NON-NLS-1$ ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = cm.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (info != null && info.isConnected()) { target = "http://www.siragon.com.ve"; //$NON-NLS-1$ } it.setData(Uri.parse(target)); it = Intent.createChooser(it, null); startActivity(it); return true; } ///////////////////////PATH SERVER/////////////////////////////////// else if (item.getItemId() == MI_ABOUT) { ScrollView sv = new ScrollView(ctx); TextView txt = new TextView(ctx); txt.setGravity(Gravity.CENTER_HORIZONTAL); txt.setTextAppearance(ctx, android.R.style.TextAppearance_Medium); sv.addView(txt); String href = "http://www.google.com.ve"; //$NON-NLS-1$ txt.setText(Html.fromHtml(getString(R.string.about_msg, getVersionName(ctx.getPackageManager(), ctx.getPackageName()), href))); txt.setMovementMethod(LinkMovementMethod.getInstance()); new AlertDialog.Builder(ctx).setTitle(R.string.app_name).setIcon(R.drawable.logo2).setView(sv) .setNegativeButton(R.string.close, null).create().show(); return true; } else if (item.getItemId() == MI_EXIT) { OnClickListener listener = new OnClickListener() { public void onClick(DialogInterface dialog, int which) { Util.killSelf(handler, ctx, (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE), ctx.getPackageName()); } }; new AlertDialog.Builder(ctx).setTitle(R.string.prompt).setMessage(R.string.exit_prompt) .setPositiveButton(android.R.string.yes, listener).setNegativeButton(android.R.string.no, null) .create().show(); return true; } else if (item.getItemId() == MI_REFRESH) { updateInfo(); return true; } return false; }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEvent.java
/** Called when the activity is first created. */ @Override// w w w .jav a 2s. co m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); BugSenseHandler.initAndStartSession(ViewZenossEvent.this, "44a76a8c"); settings = PreferenceManager.getDefaultSharedPreferences(this); setContentView(R.layout.view_zenoss_event); try { actionbar = getActionBar(); actionbar.setDisplayHomeAsUpEnabled(true); actionbar.setHomeButtonEnabled(true); } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEvent", "OnCreate", e); } try { ((TextView) findViewById(R.id.EventTitle)).setText(getIntent().getStringExtra("Device")); ((TextView) findViewById(R.id.Summary)).setText(Html.fromHtml(getIntent().getStringExtra("Summary"))); ((TextView) findViewById(R.id.LastTime)).setText(getIntent().getStringExtra("LastTime")); ((TextView) findViewById(R.id.EventCount)) .setText("Count: " + Integer.toString(getIntent().getIntExtra("Count", 0))); } catch (Exception e) { //We don't need to much more than report it because the direct API request will sort it out for us. BugSenseHandler.sendExceptionMessage("ViewZenossEvent", "OnCreate", e); } firstLoadHandler = new Handler() { public void handleMessage(Message msg) { dialog.dismiss(); try { if (EventObject.has("result") && EventObject.getJSONObject("result").getBoolean("success") == true) { //Log.i("Event",EventObject.toString(3)); TextView Title = (TextView) findViewById(R.id.EventTitle); TextView Component = (TextView) findViewById(R.id.Componant); TextView EventClass = (TextView) findViewById(R.id.EventClass); TextView Summary = (TextView) findViewById(R.id.Summary); TextView FirstTime = (TextView) findViewById(R.id.FirstTime); TextView LastTime = (TextView) findViewById(R.id.LastTime); LinearLayout logList; EventDetails = EventObject.getJSONObject("result").getJSONArray("event").getJSONObject(0); try { if (EventDetails.getString("eventState").equals("Acknowledged")) { ((ImageView) findViewById(R.id.ackIcon)) .setImageResource(R.drawable.ic_acknowledged); } } catch (Exception e) { e.printStackTrace(); } //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 { EventClass.setText(EventDetails.getString("eventClassKey")); } catch (Exception e) { EventClass.setText("Unknown Event Class"); } try { ImageView img = (ImageView) findViewById(R.id.summaryImage); URLImageParser p = new URLImageParser(img, ViewZenossEvent.this, Summary); Spanned htmlSpan = Html.fromHtml(EventDetails.getString("message"), p, null); Summary.setText(htmlSpan); //Summary.setText(Html.fromHtml(EventDetails.getString("message"))); //((ImageView) findViewById(R.id.summaryImage)).setImageDrawable(p.drawable); //Log.i("Summary",EventDetails.getString("message")); //((TextView) findViewById(R.id.Summary)).setVisibility(View.GONE); //((WebView) findViewById(R.id.summaryWebView)).loadData(EventDetails.getString("message"), "text/html", null); //((WebView) findViewById(R.id.summaryWebView)).loadDataWithBaseURL(null, EventDetails.getString("message"), "text/html", "UTF-8", "about:blank"); try { Summary.setMovementMethod(LinkMovementMethod.getInstance()); } catch (Exception e) { //Worth a shot } } catch (Exception e) { 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 { ((TextView) findViewById(R.id.EventCount)) .setText("Count: " + EventDetails.getString("count")); } catch (Exception e) { ((TextView) findViewById(R.id.EventCount)).setText("Count: ??"); } try { ((TextView) findViewById(R.id.Agent)).setText(EventDetails.getString("agent")); } catch (Exception e) { ((TextView) findViewById(R.id.Agent)).setText("unknown"); } try { JSONArray Log = EventDetails.getJSONArray("log"); int LogEntryCount = Log.length(); logList = (LinearLayout) findViewById(R.id.LogList); if (LogEntryCount == 0) { /*String[] LogEntries = {"No log entries could be found"}; ((ListView) findViewById(R.id.LogList)).setAdapter(new ArrayAdapter<String>(ViewZenossEvent.this, R.layout.search_simple,LogEntries));*/ TextView newLog = new TextView(ViewZenossEvent.this); newLog.setText("No log entries could be found"); logList.addView(newLog); } else { LogEntries = new String[LogEntryCount]; for (int i = 0; i < LogEntryCount; i++) { //LogEntries[i] = Log.getJSONArray(i).getString(0) + " set " + Log.getJSONArray(i).getString(2) +"\nAt: " + Log.getJSONArray(i).getString(1); TextView newLog = new TextView(ViewZenossEvent.this); newLog.setText(Html.fromHtml("<strong>" + Log.getJSONArray(i).getString(0) + "</strong> wrote " + Log.getJSONArray(i).getString(2) + "\n<br/><strong>At:</strong> " + Log.getJSONArray(i).getString(1))); newLog.setPadding(0, 6, 0, 6); logList.addView(newLog); } /*try { ((ListView) findViewById(R.id.LogList)).setAdapter(new ArrayAdapter<String>(ViewZenossEvent.this, R.layout.search_simple,LogEntries)); } catch(Exception e) { Toast.makeText(getApplicationContext(), "There was an error trying process the log entries for this event.", Toast.LENGTH_SHORT).show(); }*/ } } catch (Exception e) { TextView newLog = new TextView(ViewZenossEvent.this); newLog.setText("No log entries could be found"); newLog.setPadding(0, 6, 0, 6); ((LinearLayout) findViewById(R.id.LogList)).addView(newLog); /*String[] LogEntries = {"No log entries could be found"}; try { ((ListView) findViewById(R.id.LogList)).setAdapter(new ArrayAdapter<String>(ViewZenossEvent.this, R.layout.search_simple,LogEntries)); } catch(Exception e1) { //BugSenseHandler.log("ViewZenossEvent-LogEntries", e1); }*/ } } else { //Log.e("ViewEvent",EventObject.toString(3)); Toast.makeText(ViewZenossEvent.this, "There was an error loading the Event details", Toast.LENGTH_LONG).show(); //finish(); } } catch (Exception e) { Toast.makeText(ViewZenossEvent.this, "An error was encountered parsing the JSON. An error report has been sent.", Toast.LENGTH_LONG).show(); //BugSenseHandler.log("ViewZenossEvent", e); } } }; dialog = new ProgressDialog(this); dialog.setTitle("Contacting Zenoss"); dialog.setMessage("Please wait:\nLoading Event details...."); dialog.show(); dataPreload = new Thread() { public void run() { try { /*if(API == null) { if(settings.getBoolean("httpBasicAuth", false)) { API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", ""),settings.getString("BAUser", ""), settings.getString("BAPassword", "")); } else { API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", "")); } } EventObject = API.GetEvent(getIntent().getStringExtra("EventID"));*/ if (settings.getBoolean(ZenossAPI.PREFERENCE_IS_ZAAS, false)) { API = new ZenossAPIZaas(); } else { API = new ZenossAPICore(); } ZenossCredentials credentials = new ZenossCredentials(ViewZenossEvent.this); API.Login(credentials); EventObject = API.GetEvent(getIntent().getStringExtra("EventID")); } catch (Exception e) { firstLoadHandler.sendEmptyMessage(0); BugSenseHandler.sendExceptionMessage("ViewZenossEvent", "DataPreloadThread", e); } finally { firstLoadHandler.sendEmptyMessage(1); } } }; dataPreload.start(); }
From source file:it.gulch.linuxday.android.fragments.EventDetailsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_event_details, container, false); holder = new ViewHolder(); holder.inflater = inflater;//from w ww . java 2 s. com ((TextView) view.findViewById(R.id.title)).setText(event.getTitle()); TextView textView = (TextView) view.findViewById(R.id.subtitle); String text = event.getSubtitle(); if (TextUtils.isEmpty(text)) { textView.setVisibility(View.GONE); } else { textView.setText(text); } MovementMethod linkMovementMethod = LinkMovementMethod.getInstance(); // Set the persons summary text first; replace it with the clickable text when the loader completes holder.personsTextView = (TextView) view.findViewById(R.id.persons); String personsSummary = ""; if (CollectionUtils.isEmpty(event.getPeople())) { holder.personsTextView.setVisibility(View.GONE); } else { personsSummary = StringUtils.join(event.getPeople(), ", "); holder.personsTextView.setText(personsSummary); holder.personsTextView.setMovementMethod(linkMovementMethod); holder.personsTextView.setVisibility(View.VISIBLE); } ((TextView) view.findViewById(R.id.track)).setText(event.getTrack().getTitle()); Date startTime = event.getStartDate(); Date endTime = event.getEndDate(); text = String.format("%1$s, %2$s %3$s", event.getTrack().getDay().getName(), (startTime != null) ? TIME_DATE_FORMAT.format(startTime) : "?", (endTime != null) ? TIME_DATE_FORMAT.format(endTime) : "?"); ((TextView) view.findViewById(R.id.time)).setText(text); final String roomName = event.getTrack().getRoom().getName(); TextView roomTextView = (TextView) view.findViewById(R.id.room); Spannable roomText = new SpannableString(String.format("%1$s", roomName)); // final int roomImageResId = getResources() // .getIdentifier(StringUtils.roomNameToResourceName(roomName), "drawable", // getActivity().getPackageName()); // // If the room image exists, make the room text clickable to display it // if(roomImageResId != 0) { // roomText.setSpan(new UnderlineSpan(), 0, roomText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // roomTextView.setOnClickListener(new View.OnClickListener() // { // // @Override // public void onClick(View view) // { // RoomImageDialogFragment.newInstance(roomName, roomImageResId).show(getFragmentManager()); // } // }); // roomTextView.setFocusable(true); // } roomTextView.setText(roomText); textView = (TextView) view.findViewById(R.id.abstract_text); text = event.getEventAbstract(); if (TextUtils.isEmpty(text)) { textView.setVisibility(View.GONE); } else { String strippedText = StringUtils.stripEnd(Html.fromHtml(text).toString(), " \n"); textView.setText(strippedText); textView.setMovementMethod(linkMovementMethod); } textView = (TextView) view.findViewById(R.id.description); text = event.getDescription(); if (TextUtils.isEmpty(text)) { textView.setVisibility(View.GONE); } else { String strippedText = StringUtils.stripEnd(Html.fromHtml(text).toString(), " \n"); textView.setText(strippedText); textView.setMovementMethod(linkMovementMethod); } holder.linksContainer = (ViewGroup) view.findViewById(R.id.links_container); return view; }
From source file:com.geecko.QuickLyric.fragment.LyricsViewFragment.java
@SuppressLint("SetTextI18n") public void update(Lyrics lyrics, View layout, boolean animation) { File musicFile = null;//from w w w . j av a 2 s.c o m Bitmap cover = null; if (PermissionsChecker.hasPermission(getActivity(), "android.permission.READ_EXTERNAL_STORAGE")) { musicFile = Id3Reader.getFile(getActivity(), lyrics.getOriginalArtist(), lyrics.getOriginalTrack()); cover = Id3Reader.getCover(getActivity(), lyrics.getArtist(), lyrics.getTitle()); } setCoverArt(cover, null); boolean artCellDownload = Integer.valueOf( PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("pref_artworks", "0")) == 0; if (cover == null) new CoverArtLoader().execute(lyrics, this.getActivity(), artCellDownload || OnlineAccessVerifier.isConnectedWifi(getActivity())); getActivity().findViewById(R.id.edit_tags_btn).setEnabled(true); getActivity().findViewById(R.id.edit_tags_btn) .setVisibility(musicFile == null || !musicFile.canWrite() || lyrics.isLRC() || Id3Reader.getLyrics(getActivity(), lyrics.getArtist(), lyrics.getTitle()) == null ? View.GONE : View.VISIBLE); TextSwitcher textSwitcher = ((TextSwitcher) layout.findViewById(R.id.switcher)); LrcView lrcView = (LrcView) layout.findViewById(R.id.lrc_view); View v = getActivity().findViewById(R.id.tracks_msg); if (v != null) ((ViewGroup) v.getParent()).removeView(v); TextView artistTV = (TextView) getActivity().findViewById(R.id.artist); TextView songTV = (TextView) getActivity().findViewById(R.id.song); final TextView id3TV = (TextView) layout.findViewById(R.id.source_tv); TextView writerTV = (TextView) layout.findViewById(R.id.writer_tv); TextView copyrightTV = (TextView) layout.findViewById(R.id.copyright_tv); RelativeLayout bugLayout = (RelativeLayout) layout.findViewById(R.id.error_msg); this.mLyrics = lyrics; if (SDK_INT >= ICE_CREAM_SANDWICH) beamLyrics(lyrics, this.getActivity()); new PresenceChecker().execute(this, new String[] { lyrics.getArtist(), lyrics.getTitle(), lyrics.getOriginalArtist(), lyrics.getOriginalTrack() }); if (lyrics.getArtist() != null) artistTV.setText(lyrics.getArtist()); else artistTV.setText(""); if (lyrics.getTitle() != null) songTV.setText(lyrics.getTitle()); else songTV.setText(""); if (lyrics.getCopyright() != null) { copyrightTV.setText("Copyright: " + lyrics.getCopyright()); copyrightTV.setVisibility(View.VISIBLE); } else { copyrightTV.setText(""); copyrightTV.setVisibility(View.GONE); } if (lyrics.getWriter() != null) { if (lyrics.getWriter().contains(",")) writerTV.setText("Writers:\n" + lyrics.getWriter()); else writerTV.setText("Writer:" + lyrics.getWriter()); writerTV.setVisibility(View.VISIBLE); } else { writerTV.setText(""); writerTV.setVisibility(View.GONE); } if (isActiveFragment) ((RefreshIcon) getActivity().findViewById(R.id.refresh_fab)).show(); EditText newLyrics = (EditText) getActivity().findViewById(R.id.edit_lyrics); if (newLyrics != null) newLyrics.setText(""); if (lyrics.getFlag() == Lyrics.POSITIVE_RESULT) { if (!lyrics.isLRC()) { textSwitcher.setVisibility(View.VISIBLE); lrcView.setVisibility(View.GONE); if (animation) textSwitcher.setText(Html.fromHtml(lyrics.getText())); else textSwitcher.setCurrentText(Html.fromHtml(lyrics.getText())); } else { textSwitcher.setVisibility(View.GONE); lrcView.setVisibility(View.VISIBLE); lrcView.setOriginalLyrics(lyrics); lrcView.setSourceLrc(lyrics.getText()); if (isActiveFragment) ((ControllableAppBarLayout) getActivity().findViewById(R.id.appbar)).expandToolbar(true); updateLRC(); } bugLayout.setVisibility(View.INVISIBLE); id3TV.setMovementMethod(LinkMovementMethod.getInstance()); if ("Storage".equals(lyrics.getSource())) { id3TV.setVisibility(View.VISIBLE); SpannableString text = new SpannableString(getString(R.string.from_id3)); text.setSpan(new UnderlineSpan(), 1, text.length() - 1, 0); id3TV.setText(text); id3TV.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((MainActivity) getActivity()).id3PopUp(id3TV); } }); } else { id3TV.setOnClickListener(null); id3TV.setVisibility(View.GONE); } mScrollView.post(new Runnable() { @Override public void run() { mScrollView.scrollTo(0, 0); //only useful when coming from localLyricsFragment mScrollView.smoothScrollTo(0, 0); } }); } else { textSwitcher.setText(""); textSwitcher.setVisibility(View.INVISIBLE); lrcView.setVisibility(View.INVISIBLE); bugLayout.setVisibility(View.VISIBLE); int message; int whyVisibility; if (lyrics.getFlag() == Lyrics.ERROR || !OnlineAccessVerifier.check(getActivity())) { message = R.string.connection_error; whyVisibility = TextView.GONE; } else { message = R.string.no_results; whyVisibility = TextView.VISIBLE; updateSearchView(false, lyrics.getTitle(), false); } TextView whyTextView = ((TextView) bugLayout.findViewById(R.id.bugtext_why)); ((TextView) bugLayout.findViewById(R.id.bugtext)).setText(message); whyTextView.setVisibility(whyVisibility); whyTextView.setPaintFlags(whyTextView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); id3TV.setVisibility(View.GONE); } stopRefreshAnimation(); getActivity().getIntent().setAction(""); getActivity().invalidateOptionsMenu(); }
From source file:gr.scify.newsum.ui.SearchViewActivity.java
private void initTopicSpinner() { // Get topics in category. Null accepts all user sources. Modify // according to user selection final String[] saTopicIDs = SearchTopicActivity.saTopicIDs; final String[] saTitles = SearchTopicActivity.saTopicTitles; final String[] saDates = SearchTopicActivity.saTopicDates; // TODO add TopicInfo for SearchResults as well and parse accordingly // final String[] saTopicIDs = extras.getStringArray("searchresults"); final TextView title = (TextView) findViewById(R.id.title); // Fill topic spinner ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item, saTitles); final TextView tx = (TextView) findViewById(R.id.textView1); // tx.setMovementMethod(LinkMovementMethod.getInstance()); // final float minm = tx.getTextSize(); // final float maxm = (minm + 24); // create an invisible spinner just to control the summaries of the // category (i will use it later on Swipe) Spinner spinner = (Spinner) findViewById(R.id.spinner1); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter);/* w ww . ja va 2s. c om*/ // Scroll view init final ScrollView scroll = (ScrollView) findViewById(R.id.scrollView1); // Add selection event spinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // Show waiting dialog showWaitingDialog(); // Changing summary loading = true; // Update visibility of rating bar final RatingBar rb = (RatingBar) findViewById(R.id.ratingBar); rb.setRating(0.0f); rb.setVisibility(View.VISIBLE); final TextView rateLbl = (TextView) findViewById(R.id.rateLbl); rateLbl.setVisibility(View.VISIBLE); scroll.scrollTo(0, 0); // String[] saTopicIDs = sTopicIds.split(sSeparator); SharedPreferences settings = getSharedPreferences("urls", 0); // get user settings for sources String UserSources = settings.getString("UserLinks", "All"); String[] Summary = NewSumServiceClient.getSummary(saTopicIDs[arg2], UserSources); if (Summary.length == 0) { // WORK. Updated: CHECK // Close waiting dialog closeWaitingDialog(); AlertDialog.Builder alert = new AlertDialog.Builder(SearchViewActivity.this); alert.setMessage(R.string.shouldReloadSummaries); alert.setNeutralButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { startActivity(new Intent(getApplicationContext(), NewSumUiActivity.class) .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); } }); alert.setCancelable(false); alert.show(); loading = false; return; } // track summary views per Search and topic title if (getAnalyticsPref()) { EasyTracker.getTracker().sendEvent(VIEW_SUMMARY_ACTION, "From Search", saTitles[arg2] + ": " + saDates[arg2], 0l); } // Generate summary text sText = ViewActivity.generateSummaryText(Summary, SearchViewActivity.this); pText = ViewActivity.generatesummarypost(Summary, SearchViewActivity.this); tx.setText(Html.fromHtml(sText)); tx.setMovementMethod(LinkMovementMethod.getInstance()); title.setText(saTitles[arg2] + ": " + saDates[arg2]); float defSize = tx.getTextSize(); SharedPreferences usersize = getSharedPreferences("textS", 0); float newSize = usersize.getFloat("size", defSize); tx.setTextSize(TypedValue.COMPLEX_UNIT_PX, newSize); // update the TopicActivity with viewed item TopicActivity.addVisitedTopicID(saTopicIDs[arg2]); // Close waiting dialog closeWaitingDialog(); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); }
From source file:com.heath_bar.tvdb.EpisodeDetails.java
/** Populate the GUI with the data we've found */ public void PopulateStuff(TvEpisode theEpisode) { // Set Title/*from ww w . java 2s.c om*/ TextView textview = (TextView) findViewById(R.id.title); textview.setVisibility(View.VISIBLE); textview.setText(theEpisode.getSeason() + "x" + String.format("%02d", theEpisode.getNumber()) + " " + theEpisode.getName()); // Set Thumb if (theEpisode.getImage() != null && (theEpisode.getImage().getBitmap() == null || theEpisode.getImage().getUrl().equals(""))) { // do nothin } else { imageId = theEpisode.getImage().getId(); ImageButton banner = (ImageButton) findViewById(R.id.episode_thumb); banner.setImageBitmap(theEpisode.getImage().getBitmap()); banner.setVisibility(View.VISIBLE); banner.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { shareImage(); } }); } // Overview textview = (TextView) findViewById(R.id.overview_header); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.overview); textview.setVisibility(View.VISIBLE); textview.setText(theEpisode.getOverview()); // Director textview = (TextView) findViewById(R.id.director_header); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.director); textview.setVisibility(View.VISIBLE); textview.setText(theEpisode.getDirector()); // Writer textview = (TextView) findViewById(R.id.writer_header); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.writer); textview.setVisibility(View.VISIBLE); textview.setText(theEpisode.getWriter()); // Rating textview = (TextView) findViewById(R.id.rating_header); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.rating); textview.setVisibility(View.VISIBLE); textview.setText(theEpisode.getRating() + " / 10"); // First Aired textview = (TextView) findViewById(R.id.first_aired_header); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.first_aired); textview.setVisibility(View.VISIBLE); textview.setText(DateUtil.toString(theEpisode.getAirDate())); // Guest Stars textview = (TextView) findViewById(R.id.guest_stars_header); textview.setVisibility(View.VISIBLE); textview = (TextView) findViewById(R.id.guest_stars); textview.setVisibility(View.VISIBLE); textview.setText(theEpisode.getGuestStars()); textview = (TextView) findViewById(R.id.imdb_link); textview.setVisibility(View.VISIBLE); final String imdbId = theEpisode.getIMDB(); if (imdbId != "") { SpannableStringBuilder ssb = new SpannableStringBuilder(getResources().getString(R.string.imdb)); ssb.setSpan(new NonUnderlinedClickableSpan(getResources().getString(R.string.imdb)) { @Override public void onClick(View v) { Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.imdb.com/title/" + imdbId)); startActivity(myIntent); } }, 0, ssb.length(), 0); ssb.setSpan(new TextAppearanceSpan(this, R.style.episode_link), 0, ssb.length(), 0); // Set the style of the text textview.setText(ssb, BufferType.SPANNABLE); textview.setMovementMethod(LinkMovementMethod.getInstance()); } }
From source file:github.daneren2005.dsub.fragments.SelectDirectoryFragment.java
private void setupTextDisplay(final View header) { final TextView titleView = (TextView) header.findViewById(R.id.select_album_title); if (playlistName != null) { titleView.setText(playlistName); } else if (podcastName != null) { titleView.setText(podcastName);//from w w w.j a v a 2s. c o m titleView.setPadding(0, 6, 4, 8); } else if (name != null) { titleView.setText(name); if (artistInfo != null) { titleView.setPadding(0, 6, 4, 8); } } else if (share != null) { titleView.setVisibility(View.GONE); } int songCount = 0; Set<String> artists = new HashSet<String>(); Set<Integer> years = new HashSet<Integer>(); Integer totalDuration = 0; for (Entry entry : entries) { if (!entry.isDirectory()) { songCount++; if (entry.getArtist() != null) { artists.add(entry.getArtist()); } if (entry.getYear() != null) { years.add(entry.getYear()); } Integer duration = entry.getDuration(); if (duration != null) { totalDuration += duration; } } } final TextView artistView = (TextView) header.findViewById(R.id.select_album_artist); if (podcastDescription != null || artistInfo != null) { artistView.setVisibility(View.VISIBLE); String text = podcastDescription != null ? podcastDescription : artistInfo.getBiography(); Spanned spanned = null; if (text != null) { spanned = Html.fromHtml(text); } artistView.setText(spanned); artistView.setSingleLine(false); final int minLines = context.getResources().getInteger(R.integer.TextDescriptionLength); artistView.setLines(minLines); artistView.setTextAppearance(context, android.R.style.TextAppearance_Small); final Spanned spannedText = spanned; artistView.setOnClickListener(new View.OnClickListener() { @TargetApi(Build.VERSION_CODES.JELLY_BEAN) @Override public void onClick(View v) { if (artistView.getMaxLines() == minLines) { // Use LeadingMarginSpan2 to try to make text flow around image Display display = context.getWindowManager().getDefaultDisplay(); ImageView coverArtView = (ImageView) header.findViewById(R.id.select_album_art); coverArtView.measure(display.getWidth(), display.getHeight()); int height, width; ViewGroup.MarginLayoutParams vlp = (ViewGroup.MarginLayoutParams) coverArtView .getLayoutParams(); if (coverArtView.getDrawable() != null) { height = coverArtView.getMeasuredHeight() + coverArtView.getPaddingBottom(); width = coverArtView.getWidth() + coverArtView.getPaddingRight(); } else { height = coverArtView.getHeight(); width = coverArtView.getWidth() + coverArtView.getPaddingRight(); } float textLineHeight = artistView.getPaint().getTextSize(); int lines = (int) Math.ceil(height / textLineHeight); SpannableString ss = new SpannableString(spannedText); ss.setSpan(new MyLeadingMarginSpan2(lines, width), 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); View linearLayout = header.findViewById(R.id.select_album_text_layout); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) linearLayout .getLayoutParams(); int[] rules = params.getRules(); rules[RelativeLayout.RIGHT_OF] = 0; params.leftMargin = vlp.rightMargin; artistView.setText(ss); artistView.setMaxLines(100); vlp = (ViewGroup.MarginLayoutParams) titleView.getLayoutParams(); vlp.leftMargin = width; } else { artistView.setMaxLines(minLines); } } }); artistView.setMovementMethod(LinkMovementMethod.getInstance()); } else if (topTracks) { artistView.setText(R.string.menu_top_tracks); artistView.setVisibility(View.VISIBLE); } else if (showAll) { artistView.setText(R.string.menu_show_all); artistView.setVisibility(View.VISIBLE); } else if (artists.size() == 1) { String artistText = artists.iterator().next(); if (years.size() == 1) { artistText += " - " + years.iterator().next(); } artistView.setText(artistText); artistView.setVisibility(View.VISIBLE); } else { artistView.setVisibility(View.GONE); } TextView songCountView = (TextView) header.findViewById(R.id.select_album_song_count); TextView songLengthView = (TextView) header.findViewById(R.id.select_album_song_length); if (podcastDescription != null || artistInfo != null) { songCountView.setVisibility(View.GONE); songLengthView.setVisibility(View.GONE); } else { String s = context.getResources().getQuantityString(R.plurals.select_album_n_songs, songCount, songCount); songCountView.setText(s.toUpperCase()); songLengthView.setText(Util.formatDuration(totalDuration)); } }
From source file:org.schabi.newpipe.detail.VideoItemDetailFragment.java
private void updateInfo(final StreamInfo info) { Activity a = getActivity();//from w w w . java 2 s . c o m RelativeLayout textContentLayout = (RelativeLayout) activity.findViewById(R.id.detail_text_content_layout); final TextView videoTitleView = (TextView) activity.findViewById(R.id.detail_video_title_view); TextView uploaderView = (TextView) activity.findViewById(R.id.detail_uploader_view); TextView viewCountView = (TextView) activity.findViewById(R.id.detail_view_count_view); TextView thumbsUpView = (TextView) activity.findViewById(R.id.detail_thumbs_up_count_view); TextView thumbsDownView = (TextView) activity.findViewById(R.id.detail_thumbs_down_count_view); TextView uploadDateView = (TextView) activity.findViewById(R.id.detail_upload_date_view); TextView descriptionView = (TextView) activity.findViewById(R.id.detail_description_view); RecyclerView nextStreamView = (RecyclerView) activity.findViewById(R.id.detail_next_stream_content); RelativeLayout nextVideoRootFrame = (RelativeLayout) activity .findViewById(R.id.detail_next_stream_root_layout); TextView similarTitle = (TextView) activity.findViewById(R.id.detail_similar_title); Button backgroundButton = (Button) activity .findViewById(R.id.detail_stream_thumbnail_window_background_button); View topView = activity.findViewById(R.id.detailTopView); Button channelButton = (Button) activity.findViewById(R.id.channel_button); // prevents a crash if the activity/fragment was already left when the response came if (channelButton != null) { progressBar.setVisibility(View.GONE); if (info.next_video != null) { // todo: activate this function or remove it nextStreamView.setVisibility(View.GONE); } else { nextStreamView.setVisibility(View.GONE); activity.findViewById(R.id.detail_similar_title).setVisibility(View.GONE); } textContentLayout.setVisibility(View.VISIBLE); if (android.os.Build.VERSION.SDK_INT < 18) { playVideoButton.setVisibility(View.VISIBLE); } else { ImageView playArrowView = (ImageView) activity.findViewById(R.id.play_arrow_view); playArrowView.setVisibility(View.VISIBLE); } if (!showNextStreamItem) { nextVideoRootFrame.setVisibility(View.GONE); similarTitle.setVisibility(View.GONE); } videoTitleView.setText(info.title); topView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == android.view.MotionEvent.ACTION_UP) { ImageView arrow = (ImageView) activity.findViewById(R.id.toggle_description_view); View extra = activity.findViewById(R.id.detailExtraView); if (extra.getVisibility() == View.VISIBLE) { extra.setVisibility(View.GONE); arrow.setImageResource(R.drawable.arrow_down); } else { extra.setVisibility(View.VISIBLE); arrow.setImageResource(R.drawable.arrow_up); } } return true; } }); // Since newpipe is designed to work even if certain information is not available, // the UI has to react on missing information. videoTitleView.setText(info.title); if (!info.uploader.isEmpty()) { uploaderView.setText(info.uploader); } else { activity.findViewById(R.id.detail_uploader_view).setVisibility(View.GONE); } if (info.view_count >= 0) { viewCountView.setText(Localization.localizeViewCount(info.view_count, a)); } else { viewCountView.setVisibility(View.GONE); } if (info.dislike_count >= 0) { thumbsDownView.setText(Localization.localizeNumber(info.dislike_count, a)); } else { thumbsDownView.setVisibility(View.INVISIBLE); activity.findViewById(R.id.detail_thumbs_down_count_view).setVisibility(View.GONE); } if (info.like_count >= 0) { thumbsUpView.setText(Localization.localizeNumber(info.like_count, a)); } else { thumbsUpView.setVisibility(View.GONE); activity.findViewById(R.id.detail_thumbs_up_img_view).setVisibility(View.GONE); thumbsDownView.setVisibility(View.GONE); activity.findViewById(R.id.detail_thumbs_down_img_view).setVisibility(View.GONE); } if (!info.upload_date.isEmpty()) { uploadDateView.setText(Localization.localizeDate(info.upload_date, a)); } else { uploadDateView.setVisibility(View.GONE); } if (!info.description.isEmpty()) { descriptionView.setText(Html.fromHtml(info.description)); } else { descriptionView.setVisibility(View.GONE); } descriptionView.setMovementMethod(LinkMovementMethod.getInstance()); // parse streams Vector<VideoStream> streamsToUse = new Vector<>(); for (VideoStream i : info.video_streams) { if (useStream(i, streamsToUse)) { streamsToUse.add(i); } } textContentLayout.setVisibility(View.VISIBLE); if (info.next_video == null) { activity.findViewById(R.id.detail_next_stream_title).setVisibility(View.GONE); } if (info.related_streams != null && !info.related_streams.isEmpty()) { initSimilarVideos(info); } else { activity.findViewById(R.id.detail_similar_title).setVisibility(View.GONE); activity.findViewById(R.id.similar_streams_view).setVisibility(View.GONE); } setupActionBarHandler(info); if (autoPlayEnabled) { playVideo(info); } if (android.os.Build.VERSION.SDK_INT < 18) { playVideoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playVideo(info); } }); } backgroundButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { playVideo(info); } }); if (info.channel_url != null && info.channel_url != "") { channelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(activity, ChannelActivity.class); i.putExtra(ChannelActivity.CHANNEL_URL, info.channel_url); i.putExtra(ChannelActivity.SERVICE_ID, info.service_id); startActivity(i); } }); } else { channelButton.setVisibility(Button.GONE); } initThumbnailViews(info); } }