本文整理汇总了Java中android.os.Bundle.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.getInt方法的具体用法?Java Bundle.getInt怎么用?Java Bundle.getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.os.Bundle
的用法示例。
在下文中一共展示了Bundle.getInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityCreated
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (savedInstanceState != null) {
final int seriesCount = savedInstanceState.getInt("seriesCount");
for (int i = 0; i < seriesCount; i++) {
final int seriesColor = savedInstanceState.getInt("seriesColor" + i);
final int areaColor = savedInstanceState.getInt("areaColor" + i);
final ISciList<Double> xValues = savedInstanceState.getParcelable("xValues" + i);
final ISciList<Double> yValues = savedInstanceState.getParcelable("yValues" + i);
final IXyDataSeries<Double, Double> series = new XyDataSeries<>(Double.class, Double.class);
series.append(xValues, yValues);
final FastMountainRenderableSeries renderableSeries = sciChartBuilder.newMountainSeries()
.withDataSeries(series)
.withAreaFillColor(areaColor)
.withStrokeStyle(seriesColor)
.build();
surface.getRenderableSeries().add(renderableSeries);
}
}
}
示例2: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = getArguments();
if (bundle != null) {
what = bundle.getInt("what", ContentType.PHOTO.ordinal());
id = bundle.getLong("id", 0);
cols = bundle.getInt("cols", 0);
}
setHasOptionsMenu(true);
DisplayMetrics metrics = getResources().getDisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
Log.d(TAG, String.valueOf(metrics.density));
Log.d(TAG, String.valueOf(metrics.widthPixels));
if (cols == 0) {
cols = 4;
}
}
示例3: onRestoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
final Bundle bundle = (Bundle) state;
mTextColor = bundle.getInt(INSTANCE_TEXT_COLOR);
mTextSize = bundle.getFloat(INSTANCE_TEXT_SIZE);
mReachedBarHeight = bundle.getFloat(INSTANCE_REACHED_BAR_HEIGHT);
mUnreachedBarHeight = bundle.getFloat(INSTANCE_UNREACHED_BAR_HEIGHT);
mReachedBarColor = bundle.getInt(INSTANCE_REACHED_BAR_COLOR);
mUnreachedBarColor = bundle.getInt(INSTANCE_UNREACHED_BAR_COLOR);
initializePainters();
setMax(bundle.getInt(INSTANCE_MAX));
setProgress(bundle.getInt(INSTANCE_PROGRESS));
setPrefix(bundle.getString(INSTANCE_PREFIX));
setSuffix(bundle.getString(INSTANCE_SUFFIX));
setProgressTextVisibility(bundle.getBoolean(INSTANCE_TEXT_VISIBILITY) ? ProgressTextVisibility.Visible : ProgressTextVisibility.Invisible);
super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATE));
return;
}
super.onRestoreInstanceState(state);
}
示例4: onEvent
import android.os.Bundle; //导入方法依赖的package包/类
public void onEvent(Context context, Event event, Bundle extras) {
if (Event.NOTIFICATION_OPENED.equals(event) || Event.NOTIFICATION_CLICK_BTN.equals(event)) {
int notifyId = extras.getInt(BOUND_KEY.pushNotifyId, 0);
if (0 != notifyId) {
NotificationManager manager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
manager.cancel(notifyId);
}
String content = "receive extented notification message: " + extras.getString(BOUND_KEY.pushMsgKey);
CordovaHuaweiPush.openNotificationId = notifyId;
CordovaHuaweiPush.openNotificationExtras = extras.getString(BOUND_KEY.pushMsgKey);
Log.w(CordovaHuaweiPush.TAG, content);
CordovaHuaweiPush.notificationOpened(CordovaHuaweiPush.openNotificationId,CordovaHuaweiPush.openNotificationExtras);
Intent launch = context.getPackageManager().getLaunchIntentForPackage(
context.getPackageName());
launch.addCategory(Intent.CATEGORY_LAUNCHER);
launch.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
context.startActivity(launch);
}
super.onEvent(context, event, extras);
}
示例5: onRestoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
/**
* If the passed in state is a Bundle, an attempt is made to restore from it.
* @param state a Parcelable containing the current state
*/
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (state.getClass() != Bundle.class) {
super.onRestoreInstanceState(state);
} else {
Bundle instanceState = (Bundle)state;
super.onRestoreInstanceState(instanceState.getParcelable(SUPER_STATE_KEY));
profileId = instanceState.getString(PROFILE_ID_KEY);
presetSizeType = instanceState.getInt(PRESET_SIZE_KEY);
isCropped = instanceState.getBoolean(IS_CROPPED_KEY);
queryWidth = instanceState.getInt(BITMAP_WIDTH_KEY);
queryHeight = instanceState.getInt(BITMAP_HEIGHT_KEY);
setImageBitmap((Bitmap)instanceState.getParcelable(BITMAP_KEY));
if (instanceState.getBoolean(PENDING_REFRESH_KEY)) {
refreshImage(true);
}
}
}
示例6: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
Bundle bundle = getActivity().getIntent().getBundleExtra(
SimpleBackActivity.BUNDLE_KEY_ARGS);
if (bundle != null) {
editData = (NotebookData) bundle.getSerializable(NOTE_KEY);
whereFrom = bundle.getInt(NOTE_FROMWHERE_KEY, QUICK_DIALOG);
}
}
示例7: onCreateView
import android.os.Bundle; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
Utils.logD(LOG_TAG, "onCreateView:" + this);
View view = inflater.inflate(R.layout.fragment_tab_map, container, false);
unbinder = ButterKnife.bind(this, view);
setUpBotomSheet();
setUpTvPhone();
setUpIvCall();
setUpIvGo();
setUpIvShare();
setUpIvFavorite();
setUpIvOpeningHours();
setUpZoomControls();
mapFragment = Utils.handleMapFragmentRecreation(getChildFragmentManager(),
R.id.mapFragmentContainer, "mapFragment");
mapFragment.getMapAsync(this);
mMapFragment = mapFragment;
if (savedInstanceState != null) {
mRotation = true;
mLastMarkerClicked = savedInstanceState.getParcelable(LAST_MARKER_KEY);
mPresenter.onSetLastMarkerClick(mLastMarkerClicked);
mBottomSheetState = savedInstanceState.getInt(BOTTOM_SHEET_STATE);
}
markerBitmap = Utils.getBitmapFromVectorDrawable(getActivity().getApplicationContext(), R.drawable.hospital_pin_stroke);
mPresenter.onSetMarkerBitMap(markerBitmap);
return view;
}
示例8: onRestoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
if(savedInstanceState != null) {
mActionType = (KeyUtils.ActionType) savedInstanceState.getSerializable(ARG_ACTION_TYPE);
id = savedInstanceState.getInt(ARG_ACTION_ID, 0);
isPreviewMode = savedInstanceState.getBoolean(arg_key_is_preview);
original = savedInstanceState.getString(arg_key_editor);
}
}
示例9: setFrameworkVersionByMeta
import android.os.Bundle; //导入方法依赖的package包/类
/**
* 根据MetaData来设置框架版本号 <p>
* 注意:若为“纯APK”方案所用,则修改后需调用PluginInfoList.save来保存,否则会无效
*
* @param meta MetaData数据
*/
public void setFrameworkVersionByMeta(Bundle meta) {
int dfv = RePlugin.getConfig().getDefaultFrameworkVersion();
int frameVer = 0;
if (meta != null) {
frameVer = meta.getInt("com.qihoo360.framework.ver", dfv);
}
if (frameVer < 1) {
frameVer = dfv;
}
setFrameworkVersion(frameVer);
}
示例10: onResult
import android.os.Bundle; //导入方法依赖的package包/类
/**
* Let the hosting fragment or activity implement this interface
* to receive results from the dialog
*
* @param dialogTag the tag passed to {@link SimpleDialog#show}
* @param which result type, one of {@link #BUTTON_POSITIVE}, {@link #BUTTON_NEGATIVE},
* {@link #BUTTON_NEUTRAL} or {@link #CANCELED}
* @param extras the extras passed to {@link SimpleDialog#extra(Bundle)}
* @return true if the result was handled, false otherwise
*/
@Override
public boolean onResult(@NonNull String dialogTag, int which, @NonNull Bundle extras) {
// handle results as usual
if (COLOR_FRAGMENT.equals(dialogTag) && which == BUTTON_POSITIVE) {
@ColorInt int color = extras.getInt(SimpleColorDialog.COLOR);
// Sets action bar colors
if (getSupportActionBar() != null) {
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xFF000000 | color));
boolean dark = Color.red(color) * 0.299 + Color.green(color) * 0.587 + Color.blue(color) * 0.114 < 180;
SpannableString s = new SpannableString(getSupportActionBar().getTitle());
s.setSpan(new ForegroundColorSpan(dark ? Color.WHITE : Color.BLACK), 0, s.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
getSupportActionBar().setTitle(s);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[2] *= 0.75;
getWindow().setStatusBarColor(Color.HSVToColor(hsv));
}
return true;
}
return false;
}
示例11: onCreate
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Set the result to CANCELED. This will cause the widget host to cancel
// out of the widget placement if the user presses the back button.
setResult(RESULT_CANCELED);
setContentView(R.layout.git_hub_journey_widget_configure);
mAppWidgetText = (EditText) findViewById(R.id.appwidget_text);
findViewById(R.id.add_button).setOnClickListener(mOnClickListener);
// Find the widget id from the intent.
Intent intent = getIntent();
Bundle extras = intent.getExtras();
if (extras != null) {
mAppWidgetId = extras.getInt(
AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
}
// If this activity was started with an intent without an app widget ID, finish with an error.
if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
finish();
return;
}
mAppWidgetText.setText(loadTitlePref(GitHubJourneyWidgetConfigureActivity.this, mAppWidgetId));
}
示例12: getExtraData
import android.os.Bundle; //导入方法依赖的package包/类
private void getExtraData() {
Bundle bundle = getIntent().getExtras();
if (bundle != null) {
pushUrl = bundle.getString(URL);
resolution = bundle.getInt(VIDEO_RESOLUTION);
screenOrientation = bundle.getBoolean(SCREENORIENTATION);
cameraFrontFacing = bundle.getInt(FRONT_CAMERA_FACING);
mWatermark = new AlivcWatermark.Builder()
.watermarkUrl(bundle.getString(WATERMARK_PATH))
.paddingX(bundle.getInt(WATERMARK_DX))
.paddingY(bundle.getInt(WATERMARK_DY))
.site(bundle.getInt(WATERMARK_SITE))
.build();
minBitrate = bundle.getInt(MIN_BITRATE);
maxBitrate = bundle.getInt(MAX_BITRATE);
bestBitrate = bundle.getInt(BEST_BITRATE);
initBitrate = bundle.getInt(INIT_BITRATE);
frameRate = bundle.getInt(FRAME_RATE);
pList = bundle.getParcelableArrayList(PRODUCT_LIST);
eventUrl = bundle.getString(EVENT_URL);
memberLevelId = bundle.getInt(MEMBERLEVEL_ID);
mShareInfo = bundle.getParcelable(SHARE_INFO);
openID = bundle.getString(OPEN_ID);
//获取分享缩略图
new Thread(new Runnable() {
@Override
public void run() {
mBitmap = HttpUtils.getBitmapByUrl(mShareInfo.getImgUrl());
}
}).start();
}
}
示例13: onViewCreated
import android.os.Bundle; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (savedInstanceState != null) {
mHeaderDisplay = savedInstanceState
.getInt(KEY_HEADER_POSITIONING,
getResources().getInteger(R.integer.default_header_display));
mAreMarginsFixed = savedInstanceState
.getBoolean(KEY_MARGINS_FIXED,
getResources().getBoolean(R.bool.default_margins_fixed));
} else {
mHeaderDisplay = getResources().getInteger(R.integer.default_header_display);
mAreMarginsFixed = getResources().getBoolean(R.bool.default_margins_fixed);
}
db = FlashcardDb.getInstance(getActivity().getApplicationContext());
flashcards = db.getAllFlashcards();
Log.d(TAG, "onViewCreated: flashcards.size() = " + flashcards.size());
rv.setLayoutManager(new LayoutManager(getActivity()));
//OverScrollDecoratorHelper.setUpOverScroll(rv, OverScrollDecoratorHelper.ORIENTATION_VERTICAL);
adapter = new RVMainAdapter(getActivity(), mHeaderDisplay,
Utils.getMostUsedFlashcards(flashcards)
);
adapter.setMarginsFixed(mAreMarginsFixed);
adapter.setHeaderDisplay(mHeaderDisplay);
rv.setAdapter(new ScaleInAnimationAdapter(new AlphaInAnimationAdapter(adapter)));
LinearLayout noSets = (LinearLayout)view.findViewById(R.id.no_sets);
if (Utils.getMostUsedFlashcards(flashcards).isEmpty())
noSets.setVisibility(View.VISIBLE);
else
noSets.setVisibility(View.GONE);
}
示例14: onRestoreInstanceState
import android.os.Bundle; //导入方法依赖的package包/类
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
mCurrentTab = bundle.getInt("mCurrentTab");
state = bundle.getParcelable("instanceState");
if (mCurrentTab != 0 && mTabsContainer.getChildCount() > 0) {
updateTabSelection(mCurrentTab);
}
}
super.onRestoreInstanceState(state);
}
示例15: updateWidget
import android.os.Bundle; //导入方法依赖的package包/类
private static void updateWidget(final Context context, final AppWidgetManager appWidgetManager,
final int appWidgetId, final Bundle appWidgetOptions, final Coin balance) {
final Configuration config = new Configuration(PreferenceManager.getDefaultSharedPreferences(context),
context.getResources());
final MonetaryFormat btcFormat = config.getFormat();
final Spannable balanceStr = new MonetarySpannable(btcFormat.noCode(), balance).applyMarkup(null,
MonetarySpannable.STANDARD_INSIGNIFICANT_SPANS);
final Cursor data = context.getContentResolver().query(
ExchangeRatesProvider.contentUri(context.getPackageName(), true), null,
ExchangeRatesProvider.KEY_CURRENCY_CODE, new String[] { config.getExchangeCurrencyCode() }, null);
final Spannable localBalanceStr;
if (data != null) {
if (data.moveToFirst()) {
final ExchangeRate exchangeRate = ExchangeRatesProvider.getExchangeRate(data);
final Fiat localBalance = exchangeRate.rate.coinToFiat(balance);
final MonetaryFormat localFormat = Constants.LOCAL_FORMAT.code(0,
Constants.PREFIX_ALMOST_EQUAL_TO + GenericUtils.currencySymbol(exchangeRate.getCurrencyCode()));
final Object[] prefixSpans = new Object[] { MonetarySpannable.SMALLER_SPAN,
new ForegroundColorSpan(context.getResources().getColor(R.color.fg_less_significant)) };
localBalanceStr = new MonetarySpannable(localFormat, localBalance).applyMarkup(prefixSpans,
MonetarySpannable.STANDARD_INSIGNIFICANT_SPANS);
} else {
localBalanceStr = null;
}
data.close();
} else {
localBalanceStr = null;
}
final RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.wallet_balance_widget_content);
final String currencyCode = btcFormat.code();
if (MonetaryFormat.CODE_BTC.equals(currencyCode))
views.setImageViewResource(R.id.widget_wallet_prefix, R.drawable.currency_symbol_btc);
else if (MonetaryFormat.CODE_MBTC.equals(currencyCode))
views.setImageViewResource(R.id.widget_wallet_prefix, R.drawable.currency_symbol_mbtc);
else if (MonetaryFormat.CODE_UBTC.equals(currencyCode))
views.setImageViewResource(R.id.widget_wallet_prefix, R.drawable.currency_symbol_ubtc);
views.setTextViewText(R.id.widget_wallet_balance_btc, balanceStr);
views.setViewVisibility(R.id.widget_wallet_balance_local, localBalanceStr != null ? View.VISIBLE : View.GONE);
views.setTextViewText(R.id.widget_wallet_balance_local, localBalanceStr);
if (appWidgetOptions != null) {
final int minWidth = appWidgetOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH);
views.setViewVisibility(R.id.widget_app_icon, minWidth > 400 ? View.VISIBLE : View.GONE);
views.setViewVisibility(R.id.widget_button_request, minWidth > 300 ? View.VISIBLE : View.GONE);
views.setViewVisibility(R.id.widget_button_send, minWidth > 300 ? View.VISIBLE : View.GONE);
views.setViewVisibility(R.id.widget_button_send_qr, minWidth > 200 ? View.VISIBLE : View.GONE);
}
views.setOnClickPendingIntent(R.id.widget_button_balance,
PendingIntent.getActivity(context, 0, new Intent(context, WalletActivity.class), 0));
views.setOnClickPendingIntent(R.id.widget_button_request,
PendingIntent.getActivity(context, 0, new Intent(context, RequestCoinsActivity.class), 0));
views.setOnClickPendingIntent(R.id.widget_button_send,
PendingIntent.getActivity(context, 0, new Intent(context, SendCoinsActivity.class), 0));
views.setOnClickPendingIntent(R.id.widget_button_send_qr,
PendingIntent.getActivity(context, 0, new Intent(context, SendCoinsQrActivity.class), 0));
appWidgetManager.updateAppWidget(appWidgetId, views);
}