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


Java Parcels类代码示例

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


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

示例1: searchContacts

import org.parceler.Parcels; //导入依赖的package包/类
private RealmResults<Contact> searchContacts() {
  Contact c = Parcels.unwrap(getIntent().getParcelableExtra(EXTRA_SEARCH_FILTERS));
  realm = Realm.getDefaultInstance();
  RealmQuery<Contact> query = realm.where(Contact.class);

  query.contains(LASTNAME, c.lastName, Case.INSENSITIVE)
      .or()
      .contains(FIRSTNAME, c.lastName, Case.INSENSITIVE);

  if (!c.owner) {
    query.equalTo(OWNER, false);
  }

  if (!c.cornac) {
    query.equalTo(CORNAC, false);
  }

  if (!c.vet) {
    query.equalTo(VET, false);
  }

  return query.findAll();
}
 
开发者ID:goutfeb,项目名称:ElephantAsia,代码行数:24,代码来源:SearchContactResultActivity.java

示例2: onCreate

import org.parceler.Parcels; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mBinding = DataBindingUtil.setContentView(this, R.layout.activity_step_detail);
    setSupportActionBar(mBinding.stepDetailToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    if (getIntent() != null) {
        if (getIntent().hasExtra(STEP_EXTRA)){
            step = Parcels.unwrap(getIntent().getParcelableExtra(STEP_EXTRA));
            getSupportActionBar().setTitle(step.getShortDescription());
        }
    }
    if (savedInstanceState != null) {
        fragment = (StepDetailFragment) getSupportFragmentManager().getFragment(savedInstanceState, "stepDetailFragment");
    } else {
        fragment = StepDetailFragment.newInstance(step, true);
        getSupportFragmentManager().beginTransaction().replace(R.id.step_fragment_container, fragment).commit();
    }
}
 
开发者ID:harrynp,项目名称:BakingApp,代码行数:21,代码来源:StepDetailActivity.java

示例3: onViewCreated

import org.parceler.Parcels; //导入依赖的package包/类
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);

  presenter.subscribe(savedInstanceState != null ? Parcels.unwrap(
      savedInstanceState.getParcelable(QuestionState.QUESTION_STATE_KEY)) : null);

  View.OnClickListener buttonOnClickListener = v -> {
    multipleTypeLayout.setVisibility(View.GONE);
    booleanTypeLayout.setVisibility(View.GONE);
    Button selectedButton = (Button) v;
    presenter.answerQuestion(selectedButton.getText()
        .toString());
  };

  answerAButton.setOnClickListener(buttonOnClickListener);
  answerBButton.setOnClickListener(buttonOnClickListener);
  answerCButton.setOnClickListener(buttonOnClickListener);
  answerDButton.setOnClickListener(buttonOnClickListener);
  trueButton.setOnClickListener(buttonOnClickListener);
  falseButton.setOnClickListener(buttonOnClickListener);
}
 
开发者ID:dfloureiro,项目名称:opentrivia,代码行数:22,代码来源:QuestionActivityFragment.java

示例4: onCreateView

import org.parceler.Parcels; //导入依赖的package包/类
/**
 * Run initial setup for creating a new game.
 * Any subclasses should override this method and set up
 * the root layout and presenter specific to their game mode.
 */
@Override
public View onCreateView(LayoutInflater inflater,
                         @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    // Reload the game state if we've been rotated or restarted
    if (savedInstanceState != null) {
        mExistingGame = Parcels
                .unwrap(savedInstanceState
                        .getParcelable(getString(R.string.bundle_key_game)));
        mCheckedPositions = savedInstanceState
                .getIntArray(getString(R.string.bundle_key_checked_positions));
        mCheckedCount = savedInstanceState
                .getInt(getString(R.string.bundle_key_checked_count));

        Log.d(LOG_TAG, "Restored the game from a previous state.");
    }

    return super.onCreateView(inflater, container, savedInstanceState);
}
 
开发者ID:jaysondc,项目名称:TripleTap,代码行数:25,代码来源:GameFragment.java

示例5: onSaveInstanceState

import org.parceler.Parcels; //导入依赖的package包/类
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    // Get the SetGame
    SetGame game = mActionsListener.getSetGame();

    SparseBooleanArray checkedItemPositions = getCheckedItemPositions();
    int positionIndex = 0;
    // Loop through SparseBooleanArray and grab the positions that are checked
    for (int i = 0; i < checkedItemPositions.size(); i++) {
        if (checkedItemPositions.valueAt(i)) {
            mCheckedPositions[positionIndex] = checkedItemPositions.keyAt(i);
            positionIndex++;
        }
    }

    // Bundle objects
    outState.putParcelable(getString(R.string.bundle_key_game), Parcels.wrap(game));
    outState.putIntArray(getString(R.string.bundle_key_checked_positions), mCheckedPositions);
    outState.putInt(getString(R.string.bundle_key_checked_count), mCheckedCount);
}
 
开发者ID:jaysondc,项目名称:TripleTap,代码行数:23,代码来源:GameFragment.java

示例6: searchElephants

import org.parceler.Parcels; //导入依赖的package包/类
private RealmResults<Elephant> searchElephants() {
  Elephant e = Parcels.unwrap(getIntent().getParcelableExtra(EXTRA_SEARCH_ELEPHANT));
  RealmQuery<Elephant> query = realm.where(Elephant.class);

  query.contains(NAME, e.name, Case.INSENSITIVE);

  if (e.chips1 != null) {
    query.contains(CHIPS1, e.chips1, Case.INSENSITIVE);
  }

  if (!e.male) {
    query.equalTo(MALE, false);
  }

  if (!e.female) {
    query.equalTo(FEMALE, false);
  }
  return query.findAll();
}
 
开发者ID:goutfeb,项目名称:ElephantAsia,代码行数:20,代码来源:SearchElephantResultActivity.java

示例7: onClick

import org.parceler.Parcels; //导入依赖的package包/类
@Override
public void onClick(Recipe recipe) {
    Intent detailIntent = new Intent(getActivity(), DetailActivity.class);
    ArrayList<Parcelable> ingredients = new ArrayList<>();
    for (Ingredient ingredient : recipe.getIngredients()){
        ingredients.add(Parcels.wrap(ingredient));
    }
    ArrayList<Parcelable> steps = new ArrayList<>();
    for (Step step : recipe.getSteps()){
        steps.add(Parcels.wrap(step));
    }
    detailIntent.putExtra(IngredientsFragment.INGREDIENTS_EXTRA, ingredients);
    detailIntent.putExtra(StepsFragment.STEPS_EXTRA, steps);
    detailIntent.putExtra("RECIPE_NAME", recipe.getName());
    startActivity(detailIntent);
}
 
开发者ID:harrynp,项目名称:BakingApp,代码行数:17,代码来源:MainActivityFragment.java

示例8: onCreate

import org.parceler.Parcels; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_user_detail);
    unbinder = ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle("");
    }
    if (savedInstanceState == null) {
        addFragment(R.id.user_detail_container,
                UserDetailFragment.newInstance(Parcels.unwrap(getIntent().getParcelableExtra(UI_MODEL))), "",
                null);
    }
}
 
开发者ID:Zeyad-37,项目名称:RxRedux,代码行数:18,代码来源:UserDetailActivity.java

示例9: onCreate

import org.parceler.Parcels; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_media_view);
    ButterKnife.bind(this);

    imgLoader = new FirebaseImageLoader();
    storage = FirebaseStorage.getInstance();
    Intent incoming = getIntent();
    if (incoming.hasExtra("JRNL_ENTRY")) {
        Parcelable parcel = incoming.getParcelableExtra("JRNL_ENTRY");
        entry = Parcels.unwrap(parcel);
        if (entry.getType() == 4) {
            initExoPlayer();
        }
    }
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:18,代码来源:MediaViewActivity.java

示例10: onActivityResult

import org.parceler.Parcels; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == NEW_TRIP_REQUEST) {
        if (data != null && data.hasExtra("TRIP")) {
            Parcelable par = data.getParcelableExtra("TRIP");
            Trip t = Parcels.unwrap(par);
            topRef.push().setValue(t);
            Snackbar.make(toolbar, "New Trip Added", Snackbar.LENGTH_SHORT).show();
        }
    }
    else
        super.onActivityResult(requestCode, resultCode, data);
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:14,代码来源:MainActivity.java

示例11: onCreate

import org.parceler.Parcels; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_media_view);
    ButterKnife.bind(this);

    imgLoader = new FirebaseImageLoader();
    storage = FirebaseStorage.getInstance();
    Intent incoming = getIntent();
    if (incoming.hasExtra("JRNL_ENTRY")) {
        Parcelable parcel = incoming.getParcelableExtra("JRNL_ENTRY");
        entry = Parcels.unwrap(parcel);
        switch (entry.getType()) {
            case 1:
                break;
            case 2:
                videoView.setVisibility(View.GONE);
                break;
            case 3:
            case 4:
                photoView.setVisibility(View.GONE);
                initExoPlayer();
                break;
        }
    }
}
 
开发者ID:gvsucis,项目名称:mobile-app-dev-book,代码行数:27,代码来源:MediaViewActivity.java

示例12: initializeActivity

import org.parceler.Parcels; //导入依赖的package包/类
/**
 * Initializes this activity.
 */
public void initializeActivity(Bundle savedInstanceState) {
    if (savedInstanceState == null) {
        this.userSubscription =
                Parcels.unwrap(getIntent().getParcelableExtra(INTENT_EXTRA_PARAM_SUBSCRIPTION));
        if (userSubscription == null) {
            userSubscription = new UserSubscription();
        }
        addFragment(R.id.fragmentContainer,
                CreateSubscriptionFragment.forSubscription(userSubscription,
                        getIntent().hasExtra(INTENT_EXTRA_EDIT_MODE)));
    } else {
        this.userSubscription = Parcels.unwrap(
                savedInstanceState.getParcelable(INSTANCE_STATE_PARAM_SUBSCRIPTION));
    }
}
 
开发者ID:riteshakya037,项目名称:Subs,代码行数:19,代码来源:CreateSubscriptionActivity.java

示例13: onViewCreated

import org.parceler.Parcels; //导入依赖的package包/类
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  categorySpinnerAdapter =
      new ArrayAdapter<>(getActivity(), R.layout.support_simple_spinner_dropdown_item,
          new ArrayList<>());
  categoriesSpinner.setAdapter(categorySpinnerAdapter);

  ArrayAdapter<String> difficultySpinnerAdapter =
      new ArrayAdapter<>(getActivity(), R.layout.support_simple_spinner_dropdown_item,
          difficulties);
  difficultiesSpinner.setAdapter(difficultySpinnerAdapter);

  ArrayAdapter<String> gameTypeSpinnerAdapter =
      new ArrayAdapter<>(getActivity(), R.layout.support_simple_spinner_dropdown_item, gameTypes);
  gameTypesSpinner.setAdapter(gameTypeSpinnerAdapter);

  ArrayAdapter<String> amountsSpinnerAdapter =
      new ArrayAdapter<>(getActivity(), R.layout.support_simple_spinner_dropdown_item, amounts);
  amountsSpinner.setAdapter(amountsSpinnerAdapter);

  presenter.subscribe(savedInstanceState != null ? Parcels.unwrap(
      savedInstanceState.getParcelable(MainState.CATEGORY_STATE_KEY)) : null);

  categoriesSpinner.setSelection(
      savedInstanceState != null ? savedInstanceState.getInt(CATEGORIES_POSITION_KEY) : 0);
  difficultiesSpinner.setSelection(
      savedInstanceState != null ? savedInstanceState.getInt(DIFFICULTIES_POSITION_KEY) : 0);
  gameTypesSpinner.setSelection(
      savedInstanceState != null ? savedInstanceState.getInt(GAMETYPE_POSITION_KEY) : 0);
  amountsSpinner.setSelection(
      savedInstanceState != null ? savedInstanceState.getInt(GAMETYPE_POSITION_KEY) : 0);
}
 
开发者ID:dfloureiro,项目名称:opentrivia,代码行数:33,代码来源:MainActivityFragment.java

示例14: onSaveInstanceState

import org.parceler.Parcels; //导入依赖的package包/类
@Override public void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  outState.putParcelable(MainState.CATEGORY_STATE_KEY, Parcels.wrap(presenter.getState()));
  outState.putInt(CATEGORIES_POSITION_KEY, categoriesSpinner.getSelectedItemPosition());
  outState.putInt(DIFFICULTIES_POSITION_KEY, difficultiesSpinner.getSelectedItemPosition());
  outState.putInt(GAMETYPE_POSITION_KEY, gameTypesSpinner.getSelectedItemPosition());
  outState.putInt(AMOUNTS_POSITION_KEY, amountsSpinner.getSelectedItemPosition());
}
 
开发者ID:dfloureiro,项目名称:opentrivia,代码行数:9,代码来源:MainActivityFragment.java

示例15: onListItemClick

import org.parceler.Parcels; //导入依赖的package包/类
@Override
public void onListItemClick(long position) {
    Member memberClicked = mMemberAdapter.getData().get((int)position);

    Intent memberDetailsIntent = new Intent(mContext, MemberDetailsActivity.class);
    memberDetailsIntent.putExtra(EXTRA_MEMBER_DETAILS, Parcels.wrap(memberClicked));
    mContext.startActivity(memberDetailsIntent);
}
 
开发者ID:codingdojoangola,项目名称:cda-app,代码行数:9,代码来源:MembersFragment.java


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