use of android.os.Parcelable in project XobotOS by xamarin.
the class MenuBuilder method saveActionViewStates.
public void saveActionViewStates(Bundle outStates) {
SparseArray<Parcelable> viewStates = null;
final int itemCount = size();
for (int i = 0; i < itemCount; i++) {
final MenuItem item = getItem(i);
final View v = item.getActionView();
if (v != null && v.getId() != View.NO_ID) {
if (viewStates == null) {
viewStates = new SparseArray<Parcelable>();
}
v.saveHierarchyState(viewStates);
if (item.isActionViewExpanded()) {
outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId());
}
}
if (item.hasSubMenu()) {
final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
subMenu.saveActionViewStates(outStates);
}
}
if (viewStates != null) {
outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates);
}
}
use of android.os.Parcelable in project XobotOS by xamarin.
the class MenuBuilder method dispatchSaveInstanceState.
private void dispatchSaveInstanceState(Bundle outState) {
if (mPresenters.isEmpty())
return;
SparseArray<Parcelable> presenterStates = new SparseArray<Parcelable>();
for (WeakReference<MenuPresenter> ref : mPresenters) {
final MenuPresenter presenter = ref.get();
if (presenter == null) {
mPresenters.remove(ref);
} else {
final int id = presenter.getId();
if (id > 0) {
final Parcelable state = presenter.onSaveInstanceState();
if (state != null) {
presenterStates.put(id, state);
}
}
}
}
outState.putSparseParcelableArray(PRESENTER_KEY, presenterStates);
}
use of android.os.Parcelable in project ZI by yixia.
the class IntentHelper method getIntentUri.
public static Uri getIntentUri(Intent intent) {
Uri result = null;
if (intent != null) {
result = intent.getData();
if (result == null) {
final String type = intent.getType();
String sharedUrl = intent.getStringExtra(Intent.EXTRA_TEXT);
if (!TextUtils.isEmpty(sharedUrl)) {
if ("text/plain".equals(type) && sharedUrl != null) {
result = getTextUri(sharedUrl);
} else if ("text/html".equals(type) && sharedUrl != null) {
result = getTextUri(Html.fromHtml(sharedUrl).toString());
}
} else {
Parcelable parce = intent.getParcelableExtra(Intent.EXTRA_STREAM);
if (parce != null)
result = (Uri) parce;
}
}
}
return result;
}
use of android.os.Parcelable in project XobotOS by xamarin.
the class Message method writeToParcel.
public void writeToParcel(Parcel dest, int flags) {
if (callback != null) {
throw new RuntimeException("Can't marshal callbacks across processes.");
}
dest.writeInt(what);
dest.writeInt(arg1);
dest.writeInt(arg2);
if (obj != null) {
try {
Parcelable p = (Parcelable) obj;
dest.writeInt(1);
dest.writeParcelable(p, flags);
} catch (ClassCastException e) {
throw new RuntimeException("Can't marshal non-Parcelable objects across processes.");
}
} else {
dest.writeInt(0);
}
dest.writeLong(when);
dest.writeBundle(data);
Messenger.writeMessengerOrNullToParcel(replyTo, dest);
}
use of android.os.Parcelable in project XobotOS by xamarin.
the class ProgressBar method onSaveInstanceState.
@Override
public Parcelable onSaveInstanceState() {
// Force our ancestor class to save its state
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.progress = mProgress;
ss.secondaryProgress = mSecondaryProgress;
return ss;
}
Aggregations