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

The following examples show how to use android.os.Bundle#getSerializable() . 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: VenvyUDNotificationCallback.java    From VideoOS-Android-SDK with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void notifyChanged(VenvyObservable observable, String tag, Bundle bundle) {
    if (bundle == null) {
        return;
    }
    if (!TextUtils.equals(tag, bundle.getString(OBSERVABLE_NOTIFICATION_TAG))) {
        return;
    }
    Serializable serializable = bundle.getSerializable(OBSERVABLE_NOTIFICATION_MESSAGE);
    if (serializable == null) {
        if (registerNotificationCallback != null) {
            if (serializable != null && serializable instanceof NotificationInfo) {
                LuaUtil.callFunction(registerNotificationCallback, LuaValue.NIL);
            }
        }
        return;
    }
    NotificationInfo info = (NotificationInfo) serializable;
    if (registerNotificationCallback != null) {
        if (serializable != null && serializable instanceof NotificationInfo) {
            LuaUtil.callFunction(registerNotificationCallback, LuaUtil.toTable(info.messageInfo));
        }
    }
}
 
Example 2
Source File: SystemInfoFragment.java    From Kernel-Tuner with GNU General Public License v3.0 6 votes vote down vote up
@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
  {
tempUnit = PrefsManager.getTempUnit();
      Bundle args = getArguments();
      type = (Type) args.getSerializable(TYPE);

      View view = inflater.inflate(R.layout.layout_fragment_system_info_overview, container, false);
      mListView = (ListView)view.findViewById(R.id.list);
      pbLoading = (ProgressBar)view.findViewById(R.id.pbLoading);
      mAdapter = new SystemInfoAdapter(getActivity(), new ArrayList<SystemInfo>());
      mListView.setAdapter(mAdapter);

      atGetData = new ATGetData(type);
atGetData.execute();

      return view;
  }
 
Example 3
Source File: TypeFrangment.java    From programming with GNU General Public License v3.0 6 votes vote down vote up
@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 4
Source File: QBFindUsersCommand.java    From q-municate-android with Apache License 2.0 6 votes vote down vote up
@Override
public Bundle perform(Bundle extras) throws Exception {
    String constraint = (String) extras.getSerializable(QBServiceConsts.EXTRA_CONSTRAINT);
    QBUser currentUser = (QBUser) extras.getSerializable(QBServiceConsts.EXTRA_USER);
    int page = extras.getInt(QBServiceConsts.EXTRA_PAGE);

    QBPagedRequestBuilder requestBuilder = new QBPagedRequestBuilder();
    requestBuilder.setPage(page);
    requestBuilder.setPerPage(ConstsCore.FL_FRIENDS_PER_PAGE);

    Bundle requestParams = new Bundle();
    Collection<QBUser> userList = QBUsers.getUsersByFullName(constraint, requestBuilder, requestParams).perform();
    Collection<QMUser> userCollection = UserFriendUtils.createUsersList(userList);

    Bundle params = new Bundle();
    params.putString(QBServiceConsts.EXTRA_CONSTRAINT, constraint);
    params.putInt(QBServiceConsts.EXTRA_TOTAL_ENTRIES, requestParams.getInt(QBServiceConsts.EXTRA_TOTAL_ENTRIES));
    params.putSerializable(QBServiceConsts.EXTRA_USERS, (java.io.Serializable) userCollection);

    return params;
}
 
Example 5
Source File: ControllerCover.java    From PlayerBase with Apache License 2.0 6 votes vote down vote up
@Override
public void onPlayerEvent(int eventCode, Bundle bundle) {
    switch (eventCode){
        case OnPlayerEventListener.PLAYER_EVENT_ON_DATA_SOURCE_SET:
            mBufferPercentage = 0;
            mTimeFormat = null;
            updateUI(0, 0);
            setBottomSeekBarState(true);
            DataSource data = (DataSource) bundle.getSerializable(EventKey.SERIALIZABLE_DATA);
            getGroupValue().putObject(DataInter.Key.KEY_DATA_SOURCE, data);
            setTitle(data);
            break;
        case OnPlayerEventListener.PLAYER_EVENT_ON_STATUS_CHANGE:
            int status = bundle.getInt(EventKey.INT_DATA);
            if(status== IPlayer.STATE_PAUSED){
                mStateIcon.setSelected(true);
            }else if(status==IPlayer.STATE_STARTED){
                mStateIcon.setSelected(false);
            }
            break;
        case OnPlayerEventListener.PLAYER_EVENT_ON_VIDEO_RENDER_START:
        case OnPlayerEventListener.PLAYER_EVENT_ON_SEEK_COMPLETE:
            mTimerUpdateProgressEnable = true;
            break;
    }
}
 
Example 6
Source File: OFragment.java    From fingerpoetry-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle args = getArguments();
    if (args != null) {
        mData = (WxArticle) args.getSerializable(ARG_CONTENT);
    }
}
 
Example 7
Source File: MultiImageSelectorFragment.java    From MultiImageSelector with MIT License 5 votes vote down vote up
@Override
public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
    super.onViewStateRestored(savedInstanceState);
    if (savedInstanceState != null) {
        mTmpFile = (File) savedInstanceState.getSerializable(KEY_TEMP_FILE);
    }
}
 
Example 8
Source File: Parcelables.java    From particle-android with Apache License 2.0 5 votes vote down vote up
public static <T extends Serializable> Map<String, T> readSerializableMap(Parcel parcel) {
    Map<String, T> map = new ArrayMap<>();
    Bundle bundle = parcel.readBundle(Parcelables.class.getClassLoader());
    for (String key : bundle.keySet()) {
        @SuppressWarnings("unchecked")
        T serializable = (T) bundle.getSerializable(key);
        map.put(key, serializable);
    }
    return map;
}
 
Example 9
Source File: NendNativeAdForwarder.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
void requestNativeAd(
    Context context,
    MediationNativeListener mediationNativeListener,
    Bundle serverParameters,
    NativeMediationAdRequest nativeMediationAdRequest,
    Bundle mediationExtras) {
  if (!nativeMediationAdRequest.isUnifiedNativeAdRequested()) {
    Log.e(TAG, "Failed to load ad. Request must be for unified native ads.");
    if (canInvokeListenerEvent()) {
      mediationNativeListener.onAdFailedToLoad(adapter, AdRequest.ERROR_CODE_INVALID_REQUEST);
    }
    return;
  }

  AdUnitMapper mapper = AdUnitMapper.createAdUnitMapper(serverParameters);
  if (mapper == null) {
    if (canInvokeListenerEvent()) {
      mediationNativeListener.onAdFailedToLoad(adapter, AdRequest.ERROR_CODE_INVALID_REQUEST);
    }
    return;
  }
  contextWeakReference = new WeakReference<>(context);
  this.mediationNativeListener = mediationNativeListener;

  if (mediationExtras != null
      && NendMediationAdapter.FormatType.TYPE_VIDEO
          == mediationExtras.getSerializable(KEY_NATIVE_ADS_FORMAT_TYPE)) {
    videoAdLoader =
        new NativeVideoAdLoader(this, mapper, nativeMediationAdRequest, mediationExtras);
    videoAdLoader.loadAd();
  } else {
    normalAdLoader =
        new NativeAdLoader(
            this,
            new NendAdNativeClient(context, mapper.spotId, mapper.apiKey),
            nativeMediationAdRequest.getNativeAdOptions());
    normalAdLoader.loadAd();
  }
}
 
Example 10
Source File: EPubReaderFragment.java    From fangzhuishushenqi with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) {
    if ((state != null) && state.containsKey(BUNDLE_POSITION)
            && state.containsKey(BUNDLE_BOOK)) {
        mPosition = state.getInt(BUNDLE_POSITION);
        mBook = (Book) state.getSerializable(BUNDLE_BOOK);
        mEpubFileName = state.getString(BUNDLE_EPUB_FILE_NAME);
        mIsSmilAvailable = state.getBoolean(BUNDLE_IS_SMIL_AVAILABLE);
    }
    return super.onCreateView(inflater, container, state);
}
 
Example 11
Source File: FriendZixiFragment.java    From Conquer with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.item_friendzixi, container, false);
    Bundle bundle = getArguments();
    task = (Task) bundle.getSerializable("task");
    loader = ImageLoader.getInstance();
    root = v;
    init(v);
    return v;
}
 
Example 12
Source File: LoginActivity.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.com_facebook_login_activity_layout);

    if (savedInstanceState != null) {
        callingPackage = savedInstanceState.getString(SAVED_CALLING_PKG_KEY);
        authorizationClient = (AuthorizationClient) savedInstanceState.getSerializable(SAVED_AUTH_CLIENT);
    } else {
        callingPackage = getCallingPackage();
        authorizationClient = new AuthorizationClient();
        request = (AuthorizationClient.AuthorizationRequest) getIntent().getSerializableExtra(EXTRA_REQUEST);
    }

    authorizationClient.setContext(this);
    authorizationClient.setOnCompletedListener(new AuthorizationClient.OnCompletedListener() {
        @Override
        public void onCompleted(AuthorizationClient.Result outcome) {
            onAuthClientCompleted(outcome);
        }
    });
    authorizationClient.setBackgroundProcessingListener(new AuthorizationClient.BackgroundProcessingListener() {
        @Override
        public void onBackgroundProcessingStarted() {
            findViewById(R.id.com_facebook_login_activity_progress_bar).setVisibility(View.VISIBLE);
        }

        @Override
        public void onBackgroundProcessingStopped() {
            findViewById(R.id.com_facebook_login_activity_progress_bar).setVisibility(View.GONE);
        }
    });
}
 
Example 13
Source File: GuessingCardPresenter.java    From px-android with MIT License 5 votes vote down vote up
public void onRestoreInstanceState(final Bundle savedInstanceState) {
    final PaymentMethod pm = savedInstanceState.getParcelable(PAYMENT_METHOD_BUNDLE);
        if (pm != null) {
            identificationTypes = savedInstanceState.getParcelableArrayList(IDENTIFICATION_TYPES_LIST_BUNDLE);
            saveBin(savedInstanceState.getString(CARD_INFO_BIN_BUNDLE));
            setIdentificationNumberRequired(savedInstanceState.getBoolean(ID_REQUIRED_BUNDLE));
            setSecurityCodeRequired(savedInstanceState.getBoolean(SEC_CODE_REQUIRED_BUNDLE));
            setCardNumber(savedInstanceState.getString(CARD_NUMBER_BUNDLE));
            setCardholderName(savedInstanceState.getString(CARD_NAME_BUNDLE));
            setExpiryMonth(savedInstanceState.getString(EXPIRY_MONTH_BUNDLE));
            setExpiryYear(savedInstanceState.getString(EXPIRY_YEAR_BUNDLE));
            final Token token = (Token) savedInstanceState.getSerializable(TOKEN_BUNDLE);
            setToken(token);
            final String idNumber = savedInstanceState.getString(IDENTIFICATION_NUMBER_BUNDLE);
            setIdentificationNumber(idNumber);
            final Identification identification = savedInstanceState.getParcelable(IDENTIFICATION_BUNDLE);
            identification.setNumber(idNumber);
            setIdentification(identification);
            setSecurityCodeLocation(savedInstanceState.getString(SEC_CODE_LOCATION_BUNDLE));
            final CardToken cardToken = JsonUtil
                .fromJson(savedInstanceState.getString(CARD_TOKEN_BUNDLE), CardToken.class);
            cardToken.getCardholder().setIdentification(identification);
            final IdentificationType identificationType = savedInstanceState.getParcelable(IDENTIFICATION_TYPE_BUNDLE);
            setCardToken(cardToken);
            setIdentificationType(identificationType);
            final boolean lowResActive = savedInstanceState.getBoolean(LOW_RES_BUNDLE);
            getView().recoverCardViews(lowResActive, getCardNumber(), getCardholderName(), getExpiryMonth(),
                getExpiryYear(), idNumber, identificationType);
            onPaymentMethodSet(pm);
        }
}
 
Example 14
Source File: PinSupportFragment.java    From android-pin with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);
    Bundle args = getArguments();
    mPinDisplayType = (PinDisplayType) args.getSerializable(KEY_FRAGMENT_VIEW_TYPE);
}
 
Example 15
Source File: MultiImagePreviewActivity.java    From YImagePicker with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle bundle = getArguments();
    if (bundle == null) {
        return;
    }
    imageItem = (ImageItem) bundle.getSerializable(KEY_URL);
}
 
Example 16
Source File: PersistentSearchView.java    From persistentsearchview with Apache License 2.0 5 votes vote down vote up
private SavedState(Parcel parcel) {
    super(parcel);

    // Restoring the data
    final Bundle bundle = parcel.readBundle(getClass().getClassLoader());
    this.queryInputHintColor = bundle.getInt(KEY_QUERY_INPUT_HINT_COLOR);
    this.queryInputTextColor = bundle.getInt(KEY_QUERY_INPUT_TEXT_COLOR);
    this.queryInputCursorColor = bundle.getInt(KEY_QUERY_INPUT_CURSOR_COLOR);
    this.inputBarIconColor = bundle.getInt(KEY_INPUT_BAR_ICON_COLOR);
    this.dividerColor = bundle.getInt(KEY_DIVIDER_COLOR);
    this.progressBarColor = bundle.getInt(KEY_PROGRESS_BAR_COLOR);
    this.suggestionIconColor = bundle.getInt(KEY_SUGGESTION_ICON_COLOR);
    this.recentSearchIconColor = bundle.getInt(KEY_RECENT_SEARCH_ICON_COLOR);
    this.searchSuggestionIconColor = bundle.getInt(KEY_SEARCH_SUGGESTION_ICON_COLOR);
    this.suggestionTextColor = bundle.getInt(KEY_SUGGESTION_TEXT_COLOR);
    this.suggestionSelectedTextColor = bundle.getInt(KEY_SUGGESTION_SELECTED_TEXT_COLOR);
    this.cardBackgroundColor = bundle.getInt(KEY_CARD_BACKGROUND_COLOR);
    this.backgroundDimColor = bundle.getInt(KEY_BACKGROUND_DIM_COLOR);
    this.cardCornerRadius = bundle.getInt(KEY_CARD_CORNER_RADIUS);
    this.cardElevation = bundle.getInt(KEY_CARD_ELEVATION);
    this.dimAmount = bundle.getFloat(KEY_DIM_AMOUNT, DEFAULT_DIM_AMOUNT);
    this.query = bundle.getString(KEY_QUERY);
    this.inputHint = bundle.getString(KEY_INPUT_HINT);
    this.state = (State) bundle.getSerializable(KEY_STATE);
    this.isDismissibleOnTouchOutside = bundle.getBoolean(KEY_IS_DISMISSIBLE_ON_TOUCH_OUTSIDE, true);
    this.isProgressBarEnabled = bundle.getBoolean(KEY_IS_PROGRESS_BAR_ENABLED, true);
    this.isVoiceInputButtonEnabled = bundle.getBoolean(KEY_IS_VOICE_INPUT_BUTTON_ENABLED, true);
    this.isClearInputButtonEnabled = bundle.getBoolean(KEY_IS_CLEAR_INPUT_BUTTON_ENABLED, true);
    this.areSuggestionsDisabled = bundle.getBoolean(KEY_ARE_SUGGESTIONS_DISABLED, false);
    this.shouldDimBehind = bundle.getBoolean(KEY_SHOULD_DIM_BEHIND, true);
}
 
Example 17
Source File: MentionsCommentTimeLineFragment.java    From iBeebo with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    switch (getCurrentState(savedInstanceState)) {
        case FIRST_TIME_START:
            getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
            break;
        case ACTIVITY_DESTROY_AND_CREATE:
            userBean = savedInstanceState.getParcelable(Constants.USERBEAN);
            accountBean = savedInstanceState.getParcelable(Constants.ACCOUNT);
            token = savedInstanceState.getString(Constants.TOKEN);
            unreadBean = savedInstanceState.getParcelable("unreadBean");
            timeLinePosition = (TimeLinePosition) savedInstanceState.getSerializable("timeLinePosition");
            CommentListBean savedBean = savedInstanceState.getParcelable(Constants.BEAN);

            Loader<CommentTimeLineData> loader = getLoaderManager().getLoader(DB_CACHE_LOADER_ID);
            if (loader != null) {
                getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
            }

            if (savedBean != null && savedBean.getSize() > 0) {
                clearAndReplaceValue(savedBean);
                timeLineAdapter.notifyDataSetChanged();
            } else {
                getLoaderManager().initLoader(DB_CACHE_LOADER_ID, null, dbCallback);
            }

            break;
    }

}
 
Example 18
Source File: ImageViewerActivity.java    From android-project-wo2b with Apache License 2.0 4 votes vote down vote up
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(RockyIntent.EXTRA_IMAGE_SET);
	int pagerPosition = bundle.getInt(RockyIntent.EXTRA_POSITION, 0);
	mExtraDirectory = bundle.getString(RockyIntent.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);
	mPullToRefreshViewPager = (PullToRefreshViewPager) findViewById(R.id.pull_refresh_viewpager);
	mViewPager = mPullToRefreshViewPager.getRefreshableView();
	mViewPager.setAdapter(new ImagePagerAdapter(mPhotoList));
	mViewPager.setCurrentItem(pagerPosition);
	
	initView();
}
 
Example 19
Source File: MainActivity.java    From developerWorks with Apache License 2.0 4 votes vote down vote up
/**
 * The ubiquitous onCreate() method, where much of the magic happens.
 *
 * @param savedInstanceState The saved bundle from a previous incarnation. We don't really
 *                           care too much about it, just based on the nature of this
 *                           particular application.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Create the Deque that holds notifications
    // Try to retrieve it from saved instance state first
    if (savedInstanceState != null) {
        Serializable savedInstanceStateSerializable = savedInstanceState.getSerializable(INSTANCE_STATE_NOTIFICATIONS);
        if (savedInstanceStateSerializable != null) {
            // This unchecked cast is okay
            //noinspection unchecked
            notifications = (ArrayDeque<NotificationContent.NotificationItem>) savedInstanceStateSerializable;
        } else {
            notifications = null; // force recreate of the Deque
        }
    }

    // Create the FloatingActionBar, this provides information about each fragment
    FloatingActionButton fab = findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            // Figure out which Fragment we're looking at, and display info
            /// specific to that Fragment. Use the menu ID as the cracker.
            Toast toast;
            int activeFragmentId = getActiveFragmentId();
            switch (getActiveFragmentId()) {
                // Home Fragment
                case R.id.navigation_home:
                    // TODO: Toast is temporary, replace with Dialog
                    toast = Toast.makeText(getApplicationContext(), "This (" + activeFragmentId + ") is the Home fragment", Toast.LENGTH_LONG);
                    break;
                // Navigation Fragment
                case R.id.navigation_dashboard:
                    // TODO: Toast is temporary, replace with Dialog
                    toast = Toast.makeText(getApplicationContext(), "This (" + activeFragmentId + ") is the Dashboard fragment", Toast.LENGTH_LONG);
                    break;
                // Notifications Fragment
                case R.id.navigation_notifications:
                    // TODO: Toast is temporary, replace with Dialog
                    toast = Toast.makeText(getApplicationContext(), "This (" + activeFragmentId + ") is the Notifications fragment", Toast.LENGTH_LONG);
                    break;
                // Settings Fragment
                case R.id.navigation_settings:
                    // TODO: Toast is temporary, replace with Dialog
                    toast = Toast.makeText(getApplicationContext(), "This (" + activeFragmentId + ") is the Settings fragment", Toast.LENGTH_LONG);
                    break;
                default:
                    // TODO: Toast is temporary, replace with Dialog
                    toast = Toast.makeText(getApplicationContext(), "Unknown Fragment ID: " + activeFragmentId + ", no info", Toast.LENGTH_LONG);
            }
            if (toast != null) {
                toast.show();
            }
        }
    });

    // Load application properties from SharedPreferences
    setApplicationProperties(new ApplicationProperties(getApplicationContext()));

    // Create the BottomNavigationView
    mFragmentTitle = findViewById(R.id.message);
    BottomNavigationView navigation = findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);

    // Start at home (why not?)
    loadHomeFragment();

    // Disable the Dashboard until connected
    disableBottomNavigationMenuItem(R.id.navigation_dashboard);
}
 
Example 20
Source File: WeaponDetailFragment.java    From Companion-For-PUBG-Android with MIT License 4 votes vote down vote up
@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);
    }
}