当前位置: 首页>>代码示例>>Java>>正文


Java Parcelable类代码示例

本文整理汇总了Java中android.os.Parcelable的典型用法代码示例。如果您正苦于以下问题:Java Parcelable类的具体用法?Java Parcelable怎么用?Java Parcelable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Parcelable类属于android.os包,在下文中一共展示了Parcelable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRestoreInstanceState

import android.os.Parcelable; //导入依赖的package包/类
@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);
}
 
开发者ID:pedromassango,项目名称:Programmers,代码行数:19,代码来源:TouchImageView.java

示例2: getDefaultScreenGettingFunction

import android.os.Parcelable; //导入依赖的package包/类
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.");
			}
		}
	};
}
 
开发者ID:aartikov,项目名称:Alligator,代码行数:18,代码来源:DialogFragmentConverter.java

示例3: onRestoreInstanceState

import android.os.Parcelable; //导入依赖的package包/类
@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);
  }
 
开发者ID:tateisu,项目名称:SubwayTooter,代码行数:17,代码来源:ColorPickerView.java

示例4: addArg

import android.os.Parcelable; //导入依赖的package包/类
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;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:21,代码来源:ProviderCall.java

示例5: onRestoreInstanceState

import android.os.Parcelable; //导入依赖的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);
        }
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:26,代码来源:ProfilePictureView.java

示例6: onRestoreInstanceState

import android.os.Parcelable; //导入依赖的package包/类
/**
 * {@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());
}
 
开发者ID:sathishmscict,项目名称:ChipsLayoutManager,代码行数:28,代码来源:ChipsLayoutManager.java

示例7: onRestoreInstanceState

import android.os.Parcelable; //导入依赖的package包/类
@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();
}
 
开发者ID:OlayinkaPeter,项目名称:Toodoo,代码行数:25,代码来源:FloatingActionButton.java

示例8: onRestoreInstanceState

import android.os.Parcelable; //导入依赖的package包/类
@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;
    }
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:20,代码来源:ViewPagerCompat.java

示例9: onRestoreInstanceState

import android.os.Parcelable; //导入依赖的package包/类
@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();
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:23,代码来源:CircularSeekBar.java

示例10: onRestoreInstanceState

import android.os.Parcelable; //导入依赖的package包/类
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);
}
 
开发者ID:asif-patel,项目名称:ImageEraser,代码行数:17,代码来源:TouchImageView.java

示例11: onSaveInstanceState

import android.os.Parcelable; //导入依赖的package包/类
@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;
}
 
开发者ID:michaelprimez,项目名称:searchablespinner,代码行数:23,代码来源:SearchableSpinner.java

示例12: onRestoreInstanceState

import android.os.Parcelable; //导入依赖的package包/类
@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;
}
 
开发者ID:zhudongya123,项目名称:WechatChatroomHelper,代码行数:18,代码来源:BGASwipeBackLayout2.java

示例13: getUriArrayFromNotificationParcelableArray

import android.os.Parcelable; //导入依赖的package包/类
@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;
}
 
开发者ID:bunnyblue,项目名称:NoticeDog,代码行数:17,代码来源:Notification.java

示例14: onRestoreInstanceState

import android.os.Parcelable; //导入依赖的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);
            scrollToCurrentTab();
        }
    }
    super.onRestoreInstanceState(state);
}
 
开发者ID:767954322,项目名称:FlycoTabLayout,代码行数:14,代码来源:SlidingTabLayout.java

示例15: onSaveInstanceState

import android.os.Parcelable; //导入依赖的package包/类
@Override
protected Parcelable onSaveInstanceState() {
    Parcelable parentState = super.onSaveInstanceState();
    SavedState savedState = new SavedState(parentState);
    savedState.currentState = currentState;
    savedState.previousState = previousState;

    return savedState;
}
 
开发者ID:elms1990,项目名称:many-faced-view,代码行数:10,代码来源:ManyFacedView.java


注:本文中的android.os.Parcelable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。