本文整理汇总了Java中com.google.samples.apps.iosched.util.UIUtils.setTextMaybeHtml方法的典型用法代码示例。如果您正苦于以下问题:Java UIUtils.setTextMaybeHtml方法的具体用法?Java UIUtils.setTextMaybeHtml怎么用?Java UIUtils.setTextMaybeHtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.samples.apps.iosched.util.UIUtils
的用法示例。
在下文中一共展示了UIUtils.setTextMaybeHtml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displaySpeakersData
import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
private void displaySpeakersData(SessionDetailModel data) {
final ViewGroup speakersGroup = (ViewGroup) getActivity()
.findViewById(R.id.session_speakers_block);
// Remove all existing speakers (everything but first child, which is the header)
for (int i = speakersGroup.getChildCount() - 1; i >= 1; i--) {
speakersGroup.removeViewAt(i);
}
final LayoutInflater inflater = getActivity().getLayoutInflater();
boolean hasSpeakers = false;
List<SessionDetailModel.Speaker> speakers = data.getSpeakers();
for (final SessionDetailModel.Speaker speaker : speakers) {
String speakerHeader = speaker.getName();
if (!TextUtils.isEmpty(speaker.getCompany())) {
speakerHeader += ", " + speaker.getCompany();
}
final View speakerView = inflater
.inflate(R.layout.speaker_detail, speakersGroup, false);
final TextView speakerHeaderView = (TextView) speakerView
.findViewById(R.id.speaker_header);
final ImageView speakerImageView = (ImageView) speakerView
.findViewById(R.id.speaker_image);
final TextView speakerAbstractView = (TextView) speakerView
.findViewById(R.id.speaker_abstract);
final ImageView plusOneIcon = (ImageView) speakerView.findViewById(R.id.gplus_icon_box);
final ImageView twitterIcon = (ImageView) speakerView.findViewById(
R.id.twitter_icon_box);
setUpSpeakerSocialIcon(speaker, twitterIcon, speaker.getTwitterUrl(),
UIUtils.TWITTER_COMMON_NAME, UIUtils.TWITTER_PACKAGE_NAME);
setUpSpeakerSocialIcon(speaker, plusOneIcon, speaker.getPlusoneUrl(),
UIUtils.GOOGLE_PLUS_COMMON_NAME, UIUtils.GOOGLE_PLUS_PACKAGE_NAME);
// A speaker may have both a Twitter and GPlus page, only a Twitter page or only a
// GPlus page, or neither. By default, align the Twitter icon to the right and the GPlus
// icon to its left. If only a single icon is displayed, align it to the right.
determineSocialIconPlacement(plusOneIcon, twitterIcon);
if (!TextUtils.isEmpty(speaker.getImageUrl()) && mSpeakersImageLoader != null) {
mSpeakersImageLoader.loadImage(speaker.getImageUrl(), speakerImageView);
}
speakerHeaderView.setText(speakerHeader);
speakerImageView.setContentDescription(
getString(R.string.speaker_googleplus_profile, speakerHeader));
UIUtils.setTextMaybeHtml(speakerAbstractView, speaker.getAbstract());
if (!TextUtils.isEmpty(speaker.getUrl())) {
speakerImageView.setEnabled(true);
speakerImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent speakerProfileIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse(speaker.getUrl()));
speakerProfileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
UIUtils.preferPackageForIntent(getActivity(),
speakerProfileIntent,
UIUtils.GOOGLE_PLUS_PACKAGE_NAME);
startActivity(speakerProfileIntent);
}
});
} else {
speakerImageView.setEnabled(false);
speakerImageView.setOnClickListener(null);
}
speakersGroup.addView(speakerView);
hasSpeakers = true;
}
speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE);
updateEmptyView(data);
}
示例2: displaySpeakersData
import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
private void displaySpeakersData(SessionDetailModel data) {
final ViewGroup speakersGroup = (ViewGroup) getActivity()
.findViewById(R.id.session_speakers_block);
speakersGroup.removeAllViews();
final LayoutInflater inflater = getActivity().getLayoutInflater();
List<SessionDetailModel.Speaker> speakers = data.getSpeakers();
for (SessionDetailModel.Speaker speaker : speakers) {
View speakerView = inflater.inflate(R.layout.speaker_detail, speakersGroup, false);
ImageView speakerImage = (ImageView) speakerView.findViewById(R.id.speaker_image);
TextView speakerName = (TextView) speakerView.findViewById(R.id.speaker_name);
TextView speakerCompany = (TextView) speakerView.findViewById(R.id.speaker_company);
TextView speakerAbstract = (TextView) speakerView.findViewById(R.id.speaker_abstract);
speakerName.setText(speaker.getName());
if (TextUtils.isEmpty(speaker.getCompany())) {
speakerCompany.setVisibility(GONE);
} else {
speakerCompany.setText(speaker.getCompany());
}
if (!TextUtils.isEmpty(speaker.getImageUrl()) && mImageLoader != null) {
mImageLoader.loadImage(speaker.getImageUrl(), speakerImage);
}
UIUtils.setTextMaybeHtml(speakerAbstract, speaker.getAbstract());
speakersGroup.addView(speakerView);
}
speakersGroup.setVisibility(speakersGroup.getChildCount() > 0 ? VISIBLE : GONE);
updateEmptyView(data);
}
示例3: onSpeakersQueryComplete
import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
private void onSpeakersQueryComplete(Cursor cursor) {
mSpeakersCursor = true;
final ViewGroup speakersGroup = (ViewGroup) findViewById(R.id.session_speakers_block);
// Remove all existing speakers (everything but first child, which is the header)
for (int i = speakersGroup.getChildCount() - 1; i >= 1; i--) {
speakersGroup.removeViewAt(i);
}
final LayoutInflater inflater = getLayoutInflater();
boolean hasSpeakers = false;
cursor.moveToPosition(-1); // move to just before first record
while (cursor.moveToNext()) {
final String speakerName = cursor.getString(SpeakersQuery.SPEAKER_NAME);
if (TextUtils.isEmpty(speakerName)) {
continue;
}
final String speakerImageUrl = cursor.getString(SpeakersQuery.SPEAKER_IMAGE_URL);
final String speakerCompany = cursor.getString(SpeakersQuery.SPEAKER_COMPANY);
final String speakerUrl = cursor.getString(SpeakersQuery.SPEAKER_URL);
final String speakerAbstract = cursor.getString(SpeakersQuery.SPEAKER_ABSTRACT);
String speakerHeader = speakerName;
if (!TextUtils.isEmpty(speakerCompany)) {
speakerHeader += ", " + speakerCompany;
}
final View speakerView = inflater
.inflate(R.layout.speaker_detail, speakersGroup, false);
final TextView speakerHeaderView = (TextView) speakerView
.findViewById(R.id.speaker_header);
final ImageView speakerImageView = (ImageView) speakerView
.findViewById(R.id.speaker_image);
final TextView speakerAbstractView = (TextView) speakerView
.findViewById(R.id.speaker_abstract);
if (!TextUtils.isEmpty(speakerImageUrl) && mSpeakersImageLoader != null) {
mSpeakersImageLoader.loadImage(speakerImageUrl, speakerImageView);
}
speakerHeaderView.setText(speakerHeader);
speakerImageView.setContentDescription(
getString(R.string.speaker_googleplus_profile, speakerHeader));
UIUtils.setTextMaybeHtml(speakerAbstractView, speakerAbstract);
if (!TextUtils.isEmpty(speakerUrl)) {
speakerImageView.setEnabled(true);
speakerImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent speakerProfileIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse(speakerUrl));
speakerProfileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
UIUtils.preferPackageForIntent(SessionDetailActivity.this,
speakerProfileIntent,
UIUtils.GOOGLE_PLUS_PACKAGE_NAME);
startActivity(speakerProfileIntent);
}
});
} else {
speakerImageView.setEnabled(false);
speakerImageView.setOnClickListener(null);
}
speakersGroup.addView(speakerView);
hasSpeakers = true;
mHasSummaryContent = true;
}
speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE);
updateEmptyView();
}
示例4: displaySessionData
import com.google.samples.apps.iosched.util.UIUtils; //导入方法依赖的package包/类
private void displaySessionData(final SessionDetailModel data) {
try {
AppIndex.AppIndexApi.start(mClient, getActionForTitle(data.getSessionTitle()));
} catch (Throwable e) {
// Nothing to do if indexing fails.
}
mToolbarTitle.setText(data.getSessionTitle());
mTitle.setText(data.getSessionTitle());
mSubtitle.setText(data.getSessionSubtitle());
if (!TextUtils.isEmpty(data.getSessionAbstract())) {
UIUtils.setTextMaybeHtml(mAbstract, data.getSessionAbstract());
mAbstract.setVisibility(VISIBLE);
} else {
mAbstract.setVisibility(GONE);
}
// Handle Keynote as a special case, where the user cannot remove it
// from the schedule (it is auto added to schedule on sync)
showInSchedule(!data.isKeynote() && data.isInSchedule(), false);
displayTags(data);
updateTimeBasedUi(data);
updateEmptyView(data);
if (data.shouldShowHeaderImage()) {
setToolbarTint(mIconTintCollapsing);
mImageLoader.loadImage(data.getPhotoUrl(), mPhotoView);
mPhotoViewContainer.setVisibility(VISIBLE);
} else {
setToolbarTint(mIconTintNormal);
mPhotoViewContainer.setVisibility(GONE);
}
if (data.getLiveStreamVideoWatched()) {
mPhotoView.setColorFilter(getContext().getResources().getColor(
R.color.played_video_tint));
mWatchVideo.setText(getString(R.string.session_replay));
}
if (data.hasLiveStream()) {
mWatchVideo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String videoId = YouTubeUtils.getVideoIdFromSessionData(data.getYouTubeUrl(),
data.getLiveStreamId());
if (videoId != null) {
YouTubeUtils.showYouTubeVideo(videoId, getActivity());
AnalyticsHelper.sendEvent("Session", "Youtube Video", mTitle.toString());
}
}
});
}
fireAnalyticsScreenView(data.getSessionTitle());
mTimeHintUpdaterRunnable = new Runnable() {
@Override
public void run() {
if (getActivity() == null) {
// Do not post a delayed message if the activity is detached.
return;
}
updateTimeBasedUi(data);
mHandler.postDelayed(mTimeHintUpdaterRunnable,
SessionDetailConstants.TIME_HINT_UPDATE_INTERVAL);
}
};
mHandler.postDelayed(mTimeHintUpdaterRunnable,
SessionDetailConstants.TIME_HINT_UPDATE_INTERVAL);
if (!mHasEnterTransition) {
// No enter transition so update UI manually
enterTransitionFinished();
}
updateReservationStatusFromServer(data);
}