本文整理汇总了Java中com.google.samples.apps.iosched.Config类的典型用法代码示例。如果您正苦于以下问题:Java Config类的具体用法?Java Config怎么用?Java Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Config类属于com.google.samples.apps.iosched包,在下文中一共展示了Config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: tryTranslateHttpIntent
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
/**
* If an activity's intent is for a Google I/O web URL that the app can handle
* natively, this method translates the intent to the equivalent native intent.
*/
public static void tryTranslateHttpIntent(Activity activity) {
Intent intent = activity.getIntent();
if (intent == null) {
return;
}
Uri uri = intent.getData();
if (uri == null || TextUtils.isEmpty(uri.getPath())) {
return;
}
Uri sessionDetailWebUrlPrefix = Uri.parse(Config.SESSION_DETAIL_WEB_URL_PREFIX);
String prefixPath = sessionDetailWebUrlPrefix.getPath();
String path = uri.getPath();
if (sessionDetailWebUrlPrefix.getScheme().equals(uri.getScheme()) &&
sessionDetailWebUrlPrefix.getHost().equals(uri.getHost()) &&
path.startsWith(prefixPath)) {
String sessionId = path.substring(prefixPath.length());
activity.setIntent(new Intent(
Intent.ACTION_VIEW,
ScheduleContract.Sessions.buildSessionUri(sessionId)));
}
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:29,代码来源:UIUtils.java
示例2: onPostCreate
import com.google.samples.apps.iosched.Config; //导入依赖的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
示例3: computeTypeOrder
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
private int computeTypeOrder(Session session) {
int order = Integer.MAX_VALUE;
int keynoteOrder = -1;
if (mTagMap == null) {
throw new IllegalStateException("Attempt to compute type order without tag map.");
}
for (String tagId : session.tags) {
if (Config.Tags.SPECIAL_KEYNOTE.equals(tagId)) {
return keynoteOrder;
}
Tag tag = mTagMap.get(tagId);
if (tag != null && Config.Tags.SESSION_GROUPING_TAG_CATEGORY.equals(tag.category)) {
if (tag.order_in_category < order) {
order = tag.order_in_category;
}
}
}
return order;
}
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:20,代码来源:SessionsHandler.java
示例4: onResume
import com.google.samples.apps.iosched.Config; //导入依赖的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
示例5: onPostCreate
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
if (mViewPager != null) {
long now = UIUtils.getCurrentTime(this);
for (int i = 0; i < Config.CONFERENCE_DAYS.length; i++) {
if (now >= Config.CONFERENCE_DAYS[i][0] && now <= Config.CONFERENCE_DAYS[i][1]) {
mViewPager.setCurrentItem(i);
setTimerToUpdateUI(i);
break;
}
}
}
setProgressBarTopWhenActionBarShown((int)
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2,
getResources().getDisplayMetrics()));
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:18,代码来源:MyScheduleActivity.java
示例6: getItemViewType
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
@Override
public int getItemViewType(int position) {
if (position < 0 || position >= mItems.size()) {
LOGE(TAG, "Invalid view position passed to MyScheduleAdapter: " + position);
return VIEW_TYPE_NORMAL;
}
ScheduleItem item = mItems.get(position);
long now = UIUtils.getCurrentTime(mContext);
if (item.startTime <= now && now <= item.endTime && item.type == ScheduleItem.SESSION) {
return VIEW_TYPE_NOW;
} else if (item.endTime <= now && now < Config.CONFERENCE_END_MILLIS) {
return VIEW_TYPE_PAST_DURING_CONFERENCE;
} else {
return VIEW_TYPE_NORMAL;
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:17,代码来源:MyScheduleAdapter.java
示例7: launchIoHunt
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
private void launchIoHunt() {
if (!TextUtils.isEmpty(Config.IO_HUNT_PACKAGE_NAME)) {
LOGD(TAG, "Attempting to launch I/O hunt.");
PackageManager pm = getPackageManager();
Intent launchIntent = pm.getLaunchIntentForPackage(Config.IO_HUNT_PACKAGE_NAME);
if (launchIntent != null) {
// start I/O Hunt
LOGD(TAG, "I/O hunt intent found, launching.");
startActivity(launchIntent);
} else {
// send user to the Play Store to download it
LOGD(TAG, "I/O hunt intent NOT found, going to Play Store.");
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(
Config.PLAY_STORE_URL_PREFIX + Config.IO_HUNT_PACKAGE_NAME));
startActivity(intent);
}
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:19,代码来源:BaseActivity.java
示例8: updateHeaderColor
import com.google.samples.apps.iosched.Config; //导入依赖的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
示例9: showSecondaryFilters
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
private void showSecondaryFilters() {
showFilterBox(false);
// repopulate secondary filter spinners
if (!TextUtils.isEmpty(mFilterTags[0])) {
TagMetadata.Tag topTag = mTagMetadata.getTag(mFilterTags[0]);
String topCategory = topTag.getCategory();
if (topCategory.equals(Config.Tags.EXPLORE_CATEGORIES[0])) {
populateSecondLevelFilterSpinner(0, 1);
populateSecondLevelFilterSpinner(1, 2);
} else if (topCategory.equals(Config.Tags.EXPLORE_CATEGORIES[1])) {
populateSecondLevelFilterSpinner(0, 0);
populateSecondLevelFilterSpinner(1, 2);
} else {
populateSecondLevelFilterSpinner(0, 0);
populateSecondLevelFilterSpinner(1, 1);
}
showFilterBox(true);
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:21,代码来源:BrowseSessionsActivity.java
示例10: reloadFromIntent
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
/**
* Reloads all data in the activity and fragments from a given intent
* @param intent The intent to load from
*/
private void reloadFromIntent(Intent intent) {
final String youtubeUrl = intent.getStringExtra(EXTRA_YOUTUBE_URL);
// Check if youtube url is set as an extra first
if (youtubeUrl != null) {
mLoadFromExtras = true;
String actionBarTitle = getString(R.string.session_livestream_title);
getActionBar().setTitle(actionBarTitle);
updateSessionViews(youtubeUrl,
intent.getStringExtra(EXTRA_TITLE),
intent.getStringExtra(EXTRA_ABSTRACT),
Config.CONFERENCE_HASHTAG,
intent.getStringExtra(EXTRA_CAPTIONS));
} else {
// Otherwise load from session uri
reloadFromUri(intent.getData());
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:22,代码来源:SessionLivestreamActivity.java
示例11: updateViews
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
public void updateViews(String captionsUrl) {
mLocalCaptionsUrl = captionsUrl;
if (mWebView != null && !TextUtils.isEmpty(captionsUrl)) {
if (mDarkTheme) {
mWebView.setBackgroundColor(Color.BLACK);
mContainer.setBackgroundColor(Color.BLACK);
mNoCaptionsTextView.setTextColor(Color.WHITE);
} else {
mWebView.setBackgroundColor(Color.WHITE);
}
String finalCaptionsUrl = captionsUrl;
if (finalCaptionsUrl != null) {
if (mDarkTheme) {
finalCaptionsUrl += Config.LIVESTREAM_CAPTIONS_DARK_THEME_URL_PARAM;
}
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl(finalCaptionsUrl);
mNoCaptionsTextView.setVisibility(View.GONE);
mWebView.setVisibility(View.VISIBLE);
} else {
showNoCaptionsAvailable();
}
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:27,代码来源:SessionLivestreamActivity.java
示例12: shouldBypassWiFiSetup
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
/**
* Helper method to decide whether to bypass conference WiFi setup. Return true if
* WiFi AP is already configured (WiFi adapter enabled) or WiFi configuration is complete
* as per shared preference.
*/
public static boolean shouldBypassWiFiSetup(final Context context) {
final WifiManager wifiManager =
(WifiManager) context.getSystemService(Context.WIFI_SERVICE);
// Is WiFi on?
if (wifiManager.isWifiEnabled()) {
// Check for existing APs.
final List<WifiConfiguration> configs = wifiManager.getConfiguredNetworks();
final String conferenceSSID = String.format("\"%s\"", Config.WIFI_SSID);
for(WifiConfiguration config : configs) {
if (conferenceSSID.equalsIgnoreCase(config.SSID)) return true;
}
}
return WIFI_CONFIG_DONE.equals(getWiFiConfigStatus(context));
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:22,代码来源:WiFiUtils.java
示例13: tryTranslateHttpIntent
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
/**
* If an activity's intent is for a Google I/O web URL that the app can handle
* natively, this method translates the intent to the equivalent native intent.
*/
public static void tryTranslateHttpIntent(Activity activity) {
Intent intent = activity.getIntent();
if (intent == null) {
return;
}
Uri uri = intent.getData();
if (uri == null || TextUtils.isEmpty(uri.getPath())) {
return;
}
String prefixPath = Config.SESSION_DETAIL_WEB_URL_PREFIX.getPath();
String path = uri.getPath();
if (Config.SESSION_DETAIL_WEB_URL_PREFIX.getScheme().equals(uri.getScheme()) &&
Config.SESSION_DETAIL_WEB_URL_PREFIX.getHost().equals(uri.getHost()) &&
path.startsWith(prefixPath)) {
String sessionId = path.substring(prefixPath.length());
activity.setIntent(new Intent(
Intent.ACTION_VIEW,
ScheduleContract.Sessions.buildSessionUri(sessionId)));
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:28,代码来源:UIUtils.java
示例14: getManifestUrl
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
/**
* Returns the remote manifest file's URL. This is stored as a resource in the app,
* but can be overriden by a file in the filesystem for debug purposes.
* @return The URL of the remote manifest file.
*/
private String getManifestUrl() {
String manifestUrl = Config.MANIFEST_URL;
// check for an override file
File urlOverrideFile = new File(mContext.getFilesDir(), URL_OVERRIDE_FILE_NAME);
if (urlOverrideFile.exists()) {
try {
String overrideUrl = FileUtils.readFileAsString(urlOverrideFile).trim();
LOGW(TAG, "Debug URL override active: " + overrideUrl);
return overrideUrl;
} catch (IOException ex) {
return manifestUrl;
}
} else {
return manifestUrl;
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:24,代码来源:RemoteConferenceDataFetcher.java
示例15: unregister
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
/**
* Unregister this account/device pair within the server.
*
* @param context Current context
* @param gcmId The GCM registration ID for this device
*/
static void unregister(final Context context, final String gcmId) {
if (!checkGcmEnabled()) {
return;
}
LOGI(TAG, "unregistering device (gcmId = " + gcmId + ")");
String serverUrl = Config.GCM_SERVER_URL + "/unregister";
Map<String, String> params = new HashMap<String, String>();
params.put("gcm_id", gcmId);
try {
post(serverUrl, params, Config.GCM_API_KEY);
setRegisteredOnServer(context, false, gcmId, null);
} catch (IOException e) {
// At this point the device is unregistered from GCM, but still
// registered in the server.
// We could try to unregister again, but it is not necessary:
// if the server tries to send a message to the device, it will get
// a "NotRegistered" error message and should unregister the device.
LOGD(TAG, "Unable to unregister from application server", e);
} finally {
// Regardless of server success, clear local preferences
setRegisteredOnServer(context, false, null, null);
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:31,代码来源:ServerUtilities.java
示例16: notifyUserDataChanged
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
/**
* Request user data sync.
*
* @param context Current context
*/
public static void notifyUserDataChanged(final Context context) {
if (!checkGcmEnabled()) {
return;
}
LOGI(TAG, "Notifying GCM that user data changed");
String serverUrl = Config.GCM_SERVER_URL + "/send/self/sync_user";
try {
String gcmKey = AccountUtils.getGcmKey(context, AccountUtils.getActiveAccountName(context));
if (gcmKey != null) {
post(serverUrl, new HashMap<String, String>(), gcmKey);
}
} catch (IOException e) {
LOGE(TAG, "Unable to notify GCM about user data change", e);
}
}
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:22,代码来源:ServerUtilities.java
示例17: getActionForTitle
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
private Action getActionForTitle(String title) {
Uri sessionUri = ((SessionDetailActivity) getActivity()).getSessionUri();
String uuid = sessionUri.toString().substring(sessionUri.toString().lastIndexOf("/") + 1);
Uri uri = new Uri.Builder()
.scheme(Config.HTTPS)
.authority(BuildConfig.PRODUCTION_WEBSITE_HOST_NAME)
.path(BuildConfig.WEB_URL_SCHEDULE_PATH)
.appendQueryParameter(Config.SESSION_ID_URL_QUERY_KEY, uuid)
.build();
// Build a schema.org Thing that represents the session details currently displayed. Its
// name is the session's title, and its URL is a deep link back to this
// SessionDetailFragment.
Thing session = new Thing.Builder()
.setName(title)
.setUrl(uri)
.build();
// Build a schema.org Action that represents a user viewing this session screen. This Action
// is then ready to be passed to the App Indexing API. Read more about the API here:
// https://developers.google.com/app-indexing/introduction#android.
return new Action.Builder(Action.TYPE_VIEW)
.setObject(session)
.build();
}
开发者ID:google,项目名称:iosched,代码行数:24,代码来源:SessionDetailFragment.java
示例18: updateData
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
/**
* This updates the data, by calling {@link ScheduleFetcher#getScheduleDataAsync
* (LoadScheduleDataListener, long, long)} for each day. It is protected and not private, to
* allow us to extend this class and use mock data in UI tests (refer {@code
* StubMyScheduleModel} in {@code androidTest}).
*/
protected void updateData(final DataQueryCallback<MyScheduleQueryEnum> callback) {
for (int i = 0; i < Config.CONFERENCE_DAYS.length; i++) {
/**
* The key in {@link #mScheduleData} is 1 for the first day, 2 for the second etc
*/
final int dayId = i + 1;
// Immediately use cached data if available
if (callback != null && mScheduleData.indexOfKey(dayId) >= 0) {
callback.onModelUpdated(this, MyScheduleQueryEnum.SCHEDULE);
}
// Update cached data
mScheduleHelper.getScheduleDataAsync(new LoadScheduleDataListener() {
@Override
public void onDataLoaded(ArrayList<ScheduleItem> scheduleItems) {
updateCache(dayId, scheduleItems, callback);
}
}, Config.CONFERENCE_DAYS[i][0], Config.CONFERENCE_DAYS[i][1], mTagFilterHolder);
}
}
开发者ID:google,项目名称:iosched,代码行数:28,代码来源:ScheduleModel.java
示例19: formatSessionSubtitle
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
/**
* Format and return the given session time and {@link Rooms} values using {@link
* Config#CONFERENCE_TIMEZONE}.
*/
public static String formatSessionSubtitle(long intervalStart, long intervalEnd,
String roomName, StringBuilder recycle, Context context) {
// Determine if the session is in the past
long currentTimeMillis = TimeUtils.getCurrentTime(context);
boolean conferenceEnded = currentTimeMillis > Config.CONFERENCE_END_MILLIS;
boolean sessionEnded = currentTimeMillis > intervalEnd;
if (sessionEnded && !conferenceEnded) {
return context.getString(R.string.session_finished);
}
if (roomName == null) {
roomName = context.getString(R.string.unknown_room);
}
String timeInterval = formatIntervalTimeString(intervalStart, intervalEnd, recycle,
context);
return timeInterval + "\n" + roomName;
}
开发者ID:google,项目名称:iosched,代码行数:23,代码来源:UIUtils.java
示例20: tryTranslateHttpIntent
import com.google.samples.apps.iosched.Config; //导入依赖的package包/类
/**
* If an activity's intent is for a Google I/O web URL that the app can handle natively, this
* method translates the intent to the equivalent native intent.
*/
public static void tryTranslateHttpIntent(Activity activity) {
Intent intent = activity.getIntent();
if (intent == null) {
return;
}
Uri uri = intent.getData();
if (uri == null || TextUtils.isEmpty(uri.getPath())) {
return;
}
Uri sessionDetailWebUrlPrefix = Uri.parse(Config.SESSION_DETAIL_WEB_URL_PREFIX);
String prefixPath = sessionDetailWebUrlPrefix.getPath();
String path = uri.getPath();
if (sessionDetailWebUrlPrefix.getScheme().equals(uri.getScheme()) &&
sessionDetailWebUrlPrefix.getHost().equals(uri.getHost()) &&
path.startsWith(prefixPath) &&
uri.getQueryParameter(Config.SESSION_ID_URL_QUERY_KEY) != null) {
String sessionId = uri.getQueryParameter(Config.SESSION_ID_URL_QUERY_KEY);
activity.setIntent(new Intent(
Intent.ACTION_VIEW,
ScheduleContract.Sessions.buildSessionUri(sessionId)));
}
}
开发者ID:google,项目名称:iosched,代码行数:30,代码来源:UIUtils.java
注:本文中的com.google.samples.apps.iosched.Config类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论