Java Code Examples for android.os.Bundle.getSerializable()

The following are Jave code examples for showing how to use getSerializable() of the android.os.Bundle class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: programming   File: TypeFrangment.java   View Source Code Vote up 6 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_type, container, false);
    ButterKnife.bind(this, view);

    Bundle bundle = getArguments();
    if (bundle != null){
        Pokemon pokemon = (Pokemon) bundle.getSerializable(TIPO);
        setPokemonDetail(pokemon);

    }


    return view;

}
 
Example 2
Project: Kandroid   File: MainActivity.java   View Source Code Vote up 6 votes
private void restoreSavedState(Bundle savedInstanceState) {
    // User rotated the screen or something
    if (BuildConfig.DEBUG) Log.v(Constants.TAG, "MainActivity: restore savedInstanceState");

    if (savedInstanceState.containsKey("me")) {
        Me = (KanboardUserInfo) savedInstanceState.getSerializable("me");
    }
    if (savedInstanceState.containsKey("dashboard")) {
        mDashboard = (KanboardDashboard) savedInstanceState.getSerializable("dashboard");
    }
    if (savedInstanceState.containsKey("projectList")) {
        mProjectList = (ArrayList<KanboardProject>) savedInstanceState.getSerializable("projectList");
        populateProjectsMenu();
    }
    if (savedInstanceState.containsKey("project"))
        mProject = (KanboardProject) savedInstanceState.getSerializable("project");
    mode = savedInstanceState.getInt("mode");
    if (savedInstanceState.containsKey("colors")) {
        Object o = savedInstanceState.getSerializable("colors");
        if (o instanceof HashMap)
            mColors = new Hashtable<>((HashMap<String, KanboardColor>) o);
        else
            mColors = (Hashtable<String, KanboardColor>) o;
    }
}
 
Example 3
Project: Companion-For-PUBG-Android   File: AmmoDetailFragment.java   View Source Code Vote up 6 votes
@Override
public void onViewCreated(final View view,
                          @Nullable final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final Bundle args = getArguments();
    if (args == null) {
        throw new IllegalStateException("Missing arguments");
    }
    final Ammo ammo = (Ammo) args.getSerializable(ARG_AMMO);
    if (ammo == null) {
        throw new IllegalStateException("Missing Ammo");
    }
    setNameText(ammo.getName());
    setAmmoImageView(ammo.getImageUrl());
    if (this.weaponsRecycler != null) {
        final WeaponList weapons = PUBGApplication.getInstance().getItems().getCategories().getWeaponCategory().getWeaponsUsingAmmo(ammo.getId());
        ItemRecyclerViewAdapter<Weapon> adapter = new ItemRecyclerViewAdapter<>((weapons));
        adapter.setListener(this);
        final DividerItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL);
        this.weaponsRecycler.addItemDecoration(itemDecoration);
        this.weaponsRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));

        this.weaponsRecycler.setAdapter(adapter);
    }

}
 
Example 4
Project: AppChooser   File: ResolversFragment.java   View Source Code Vote up 6 votes
@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    if (getArguments() != null) {
        Bundle args = getArguments();

        File file = (File) args.getSerializable(EXTRA_FILE);
        if (file == null) {
            throw new NullPointerException("file == null");
        }
        String mimeType = args.getString(EXTRA_MIME_TYPE);
        if (mimeType == null) {
            mimeType = MimeTypeUtils.getMimeType(file);
        }
        int requestCode = args.getInt(EXTRA_REQUEST_CODE);
        ArrayList<ComponentName> excluded = args.getParcelableArrayList(EXTRA_EXCLUDED);

        new ResolversPresenter(this, Injection.provideSchedulerProvider(),
                file, mimeType, requestCode, excluded,
                Injection.provideActivityInfosRepository(activity),
                Injection.provideMediaTypesRepository(activity),
                Injection.providerResolversRepository(activity));
    } else {
        throw new NullPointerException("Not found arguments");
    }
}
 
Example 5
Project: Mobike   File: BDInnerNaviActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	createHandler();
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
	}
	View view = null;
	if (useCommonInterface) {
		//使用通用接口
		mBaiduNaviCommonModule = NaviModuleFactory.getNaviModuleManager().getNaviCommonModule(
				NaviModuleImpl.BNaviCommonModuleConstants.ROUTE_GUIDE_MODULE, this,
				BNaviBaseCallbackModel.BNaviBaseCallbackConstants.CALLBACK_ROUTEGUIDE_TYPE, mOnNavigationListener);
		if(mBaiduNaviCommonModule != null) {
			mBaiduNaviCommonModule.onCreate();
			view = mBaiduNaviCommonModule.getView();
		}

	} else {
		//使用传统接口
		view = BNRouteGuideManager.getInstance().onCreate(this,mOnNavigationListener);
	}


	if (view != null) {
		setContentView(view);
	}

	Intent intent = getIntent();
	if (intent != null) {
		Bundle bundle = intent.getExtras();
		if (bundle != null) {
			mBNRoutePlanNode = (BNRoutePlanNode) bundle.getSerializable(NavUtil.ROUTE_PLAN_NODE);
		}
	}
	//显示自定义图标
	if (hd != null) {
		hd.sendEmptyMessageAtTime(MSG_SHOW, 5000);
	}
}
 
Example 6
Project: ViewPagerAnimator   File: PagerFragment.java   View Source Code Vote up 5 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    Bundle arguments = getArguments();
    PagerItem item = (PagerItem) arguments.getSerializable(KEY_ITEM);
    View view = inflater.inflate(R.layout.pager_fragment, container, false);
    TextView textView = (TextView) view.findViewById(R.id.textView);
    textView.setText(item.getTitle());
    return view;
}
 
Example 7
Project: AssistantBySDK   File: TimePickerDialog.java   View Source Code Vote up 5 votes
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_INITIAL_TIME)
                && savedInstanceState.containsKey(KEY_IS_24_HOUR_VIEW)) {
        mInitialTime = savedInstanceState.getParcelable(KEY_INITIAL_TIME);
        mIs24HourMode = savedInstanceState.getBoolean(KEY_IS_24_HOUR_VIEW);
        mInKbMode = savedInstanceState.getBoolean(KEY_IN_KB_MODE);
        mTitle = savedInstanceState.getString(KEY_TITLE);
        mThemeDark = savedInstanceState.getBoolean(KEY_THEME_DARK);
        mThemeDarkChanged = savedInstanceState.getBoolean(KEY_THEME_DARK_CHANGED);
        mAccentColor = savedInstanceState.getInt(KEY_ACCENT);
        mVibrate = savedInstanceState.getBoolean(KEY_VIBRATE);
        mDismissOnPause = savedInstanceState.getBoolean(KEY_DISMISS);
        mSelectableTimes = (Timepoint[])savedInstanceState.getParcelableArray(KEY_SELECTABLE_TIMES);
        mMinTime = savedInstanceState.getParcelable(KEY_MIN_TIME);
        mMaxTime = savedInstanceState.getParcelable(KEY_MAX_TIME);
        mEnableSeconds = savedInstanceState.getBoolean(KEY_ENABLE_SECONDS);
        mEnableMinutes = savedInstanceState.getBoolean(KEY_ENABLE_MINUTES);
        mOkResid = savedInstanceState.getInt(KEY_OK_RESID);
        mOkString = savedInstanceState.getString(KEY_OK_STRING);
        mOkColor = savedInstanceState.getInt(KEY_OK_COLOR);
        mCancelResid = savedInstanceState.getInt(KEY_CANCEL_RESID);
        mCancelString = savedInstanceState.getString(KEY_CANCEL_STRING);
        mCancelColor = savedInstanceState.getInt(KEY_CANCEL_COLOR);
        mVersion = (Version) savedInstanceState.getSerializable(KEY_VERSION);
    }
}
 
Example 8
Project: popomusic   File: JKActivity.java   View Source Code Vote up 5 votes
@Override
public void handleMessage(Message msgFromService) {
   JKActivity activity = weakActivity.get();
    if (null == activity) return;
    switch (msgFromService.what) {
        case Constant.MEDIA_PLAYER_SERVICE_SONG_PLAYING://通过Bundle传递对象,显示正在播放的歌曲
            LogUtils.e(TAG, "收到消息了");
            Bundle bundle = msgFromService.getData();
            activity.mAdapter.showPlaying((MusicBean) bundle.getSerializable(Constant.MEDIA_PLAYER_SERVICE_MODEL_PLAYING));
            activity.mAdapter.notifyDataSetChanged();
            MusicBean musicBean = (MusicBean) bundle.getSerializable(Constant.MEDIA_PLAYER_SERVICE_MODEL_PLAYING);
            activity.title.setText(musicBean.getSongname());
            activity.artist.setText(musicBean.getSingername());
            Glide.with(activity).load(musicBean.getAlbumpic_big()).into(activity.playcard);
            break;
        case Constant.MEDIA_PLAYER_SERVICE_IS_PLAYING:
            LogUtils.d(TAG, "收到了来自service的信息:是否更新UI");
            if (1 == msgFromService.arg1) {//正在播放
                LogUtils.d(TAG, "play按钮触发");
                activity.mBtnPlay.setImageResource(R.mipmap.bar_puase);

            } else {
                LogUtils.d(TAG, "pause按钮触发");
                activity.mBtnPlay.setImageResource(R.mipmap.bar_play);
            }

            break;
        case Constant.MEDIA_PLAYER_SERVICE_PROGRESS:
            //    LogUtils.d("LocalMusicActivity", "进度条开始工作");
            activity.currentTime = msgFromService.arg1;
            activity.duration = msgFromService.arg2;
            if (0 == activity.duration) break;
            activity.progressBar.setProgress(activity.currentTime * 100 / activity.duration);
            break;
    }

    super.handleMessage(msgFromService);
}
 
Example 9
Project: GoalsAndHabits   File: ViewEventActivity.java   View Source Code Vote up 5 votes
/**
 * Saving instant state for every action
 * @param savedInstanceState
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_habit_events);

    Bundle extras = getIntent().getExtras();
    if (extras!=null){
        if (extras.containsKey(HabitHistoryActivity.EXTRA_EVENT_SERIAL)){
            event = (HabitEvent) extras.getSerializable(HabitHistoryActivity.EXTRA_EVENT_SERIAL);
            position = (int) extras.getSerializable(HabitHistoryActivity.EXTRA_EVENT_POSITION);
        }
    }
    if (event==null){
        finish();
        return;
    }

    mFusedLocationClient = LocationServices.getFusedLocationProviderClient(this);


    comment = (TextView) findViewById(R.id.eventComment);
    comment.setText(event.getComment());
    image = (ImageView) findViewById(R.id.eventPhoto);
    eventdate = (TextView) findViewById(R.id.eventDate);
    eventdate.setText(dateFormat.format(event.getDate()));
    toolbar = (Toolbar) findViewById(R.id.actionbar);
    toolbar.setTitle("Habit Event");
    toolbar.setNavigationIcon(R.drawable.ic_close_button);
    setSupportActionBar(toolbar);

    if (event.getEncodedPhoto()!=null){
        imageDisplay = ImageController.base64ToImage(event.getEncodedPhoto());
        image.setImageBitmap(imageDisplay);
    }else{
        imageDisplay = null;
    }

    image.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dispatchTakePictureIntent();
        }
    });
}
 
Example 10
Project: buildAPKsApps   File: GraphicalActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  Bundle extras = getIntent().getExtras();
  mChart = (AbstractChart) extras.getSerializable(ChartFactory.CHART);
  mView = new GraphicalView(this, mChart);
  String title = extras.getString(ChartFactory.TITLE);
  if (title == null) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
  } else if (title.length() > 0) {
    setTitle(title);
  }
  setContentView(mView);
}
 
Example 11
Project: NanoIconPack   File: IconDialog.java   View Source Code Vote up 5 votes
@NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        View viewContent = getActivity().getLayoutInflater().inflate(R.layout.dialog_icon, null);

        initView(viewContent);

        AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
                .setView(viewContent);

        Bundle bundle = getArguments();
        if (bundle != null) {
            iconBean = (IconBean) bundle.getSerializable("bean");
            if (iconBean != null) {
                builder.setTitle(getTitle(iconBean));
//                ivIcon.setImageResource(iconBean.getId());
                int hdIconId = getResources().getIdentifier(iconBean.getName(), "mipmap",
                        getContext().getPackageName());
                ivIcon.setImageResource(hdIconId != 0 ? hdIconId : iconBean.getId());
                viewActionSave.setVisibility(iconBean.getId() != 0 || hdIconId != 0
                        ? View.VISIBLE : View.GONE);
                viewActionSend2Home.setVisibility(iconBean.containsInstalledComponent()
                        ? View.VISIBLE : View.GONE);
            }
            if (bundle.getBoolean("pick")) {
                viewActionSave.setVisibility(View.GONE);
                viewActionSend2Home.setVisibility(View.GONE);
                viewActionChoose.setVisibility(View.VISIBLE);
            }
        }

        return builder.create();
    }
 
Example 12
Project: OSchina_resources_android   File: TeamProjectActiveFragment.java   View Source Code Vote up 5 votes
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle bundle = getArguments();
    if (bundle != null) {
        mTeam = (Team) bundle
                .getSerializable(TeamMainActivity.BUNDLE_KEY_TEAM);

        mTeamProject = (TeamProject) bundle
                .getSerializable(TeamMainActivity.BUNDLE_KEY_PROJECT);

        mTeamId = mTeam.getId();
    }
}
 
Example 13
Project: GxIconDIY   File: IconDialog.java   View Source Code Vote up 5 votes
@NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        View viewContent = getActivity().getLayoutInflater().inflate(R.layout.dialog_icon, null);

        initView(viewContent);

        AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
                .setView(viewContent);

        Bundle bundle = getArguments();
        if (bundle != null) {
            iconBean = (IconBean) bundle.getSerializable("bean");
            if (iconBean != null) {
                builder.setTitle(getTitle(iconBean));
//                ivIcon.setImageResource(iconBean.getId());
                int hdIconId = getResources().getIdentifier(iconBean.getName(), "mipmap",
                        getContext().getPackageName());
                ivIcon.setImageResource(hdIconId != 0 ? hdIconId : iconBean.getId());
                viewActionSave.setVisibility(iconBean.getId() != 0 || hdIconId != 0
                        ? View.VISIBLE : View.GONE);
                viewActionSend2Home.setVisibility(iconBean.containsInstalledComponent()
                        ? View.VISIBLE : View.GONE);
            }
            if (bundle.getBoolean("pick")) {
                viewActionSave.setVisibility(View.GONE);
                viewActionSend2Home.setVisibility(View.GONE);
                viewActionChoose.setVisibility(View.VISIBLE);
            }
        }

        return builder.create();
    }
 
Example 14
Project: starcraft-2-build-player   File: EditBuildItemsFragment.java   View Source Code Vote up 5 votes
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	// populate list view with build items
	if (savedInstanceState == null) {			
        // set up list adapter
		
		// Okay something really funky happens here... the build object we "deserialize" from the
		// intent arguments is actually a reference to the original build in the parent activity!
		// Which causes problems because the original build's items are checked against the items
		// returned from this fragment to see if the user has made changes. In actual fact
		// any changes made will affect both build item lists meaning it will appear as though the
		// user has never changed anything!
		// The solution is to deep copy the build we get, even though it was supposedly serialized
		// which should perform the same function as deep copy...
		
		Build callerBuild = (Build) getArguments().getSerializable(IntentKeys.KEY_BUILD_OBJECT);
		//Build build = callerBuild == null ? null : (Build) UnoptimizedDeepCopy.copy(callerBuild);
		Build build = callerBuild;
		
		mFaction = build.getFaction();
		//Timber.d(this.toString(), "in EditBuildItemsFragment.onCreate(), build id = " + Integer.toHexString(System.identityHashCode(build)));
		
        mWorkingList = build.getItems() == null ? new ArrayList<BuildItem>() : build.getItems();
	} else {
		mWorkingList = (ArrayList<BuildItem>) savedInstanceState.getSerializable(KEY_BUILD_ITEM_ARRAY);
		
		// stub: doesn't keep up to date with faction selection in Info tab!
		mFaction = (Faction) savedInstanceState.getSerializable(IntentKeys.KEY_FACTION_ENUM);
	}

	// get a reference to the global DB instance
	MyApplication app = (MyApplication) getActivity().getApplicationContext();
	this.mDb = app.getDb();
}
 
Example 15
Project: LucaHome-MediaServer   File: RSSViewController.java   View Source Code Vote up 4 votes
@SuppressWarnings("unchecked")
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
    if (!_screenEnabled) {
        _logger.Debug("Screen is not enabled!");
        return;
    }

    _index = 0;
    _items = (List<RssItem>) resultData.getSerializable(RssService.ITEMS);
    if (_items != null) {
        _changeTextHandler.removeCallbacks(_updateRSSTextViewRunnable);
        _updateRSSTextViewRunnable.run();

        _rssTitleTextView.setText(resultData.getString(RssService.TITLE));
        _rssTitleTextView.setVisibility(View.VISIBLE);

        _rssSeparatorTextView.setVisibility(View.VISIBLE);

        _rssTextView1.setVisibility(View.VISIBLE);
        _rssTextView1Description.setVisibility(View.VISIBLE);
        _rssTextView2.setVisibility(View.VISIBLE);
        _rssTextView2Description.setVisibility(View.VISIBLE);
        _rssTextView3.setVisibility(View.VISIBLE);
        _rssTextView3Description.setVisibility(View.VISIBLE);
    } else {
        _changeTextHandler.removeCallbacks(_updateRSSTextViewRunnable);

        _rssTitleTextView.setVisibility(View.GONE);

        _rssSeparatorTextView.setVisibility(View.GONE);

        _rssTextView1.setVisibility(View.GONE);
        _rssTextView1Description.setVisibility(View.GONE);
        _rssTextView2.setVisibility(View.GONE);
        _rssTextView2Description.setVisibility(View.GONE);
        _rssTextView3.setVisibility(View.GONE);
        _rssTextView3Description.setVisibility(View.GONE);

        Toasty.error(_context, "An error appeared while downloading the rss feed.", Toast.LENGTH_LONG).show();
    }
}
 
Example 16
Project: android-project-gallery   File: ImageViewerActivity.java   View Source Code Vote up 4 votes
public void onCreate(Bundle savedInstanceState)
{
	//getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
	super.onCreate(savedInstanceState);
	setContentView(R.layout.image_viewer);
	
	getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg_translucent));
	

	final long useDayCount = XPreferenceManager.getUseDayCount();
	if (useDayCount <= NOTICE_MAX || useDayCount % NOTICE_CYCLE == 0)
	{
		if (!getSupportActionBar().isShowing())
		{
			getSupportActionBar().show();
		}
	}
	
	Bundle bundle = getIntent().getExtras();
	PhotoInfoSet photoInfoSet = (PhotoInfoSet) bundle.getSerializable(GIntent.EXTRA_IMAGE_SET);
	int pagerPosition = bundle.getInt(GIntent.EXTRA_POSITION, 0);
	mExtraDirectory = bundle.getString(GIntent.EXTRA_DIRECTORY);
	String title = photoInfoSet.getAlbumname();
	getSupportActionBar().setTitle(title);
	//getToolbar().setBackgroundResource(R.drawable.actionbar_bg_translucent);
	
	mPhotoList = photoInfoSet.getData();
	
	// boolean isCacheOnDisc = true;
	if (TextUtils.isEmpty(mExtraDirectory))
	{
		// 没有缓存路径, 不进行缓存.
		mCacheOnDisc = false;
	}

	if (savedInstanceState != null)
	{
		pagerPosition = savedInstanceState.getInt(STATE_POSITION);
	}

	SaveImageOptions saveOptions = new SaveImageOptions.Builder()
		.medule("IMAGE_VIEWER")
		.extraDir(mExtraDirectory)
		.build();

	mWallpaperBaseUri = Uri.parse("file://" + new AppCacheFactory().getWallpaper());
	mCacheDir = "file://" + mImageLoader.getDiscCache().getExtraDir().toString() + "/" + mExtraDirectory;
	
	mOptions = new DisplayImageOptions.Builder()
		.showImageForEmptyUri(R.drawable.warn_image_empty)
		.showImageOnFail(R.drawable.warn_image_error)
		.resetViewBeforeLoading(true)
		.cacheOnDisc(mCacheOnDisc)
		.imageScaleType(ImageScaleType.EXACTLY)
		.bitmapConfig(Bitmap.Config.RGB_565)
		.considerExifParams(true)
		.displayer(new FadeInBitmapDisplayer(300))
		.saveImageOptions(saveOptions)
		.build();
	
	mFavoriteView = (ImageView) findViewById(R.id.favorite_tips_iv);
	mFavoriteView.setVisibility(View.GONE);
	mViewPager = (AutoScrollViewPager) findViewById(R.id.pull_refresh_viewpager);
	mViewPager.setAdapter(new ImagePagerAdapter(mPhotoList));
	mViewPager.setCurrentItem(pagerPosition);
	
	initView();
}
 
Example 17
Project: Companion-For-PUBG-Android   File: WeaponDetailFragment.java   View Source Code Vote up 4 votes
@Override
public void onViewCreated(final View view,
                          @Nullable final Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final Bundle args = getArguments();
    if (args == null) {
        throw new IllegalStateException("Missing arguments");
    }
    final Weapon weapon = (Weapon) args.getSerializable(ARG_WEAPON);
    if (weapon == null) {
        throw new IllegalStateException("Missing Weapon");
    }
    setNameText(weapon.getName());
    setWeaponImageView(weapon.getImageUrl());
    setTypeText(getString(weapon.getType().getString()));
    if (weapon instanceof ProjectileWeapon) {
        final ProjectileWeapon projectileWeapon = ((ProjectileWeapon) weapon);
        final Ammo ammo = PUBGApplication.getInstance().getItems().getCategories().getAmmoCategory().getAmmoWithId((projectileWeapon.getAmmoId()));
        if (ammo == null) {
            return;
        }
        setAmmoImageView(ammo.getImageUrl());
        setAmmoTextView(ammo.getName());
        setBarValue(this.damageBarValueView, R.string.row_item_damage, projectileWeapon.getDamage().getChest0());
        setBarValue(this.rangeBarValueView, R.string.row_item_range, projectileWeapon.getRange());
        setBarValue(this.stabilityBarValueView, R.string.row_item_stability, projectileWeapon.getStability());
        setBarValue(this.rateBarValueView, R.string.row_item_rate, projectileWeapon.getRate());
        setBarValue(this.magazineBarValueView, R.string.row_item_magazine, projectileWeapon.getMagazineSize());
        setAmmoClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ItemDetailActivity.startActivity(getActivity(), ammo);
            }
        });
        setLoopsPickerView(getAttachmentsFor(projectileWeapon.getLoopIds()));
        setMagazinePickerView(getAttachmentsFor(projectileWeapon.getMagazinesIds()));
        setMuzzlePickerView(getAttachmentsFor(projectileWeapon.getMuzzleIds()));
        setGripPickerView(getAttachmentsFor(projectileWeapon.getGripIds()));
        setSightPickerView(getAttachmentsFor(projectileWeapon.getSightIds()));
        setStockPickerView(getAttachmentsFor(projectileWeapon.getStockIds()));
    } else {
        setAttachmentDividerVisible(false);
    }
}
 
Example 18
Project: FriendBook   File: LabelSelectionFragment.java   View Source Code Vote up 4 votes
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    Bundle arguments = getArguments();
    if (arguments != null) {
        final ArrayList<LabelSelectionItem> labelSelectionItems = new ArrayList<>();
        labelSelectionItems.add(new LabelSelectionItem(LabelSelectionItem.TYPE_LABEL_SELECTED_TITLE, "切换栏目"));
        ArrayList<Label> alwaySelectedLabels = (ArrayList<Label>) arguments.getSerializable(BUNDLE_ALWAY_SELECTED_LABELS);
        if (alwaySelectedLabels != null && alwaySelectedLabels.size() > 0) {
            for (Label alwaySelectedLabel : alwaySelectedLabels) {
                labelSelectionItems.add(new LabelSelectionItem(LabelSelectionItem.TYPE_LABEL_ALWAY_SELECTED, alwaySelectedLabel));
            }
        }
        ArrayList<Label> selectedLabels = (ArrayList<Label>) arguments.getSerializable(BUNDLE_SELECTED_LABELS);
        if (selectedLabels != null && selectedLabels.size() > 0) {
            for (Label selectedLabel : selectedLabels) {
                labelSelectionItems.add(new LabelSelectionItem(LabelSelectionItem.TYPE_LABEL_SELECTED, selectedLabel));
            }
        }
        labelSelectionItems.add(new LabelSelectionItem(LabelSelectionItem.TYPE_LABEL_UNSELECTED_TITLE, "点击添加更多标签"));
        ArrayList<Label> unselectedLabels = (ArrayList<Label>) arguments.getSerializable(BUNDLE_UNSELECTED_LABELS);
        if (unselectedLabels != null && unselectedLabels.size() > 0) {

            for (Label unselectedLabel : unselectedLabels) {
                labelSelectionItems.add(new LabelSelectionItem(LabelSelectionItem.TYPE_LABEL_UNSELECTED, unselectedLabel));
            }
        }
        mLabelSelectionAdapter = new LabelSelectionAdapter(labelSelectionItems);
        mLabelSelectionAdapter.setSelectedName(getArguments().getString(BUNDLE_SELECTED_NAME));
        mLabelSelectionAdapter.setOnLabelClickListener(onLabelClickListener);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 4);
        gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
            @Override
            public int getSpanSize(int position) {
                int itemViewType = mLabelSelectionAdapter.getItemViewType(position);
                return itemViewType == LabelSelectionItem.TYPE_LABEL_SELECTED || itemViewType == LabelSelectionItem.TYPE_LABEL_UNSELECTED || itemViewType == LabelSelectionItem.TYPE_LABEL_ALWAY_SELECTED ? 1 : 4;
            }
        });
        mRecyclerView.setLayoutManager(gridLayoutManager);
        mRecyclerView.setAdapter(mLabelSelectionAdapter);

        ItemDragHelperCallBack callBack = new ItemDragHelperCallBack(this);
        mLabelSelectionAdapter.setOnChannelDragListener(this);
        mLabelSelectionAdapter.setOnEditFinishListener(mOnEditFinishListener);
        mHelper = new ItemTouchHelper(callBack);
        mHelper.attachToRecyclerView(mRecyclerView);

    }


}
 
Example 19
Project: cniao5   File: GoodsDetailsActivity.java   View Source Code Vote up 4 votes
@Override
protected void init() {

    //接收数据
    Bundle bundle = getIntent().getExtras();
    goodsBean = (HotGoods.ListBean) bundle.getSerializable("itemClickGoods");
    if (goodsBean == null) {
        finish();
    }

    cartProvider = new CartShopProvider(this);

    LogUtil.e("跳转后数据", goodsBean.getName() + goodsBean.getPrice(), true);

    initToolBar();

    initData();

}
 
Example 20
Project: android-state   File: InjectionHelper.java   View Source Code Vote up 4 votes
@SuppressWarnings("unchecked")
public <T extends Serializable> T getSerializable(Bundle state, String key) {
    return (T) state.getSerializable(key + mBaseKey);
}