changed the statistics icon to a more space saving one + some clean-up

This commit is contained in:
y20k 2017-10-16 10:20:59 +02:00
parent 44c7829ec3
commit 179a3f8558
9 changed files with 50 additions and 25 deletions

View file

@ -414,6 +414,7 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
mFloatingActionButtonSubMenu1.setOnClickListener(new View.OnClickListener() { mFloatingActionButtonSubMenu1.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
// todo check -> may produce NullPointerException
MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP); MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP);
mainActivityMapFragment.onActivityResult(RESULT_SAVE_DIALOG, Activity.RESULT_OK, getIntent()); mainActivityMapFragment.onActivityResult(RESULT_SAVE_DIALOG, Activity.RESULT_OK, getIntent());
handleStateAfterSave(); handleStateAfterSave();
@ -474,7 +475,7 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
mFloatingActionButtonState = FAB_STATE_RECORDING; mFloatingActionButtonState = FAB_STATE_RECORDING;
setFloatingActionButtonState(); setFloatingActionButtonState();
// get last location from MainActivity Fragment // get last location from MainActivity Fragment // todo check -> may produce NullPointerException
MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP); MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP);
Location lastLocation = mainActivityMapFragment.getCurrentBestLocation(); Location lastLocation = mainActivityMapFragment.getCurrentBestLocation();
@ -525,7 +526,7 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
} }
// update tracking state in MainActivityMapFragment // update tracking state in MainActivityMapFragment // todo check -> may produce NullPointerException
MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP); MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP);
mainActivityMapFragment.setTrackingState(mTrackerServiceRunning); mainActivityMapFragment.setTrackingState(mTrackerServiceRunning);
} }
@ -660,7 +661,7 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
mFloatingActionButtonState = FAB_STATE_SAVE; mFloatingActionButtonState = FAB_STATE_SAVE;
setFloatingActionButtonState(); setFloatingActionButtonState();
// pass tracking state to MainActivityMapFragment // pass tracking state to MainActivityMapFragment // todo check -> may produce NullPointerException
MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP); MainActivityMapFragment mainActivityMapFragment = (MainActivityMapFragment) mSectionsPagerAdapter.getFragment(FRAGMENT_ID_MAP);
mainActivityMapFragment.setTrackingState(false); mainActivityMapFragment.setTrackingState(false);
} }

View file

@ -36,6 +36,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
@ -81,6 +82,8 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
private LinearLayout mTrackManagementLayout; private LinearLayout mTrackManagementLayout;
private Spinner mDropdown; private Spinner mDropdown;
private View mStatisticsSheet; private View mStatisticsSheet;
private ImageView mStatisticsIcon;
private TextView mStatisticsHeadline;
private TextView mDistanceView; private TextView mDistanceView;
private TextView mStepsView; private TextView mStepsView;
private TextView mWaypointsView; private TextView mWaypointsView;
@ -189,6 +192,8 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
// get views for statistics sheet // get views for statistics sheet
View statisticsView = mRootView.findViewById(R.id.statistics_view); View statisticsView = mRootView.findViewById(R.id.statistics_view);
mStatisticsIcon = mRootView.findViewById(R.id.statistics_icon);
mStatisticsHeadline = mRootView.findViewById(R.id.statistics_headline);
mStatisticsSheet = mRootView.findViewById(R.id.statistics_sheet); mStatisticsSheet = mRootView.findViewById(R.id.statistics_sheet);
mDistanceView = (TextView) mRootView.findViewById(R.id.statistics_data_distance); mDistanceView = (TextView) mRootView.findViewById(R.id.statistics_data_distance);
mStepsView = (TextView) mRootView.findViewById(R.id.statistics_data_steps); mStepsView = (TextView) mRootView.findViewById(R.id.statistics_data_steps);
@ -427,10 +432,16 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
case BottomSheetBehavior.STATE_EXPANDED: case BottomSheetBehavior.STATE_EXPANDED:
// statistics sheet expanded // statistics sheet expanded
mTrackManagementLayout.setVisibility(View.INVISIBLE); mTrackManagementLayout.setVisibility(View.INVISIBLE);
// mStatisticsSheet.setBackgroundColor(ContextCompat.getColor(mActivity, R.color.trackbook_blue_85percent));
// mStatisticsIcon.setBackgroundResource(R.drawable.ic_statistics_white_48dp);
// mStatisticsHeadline.setVisibility(View.VISIBLE);
break; break;
case BottomSheetBehavior.STATE_COLLAPSED: case BottomSheetBehavior.STATE_COLLAPSED:
// statistics sheet collapsed // statistics sheet collapsed
mTrackManagementLayout.setVisibility(View.VISIBLE); mTrackManagementLayout.setVisibility(View.VISIBLE);
// mStatisticsSheet.setBackgroundColor(ContextCompat.getColor(mActivity, R.color.trackbook_transparent));
// mStatisticsIcon.setBackgroundResource(R.drawable.ic_statistics_blue_48dp);
// mStatisticsHeadline.setVisibility(View.INVISIBLE);
mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); mStatisticsSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
break; break;
case BottomSheetBehavior.STATE_HIDDEN: case BottomSheetBehavior.STATE_HIDDEN:
@ -449,7 +460,15 @@ public class MainActivityTrackFragment extends Fragment implements AdapterView.O
} else { } else {
mTrackManagementLayout.setVisibility(View.INVISIBLE); mTrackManagementLayout.setVisibility(View.INVISIBLE);
} }
// if (slideOffset < 0.125f) {
// mStatisticsSheet.setBackgroundColor(ContextCompat.getColor(mActivity, R.color.trackbook_transparent));
// mStatisticsIcon.setBackgroundResource(R.drawable.ic_statistics_blue_48dp);
// mStatisticsHeadline.setVisibility(View.INVISIBLE);
// } else {
// mStatisticsSheet.setBackgroundColor(ContextCompat.getColor(mActivity, R.color.trackbook_blue_85percent));
// mStatisticsIcon.setBackgroundResource(R.drawable.ic_statistics_white_48dp);
// mStatisticsHeadline.setVisibility(View.VISIBLE);
// }
} }
}; };
} }

View file

@ -173,7 +173,7 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
// stopFindingLocation(); // stopFindingLocation();
// mSensorManager.unregisterListener(this); // mSensorManager.unregisterListener(this);
// todo describe // remove TrackerService from foreground state
stopForeground(true); stopForeground(true);
super.onDestroy(); super.onDestroy();
@ -297,7 +297,7 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
// disable content observer for changes in System Settings // disable content observer for changes in System Settings
this.getContentResolver().unregisterContentObserver(mSettingsContentObserver); this.getContentResolver().unregisterContentObserver(mSettingsContentObserver);
// todo describe // remove TrackerService from foreground state
stopForeground(false); stopForeground(false);
} }

View file

@ -71,7 +71,7 @@ public class StorageHelper implements TrackbookKeys {
mFolder.mkdirs(); mFolder.mkdirs();
} }
// create temp file object // create temp file object // todo check -> may produce NullPointerException
mTempFile = new File(mFolder.toString() + "/" + FILE_NAME_TEMP + FILE_TYPE_TRACKBOOK_EXTENSION); mTempFile = new File(mFolder.toString() + "/" + FILE_NAME_TEMP + FILE_TYPE_TRACKBOOK_EXTENSION);
// delete old track - exclude temp file // delete old track - exclude temp file

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/trackbook_white"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
</vector>

View file

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/trackbook_white"
android:pathData="M19,3L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM9,17L7,17v-7h2v7zM13,17h-2L11,7h2v10zM17,17h-2v-4h2v4z"/>
</vector>

View file

@ -76,7 +76,7 @@
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@color/trackbook_blue_85percent" android:background="@color/trackbook_blue_85percent"
app:behavior_hideable="true" app:behavior_hideable="true"
app:behavior_peekHeight="132dp" app:behavior_peekHeight="112dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"> app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
@ -99,9 +99,10 @@
android:paddingEnd="@dimen/activity_horizontal_margin" android:paddingEnd="@dimen/activity_horizontal_margin"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/statistics_headline"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:textAppearance="@android:style/TextAppearance.Large.Inverse" android:textAppearance="@android:style/TextAppearance.Medium.Inverse"
android:layout_weight="1" android:layout_weight="1"
android:gravity="start|center" android:gravity="start|center"
android:textStyle="bold" android:textStyle="bold"
@ -109,11 +110,12 @@
android:text="@string/statistics_sheet_h1_statistics" android:text="@string/statistics_sheet_h1_statistics"
android:contentDescription="@string/descr_statistics_sheet_headline" /> android:contentDescription="@string/descr_statistics_sheet_headline" />
<ImageView <ImageView
android:id="@+id/statistics_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="end|center" android:gravity="end|center"
android:background="@drawable/ic_statistics_white_48dp" android:contentDescription="@string/descr_statistics_sheet_icon"
android:contentDescription="@string/descr_statistics_sheet_icon" /> app:srcCompat="@drawable/ic_info_white_24dp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View file

@ -18,4 +18,7 @@
<color name="trackbook_grey">#FF455a64</color> <color name="trackbook_grey">#FF455a64</color>
<color name="trackbook_grey_85percent">#D9455a64</color> <color name="trackbook_grey_85percent">#D9455a64</color>
<color name="trackbook_transparent">#00000000</color>
</resources> </resources>

View file

@ -21,16 +21,16 @@ allprojects {
} }
project.ext { project.ext {
applicationId = 'org.y20k.trackbook' applicationId = 'org.y20k.trackbook'
versionCode = 14 versionCode = 15
versionName = '1.0.7' versionName = '1.0.8'
minSdkVersion = 22 minSdkVersion = 22
compileSdkVersion = 26 compileSdkVersion = 26
targetSdkVersion = 26 targetSdkVersion = 26
buildToolsVersion = '26.0.1' buildToolsVersion = '26.0.2'
supportLibraryVersion = '26.0.1' supportLibraryVersion = '26.1.0'
osmdroidVersion = '5.6.5' osmdroidVersion = '5.6.5'
gsonVersion = '2.8.1' gsonVersion = '2.8.2'
} }
} }