项目:Programmers
文件:TouchImageView.java
@Override
public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
normalizedScale = bundle.getFloat("saveScale");
m = bundle.getFloatArray("matrix");
prevMatrix.setValues(m);
prevMatchViewHeight = bundle.getFloat("matchViewHeight");
prevMatchViewWidth = bundle.getFloat("matchViewWidth");
prevViewHeight = bundle.getInt("viewHeight");
prevViewWidth = bundle.getInt("viewWidth");
imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
return;
}
super.onRestoreInstanceState(state);
}
项目:yphoto
文件:TouchImageView.java
@Override
public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
normalizedScale = bundle.getFloat("saveScale");
m = bundle.getFloatArray("matrix");
prevMatrix.setValues(m);
prevMatchViewHeight = bundle.getFloat("matchViewHeight");
prevMatchViewWidth = bundle.getFloat("matchViewWidth");
prevViewHeight = bundle.getInt("viewHeight");
prevViewWidth = bundle.getInt("viewWidth");
imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
return;
}
super.onRestoreInstanceState(state);
}
项目:Alligator
文件:DialogFragmentConverter.java
public static <ScreenT extends Screen> Function<DialogFragment,ScreenT> getDefaultScreenGettingFunction(final Class<ScreenT> screenClass) {
return new Function<DialogFragment,ScreenT>() {
@Override
@SuppressWarnings("unchecked")
public ScreenT call(DialogFragment dialogFragment) {
if (dialogFragment.getArguments() == null) {
throw new IllegalArgumentException("Dialog dialogFragment has no arguments.");
} else if (Serializable.class.isAssignableFrom(screenClass)) {
return (ScreenT) dialogFragment.getArguments().getSerializable(KEY_SCREEN);
} else if (Parcelable.class.isAssignableFrom(screenClass)) {
return (ScreenT) dialogFragment.getArguments().getParcelable(KEY_SCREEN);
} else {
throw new IllegalArgumentException("Screen " + screenClass.getSimpleName() + " should be Serializable or Parcelable.");
}
}
};
}
项目:SubwayTooter
文件:ColorPickerView.java
@Override public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
alpha = bundle.getInt("alpha");
hue = bundle.getFloat("hue");
sat = bundle.getFloat("sat");
val = bundle.getFloat("val");
showAlphaPanel = bundle.getBoolean("show_alpha");
alphaSliderText = bundle.getString("alpha_text");
state = bundle.getParcelable("instanceState");
}
super.onRestoreInstanceState(state);
}
项目:VirtualHook
文件:ProviderCall.java
public Builder addArg(String key,Object value) {
if (value != null) {
if (value instanceof Boolean) {
bundle.putBoolean(key,(Boolean) value);
} else if (value instanceof Integer) {
bundle.putInt(key,(Integer) value);
} else if (value instanceof String) {
bundle.putString(key,(String) value);
} else if (value instanceof Serializable) {
bundle.putSerializable(key,(Serializable) value);
} else if (value instanceof Bundle) {
bundle.putBundle(key,(Bundle) value);
} else if (value instanceof Parcelable) {
bundle.putParcelable(key,(Parcelable) value);
} else {
throw new IllegalArgumentException("UnkNown type " + value.getClass() + " in Bundle.");
}
}
return this;
}
项目:AndroidbackendlessChat
文件:ProfilePictureView.java
/**
* 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);
}
}
}
项目:ChipsLayoutManager
文件:ChipsLayoutManager.java
/**
* {@inheritDoc}
*/
@Override
public void onRestoreInstanceState(Parcelable state) {
container = (ParcelableContainer) state;
anchorView = container.getAnchorViewState();
if (orientation != container.getorientation()) {
//orientation have been changed,clear anchor rect
int anchorPos = anchorView.getPosition();
anchorView = anchorFactory.createNotFound();
anchorView.setPosition(anchorPos);
}
viewPositionsstorage.onRestoreInstanceState(container.getPositionsCache(orientation));
cachenormalizationPosition = container.getnormalizationPosition(orientation);
Log.d(TAG,"RESTORE. last cache position before cleanup = " + viewPositionsstorage.getLastCachePosition());
if (cachenormalizationPosition != null) {
viewPositionsstorage.purgeCacheFromPosition(cachenormalizationPosition);
}
viewPositionsstorage.purgeCacheFromPosition(anchorView.getPosition());
Log.d(TAG,"RESTORE. anchor position =" + anchorView.getPosition());
Log.d(TAG,"RESTORE. layoutOrientation = " + orientation + " normalizationPos = " + cachenormalizationPosition);
Log.d(TAG,"RESTORE. last cache position = " + viewPositionsstorage.getLastCachePosition());
}
@Override
public void onRestoreInstanceState(Parcelable state) {
if (!(state instanceof ProgressSavedState)) {
super.onRestoreInstanceState(state);
return;
}
ProgressSavedState ss = (ProgressSavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
this.mCurrentProgress = ss.mCurrentProgress;
this.mTargetProgress = ss.mTargetProgress;
this.mSpinSpeed = ss.mSpinSpeed;
this.mProgressWidth = ss.mProgressWidth;
this.mProgressColor = ss.mProgressColor;
this.mProgressBackgroundColor = ss.mProgressBackgroundColor;
this.mShouldProgressIndeterminate = ss.mShouldProgressIndeterminate;
this.mShouldSetProgress = ss.mShouldSetProgress;
this.mProgress = ss.mProgress;
this.mAnimateProgress = ss.mAnimateProgress;
this.mShowProgressBackground = ss.mShowProgressBackground;
this.mLastTimeAnimated = SystemClock.uptimeMillis();
}
@Override
public void onRestoreInstanceState(Parcelable state) {
if (!(state instanceof SavedState)) {
super.onRestoreInstanceState(state);
return;
}
SavedState ss = (SavedState)state;
super.onRestoreInstanceState(ss.getSuperState());
if (mAdapter != null) {
mAdapter.restoreState(ss.adapterState,ss.loader);
setCurrentItemInternal(ss.position,false,true);
} else {
mRestoredCurItem = ss.position;
mRestoredAdapterState = ss.adapterState;
mRestoredClassLoader = ss.loader;
}
}
@Override
protected void onRestoreInstanceState(Parcelable state) {
Bundle savedState = (Bundle) state;
Parcelable superState = savedState.getParcelable("PARENT");
super.onRestoreInstanceState(superState);
mMax = savedState.getInt("MAX");
mProgress = savedState.getInt("PROGRESS");
mCircleColor = savedState.getInt("mCircleColor");
mCircleProgressColor = savedState.getInt("mCircleProgressColor");
mPointerColor = savedState.getInt("mPointerColor");
mPointerHaloColor = savedState.getInt("mPointerHaloColor");
mPointerHaloColorOnTouch = savedState.getInt("mPointerHaloColorOnTouch");
mPointeralpha = savedState.getInt("mPointeralpha");
mPointeralphaOnTouch = savedState.getInt("mPointeralphaOnTouch");
lockEnabled = savedState.getBoolean("lockEnabled");
initPaints();
recalculateall();
}
项目:ImageEraser
文件:TouchImageView.java
public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
this.normalizedScale = bundle.getFloat("saveScale");
this.f3m = bundle.getFloatArray("matrix");
this.prevMatrix.setValues(this.f3m);
this.prevMatchViewHeight = bundle.getFloat("matchViewHeight");
this.prevMatchViewWidth = bundle.getFloat("matchViewWidth");
this.prevViewHeight = bundle.getInt("viewHeight");
this.prevViewWidth = bundle.getInt("viewWidth");
this.imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
return;
}
super.onRestoreInstanceState(state);
}
项目:searchablespinner
文件:SearchableSpinner.java
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.mViewState = ViewState.ShowingRevealedLayout;
ss.mAnimDuration = mAnimDuration;
ss.mBordeRSSize = mBordeRSSize;
ss.mExpandSize = mExpandSize;
ss.mBoarderColor = mBoarderColor;
ss.mRevealViewBackgroundColor = mRevealViewBackgroundColor;
ss.mStartEditTintColor = mStartEditTintColor;
ss.mEditViewBackgroundColor = mEditViewBackgroundColor;
ss.mEditViewTextColor = mEditViewTextColor;
ss.mDoneEditTintColor = mDoneEditTintColor;
ss.mShowBorders = mShowBorders;
ss.mKeepLastSearch = mKeepLastSearch;
ss.mRevealEmptyText = mRevealEmptyText;
ss.mSearchHintText = mSearchHintText;
ss.mNoItemsFoundText = mNoItemsFoundText;
ss.mSelectedViewPosition = mCurrSelectedView != null ? mCurrSelectedView.getPosition() : -1;
return ss;
}
项目:WechatChatroomHelper
文件:BGASwipeBackLayout2.java
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (!(state instanceof SavedState)) {
super.onRestoreInstanceState(state);
return;
}
SavedState ss = (SavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
if (ss.isOpen) {
openPane();
} else {
closePane();
}
mPreservedOpenState = ss.isOpen;
}
项目:NoticeDog
文件:Notification.java
@TargetApi(19)
List<Uri> getUriArrayFromNotificationParcelableArray(android.app.Notification n,String extra) {
Parcelable[] pa = n.extras.getParcelableArray(extra);
if (pa == null) {
try {
return new ArrayList();
} catch (Exception e) {
return new ArrayList();
}
}
List<Uri> uris = new ArrayList(pa.length);
for (Parcelable p : pa) {
uris.add((Uri) p);
}
return uris;
}
项目:FlycoTabLayout
文件:SlidingTabLayout.java
@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);
scrollToCurrentTab();
}
}
super.onRestoreInstanceState(state);
}
项目:many-faced-view
文件:ManyFacedView.java
项目:mobile-app-dev-book
文件:JournalViewActivity.java
private void toMediaEdit (JournalEntry model,String key) {
Intent toEdit = new Intent(this,JournalEditactivity.class);
Parcelable parcel = Parcels.wrap(model);
toEdit.putExtra ("JRNL_ENTRY",parcel);
toEdit.putExtra ("JRNL_KEY",key);
toEdit.putExtra ("DB_REF",entriesRef.getRef().getParent()
.toString());
startActivity (toEdit);
}
项目:Huochexing12306
文件:UnderlinePageIndicator.java
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState savedState = new SavedState(superState);
savedState.currentPage = mCurrentPage;
return savedState;
}
项目:FABsMenu
文件:FABsMenu.java
@Override
public void onRestoreInstanceState(Parcelable state) {
if (state instanceof SavedState) {
SavedState savedState = (SavedState) state;
expanded = savedState.expanded;
touchDelegateGroup.setEnabled(expanded);
if (rotatingDrawable != null) {
rotatingDrawable.setRotation(expanded ? EXPANDED_PLUS_ROTATION :
COLLAPSED_PLUS_ROTATION);
}
super.onRestoreInstanceState(savedState.getSuperState());
} else {
super.onRestoreInstanceState(state);
}
}
项目:FinalProject
文件:MaterialSearchView.java
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
mSavedState = new SavedState(superState);
mSavedState.query = mUserQuery != null ? mUserQuery.toString() : null;
mSavedState.isSearchOpen = this.mIsSearchOpen;
return mSavedState;
}
项目:GitHub
文件:DirectionalViewpager.java
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.position = mCurItem;
if (mAdapter != null) {
ss.adapterState = mAdapter.saveState();
}
return ss;
}
项目:Protein
文件:FollowerListPresenter.java
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putParcelable(STATE_USER,user);
if (firstPageFollowers.size() > 0) {
outState.putParcelableArrayList(STATE_FirsT_PAGE_DATA,(ArrayList<? extends Parcelable>) firstPageFollowers);
}
outState.putString(STATE_NEXT_PAGE_URL,getNextPageUrl());
}
/**
* Open a camera device and start showing camera preview. This is typically called from
* {@link Activity#onResume()}.
*/
public void start() {
if (!mImpl.start()) {
//store the state,and restore this state after fall back o Camera1
Parcelable state=onSaveInstanceState();
// Camera2 uses legacy hardware layer; fall back to Camera1
mImpl = new Camera1(mCallbacks,createPreviewImpl(getContext()));
onRestoreInstanceState(state);
mImpl.start();
}
}
项目:SlidingUpPanelLayout
文件:BaseWeatherPanelView.java
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.mSavedSlideState = mSlideState;
return ss;
}
项目:MainCalendar
文件:ColorPanelView.java
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (!(state instanceof SavedState)) {
super.onRestoreInstanceState(state);
return;
}
SavedState ss = (SavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
mIsBrightnessGradient = ss.isBrightnessGradient;
setColor(ss.color,true);
}
项目:simple-stack
文件:BackstackDelegateTest.java
@Test
public void onCreateChoosesInitialKeysIfRestoredHistoryIsEmpty() {
BackstackDelegate backstackDelegate = new BackstackDelegate(null);
TestKey testKey = new TestKey("hello");
ArrayList<Parcelable> restoredKeys = new ArrayList<>();
Mockito.when(savedInstanceState.getParcelableArrayList(backstackDelegate.getHistoryTag())).thenReturn(restoredKeys);
backstackDelegate.onCreate(savedInstanceState,null,HistoryBuilder.single(testKey));
assertthat(backstackDelegate.getBackstack()).isNotNull();
backstackDelegate.setStateChanger(stateChanger);
assertthat(backstackDelegate.getBackstack().getHistory()).containsExactly(testKey);
}
项目:SimpleUILauncher
文件:CellLayout.java
public void restoreInstanceState(SparseArray<Parcelable> states) {
try {
dispatchRestoreInstanceState(states);
} catch (IllegalArgumentException ex) {
if (ProviderConfig.IS_DOGFOOD_BUILD) {
throw ex;
}
// Mismatched viewId / viewType preventing restore. Skip restore on production builds.
Log.e(TAG,"Ignoring an error while restoring a view instance state",ex);
}
}
项目:FontProvider
文件:IntegerSimpleMenuPreference.java
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (state == null || !state.getClass().equals(SavedState.class)) {
// Didn't save state for us in onSaveInstanceState
super.onRestoreInstanceState(state);
return;
}
SavedState myState = (SavedState) state;
super.onRestoreInstanceState(myState.getSuperState());
setValue(myState.value);
}
@Override
protected Parcelable onSaveInstanceState() {
SavedState state = new SavedState(super.onSaveInstanceState());
state.facing = getFacing();
state.ratio = getAspectRatio();
state.autoFocus = getAutoFocus();
state.flash = getFlash();
return state;
}
项目:TextView_CustomEdit_CustomColor
文件:ColorPickerPreference.java
@Override
protected Parcelable onSaveInstanceState() {
final Parcelable superState = super.onSaveInstanceState();
if (mDialog == null || !mDialog.isShowing()) {
return superState;
}
final SavedState myState = new SavedState(superState);
myState.dialogBundle = mDialog.onSaveInstanceState();
return myState;
}
项目:airgram
文件:linearlayoutmanager.java
@Override
public void onRestoreInstanceState(Parcelable state) {
if (state instanceof SavedState) {
mPendingSavedState = (SavedState) state;
requestLayout();
if (DEBUG) {
Log.d(TAG,"loaded saved state");
}
} else if (DEBUG) {
Log.d(TAG,"invalid saved state class");
}
}
protected void onRestoreInstanceState(Parcelable state) {
SavedState ss = (SavedState) state;
super.onRestoreInstanceState(ss.getSuperState());
Menu menu = this.mMenuView != null ? this.mMenuView.peekMenu() : null;
if (!(ss.expandedMenuItemId == 0 || this.mExpandedMenuPresenter == null || menu == null)) {
MenuItem item = menu.findItem(ss.expandedMenuItemId);
if (item != null) {
MenuItemCompat.expandActionView(item);
}
}
if (ss.isOverflowOpen) {
postShowOverflowMenu();
}
}
项目:proto-collecte
文件:MainActivity.java
public void onReceive(Context context,Intent intent) {
Parcelable connectionResult = intent.getParcelableExtra(Constants.GOOGLE_API_CONNECTION_RESULT);
Parcelable status = intent.getParcelableExtra(Constants.GOOGLE_API_LOCATION_RESULT);
if (status != null) {
handleLocationStatusResult((Status) status);
} else if (connectionResult != null) {
handleConnectionResult((ConnectionResult) connectionResult);
}
}
项目:q-mail
文件:SliderPreference.java
@Override
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
Bundle state = new Bundle();
state.putParcelable(STATE_KEY_SUPER,superState);
state.putInt(STATE_KEY_SEEK_BAR_VALUE,mSeekBarValue);
return state;
}
项目:letv
文件:DrawerLayout.java
protected Parcelable onSaveInstanceState() {
SavedState ss = new SavedState(super.onSaveInstanceState());
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
boolean isOpenedAndNotClosing;
LayoutParams lp = (LayoutParams) getChildAt(i).getLayoutParams();
if (lp.openState == 1) {
isOpenedAndNotClosing = true;
} else {
isOpenedAndNotClosing = false;
}
boolean isClosedAndopening;
if (lp.openState == 2) {
isClosedAndopening = true;
} else {
isClosedAndopening = false;
}
if (isOpenedAndNotClosing || isClosedAndopening) {
ss.openDrawerGravity = lp.gravity;
break;
}
}
ss.lockModeLeft = this.mlockModeLeft;
ss.lockModeRight = this.mlockModeRight;
ss.lockModeStart = this.mlockModeStart;
ss.lockModeEnd = this.mlockModeEnd;
return ss;
}
项目:BakingApp
文件:MainActivityFragment.java
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
mBinding = DataBindingUtil.inflate(inflater,R.layout.fragment_main,container,false);
recipeAdapter = new RecipeAdapter(getContext(),this);
recipeDatabaseHelper = new RecipeDatabaseHelper(getContext());
recipeapiclient = new Recipeapiclient();
recipes = new ArrayList<>();
getIdlingResource();
mBinding.swiperefresh.setonRefreshListener(new SwipeRefreshLayout.OnRefreshListener(){
@Override
public void onRefresh() {
updateRecipes();
}
});
GridAutofitLayoutManager layoutManager = new GridAutofitLayoutManager(getContext(),800);
mBinding.rvRecipes.setLayoutManager(layoutManager);
mBinding.rvRecipes.setAdapter(recipeAdapter);
mBinding.rvRecipes.setHasFixedSize(false);
if (savedInstanceState != null){
if (savedInstanceState.containsKey(SAVED_RECIPES_KEY)){
ArrayList<Parcelable> recipeParcelableArrayList = savedInstanceState.getParcelableArrayList(SAVED_RECIPES_KEY);
for (Parcelable parcelable : recipeParcelableArrayList){
Recipe recipe = Parcels.unwrap(parcelable);
recipes.add(recipe);
recipeAdapter.addRecipe(recipe);
}
}
if (savedInstanceState.containsKey(SCROLLBAR_POSITION_KEY)){
int position = savedInstanceState.getInt(SCROLLBAR_POSITION_KEY);
mBinding.rvRecipes.getLayoutManager().scrollToPosition(position);
}
} else {
mBinding.pbLoadingIndicator.setVisibility(View.VISIBLE);
recipeDatabaseHelper.getAllRecipes(this);
}
return mBinding.getRoot();
}
项目:Android_Songshuhui
文件:SegmentTabLayout.java
@Override
protected Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable("instanceState",super.onSaveInstanceState());
bundle.putInt("mCurrentTab",mCurrentTab);
return bundle;
}
项目:airgram
文件:ColorPickerView.java
@Override
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
Bundle state = new Bundle();
state.putParcelable(STATE_PARENT,superState);
state.putFloat(STATE_ANGLE,mAngle);
state.putInt(STATE_OLD_COLOR,mCenterOldColor);
state.putBoolean(STATE_SHOW_OLD_COLOR,mShowCenterOldColor);
return state;
}
项目:EasyIPC
文件:IpcBase.java
private boolean internaldispatchEvent(Parcelable event) {
List<String> t = types;
if (t != null && t.contains(event.getClass().getCanonicalName())) {
try {
return sendEventToOtherProcess(new ParcelableEvent(event));
} catch (remoteexception e) {
Log.e(e,"%s.FailedToSendEventToOtherProcess",TAG);
}
}
return false;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。