本文整理汇总了Java中com.google.samples.apps.iosched.util.UIUtils类的典型用法代码示例。如果您正苦于以下问题:Java UIUtils类的具体用法?Java UIUtils怎么用?Java UIUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIUtils类属于com.google.samples.apps.iosched.util包,在下文中一共展示了UIUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUpSpeakerSocialIcon
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
/**
* Determines visibility of a social icon, sets up a click listener to allow the user to
* navigate to the social network associated with the icon, and sets up a content description
* for the icon.
*/
private void setUpSpeakerSocialIcon(final SessionDetailModel.Speaker speaker,
ImageView socialIcon, final String socialUrl,
String socialNetworkName, final String packageName) {
if (socialUrl == null || socialUrl.isEmpty()) {
socialIcon.setVisibility(View.GONE);
} else {
socialIcon.setContentDescription(getString(
R.string.speaker_social_page,
socialNetworkName,
speaker.getName())
);
socialIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
UIUtils.fireSocialIntent(
getActivity(),
Uri.parse(socialUrl),
packageName
);
}
});
}
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:29,代码来源:SessionDetailFragment.java
示例2: scheduleFeedbackAlarm
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
public void scheduleFeedbackAlarm(final long sessionEnd,
final long alarmOffset, final String sessionTitle) {
// By default, feedback alarms fire 5 minutes before session end time. If alarm offset is
// provided, alarm is set to go off that much time from now (useful for testing).
long alarmTime;
if (alarmOffset == UNDEFINED_ALARM_OFFSET) {
alarmTime = sessionEnd - MILLI_FIVE_MINUTES;
} else {
alarmTime = UIUtils.getCurrentTime(this) + alarmOffset;
}
LOGD(TAG, "Scheduling session feedback alarm for session '" + sessionTitle + "'");
LOGD(TAG, " -> end time: " + sessionEnd + " = " + (new Date(sessionEnd)).toString());
LOGD(TAG, " -> alarm time: " + alarmTime + " = " + (new Date(alarmTime)).toString());
final Intent feedbackIntent = new Intent(
ACTION_NOTIFY_SESSION_FEEDBACK,
null,
this,
SessionAlarmService.class);
PendingIntent pi = PendingIntent.getService(
this, 1, feedbackIntent, PendingIntent.FLAG_CANCEL_CURRENT);
final AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, alarmTime, pi);
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:26,代码来源:SessionAlarmService.java
示例3: onCreateLoader
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
if (id != QUERY_TOKEN_SESSION_ROOM && id != QUERY_TOKEN_SUBTITLE) {
return null;
}
final long time = UIUtils.getCurrentTime(getActivity());
final String roomId = args.getString(QUERY_ARG_ROOMID);
final String roomTitle = args.getString(QUERY_ARG_ROOMTITLE);
final int roomType = args.getInt(QUERY_ARG_ROOMTYPE);
if (id == QUERY_TOKEN_SESSION_ROOM) {
return new OverviewSessionLoader(getActivity(), roomId, roomTitle, roomType, time);
} else if (id == QUERY_TOKEN_SUBTITLE) {
return new SingleSessionLoader(getActivity(), roomId, roomTitle, roomType);
}
return null;
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:19,代码来源:MapInfoFragment.java
示例4: isLiveStreamNow
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
/**
* Return whether this is a LiveStreamed session and whether it is happening right now.
*/
public boolean isLiveStreamNow(Context context) {
if (!isLiveStreamAvailable()) {
return false;
}
if (mStartDate == null || mEndDate == null) {
return false;
}
Calendar now = java.util.Calendar.getInstance();
now.setTimeInMillis(UIUtils.getCurrentTime(context));
if (mStartDate.before(now.getTime()) && mEndDate.after(now.getTime())) {
return true;
} else {
return false;
}
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:19,代码来源:SessionData.java
示例5: onResume
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
@Override
public void onResume() {
super.onResume();
getActivity().invalidateOptionsMenu();
// configure video fragment's top clearance to take our overlaid controls (Action Bar
// and spinner box) into account.
int actionBarSize = UIUtils.calculateActionBarSize(getActivity());
DrawShadowFrameLayout drawShadowFrameLayout =
(DrawShadowFrameLayout) getActivity().findViewById(R.id.main_content);
if (drawShadowFrameLayout != null) {
drawShadowFrameLayout.setShadowTopOffset(actionBarSize);
}
setContentTopClearance(actionBarSize
+ getResources().getDimensionPixelSize(R.dimen.explore_grid_padding));
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:17,代码来源:VideoLibraryFilteredFragment.java
示例6: onPostCreate
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
if (mViewPager != null) {
long now = UIUtils.getCurrentTime(this);
selectDay(0);
for (int i = 0; i < Config.CONFERENCE_DAYS.length; i++) {
if (now >= Config.CONFERENCE_DAYS[i][0] && now <= Config.CONFERENCE_DAYS[i][1]) {
selectDay(i);
break;
}
}
}
setProgressBarTopWhenActionBarShown((int)
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2,
getResources().getDisplayMetrics()));
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:18,代码来源:MyScheduleActivity.java
示例7: run
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
@Override
public void run() {
MyScheduleActivity activity = weakRefToParent.get();
if (activity == null || activity.hasBeenDestroyed()) {
LOGD(TAG, "Ativity is not valid anymore. Stopping UI Updater");
return;
}
LOGD(TAG, "Running MySchedule UI updater (now=" +
new Date(UIUtils.getCurrentTime(activity)) + ")");
if (activity.mScheduleAdapters != null
&& activity.mScheduleAdapters.length > today
&& activity.mScheduleAdapters[today] != null) {
try {
activity.mScheduleAdapters[today].forceUpdate();
} finally {
// schedule again
this.scheduleNextRun();
}
}
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:21,代码来源:MyScheduleActivity.java
示例8: MyScheduleAdapter
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
public MyScheduleAdapter(Context context, LUtils lUtils) {
mContext = context;
mLUtils = lUtils;
Resources resources = context.getResources();
mHourColorDefault = resources.getColor(R.color.my_schedule_hour_header_default);
mHourColorPast = resources.getColor(R.color.my_schedule_hour_header_finished);
mTitleColorDefault = resources.getColor(R.color.my_schedule_session_title_default);
mTitleColorPast = resources.getColor(R.color.my_schedule_session_title_finished);
mIconColorDefault = resources.getColor(R.color.my_schedule_icon_default);
mIconColorPast = resources.getColor(R.color.my_schedule_icon_finished);
mColorConflict = resources.getColor(R.color.my_schedule_conflict);
mColorBackgroundDefault = resources.getColor(android.R.color.white);
mColorBackgroundPast = resources.getColor(R.color.my_schedule_past_background);
mListSpacing = resources.getDimensionPixelOffset(R.dimen.element_spacing_normal);
TypedArray a = context.obtainStyledAttributes(new int[]{R.attr.selectableItemBackground});
mSelectableItemBackground = a.getResourceId(0, 0);
a.recycle();
mIsRtl = UIUtils.isRtl(context);
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:20,代码来源:MyScheduleAdapter.java
示例9: onResume
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
invalidateOptionsMenu();
if (Config.hasExpertsDirectoryExpired()) {
startActivity(new Intent(this, BrowseSessionsActivity.class));
finish();
}
Fragment frag = getFragmentManager().findFragmentById(R.id.experts_fragment);
if (frag != null) {
// configure expert fragment's top clearance to take our overlaid controls (Action Bar
// and spinner box) into account.
int actionBarSize = UIUtils.calculateActionBarSize(this);
int filterBarSize = getResources().getDimensionPixelSize(R.dimen.filterbar_height);
mDrawShadowFrameLayout.setShadowTopOffset(actionBarSize + filterBarSize);
((ExpertsDirectoryFragment) frag).setContentTopClearance(actionBarSize + filterBarSize
+ getResources().getDimensionPixelSize(R.dimen.explore_grid_padding));
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:21,代码来源:ExpertsDirectoryActivity.java
示例10: onResume
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
invalidateOptionsMenu();
Fragment frag = getFragmentManager().findFragmentById(R.id.videos_fragment);
if (frag != null) {
// configure video fragment's top clearance to take our overlaid controls (Action Bar
// and spinner box) into account.
int actionBarSize = UIUtils.calculateActionBarSize(this);
int filterBarSize = getResources().getDimensionPixelSize(R.dimen.filterbar_height);
mDrawShadowFrameLayout.setShadowTopOffset(actionBarSize + filterBarSize);
((VideoLibraryFragment) frag).setContentTopClearance(actionBarSize + filterBarSize
+ getResources().getDimensionPixelSize(R.dimen.explore_grid_padding));
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:17,代码来源:VideoLibraryActivity.java
示例11: onClick
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.container: {
String personId = (String) v.getTag(R.id.tag_person_id);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(getPlusUrl(personId)));
UIUtils.preferPackageForIntent(mContext, intent,
UIUtils.GOOGLE_PLUS_PACKAGE_NAME);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
mContext.startActivity(intent);
break;
}
case R.id.actions: {
mCurrentMenuPersonId = (String) v.getTag(R.id.tag_person_id);
mCurrentMenuPersonName = (String) v.getTag(R.id.tag_person_name);
mCurrentMenuPersonNote = (String) v.getTag(R.id.tag_person_note);
PopupMenu popup = new PopupMenu(mContext, v);
popup.getMenuInflater().inflate(R.menu.people_ive_met, popup.getMenu());
popup.setOnMenuItemClickListener(this);
popup.show();
break;
}
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:26,代码来源:PeopleIveMetFragment.java
示例12: onScrollChanged
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
@Override
public void onScrollChanged(int deltaX, int deltaY) {
// Reposition the header bar -- it's normally anchored to the top of the content,
// but locks to the top of the screen on scroll
int scrollY = mScrollView.getScrollY();
float newTop = Math.max(mPhotoHeightPixels, scrollY);
mHeaderBox.setTranslationY(newTop);
mAddScheduleButton.setTranslationY(newTop + mHeaderHeightPixels
- mAddScheduleButtonHeightPixels / 2);
float gapFillProgress = 1;
if (mPhotoHeightPixels != 0) {
gapFillProgress = Math.min(Math.max(UIUtils.getProgress(scrollY,
0,
mPhotoHeightPixels), 0), 1);
}
ViewCompat.setElevation(mHeaderBox, gapFillProgress * mMaxHeaderElevation);
ViewCompat.setElevation(mAddScheduleButton, gapFillProgress * mMaxHeaderElevation
+ mFABElevation);
// Move background photo (parallax effect)
mPhotoViewContainer.setTranslationY(scrollY * 0.5f);
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:26,代码来源:SessionDetailActivity.java
示例13: updateHeaderColor
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
private void updateHeaderColor() {
mHeaderColor = 0;
for (String tag : mFilterTags) {
if (tag != null) {
TagMetadata.Tag tagObj = mTagMetadata.getTag(tag);
if (tagObj != null && Config.Tags.CATEGORY_TOPIC.equals(tagObj.getCategory())) {
mHeaderColor = tagObj.getColor();
}
}
}
findViewById(R.id.headerbar).setBackgroundColor(
mHeaderColor == 0
? getResources().getColor(R.color.theme_primary)
: mHeaderColor);
setNormalStatusBarColor(
mHeaderColor == 0
? getThemedStatusBarColor()
: UIUtils.scaleColor(mHeaderColor, 0.8f, false));
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:20,代码来源:BrowseSessionsActivity.java
示例14: onConfigurationChanged
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
boolean landscape = (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
LinearLayout spacerView = (LinearLayout) findViewById(R.id.map_detail_spacer);
spacerView.setOrientation(landscape ? LinearLayout.HORIZONTAL : LinearLayout.VERTICAL);
spacerView.setGravity(landscape ? Gravity.END : Gravity.BOTTOM);
View popupView = findViewById(R.id.map_detail_popup);
LinearLayout.LayoutParams popupLayoutParams = (LinearLayout.LayoutParams)
popupView.getLayoutParams();
popupLayoutParams.width = landscape ? 0 : ViewGroup.LayoutParams.MATCH_PARENT;
popupLayoutParams.height = landscape ? ViewGroup.LayoutParams.MATCH_PARENT : 0;
popupLayoutParams.topMargin =
getResources().getDimensionPixelSize(R.dimen.multipane_half_padding) +
(landscape ? UIUtils.calculateActionBarSize(this) : 0);
popupView.setLayoutParams(popupLayoutParams);
popupView.requestLayout();
updateMapPadding();
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:25,代码来源:MapMultiPaneActivity.java
示例15: onCreateLoader
import com.google.samples.apps.iosched.util.UIUtils; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case SessionSummaryQuery._TOKEN:
return new CursorLoader(this, Sessions.buildSessionUri(mSessionId),
SessionSummaryQuery.PROJECTION, null, null, null);
case SessionsQuery._TOKEN:
boolean futureSessions = false;
if (args != null) {
futureSessions = args.getBoolean(LOADER_SESSIONS_ARG, false);
}
final long currentTime = UIUtils.getCurrentTime(this);
String selection = Sessions.LIVESTREAM_SELECTION + " and ";
String[] selectionArgs;
if (!futureSessions) {
selection += Sessions.AT_TIME_SELECTION;
selectionArgs = Sessions.buildAtTimeSelectionArgs(currentTime);
} else {
selection += Sessions.UPCOMING_LIVE_SELECTION;
selectionArgs = Sessions.buildUpcomingSelectionArgs(currentTime);
}
return new CursorLoader(this, Sessions.CONTENT_URI, SessionsQuery.PROJECTION,
selection, selectionArgs, SessionsQuery.SORT_ORDER);
}
return null;
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:27,代码来源:SessionLivestreamActivity.java
注:本文中的com.google.samples.apps.iosched.util.UIUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论