Java Code Examples for org.chromium.chrome.browser.util.IntentUtils#safeGetLongExtra()
The following examples show how to use
org.chromium.chrome.browser.util.IntentUtils#safeGetLongExtra() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebappInfo.java From delion with Apache License 2.0 | 6 votes |
/** * Construct a WebappInfo. * @param intent Intent containing info about the app. */ public static WebappInfo create(Intent intent) { String id = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_ID); String icon = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_ICON); String url = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_URL); int displayMode = displayModeFromIntent(intent); int orientation = orientationFromIntent(intent); int source = IntentUtils.safeGetIntExtra(intent, ShortcutHelper.EXTRA_SOURCE, ShortcutSource.UNKNOWN); long themeColor = IntentUtils.safeGetLongExtra(intent, ShortcutHelper.EXTRA_THEME_COLOR, ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING); long backgroundColor = IntentUtils.safeGetLongExtra(intent, ShortcutHelper.EXTRA_BACKGROUND_COLOR, ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING); boolean isIconGenerated = IntentUtils.safeGetBooleanExtra(intent, ShortcutHelper.EXTRA_IS_ICON_GENERATED, false); String name = nameFromIntent(intent); String shortName = shortNameFromIntent(intent); String webApkPackageName = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_WEBAPK_PACKAGE_NAME); return create(id, url, icon, name, shortName, displayMode, orientation, source, themeColor, backgroundColor, isIconGenerated, webApkPackageName); }
Example 2
Source File: WebappInfo.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Construct a WebappInfo. * @param intent Intent containing info about the app. */ public static WebappInfo create(Intent intent) { String id = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_ID); String icon = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_ICON); String url = urlFromIntent(intent); String scope = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_SCOPE); int displayMode = IntentUtils.safeGetIntExtra( intent, ShortcutHelper.EXTRA_DISPLAY_MODE, WebDisplayMode.Standalone); int orientation = IntentUtils.safeGetIntExtra( intent, ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValues.DEFAULT); int source = sourceFromIntent(intent); long themeColor = IntentUtils.safeGetLongExtra(intent, ShortcutHelper.EXTRA_THEME_COLOR, ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING); long backgroundColor = IntentUtils.safeGetLongExtra(intent, ShortcutHelper.EXTRA_BACKGROUND_COLOR, ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING); boolean isIconGenerated = IntentUtils.safeGetBooleanExtra(intent, ShortcutHelper.EXTRA_IS_ICON_GENERATED, false); String name = nameFromIntent(intent); String shortName = shortNameFromIntent(intent); return create(id, url, scope, icon, name, shortName, displayMode, orientation, source, themeColor, backgroundColor, isIconGenerated); }
Example 3
Source File: WebappInfo.java From 365browser with Apache License 2.0 | 6 votes |
/** * Construct a WebappInfo. * @param intent Intent containing info about the app. */ public static WebappInfo create(Intent intent) { String id = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_ID); String icon = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_ICON); String url = urlFromIntent(intent); String scope = IntentUtils.safeGetStringExtra(intent, ShortcutHelper.EXTRA_SCOPE); int displayMode = IntentUtils.safeGetIntExtra( intent, ShortcutHelper.EXTRA_DISPLAY_MODE, WebDisplayMode.STANDALONE); int orientation = IntentUtils.safeGetIntExtra( intent, ShortcutHelper.EXTRA_ORIENTATION, ScreenOrientationValues.DEFAULT); int source = sourceFromIntent(intent); long themeColor = IntentUtils.safeGetLongExtra(intent, ShortcutHelper.EXTRA_THEME_COLOR, ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING); long backgroundColor = IntentUtils.safeGetLongExtra(intent, ShortcutHelper.EXTRA_BACKGROUND_COLOR, ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING); boolean isIconGenerated = IntentUtils.safeGetBooleanExtra(intent, ShortcutHelper.EXTRA_IS_ICON_GENERATED, false); String name = nameFromIntent(intent); String shortName = shortNameFromIntent(intent); return create(id, url, scope, new Icon(icon), name, shortName, displayMode, orientation, source, themeColor, backgroundColor, isIconGenerated); }
Example 4
Source File: InstantAppsHandler.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * In the case where Chrome is called through the fallback mechanism from Instant Apps, * record the amount of time the whole trip took and which UI took the user back to Chrome, * if any. * @param intent The current intent. */ private void maybeRecordFallbackStats(Intent intent) { Long startTime = IntentUtils.safeGetLongExtra(intent, INSTANT_APP_START_TIME_EXTRA, 0); if (startTime > 0) { sFallbackIntentTimes.record(SystemClock.elapsedRealtime() - startTime); intent.removeExtra(INSTANT_APP_START_TIME_EXTRA); } int callSource = IntentUtils.safeGetIntExtra(intent, BROWSER_LAUNCH_REASON, 0); if (callSource > 0 && callSource < SOURCE_BOUNDARY) { sFallbackCallSource.record(callSource); intent.removeExtra(BROWSER_LAUNCH_REASON); } else if (callSource >= SOURCE_BOUNDARY) { Log.e(TAG, "Unexpected call source constant for Instant Apps: " + callSource); } }
Example 5
Source File: InstantAppsHandler.java From 365browser with Apache License 2.0 | 5 votes |
/** * In the case where Chrome is called through the fallback mechanism from Instant Apps, * record the amount of time the whole trip took and which UI took the user back to Chrome, * if any. * @param intent The current intent. */ private void maybeRecordFallbackStats(Intent intent) { Long startTime = IntentUtils.safeGetLongExtra(intent, INSTANT_APP_START_TIME_EXTRA, 0); if (startTime > 0) { sFallbackIntentTimes.record(SystemClock.elapsedRealtime() - startTime); intent.removeExtra(INSTANT_APP_START_TIME_EXTRA); } int callSource = IntentUtils.safeGetIntExtra(intent, BROWSER_LAUNCH_REASON, 0); if (callSource > 0 && callSource < SOURCE_BOUNDARY) { sFallbackCallSource.record(callSource); intent.removeExtra(BROWSER_LAUNCH_REASON); } else if (callSource >= SOURCE_BOUNDARY) { Log.e(TAG, "Unexpected call source constant for Instant Apps: " + callSource); } }