private void initializeColorBar() { drawerLayout.setScrimColor(ContextCompat.getColor(this, R.color.scrimColor)); for (NoteColor noteColor : NoteColor.values()) { ImageView view = new ImageView(this); Drawable circle; if (noteColor == NoteColor.NO_COLOR) { circle = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_remove_filter, null); } else { circle = ResourcesCompat.getDrawable(getResources(), R.drawable.color_circle, null); circle.setColorFilter(Color.parseColor(noteColor.toHexString()), PorterDuff.Mode.SRC_IN); } view.setImageDrawable(circle); view.setLayoutParams(getColorBarItemParams()); view.setTag(noteColor); view.setOnClickListener(getOnClickListener()); view.setAdjustViewBounds(true); view.setScaleType(ImageView.ScaleType.FIT_CENTER); colorBar.addView(view); } }
public void update() { mTemperatureTextView.setText(String.format("%d", mDevice.getTemperature())); int activeColor = ResourcesCompat.getColor(getResources(), R.color.colorPrimary, null); int inactiveColor = ResourcesCompat.getColor(getResources(), R.color.colorSecondaryText, null); final Device.Mode mode = mDevice.getMode(); setImageButtonColorFilter(R.id.autoModeButton, mode == Device.Mode.AUTO ? activeColor : inactiveColor); setImageButtonColorFilter(R.id.coolModeButton, mode == Device.Mode.COOL ? activeColor : inactiveColor); setImageButtonColorFilter(R.id.dryModeButton, mode == Device.Mode.DRY ? activeColor : inactiveColor); setImageButtonColorFilter(R.id.fanModeButton, mode == Device.Mode.FAN ? activeColor : inactiveColor); setImageButtonColorFilter(R.id.heatModeButton, mode == Device.Mode.HEAT ? activeColor : inactiveColor); setImageButtonColorFilter(R.id.powerButton, mDevice.isPoweredOn() ? activeColor : inactiveColor); setSwitchChecked(R.id.airSwitch, mDevice.isAirModeEnabled()); setSwitchChecked(R.id.healthSwitch, mDevice.isHealthModeEnabled()); setSwitchChecked(R.id.xfanSwitch, mDevice.isXfanModeEnabled()); setSwitchChecked(R.id.sleepSwitch, mDevice.isSleepModeEnabled()); setSwitchChecked(R.id.quietSwitch, mDevice.isQuietModeEnabled()); setSwitchChecked(R.id.turboSwitch, mDevice.isTurboModeEnabled()); setSwitchChecked(R.id.energySavingSwitch, mDevice.isSavingModeEnabled()); setSwitchChecked(R.id.lightSwitch, mDevice.isLightEnabled()); ((SeekBar) findViewById(R.id.fanSpeedSeekBar)).setProgress(mDevice.getFanSpeed().ordinal()); }
@Override public List<Item> loadInBackground() { items = new ArrayList<>(); for (SearchData data : SEARCHES_DATA) { Drawable icon = context.getDrawable(data.src); if (icon != null){ icon.setTint(ResourcesCompat.getColor(context.getResources(),R.color.color_secondary,null)); } Item search; if (data.packageName == null) { search = new InputSearch(data.label, icon, data.link, data.priority); } else { //Uri gmmIntentUri = Uri.parse("geo:0,0?q=1600 Amphitheatre Parkway, Mountain+View, California"); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setPackage(data.packageName); search = new InputSearch(data.label, icon, intent, data.link, data.priority); } items.add(search); } return items; }
protected void setupView(View view) { if (hasToolbar()) { toolbar.setVisibility(android.view.View.VISIBLE); toolbar.setBackgroundColor( ResourcesCompat.getColor(getResources(), toolbarBackground(), getContext().getTheme())); } else { toolbar.setVisibility(android.view.View.GONE); } swipeRefreshLayout.setOnRefreshListener(this); swipeRefreshLayout.setColorSchemeResources(R.color.colorAccent); recyclerView.setHasFixedSize(true); recyclerView.setAdapter(proteinAdapter = new ProteinAdapter()); recyclerView.setLayoutManager(createLayoutManager()); recyclerViewObserver = new RecyclerViewObserver() .subscribeOn(recyclerView) .setOnLoadMoreListener(() -> { if (!TextUtils.isEmpty(listPresenter.getNextPageUrl())) { listPresenter.fetchMoreData(); } }) .initialize(); }
private Bitmap getIcon(String appPackage) { Bitmap storedIcon = iconCache.get(appPackage); if (storedIcon != null) { return storedIcon; } try { Drawable appIconDrawable = service.getPackageManager().getApplicationIcon(appPackage); Bitmap iconBitmap = BitmapUtils.getBitmap(appIconDrawable); if (iconBitmap != null) { iconBitmap = BitmapUtils.shrinkPreservingRatio(iconBitmap, 64, 64); iconCache.put(appPackage, iconBitmap); return iconBitmap; } } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return BitmapUtils.getBitmap(ResourcesCompat.getDrawable(service.getResources(), android.R.drawable.sym_def_app_icon, null)); }
void bindMovie(Movie movie, int position) { mMovie = movie; positionView.setText(String.valueOf(position + 1)); Drawable placeholder = ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.background_reel, null); Picasso.with(mContext) .load(Constants.TMDB_IMAGE_URL + Constants.POSTER_SIZE_W342 + movie.getPosterPath()) .placeholder(placeholder) .fit().centerCrop() .noFade() .into(posterView); nameView.setText(movie.getTitle()); originalNameView.setText(mContext.getString(R.string.movie_original_name, movie.getOriginalTitle(), StringUtils.getYear(movie.getReleaseDate()))); voteAverageView.setText(String.valueOf(movie.getVoteAverage())); voteCountView.setText(String.valueOf(movie.getVoteCount())); }
void bindTv(TV tv, int position) { mTV = tv; positionView.setText(String.valueOf(position + 1)); Drawable placeholder = ResourcesCompat.getDrawable(mContext.getResources(), R.drawable.background_reel, null); Picasso.with(mContext) .load(Constants.TMDB_IMAGE_URL + Constants.POSTER_SIZE_W342 + tv.getPosterPath()) .placeholder(placeholder) .fit().centerCrop() .noFade() .into(posterView); nameView.setText(tv.getName()); originalNameView.setText(mContext.getString(R.string.movie_original_name, tv.getOriginalName(), StringUtils.getYear(tv.getFirstAirDate()))); voteAverageView.setText(String.valueOf(tv.getVoteAverage())); voteCountView.setText(String.valueOf(tv.getVoteCount())); }
private void setButtonColor() { if (kanboardColors == null || defaultColor == null) return; btnColor.setEnabled(true); Drawable dot = ResourcesCompat.getDrawable(getResources(), R.drawable.shape_circle, null); if (colorId != null && kanboardColors.get(colorId) != null) { //FIXME: it seems that colorId can have a value that is not in the list. Fallback to defaultColor for now. dot.setColorFilter(kanboardColors.get(colorId).getBackground(), PorterDuff.Mode.MULTIPLY); btnColor.setText(Utils.fromHtml(getString(R.string.taskedit_color, kanboardColors.get(colorId).getName()))); } else { dot.setColorFilter(kanboardColors.get(defaultColor).getBackground(), PorterDuff.Mode.MULTIPLY); btnColor.setText(Utils.fromHtml(getString(R.string.taskedit_color, kanboardColors.get(defaultColor).getName()))); } btnColor.setCompoundDrawablesRelativeWithIntrinsicBounds(dot, null, null, null); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_postulaciones_activas); // Setting ViewPager for each Tabs ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager_pa); setupViewPager(viewPager); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerpa); // Adding menu icon to Toolbar ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { VectorDrawableCompat indicator = VectorDrawableCompat.create(getResources(), R.drawable.ic_menu, getTheme()); indicator.setTint(ResourcesCompat.getColor(getResources(),R.color.white,getTheme())); supportActionBar.setHomeAsUpIndicator(indicator); supportActionBar.setDisplayHomeAsUpEnabled(true); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_changas_pendientes); // Setting ViewPager for each Tabs ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager_cp); setupViewPager(viewPager); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerCP); // Adding menu icon to Toolbar setSupportActionBar((Toolbar) findViewById(R.id.toolbar_cp)); if (getSupportActionBar() != null) { VectorDrawableCompat indicator = VectorDrawableCompat.create(getResources(), R.drawable.ic_menu, getTheme()); indicator.setTint(ResourcesCompat.getColor(getResources(),R.color.white,getTheme())); //getSupportActionBar().setHomeAsUpIndicator(indicator); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Mis changas pendientes"); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_changas_activas); // Setting ViewPager for each Tabs ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager_ca); setupViewPager(viewPager); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerCA); // Adding menu icon to Toolbar setSupportActionBar((Toolbar) findViewById(R.id.toolbar_ca)); if (getSupportActionBar() != null) { VectorDrawableCompat indicator = VectorDrawableCompat.create(getResources(), R.drawable.ic_menu, getTheme()); indicator.setTint(ResourcesCompat.getColor(getResources(),R.color.white,getTheme())); //getSupportActionBar().setHomeAsUpIndicator(indicator); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Mis changas"); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_changas_finalizadas); // Setting ViewPager for each Tabs ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager_cf); setupViewPager(viewPager); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerCF); // Adding menu icon to Toolbar setSupportActionBar((Toolbar) findViewById(R.id.toolbar_cf)); if (getSupportActionBar() != null) { VectorDrawableCompat indicator = VectorDrawableCompat.create(getResources(), R.drawable.ic_menu, getTheme()); indicator.setTint(ResourcesCompat.getColor(getResources(),R.color.white,getTheme())); //getSupportActionBar().setHomeAsUpIndicator(indicator); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Mis changas finalizadas"); } }
private void initView() { initIndicator(); initToolbar(); mTvTitle.setText("水印处理"); mColorGridAdapter = new ColorGridAdapter(MarkActivity.this); mColorGridAdapter.setOnColorItemClickListener(mOnColorItemClickListener); mGridColor.setAdapter(mColorGridAdapter); mGridColor.setSelector(ResourcesCompat.getDrawable(getResources(), R.drawable.md_transparent, null)); mEtWaterMarker.addTextChangedListener(mTextWatcher); String defaultText = (String) SPUtils.get(this, KEY_DEFAULT_TEXT, "仅提供XX银行申请XX基金扣帐他用无效"); mEtWaterMarker.setText(defaultText); mSeekBarDirection.setOnProgressChangedListener(mOnProgressChangedListener); mSeekBarAlpha.setOnProgressChangedListener(mOnProgressAlphaChangedListener); mSeekBarSize.setOnProgressChangedListener(mOnProgressSizeChangedListener); int color = (int) SPUtils.get(MarkActivity.this, COLOR_CHOOSE, Color.parseColor("#FF1744")); getPresenter().setWaterMask(mEtWaterMarker.getText().toString(), 45, 255, color, 18); }
public MapClusterOptionsProvider(Resources resources) { int poiSize = resources.getDimensionPixelSize(R.dimen.map_poi_size); Drawable d = ResourcesCompat.getDrawable(resources, R.drawable.ic_wrapper_poi_cluster, null); d.setBounds(0, 0, poiSize, poiSize); Bitmap bitmap = Bitmap.createBitmap(poiSize, poiSize, Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); d.draw(canvas); baseBitmap = bitmap; littleFontPaint.setColor(Color.BLACK); littleFontPaint.setTextAlign(Align.CENTER); littleFontPaint.setFakeBoldText(true); littleFontPaint.setTextSize(resources.getDimension(R.dimen.map_marker_cluster_text_size_small)); bigFontPaint.setColor(Color.BLACK); bigFontPaint.setTextAlign(Align.CENTER); bigFontPaint.setFakeBoldText(true); bigFontPaint.setTextSize(resources.getDimension(R.dimen.map_marker_cluster_text_size_big)); }
@Override public void onFileDownloaded(final String filePath) { setBottomNoticeMessage(getString(R.string.complete)); mDownloadFile.setEnabled(true); mDownloadFile.setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable .ic_file_download_24dp, null)); mOpenFile = true; mFilePath = filePath; mBottomNoticeLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openFile(mFilePath); mOpenFile = false; mBottomNoticeLayout.setOnClickListener(null); hideBottomNotice(); } }); }
private void makeTextView() { loadTextViewStyleAttributes(); textView.setText(text); if (textColor != 0) { textView.setTextColor(textColor); } if (textSize > 0) { textView.setTextSize(isTextSizeFromStyle ? 0 : TypedValue.COMPLEX_UNIT_SP, textSize); } if (textBold && typeface == null) { textView.setTypeface(Typeface.create(context.getString(R.string.default_font), Typeface.BOLD)); } else if (textBold) { textView.setTypeface(Typeface.create(typeface, Typeface.BOLD)); } else if (typeface != null) { textView.setTypeface(typeface); //TODO THIS CHECK IS DEPRECATED AND WILL BE DELETED SOON } else if (fontId > 0) { textView.setTypeface(ResourcesCompat.getFont(context, fontId)); } }
@SuppressWarnings("inlineValue") public static TextView setToolbarTypeface(Toolbar toolbar) { for (int i = 0; i < toolbar.getChildCount(); i++) { View view = toolbar.getChildAt(i); if (view instanceof TextView) { TextView textView = (TextView) view; if (textView.getText().equals(toolbar.getTitle())) { Typeface typeface = ResourcesCompat.getFont(toolbar.getContext(), R.font.roboto_mono_regular); textView.setTypeface(typeface); return textView; } } } return null; }
public ContactAdapter(Context context, List<Contact> contacts, ContactSelectionListener listener, String selectedIconHex, byte[] selectedDrawable) { super(contacts); this.mMaterialColors = context.getResources().getIntArray(R.array.colors); this.mContacts = contacts; this.mSelection = new ArrayList<>(); this.selectedColor = ResourcesCompat.getColor(context.getResources(), R.color.color_7,null); this.subtitleColor= ResourcesCompat.getColor(context.getResources(), R.color.subtitle,null); this.mListener = listener; if(selectedIconHex == null) this.selectedIconColor = ResourcesCompat.getColor(context.getResources(),R.color.materialGreen, null); else this.selectedIconColor = Color.parseColor(selectedIconHex); if(selectedDrawable != null) this.selectedDrawable = PickerUtils.extractDrawable(selectedDrawable); else this.selectedDrawable = PickerUtils.extractDrawable(PickerUtils.sendDrawable(context.getResources(),R.drawable.ic_done)); }
@Override protected void onCreate(Bundle savedInstanceState) { //textshow = (TextView) findViewById(R.id.textView1); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Resources resources = getResources(); final Resources.Theme theme = getTheme(); mColorHearing = ResourcesCompat.getColor(resources, R.color.status_hearing, theme); mColorNotHearing = ResourcesCompat.getColor(resources, R.color.status_not_hearing, theme); //setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); mStatus = (TextView) findViewById(R.id.status); mText = (TextView) findViewById(R.id.textView1); mRespond= (TextView) findViewById(R.id.textView3); mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); final ArrayList<String> results = savedInstanceState == null ? null : savedInstanceState.getStringArrayList(STATE_RESULTS); mAdapter = new ResultAdapter(results); mRecyclerView.setAdapter(mAdapter); /* outputFile = Environment.getExternalStorageDirectory(). getAbsolutePath() + "/audio.raw";*/ }
protected final Drawable getListSelector() { if (builder.listSelector != 0) return ResourcesCompat.getDrawable(builder.context.getResources(), builder.listSelector, null); final Drawable d = DialogUtils.resolveDrawable(builder.context, R.attr.md_list_selector); if (d != null) return d; return DialogUtils.resolveDrawable(getContext(), R.attr.md_list_selector); }
public static int getColorFromScore(float score) { int color = ResourcesCompat.getColor(resources, R.color.mediumGray, null); if (score == 0) { color = ResourcesCompat.getColor(resources, R.color.mediumGray, null); } else if (score > 0 && score <= 2) { color = ResourcesCompat.getColor(resources, R.color.red, null); } else if (score > 2 && score < 3.5) { color = ResourcesCompat.getColor(resources, R.color.yellow, null); } else if (score >= 3.5) { color = ResourcesCompat.getColor(resources, R.color.green, null); } return color; }
/** * Demonstrates converting any Drawable to an Icon, for use as a marker icon. */ public static Icon drawableToIcon(@NonNull Context context, @DrawableRes int id) { Drawable vectorDrawable = ResourcesCompat.getDrawable(context.getResources(), id, context.getTheme()); Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); vectorDrawable.draw(canvas); return IconFactory.getInstance(context).fromBitmap(bitmap); }
@Override public void onBindViewHolder(ImageViewHolder holder, int position) { Resources resources = mContext.getResources(); if (mImageDocuments.size() > position) { Glide.with(mContext) .load(mImageDocuments.get(position).mAbsolutePath) .placeholder(R.drawable.cat_placeholder) .into(holder.mImageView); holder.mTextView.setText(String.valueOf(position + 1)); } else { holder.mImageView.setImageDrawable( ResourcesCompat.getDrawable(resources, R.drawable.cat_placeholder, null)); } }
@Override public List<Item> loadInBackground() { items = new ArrayList<>(); Drawable icon = context.getDrawable(R.drawable.ic_settings_black_24dp); if (icon != null){ icon.setTint(ResourcesCompat.getColor(context.getResources(),R.color.color_secondary,null)); } for (String[] action : SETTINGS_ACTION) { Intent intent = new Intent(action[0]); DeviceSetting setting = new DeviceSetting(action[0],action[1],icon, intent); items.add(setting); } return items; }
private Typeface getDefaultTypeface(Context context, @FontRes int fontFamily) { if (fontFamily == 0) { fontFamily = CalligraphyConfig.get().getFontFamily(); } if (fontFamily != 0) { return ResourcesCompat.getFont(context, fontFamily); } return null; }
private void cancelTimer() { Activity activity = getActivity(); if (isAdded() && activity != null) { minuteServiceRunning = false; countDownTimer.cancel(); int restTime = Integer.parseInt(progresstv.getText().toString()); seekbar.setMax(settingsprefs.getInt("maxminutes", 60)); if (restTime > seekbar.getMax()) { restTime = settingsprefs.getInt("lastMinuteShutdownDelay", seekbar.getMax() / 2); progresstv.setText(String.valueOf(restTime)); } seekbar.setProgress(restTime); start.setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.play, null)); extend.startAnimation(fab_out); extend.setVisibility(View.GONE); timelayout.startAnimation(zoom_out); handler.postDelayed(new Runnable() { @Override public void run() { seekbar.startAnimation(fade_in); seekbar.setVisibility(View.VISIBLE); } }, 200); } }
private void setTabFont(int textViewId, @FontRes int font, int position) { if (font == 0) return; Typeface typeface = ResourcesCompat.getFont(getContext(), font); setTabFont(textViewId, typeface, position); }
private void initStartButton() { final Drawable pinkArrow = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_navigate_next_accent, null); if (pinkArrow != null) { pinkArrow.setBounds(0, 0, 60, 60); startButton.setCompoundDrawables(null, null, pinkArrow, null); } }
public int getImportanceColor() { switch (importance) { case 0: return ResourcesCompat.getColor(getResources(), R.color.colorTimeLeft0, null); case 1: return ResourcesCompat.getColor(getResources(), R.color.colorTimeLeft1, null); case 2: return ResourcesCompat.getColor(getResources(), R.color.colorTimeLeft2, null); case 3: return ResourcesCompat.getColor(getResources(), R.color.colorTimeLeft3, null); default: return ResourcesCompat.getColor(getResources(), R.color.colorTimeLeft4, null); } }
final private int getColorByImportance(int importance) { switch (importance) { case 0: return ResourcesCompat.getColor(getResources(), R.color.colorHabit0, null); case 1: return ResourcesCompat.getColor(getResources(), R.color.colorHabit1, null); case 2: return ResourcesCompat.getColor(getResources(), R.color.colorHabit2, null); case 3: return ResourcesCompat.getColor(getResources(), R.color.colorHabit3, null); default: return ResourcesCompat.getColor(getResources(), R.color.colorHabit4, null); } }
final private int getColorByImportance(int importance) { switch (importance) { case 0: return ResourcesCompat.getColor(getResources(), R.color.colorTask0, null); case 1: return ResourcesCompat.getColor(getResources(), R.color.colorTask1, null); case 2: return ResourcesCompat.getColor(getResources(), R.color.colorTask2, null); case 3: return ResourcesCompat.getColor(getResources(), R.color.colorTask3, null); default: return ResourcesCompat.getColor(getResources(), R.color.colorTask4, null); } }
private void setThemeBackground(View view) { TypedValue a = new TypedValue(); getActivity().getTheme().resolveAttribute(android.R.attr.windowBackground, a, true); if (a.type >= TypedValue.TYPE_FIRST_COLOR_INT && a.type <= TypedValue.TYPE_LAST_COLOR_INT) { view.setBackgroundColor(a.data); } else { try { Drawable d = ResourcesCompat.getDrawable(getActivity().getResources(), a.resourceId, getActivity().getTheme()); ViewCompat.setBackground(view, d); } catch (Resources.NotFoundException ignore) { } } }
/** * Description: Initialises the Map and sets initial options such as: * Zoom levels and controls * Compass * ScaleBar * Cluster Pin colors * Location update settings */ private void setUpMapIfNeeded() { // Check if we were successful in obtaining the map. mMap.setBuiltInZoomControls(true); mMap.setMultiTouchControls(true); mMap.setMinZoomLevel(3); mMap.setMaxZoomLevel(19); // Latest OSM can go to 21! mMap.getTileProvider().createTileCache(); mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this), mMap); ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(this); mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10); mScaleBarOverlay.setCentred(true); // Sets cluster pin color mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(MapViewerOsmDroid.this); //BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange); BitmapDrawable mapPinDrawable = (BitmapDrawable) ResourcesCompat.getDrawable(getResources(),R.drawable.ic_map_pin_orange, null); mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap()); GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(MapViewerOsmDroid.this.getBaseContext()); gpsMyLocationProvider.setLocationUpdateMinDistance(100); // [m] // Set the minimum distance for location updates gpsMyLocationProvider.setLocationUpdateMinTime(10000); // [ms] // Set the minimum time interval for location updates mMyLocationOverlay = new MyLocationNewOverlay(MapViewerOsmDroid.this.getBaseContext(), gpsMyLocationProvider, mMap); mMyLocationOverlay.setDrawAccuracyEnabled(true); mMap.getOverlays().add(mCellTowerGridMarkerClusterer); mMap.getOverlays().add(mMyLocationOverlay); mMap.getOverlays().add(mCompassOverlay); mMap.getOverlays().add(mScaleBarOverlay); }
@Override public void setNavigationIconTintColor(@ColorRes int resId) { if (!hasToolbar()) return; Drawable navigationIcon = toolbar.getNavigationIcon(); if (navigationIcon == null) return; navigationIcon.setTint(ResourcesCompat.getColor(getResources(), resId, getContext().getTheme())); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp); toolbar.getNavigationIcon().setColorFilter(ResourcesCompat.getColor(getResources(), R.color.icon_grey, getActivity().getTheme()), PorterDuff.Mode.SRC_ATOP); toolbar.setNavigationOnClickListener(v -> getActivity().onBackPressed()); presenter.start(); }
void bindTv(TV tv) { mTV = tv; tvTitle.setText(tv.getName()); Drawable placeholder = ResourcesCompat.getDrawable( mContext.getResources(), R.drawable.disk_reel, null); Picasso.with(mContext) .load(TMDB_IMAGE_URL + SIZE_W342 + tv.getPosterPath()) .placeholder(placeholder) .fit().centerCrop() .noFade() .into(tvPoster); }
void bindMovie(PersonPopular person) { this.person = person; name.setText(person.getName()); Drawable placeholder = ResourcesCompat.getDrawable( mContext.getResources(), R.drawable.disk_reel, null); Picasso.with(mContext) .load(TMDB_IMAGE_URL + SIZE_W342 + person.getProfilePath()) .placeholder(placeholder) .fit().centerCrop() .noFade() .into(personPoster); }
void bindMovie(Movie movie) { mMovie = movie; movieTitle.setText(movie.getTitle()); Drawable placeholder = ResourcesCompat.getDrawable( mContext.getResources(), R.drawable.disk_reel, null); Picasso.with(mContext) .load(TMDB_IMAGE_URL + SIZE_W342 + movie.getPosterPath()) .placeholder(placeholder) .fit().centerCrop() .noFade() .into(moviePoster); }