本文整理汇总了Java中android.content.Intent.getIntArrayExtra方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getIntArrayExtra方法的具体用法?Java Intent.getIntArrayExtra怎么用?Java Intent.getIntArrayExtra使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.getIntArrayExtra方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBroadcastReceived
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onBroadcastReceived(Context context, Intent intent) {
if (DEBUG) log(getKey() + ": received broadcast: " + intent.toString());
if (intent.getAction().equals(GravityBoxSettings.ACTION_PREF_QUICKSETTINGS_CHANGED)) {
if (intent.hasExtra(GravityBoxSettings.EXTRA_RMT_MODE)) {
int[] modes = intent.getIntArrayExtra(GravityBoxSettings.EXTRA_RMT_MODE);
if (DEBUG) log(getKey() + ": onBroadcastReceived: modes=" + Arrays.toString(modes));
updateSettings(modes);
}
if (intent.hasExtra(GravityBoxSettings.EXTRA_RMT_QUICK_MODE)) {
mQuickMode = intent.getBooleanExtra(GravityBoxSettings.EXTRA_RMT_QUICK_MODE, false);
}
}
super.onBroadcastReceived(context, intent);
}
示例2: onReceive
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(final Context context, Intent intent) {
if (AppWidgetManager.ACTION_APPWIDGET_HOST_RESTORED.equals(intent.getAction())) {
final int[] oldIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS);
final int[] newIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (oldIds.length == newIds.length) {
final PendingResult asyncResult = goAsync();
new Handler(LauncherModel.getWorkerLooper())
.postAtFrontOfQueue(new Runnable() {
@Override
public void run() {
restoreAppWidgetIds(context, asyncResult, oldIds, newIds);
}
});
}
}
}
示例3: if
import android.content.Intent; //导入方法依赖的package包/类
@SuppressLint("InlinedApi")
/* package */ static AudioCapabilities getCapabilities(Intent intent) {
if (intent == null || intent.getIntExtra(AudioManager.EXTRA_AUDIO_PLUG_STATE, 0) == 0) {
return DEFAULT_AUDIO_CAPABILITIES;
}
return new AudioCapabilities(intent.getIntArrayExtra(AudioManager.EXTRA_ENCODINGS),
intent.getIntExtra(AudioManager.EXTRA_MAX_CHANNEL_COUNT, 0));
}
示例4: dispatchRequestPermissionsResult
import android.content.Intent; //导入方法依赖的package包/类
private void dispatchRequestPermissionsResult(int requestCode, Intent data) {
mHasCurrentPermissionsRequest = false;
// If the package installer crashed we may have not data - best effort.
String[] permissions = (data != null) ? data.getStringArrayExtra(
PackageManager.EXTRA_REQUEST_PERMISSIONS_NAMES) : new String[0];
final int[] grantResults = (data != null) ? data.getIntArrayExtra(
PackageManager.EXTRA_REQUEST_PERMISSIONS_RESULTS) : new int[0];
onRequestPermissionsResult(requestCode, permissions, grantResults);
}
示例5: init
import android.content.Intent; //导入方法依赖的package包/类
private void init() {
llTopMenuWindowBg = findViewById(R.id.llTopMenuWindowBg);
llTopMenuWindowBg.setOnClickListener(this);
Intent intent = getIntent();
int[] intentCodes = intent.getIntArrayExtra(INTENT_INTENTCODES);
if (intentCodes == null || intentCodes.length <= 0) {
intentCodeList = intent.getIntegerArrayListExtra(INTENT_INTENTCODES);
} else {
intentCodeList = new ArrayList<Integer>();
for (int code : intentCodes) {
intentCodeList.add(code);
}
}
String[] menuItems = intent.getStringArrayExtra(INTENT_NAMES);
if (menuItems == null || menuItems.length <= 0) {
nameList = intent.getStringArrayListExtra(INTENT_NAMES);
} else {
nameList = new ArrayList<String>(Arrays.asList(menuItems));
}
if (nameList == null || nameList.size() <= 0) {
Log.e(TAG, "init nameList == null || nameList.size() <= 0 >> finish();return;");
finish();
return;
}
adapter = new ArrayAdapter<String>(this, R.layout.top_menu_list_item, R.id.tvTopMenuListItem, nameList);
lvTopMenu = (ListView) findViewById(R.id.lvTopMenuWindowMenu);
lvTopMenu.setAdapter(adapter);
lvTopMenu.setOnItemClickListener(this);
}
示例6: dispatchRequestPermissionsResultToFragment
import android.content.Intent; //导入方法依赖的package包/类
private void dispatchRequestPermissionsResultToFragment(int requestCode, Intent data,
Fragment fragment) {
// If the package installer crashed we may have not data - best effort.
String[] permissions = (data != null) ? data.getStringArrayExtra(
PackageManager.EXTRA_REQUEST_PERMISSIONS_NAMES) : new String[0];
final int[] grantResults = (data != null) ? data.getIntArrayExtra(
PackageManager.EXTRA_REQUEST_PERMISSIONS_RESULTS) : new int[0];
fragment.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
示例7: onActivityResult
import android.content.Intent; //导入方法依赖的package包/类
/**
* This is the callback for the important domain dialog. We should only clear if we get the
* positive button response.
*/
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == IMPORTANT_SITES_DIALOG_CODE && resultCode == Activity.RESULT_OK) {
// Deselected means that the user is excluding the domain from being cleared.
String[] deselectedDomains = data.getStringArrayExtra(
ConfirmImportantSitesDialogFragment.DESELECTED_DOMAINS_TAG);
int[] deselectedDomainReasons = data.getIntArrayExtra(
ConfirmImportantSitesDialogFragment.DESELECTED_DOMAIN_REASONS_TAG);
String[] ignoredDomains = data.getStringArrayExtra(
ConfirmImportantSitesDialogFragment.IGNORED_DOMAINS_TAG);
int[] ignoredDomainReasons = data.getIntArrayExtra(
ConfirmImportantSitesDialogFragment.IGNORED_DOMAIN_REASONS_TAG);
if (deselectedDomains != null && mSortedImportantDomains != null) {
// mMaxImportantSites is a constant on the C++ side.
RecordHistogram.recordCustomCountHistogram(
"History.ClearBrowsingData.ImportantDeselectedNum",
deselectedDomains.length, 1, mMaxImportantSites + 1,
mMaxImportantSites + 1);
RecordHistogram.recordCustomCountHistogram(
"History.ClearBrowsingData.ImportantIgnoredNum", ignoredDomains.length, 1,
mMaxImportantSites + 1, mMaxImportantSites + 1);
// We put our max at 20 instead of 100 to reduce the number of empty buckets (as
// our maximum denominator is 5).
RecordHistogram.recordEnumeratedHistogram(
"History.ClearBrowsingData.ImportantDeselectedPercent",
deselectedDomains.length * IMPORTANT_SITES_PERCENTAGE_BUCKET_COUNT
/ mSortedImportantDomains.length,
IMPORTANT_SITES_PERCENTAGE_BUCKET_COUNT + 1);
RecordHistogram.recordEnumeratedHistogram(
"History.ClearBrowsingData.ImportantIgnoredPercent",
ignoredDomains.length * IMPORTANT_SITES_PERCENTAGE_BUCKET_COUNT
/ mSortedImportantDomains.length,
IMPORTANT_SITES_PERCENTAGE_BUCKET_COUNT + 1);
}
clearBrowsingData(getSelectedOptions(), deselectedDomains, deselectedDomainReasons,
ignoredDomains, ignoredDomainReasons);
}
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:43,代码来源:ClearBrowsingDataPreferences.java
示例8: onReceive
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (AppWidgetManager.ACTION_APPWIDGET_HOST_RESTORED.equals(intent.getAction())) {
int[] oldIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_OLD_IDS);
int[] newIds = intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS);
if (oldIds.length == newIds.length) {
restoreAppWidgetIds(context, oldIds, newIds);
} else {
Log.e(TAG, "Invalid host restored received");
}
}
}
示例9: safeGetIntArrayExtra
import android.content.Intent; //导入方法依赖的package包/类
/**
* Just like {@link Intent#getIntArrayExtra(String)} but doesn't throw exceptions.
*/
public static int[] safeGetIntArrayExtra(Intent intent, String name) {
try {
return intent.getIntArrayExtra(name);
} catch (Throwable t) {
// Catches un-parceling exceptions.
Log.e(TAG, "getIntArrayExtra failed on intent " + intent);
return null;
}
}
示例10: onHandleIntent
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(final Intent intent) {
SharedPreferences prefs = getSharedPreferences("HueNotifier", MODE_PRIVATE);
if (!prefs.contains("bridge_ip") || !prefs.contains("username")) {
if (BuildConfig.DEBUG)
Logger.log(
"ColorFlashService started but no bridge connection information found");
stopSelf();
} else {
if (intent != null && intent.hasExtra("colors") && intent.hasExtra("lights")) {
api = APIHelper.getAPI(prefs);
int[] colors = intent.getIntArrayExtra("colors");
int[] lights = intent.getIntArrayExtra("lights");
final boolean flashOnlyIfLightsOn = intent.hasExtra("flashOnlyIfLightsOn") ? intent
.getBooleanExtra("flashOnlyIfLightsOn", false) : PreferenceManager
.getDefaultSharedPreferences(
this).getBoolean("flashOnlyIfLightsOn", false);
int size = Math.min(colors.length, lights.length);
for (int i = 0; i < size; i++) {
if (BuildConfig.DEBUG)
Logger.log("doColorFlash for " + lights[i]);
final int light = lights[i], color = colors[i];
new Thread(new Runnable() {
@Override
public void run() {
doColorFlash(color, light, flashOnlyIfLightsOn);
}
}).start();
}
} else if (BuildConfig.DEBUG) {
Logger.log(
"ColorFlashService started but intent does not have necessary information");
}
}
}
示例11: processOptions
import android.content.Intent; //导入方法依赖的package包/类
/**
* This method extracts {@link com.yalantis.ucrop.UCrop.Options #optionsBundle} from incoming intent
* and setups Activity, {@link OverlayView} and {@link CropImageView} properly.
*/
@SuppressWarnings("deprecation")
private void processOptions(@NonNull Intent intent) {
// Bitmap compression options
String compressionFormatName = intent.getStringExtra(UCrop.Options.EXTRA_COMPRESSION_FORMAT_NAME);
Bitmap.CompressFormat compressFormat = null;
if (!TextUtils.isEmpty(compressionFormatName)) {
compressFormat = Bitmap.CompressFormat.valueOf(compressionFormatName);
}
mCompressFormat = (compressFormat == null) ? DEFAULT_COMPRESS_FORMAT : compressFormat;
mCompressQuality = intent.getIntExtra(UCrop.Options.EXTRA_COMPRESSION_QUALITY, UCropActivity.DEFAULT_COMPRESS_QUALITY);
// Gestures options
int[] allowedGestures = intent.getIntArrayExtra(UCrop.Options.EXTRA_ALLOWED_GESTURES);
if (allowedGestures != null && allowedGestures.length == TABS_COUNT) {
mAllowedGestures = allowedGestures;
}
// Crop image view options
mGestureCropImageView.setMaxBitmapSize(intent.getIntExtra(UCrop.Options.EXTRA_MAX_BITMAP_SIZE, CropImageView.DEFAULT_MAX_BITMAP_SIZE));
mGestureCropImageView.setMaxScaleMultiplier(intent.getFloatExtra(UCrop.Options.EXTRA_MAX_SCALE_MULTIPLIER, CropImageView.DEFAULT_MAX_SCALE_MULTIPLIER));
mGestureCropImageView.setImageToWrapCropBoundsAnimDuration(intent.getIntExtra(UCrop.Options.EXTRA_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION, CropImageView.DEFAULT_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION));
// Overlay view options
mOverlayView.setDimmedColor(intent.getIntExtra(UCrop.Options.EXTRA_DIMMED_LAYER_COLOR, getResources().getColor(R.color.ucrop_color_default_dimmed)));
mOverlayView.setOvalDimmedLayer(intent.getBooleanExtra(UCrop.Options.EXTRA_OVAL_DIMMED_LAYER, OverlayView.DEFAULT_OVAL_DIMMED_LAYER));
mOverlayView.setShowCropFrame(intent.getBooleanExtra(UCrop.Options.EXTRA_SHOW_CROP_FRAME, OverlayView.DEFAULT_SHOW_CROP_FRAME));
mOverlayView.setCropFrameColor(intent.getIntExtra(UCrop.Options.EXTRA_CROP_FRAME_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_frame)));
mOverlayView.setCropFrameStrokeWidth(intent.getIntExtra(UCrop.Options.EXTRA_CROP_FRAME_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_frame_stoke_width)));
mOverlayView.setShowCropGrid(intent.getBooleanExtra(UCrop.Options.EXTRA_SHOW_CROP_GRID, OverlayView.DEFAULT_SHOW_CROP_GRID));
mOverlayView.setCropGridRowCount(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_ROW_COUNT, OverlayView.DEFAULT_CROP_GRID_ROW_COUNT));
mOverlayView.setCropGridColumnCount(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_COLUMN_COUNT, OverlayView.DEFAULT_CROP_GRID_COLUMN_COUNT));
mOverlayView.setCropGridColor(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_grid)));
mOverlayView.setCropGridStrokeWidth(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_grid_stoke_width)));
}
示例12: processOptions
import android.content.Intent; //导入方法依赖的package包/类
private void processOptions(@NonNull Intent intent) {
String compressionFormatName = intent.getStringExtra(Options.EXTRA_COMPRESSION_FORMAT_NAME);
CompressFormat compressFormat = null;
if (!TextUtils.isEmpty(compressionFormatName)) {
compressFormat = CompressFormat.valueOf(compressionFormatName);
}
if (compressFormat == null) {
compressFormat = DEFAULT_COMPRESS_FORMAT;
}
this.mCompressFormat = compressFormat;
this.mCompressQuality = intent.getIntExtra(Options.EXTRA_COMPRESSION_QUALITY, 90);
int[] allowedGestures = intent.getIntArrayExtra(Options.EXTRA_ALLOWED_GESTURES);
if (allowedGestures != null && allowedGestures.length == 3) {
this.mAllowedGestures = allowedGestures;
}
this.mGestureCropImageView.setMaxBitmapSize(intent.getIntExtra(Options
.EXTRA_MAX_BITMAP_SIZE, 0));
this.mGestureCropImageView.setMaxScaleMultiplier(intent.getFloatExtra(Options
.EXTRA_MAX_SCALE_MULTIPLIER, 10.0f));
this.mGestureCropImageView.setImageToWrapCropBoundsAnimDuration((long) intent.getIntExtra
(Options.EXTRA_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION, 500));
this.mOverlayView.setDimmedColor(intent.getIntExtra(Options.EXTRA_DIMMED_LAYER_COLOR,
getResources().getColor(R.color.ucrop_color_default_dimmed)));
this.mOverlayView.setOvalDimmedLayer(intent.getBooleanExtra(Options
.EXTRA_OVAL_DIMMED_LAYER, false));
this.mOverlayView.setShowCropFrame(intent.getBooleanExtra(Options.EXTRA_SHOW_CROP_FRAME,
true));
this.mOverlayView.setCropFrameColor(intent.getIntExtra(Options.EXTRA_CROP_FRAME_COLOR,
getResources().getColor(R.color.ucrop_color_default_crop_frame)));
this.mOverlayView.setCropFrameStrokeWidth(intent.getIntExtra(Options
.EXTRA_CROP_FRAME_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen
.ucrop_default_crop_frame_stoke_width)));
this.mOverlayView.setShowCropGrid(intent.getBooleanExtra(Options.EXTRA_SHOW_CROP_GRID,
true));
this.mOverlayView.setCropGridRowCount(intent.getIntExtra(Options
.EXTRA_CROP_GRID_ROW_COUNT, 2));
this.mOverlayView.setCropGridColumnCount(intent.getIntExtra(Options
.EXTRA_CROP_GRID_COLUMN_COUNT, 2));
this.mOverlayView.setCropGridColor(intent.getIntExtra(Options.EXTRA_CROP_GRID_COLOR,
getResources().getColor(R.color.ucrop_color_default_crop_grid)));
this.mOverlayView.setCropGridStrokeWidth(intent.getIntExtra(Options
.EXTRA_CROP_GRID_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen
.ucrop_default_crop_grid_stoke_width)));
}