Java Code Examples for com.google.android.material.floatingactionbutton.FloatingActionButton#setImageDrawable()
The following examples show how to use
com.google.android.material.floatingactionbutton.FloatingActionButton#setImageDrawable() .
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: Bindings.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 5 votes |
@BindingAdapter("searchOrAdd") public static void setFabIcoin(FloatingActionButton fab, boolean needSearch) { Drawable drawable; if (needSearch) { drawable = AppCompatResources.getDrawable(fab.getContext(), R.drawable.ic_search); } else { drawable = AppCompatResources.getDrawable(fab.getContext(), R.drawable.ic_add_accent); } fab.setColorFilter(Color.WHITE); fab.setImageDrawable(drawable); }
Example 2
Source File: CrashReport.java From trekarta with GNU General Public License v3.0 | 5 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FloatingActionButton floatingButton = mFragmentHolder.enableActionButton(); floatingButton.setImageDrawable(getContext().getDrawable(R.drawable.ic_send)); floatingButton.setOnClickListener(v -> { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"}); File file = MapTrek.getApplication().getExceptionLog(); intent.putExtra(Intent.EXTRA_STREAM, ExportProvider.getUriForFile(getContext(), file)); intent.setType("vnd.android.cursor.dir/email"); intent.putExtra(Intent.EXTRA_SUBJECT, "MapTrek crash report"); StringBuilder text = new StringBuilder(); text.append("Device : ").append(Build.DEVICE); text.append("\nBrand : ").append(Build.BRAND); text.append("\nModel : ").append(Build.MODEL); text.append("\nProduct : ").append(Build.PRODUCT); text.append("\nLocale : ").append(Locale.getDefault().toString()); text.append("\nBuild : ").append(Build.DISPLAY); text.append("\nVersion : ").append(Build.VERSION.RELEASE); try { PackageInfo info = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); if (info != null) { text.append("\nApk Version : ").append(info.versionCode).append(" ").append(info.versionName); } } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } intent.putExtra(Intent.EXTRA_TEXT, text.toString()); startActivity(Intent.createChooser(intent, getString(R.string.send_crash_report))); mFragmentHolder.disableActionButton(); mFragmentHolder.popCurrent(); }); }
Example 3
Source File: BaseMapDownload.java From trekarta with GNU General Public License v3.0 | 5 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FloatingActionButton floatingButton = mFragmentHolder.enableActionButton(); floatingButton.setImageDrawable(getContext().getDrawable(R.drawable.ic_file_download)); floatingButton.setOnClickListener(v -> { mMapIndex.downloadBaseMap(); mFragmentHolder.disableActionButton(); mFragmentHolder.popCurrent(); }); }
Example 4
Source File: MarkerInformation.java From trekarta with GNU General Public License v3.0 | 5 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mLatitude = getArguments().getDouble(ARG_LATITUDE); mLongitude = getArguments().getDouble(ARG_LONGITUDE); mName = getArguments().getString(ARG_NAME); if (savedInstanceState != null) { mLatitude = savedInstanceState.getDouble(ARG_LATITUDE); mLongitude = savedInstanceState.getDouble(ARG_LONGITUDE); mName = savedInstanceState.getString(ARG_NAME); } String name; if (mName != null && !"".equals(mName)) name = mName; else name = StringFormatter.coordinates(" ", mLatitude, mLongitude); //noinspection ConstantConditions ((TextView) getView().findViewById(R.id.name)).setText(name); final GeoPoint point = new GeoPoint(mLatitude, mLongitude); mMapHolder.showMarker(point, name, false); FloatingActionButton floatingButton = mFragmentHolder.enableActionButton(); floatingButton.setImageDrawable(getContext().getDrawable(R.drawable.ic_pin_drop)); floatingButton.setOnClickListener(v -> { String name1; if (mName != null && !"".equals(mName)) name1 = mName; else name1 = getString(R.string.place_name, Configuration.getPointsCounter()); mListener.onWaypointCreate(point, name1, true, true); mFragmentHolder.disableActionButton(); mFragmentHolder.popCurrent(); }); }