org.parceler.Parcels Java Examples
The following examples show how to use
org.parceler.Parcels.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AddGroupActivity.java From talk-android with MIT License | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { List<Member> result = Parcels.unwrap(data.getParcelableExtra(ChooseMemberActivity.MEMBERS)); if (result != null) { Iterator<Member> iterator = result.iterator(); while (iterator.hasNext()) { Member member = iterator.next(); if (member != null && member.get_id().equals(BizLogic.getUserInfo().get_id())) { iterator.remove(); } } members.addAll(result); adapter.notifyDataSetChanged(); } } super.onActivityResult(requestCode, resultCode, data); }
Example #2
Source File: GroupActivity.java From talk-android with MIT License | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { switch (requestCode) { case EDIT_GROUP_NAME_REQUEST: if (data != null) { Group group = Parcels.unwrap(data.getParcelableExtra(EditGroupNameActivity.GROUP)); if (group != null) { mAdapter.updateOne(group); GroupRealm.getInstance().addOrUpdate(group) .subscribe(new EmptyAction<Group>(), new RealmErrorAction()); } } break; } } }
Example #3
Source File: ViewKino.java From CineLog with GNU General Public License v3.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: if (editted) { Intent returnIntent = getIntent(); returnIntent.putExtra("dtoType", getIntent().getStringExtra("dtoType")); returnIntent.putExtra("kino", Parcels.wrap(kino)); returnIntent.putExtra("kino_position", position); setResult(Activity.RESULT_OK, returnIntent); } onBackPressed(); return true; default: return super.onOptionsItemSelected(item); } }
Example #4
Source File: AddTopicActivity.java From talk-android with MIT License | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { List<Member> result = Parcels.unwrap(data.getParcelableExtra(ChooseMemberActivity.MEMBERS)); List<String> removeMemberIds = Parcels.unwrap(data.getParcelableExtra(ChooseMemberActivity.REMOVE_MEMBER_IDS)); if (result != null) { Iterator<Member> iterator = result.iterator(); while (iterator.hasNext()) { Member member = iterator.next(); if (member != null && member.get_id().equals(BizLogic.getUserInfo().get_id())) { iterator.remove(); } } adapter.addMembers(result, removeMemberIds); } } super.onActivityResult(requestCode, resultCode, data); }
Example #5
Source File: GroupActivity.java From talk-android with MIT License | 6 votes |
@Override public void onLongClick(final Group group) { final CharSequence[] items = new CharSequence[]{getResources().getString(R.string.delete), getResources().getString(R.string.edit_name)}; new TalkDialog.Builder(this) .items(items) .itemsCallback(new TalkDialog.ListCallback() { @Override public void onSelection(TalkDialog dialog, View itemView, int which, CharSequence text) { if (text.equals(getResources().getString(R.string.delete))) { deleteGroup(group); } else if (text.equals(getResources().getString(R.string.edit_name))) { Intent intent = new Intent(GroupActivity.this, EditGroupNameActivity.class); intent.putExtra(EditGroupNameActivity.GROUP, Parcels.wrap(group)); startActivityForResult(intent, EDIT_GROUP_NAME_REQUEST); } } }).show(); }
Example #6
Source File: SearchResultFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(VIEW_MODEL, Parcels.wrap(viewModel)); if (allStoresResultList != null && allStoresResultList.getLayoutManager() != null) { outState.putParcelable(ALL_STORES_SEARCH_LIST_STATE, allStoresResultList.getLayoutManager() .onSaveInstanceState()); } outState.putString(UNSUBMITTED_QUERY, unsubmittedQuery); if (isSearchExpanded) outState.putBoolean(FOCUS_IN_SEARCH, true); if (followedStoresResultList != null && followedStoresResultList.getLayoutManager() != null) { outState.putParcelable(FOLLOWED_STORES_SEARCH_LIST_STATE, followedStoresResultList.getLayoutManager() .onSaveInstanceState()); } }
Example #7
Source File: AccountsActivity.java From talk-android with MIT License | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { switch (requestCode) { case REQUEST_TEAMBITION_CODE: String code = data.getStringExtra(UnionsActivity.CODE); presenter.bindTeambition(code); break; case VCodeDialogHelper.REQUEST_COUNTRY_CODE: if (data != null) { CountryModel model = Parcels.unwrap(data.getParcelableExtra(PickCountryCodeActivity.COUNTRY_CODE_DATA)); vCodeHelper.setCountryCode("+ " + String.valueOf(model.callingCode)); } break; } } super.onActivityResult(requestCode, resultCode, data); }
Example #8
Source File: EditStoryActivity.java From talk-android with MIT License | 6 votes |
protected void updateStory(String id, UpdateStoryRequestData data) { TalkClient.getInstance().getTalkApi() .updateStory(id, data) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<Story>() { @Override public void call(Story story) { hideInputMethodManager(); updateNotification(story); Intent intent = new Intent(); intent.putExtra("story", Parcels.wrap(story)); setResult(RESULT_OK, intent); finish(); overridePendingTransition(0, R.anim.anim_fade_transition_out); } }, new ApiErrorAction()); }
Example #9
Source File: ViewSerie.java From CineLog with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new ThemeWrapper().setThemeWithPreferences(this); setContentView(R.layout.activity_view_serie); ButterKnife.bind(this); kino = Parcels.unwrap(getIntent().getParcelableExtra("kino")); position = getIntent().getIntExtra("kino_position", -1); setSupportActionBar(toolbar); Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true); setViewPager(viewPager); }
Example #10
Source File: RegisterActivity.java From talk-android with MIT License | 6 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK && requestCode == REQUEST_TEAMBITION_CODE) { String code = data.getStringExtra(UnionsActivity.CODE); TalkClient.getInstance().getAccountApi() .signInByTeambition(code) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<User>() { @Override public void call(User user) { if (StringUtil.isNotBlank(user.getAccountToken())) { initUserData(RegisterActivity.this, user); getStrikeToken(); TransactionUtil.goTo(RegisterActivity.this, ChooseTeamActivity.class, true); } } }, new ApiErrorAction()); } else if (resultCode == RESULT_OK && requestCode == REQUEST_COUNTRY_CODE) { if (data != null) { CountryModel model = Parcels.unwrap(data.getParcelableExtra(PickCountryCodeActivity.COUNTRY_CODE_DATA)); tvCountryCode.setText("+ " + String.valueOf(model.callingCode)); } } }
Example #11
Source File: KinoResultsAdapter.java From CineLog with GNU General Public License v3.0 | 6 votes |
@Override protected void addReview(View view, Long tmdbId, KinoDto kinoDto) { Intent intent = new Intent(view.getContext(), EditReview.class); KinoDto kinoByTmdbMovieId = dataService.getWithTmdbId(tmdbId); intent.putExtra("dtoType", "kino"); if (kinoByTmdbMovieId == null) { intent.putExtra("kino", Parcels.wrap(kinoDto)); intent.putExtra("creation", true); } else { intent.putExtra("kino", Parcels.wrap(kinoByTmdbMovieId)); } getContext().startActivity(intent); }
Example #12
Source File: TvResultsAdapter.java From CineLog with GNU General Public License v3.0 | 6 votes |
@Override protected void addReview(View view, Long tmdbId, KinoDto kinoDto) { Intent intent = new Intent(view.getContext(), EditReview.class); KinoDto kinoByTmdbMovieId = dataService.getWithTmdbId(tmdbId); intent.putExtra("dtoType", "serie"); if (kinoByTmdbMovieId == null) { intent.putExtra("kino", Parcels.wrap(kinoDto)); intent.putExtra("creation", true); } else { intent.putExtra("kino", Parcels.wrap(kinoByTmdbMovieId)); } getContext().startActivity(intent); }
Example #13
Source File: HomeActivity.java From talk-android with MIT License | 6 votes |
public void startNotificationWithChatActivity(final String messageType, final String _targetId) { final Bundle bundle = new Bundle(); bundle.putBoolean(NOTIFICATION, true); if (XiaomiPushReceiver.DMS.equalsIgnoreCase(messageType)) { final Member member = MainApp.globalMembers.get(_targetId); bundle.putParcelable(ChatActivity.EXTRA_MEMBER, Parcels.wrap(member)); TransactionUtil.goTo(this, ChatActivity.class, bundle); } else if (XiaomiPushReceiver.ROOM.equalsIgnoreCase(messageType)) { final Room room = MainApp.globalRooms.get(_targetId); bundle.putParcelable(ChatActivity.EXTRA_ROOM, Parcels.wrap(room)); TransactionUtil.goTo(this, ChatActivity.class, bundle); } else if (XiaomiPushReceiver.STORY.equalsIgnoreCase(messageType)) { StoryRealm.getInstance().getSingleStory(_targetId) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<Story>() { @Override public void call(Story story) { if (story != null) { bundle.putParcelable(ChatActivity.EXTRA_STORY, Parcels.wrap(story)); TransactionUtil.goTo(HomeActivity.this, ChatActivity.class, bundle); } } }, new RealmErrorAction()); } }
Example #14
Source File: ViewDataActivity.java From CineLog with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new ThemeWrapper().setThemeWithPreferences(this); serieWishlistService = new SerieWishlistService(((KinoApplication) getApplicationContext()).getDaoSession()); movieWishlistService = new MovieWishlistService(((KinoApplication) getApplicationContext()).getDaoSession()); setContentView(R.layout.activity_view_unregistered_kino); ButterKnife.bind(this); wishlistDataDto = Parcels.unwrap(getIntent().getParcelableExtra("dataDto")); configureFabButton(); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
Example #15
Source File: TopicSettingActivity.java From talk-android with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_topic_setting); ButterKnife.inject(this); room = Parcels.unwrap(getIntent().getExtras().getParcelable("room")); if (room.getPurpose() == null) { room.setPurpose(""); } BusProvider.getInstance().register(this); progressBar = findViewById(R.id.progress_bar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.topic_setting); mAdapter = new TopicSettingAdapter(room); mAdapter.setListener(this); recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL,false)); recyclerView.setAdapter(mAdapter); memberIds = new ArrayList<>(); presenter = new TopicSettingPresenter(this); presenter.getTopicMembers(room.get_id()); showProgressBar(); }
Example #16
Source File: ManageUserFragment.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); bindViews(view); setupToolbar(); if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_USER_MODEL)) { currentModel = Parcels.unwrap(savedInstanceState.getParcelable(EXTRA_USER_MODEL)); loadImageStateless(currentModel.getPictureUri()); setUserName(currentModel.getName()); } else { currentModel = new ViewModel(); } if (isEditProfile) { createUserButton.setText(getString(R.string.edit_profile_save_button)); cancelUserProfile.setVisibility(View.VISIBLE); } attachPresenters(); }
Example #17
Source File: ViewUnregisteredKino.java From CineLog with GNU General Public License v3.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: if (editted) { Intent returnIntent = getIntent(); returnIntent.putExtra("dtoType", getIntent().getStringExtra("dtoType")); returnIntent.putExtra("kino", Parcels.wrap(kino)); returnIntent.putExtra("kino_position", position); setResult(Activity.RESULT_OK, returnIntent); } onBackPressed(); return true; default: return super.onOptionsItemSelected(item); } }
Example #18
Source File: ItemPhotoViewActivity.java From talk-android with MIT License | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); msgId = getIntent().getExtras().getString("msgId"); searchData = Parcels.unwrap(getIntent().getExtras().getParcelable("data")); presenter = new SearchPresenter(this); if (msgId != null && searchData != null) { originPage = searchData.page; leftPage = searchData.page; rightPage = searchData.page; presenter.search(searchData); } }
Example #19
Source File: SessionsTabFragment.java From droidkaigi2016 with Apache License 2.0 | 5 votes |
@NonNull public static SessionsTabFragment newInstance(List<Session> sessions) { SessionsTabFragment fragment = new SessionsTabFragment(); Bundle args = new Bundle(); args.putParcelable(ARG_SESSIONS, Parcels.wrap(sessions)); fragment.setArguments(args); return fragment; }
Example #20
Source File: GroupMemberActivity.java From talk-android with MIT License | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { switch (requestCode) { case CHOOSE_MEMBER_REQUEST: if (data != null) { List<Member> members = Parcels.unwrap(data.getParcelableExtra(ChooseMemberActivity.MEMBERS)); addMember(members); } break; } } }
Example #21
Source File: SettingsActivity.java From PainlessMusicPlayer with Apache License 2.0 | 5 votes |
@Override protected void onSaveInstanceState(final Bundle outState) { super.onSaveInstanceState(outState); final InstanceState instanceState = new InstanceState(); instanceState.suppressDayNightWarnings = viewModel.suppressDayNightWarnings; outState.putParcelable(EXTRA_STATE, Parcels.wrap(instanceState)); }
Example #22
Source File: VanillaFragmentProvider.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public Fragment newAppViewFragment(SearchAdResult searchAdResult, String tag) { Bundle bundle = new Bundle(); bundle.putLong(AppViewFragment.BundleKeys.APP_ID.name(), searchAdResult.getAppId()); bundle.putString(AppViewFragment.BundleKeys.PACKAGE_NAME.name(), searchAdResult.getPackageName()); bundle.putParcelable(AppViewFragment.BundleKeys.MINIMAL_AD.name(), Parcels.wrap(searchAdResult)); bundle.putString(AppViewFragment.BundleKeys.ORIGIN_TAG.name(), tag); AppViewFragment fragment = new AppViewFragment(); fragment.setArguments(bundle); return fragment; }
Example #23
Source File: CreateTeamActivity.java From talk-android with MIT License | 5 votes |
@Override public void onCreateTeamFinish(Team team) { AnalyticsHelper.getInstance().sendEvent(AnalyticsHelper.Category.switch_team, "create team", null); Intent intent = new Intent(); intent.putExtra("team", Parcels.wrap(team)); setResult(RESULT_OK, intent); finish(); }
Example #24
Source File: BottomSheetUserDialogFragment.java From intra42 with Apache License 2.0 | 5 votes |
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); dialogFragment = this; activity = getActivity(); if (getArguments() != null) { mUser = Parcels.unwrap(getArguments().getParcelable("lol")); } }
Example #25
Source File: TopicStoryFragment.java From talk-android with MIT License | 5 votes |
static public TopicStoryFragment getInstance(Story story, boolean isExpanded) { TopicStoryFragment f = new TopicStoryFragment(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { f.setSharedElementEnterTransition(new ChangeTransform()); } f.setSharedElementEnterTransition(new ChangeBounds()); } Bundle bundle = new Bundle(); bundle.putBoolean("isExpanded", isExpanded); bundle.putParcelable("story", Parcels.wrap(story)); f.setArguments(bundle); return f; }
Example #26
Source File: FileStoryFragment.java From talk-android with MIT License | 5 votes |
@Override public void onAttach(Activity activity) { super.onAttach(activity); overlay = activity.findViewById(R.id.view_overlay); this.isExpanded = getArguments().getBoolean("isExpanded", false); this.story = Parcels.unwrap(getArguments().getParcelable("story")); file = GsonProvider.getGson().fromJson(story.getData(), File.class); if (MainApp.globalMembers.containsKey(story.get_creatorId())) { creator = MainApp.globalMembers.get(story.get_creatorId()); } else { creator = MemberDataProcess.getAnonymousInstance(); } BusProvider.getInstance().register(this); }
Example #27
Source File: FileStoryFragment.java From talk-android with MIT License | 5 votes |
static public FileStoryFragment getInstance(Story story, boolean isExpanded) { FileStoryFragment f = new FileStoryFragment(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { f.setSharedElementEnterTransition(new ChangeTransform()); } f.setSharedElementEnterTransition(new ChangeBounds()); } Bundle bundle = new Bundle(); bundle.putBoolean("isExpanded", isExpanded); bundle.putParcelable("story", Parcels.wrap(story)); f.setArguments(bundle); return f; }
Example #28
Source File: LinkStoryFragment.java From talk-android with MIT License | 5 votes |
@Override public void onAttach(Activity activity) { super.onAttach(activity); overlay = activity.findViewById(R.id.view_overlay); this.isExpanded = getArguments().getBoolean("isExpanded", false); this.story = Parcels.unwrap(getArguments().getParcelable("story")); link = GsonProvider.getGson().fromJson(story.getData(), Link.class); if (MainApp.globalMembers.containsKey(story.get_creatorId())) { creator = MainApp.globalMembers.get(story.get_creatorId()); } else { creator = MemberDataProcess.getAnonymousInstance(); } BusProvider.getInstance().register(this); }
Example #29
Source File: LinkStoryFragment.java From talk-android with MIT License | 5 votes |
static public LinkStoryFragment getInstance(Story story, boolean isExpanded) { LinkStoryFragment f = new LinkStoryFragment(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { f.setSharedElementEnterTransition(new ChangeTransform()); } f.setSharedElementEnterTransition(new ChangeBounds()); } Bundle bundle = new Bundle(); bundle.putBoolean("isExpanded", isExpanded); bundle.putParcelable("story", Parcels.wrap(story)); f.setArguments(bundle); return f; }
Example #30
Source File: BottomSheetUserDialogFragment.java From intra42 with Apache License 2.0 | 5 votes |
public static BottomSheetUserDialogFragment newInstance(UsersLTE user) { BottomSheetUserDialogFragment fragment = new BottomSheetUserDialogFragment(); Bundle args = new Bundle(); args.putParcelable("lol", Parcels.wrap(user)); fragment.setArguments(args); return fragment; }