@Override protected void initFab(View rootView) { FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fabbutton); fab.setVisibility(View.GONE); } }
public void resetData(){ fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_play)); refresh.setVisibility(View.INVISIBLE); time.stop(); maxSpeed.setText(""); averageSpeed.setText(""); distance.setText(""); time.setText("00:00:00"); data = new Data(onGpsServiceUpdate); }
@Override public void onLocationChanged(Location location) { if (location.hasAccuracy()) { SpannableString s = new SpannableString(String.format("%.0f", location.getAccuracy()) + "m"); s.setSpan(new RelativeSizeSpan(0.75f), s.length()-1, s.length(), 0); accuracy.setText(s); if (firstfix){ status.setText(""); fab.setVisibility(View.VISIBLE); if (!data.isRunning() && !maxSpeed.getText().equals("")) { refresh.setVisibility(View.VISIBLE); } firstfix = false; } }else{ firstfix = true; } if (location.hasSpeed()) { progressBarCircularIndeterminate.setVisibility(View.GONE); String speed = String.format(Locale.ENGLISH, "%.0f", location.getSpeed() * 3.6) + "km/h"; if (sharedPreferences.getBoolean("miles_per_hour", false)) { // Convert to MPH speed = String.format(Locale.ENGLISH, "%.0f", location.getSpeed() * 3.6 * 0.62137119) + "mi/h"; } SpannableString s = new SpannableString(speed); s.setSpan(new RelativeSizeSpan(0.25f), s.length()-4, s.length(), 0); currentSpeed.setText(s); } }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Loader<T> loader = getLoaderManager().getLoader(NEW_MSG_LOADER_ID); if (loader != null) { getLoaderManager().initLoader(NEW_MSG_LOADER_ID, null, msgAsyncTaskLoaderCallback); } loader = getLoaderManager().getLoader(OLD_MSG_LOADER_ID); if (loader != null) { getLoaderManager().initLoader(OLD_MSG_LOADER_ID, null, msgAsyncTaskLoaderCallback); } if (getActivity() instanceof MainTimeLineActivity) { mFab.setVisibility(View.VISIBLE); } else { if (mFab != null) { mFab.setVisibility(View.GONE); } } }
status.setText(""); stopService(new Intent(getBaseContext(), GpsServices.class)); fab.setVisibility(View.INVISIBLE); refresh.setVisibility(View.INVISIBLE); accuracy.setText(""); status.setText(getResources().getString(R.string.waiting_for_fix));
public void onFabClick(View v){ if (!data.isRunning()) { fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_pause)); data.setRunning(true); time.setBase(SystemClock.elapsedRealtime() - data.getTime()); time.start(); data.setFirstTime(true); startService(new Intent(getBaseContext(), GpsServices.class)); refresh.setVisibility(View.INVISIBLE); }else{ fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_play)); data.setRunning(false); status.setText(""); stopService(new Intent(getBaseContext(), GpsServices.class)); refresh.setVisibility(View.VISIBLE); } }
fab.setVisibility(View.INVISIBLE); refresh.setVisibility(View.INVISIBLE);