some clean-up
This commit is contained in:
parent
90273d0d0d
commit
da82360625
9 changed files with 67 additions and 45 deletions
|
@ -70,8 +70,6 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
private FloatingActionButton mFloatingActionButton;
|
private FloatingActionButton mFloatingActionButton;
|
||||||
private MainActivityMapFragment mMainActivityMapFragment;
|
private MainActivityMapFragment mMainActivityMapFragment;
|
||||||
private BroadcastReceiver mTrackingStoppedReceiver;
|
private BroadcastReceiver mTrackingStoppedReceiver;
|
||||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
|
||||||
private ViewPager mViewPager;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -277,14 +275,14 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
/* BEGIN NEW STUFF */
|
/* BEGIN NEW STUFF */
|
||||||
// Create the adapter that will return a fragment for each of the three
|
// Create the adapter that will return a fragment for each of the three
|
||||||
// primary sections of the activity.
|
// primary sections of the activity.
|
||||||
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
||||||
|
|
||||||
// Set up the ViewPager with the sections adapter.
|
// Set up the ViewPager with the sections adapter.
|
||||||
mViewPager = (ViewPager) findViewById(R.id.container);
|
ViewPager viewPager = (ViewPager) findViewById(R.id.container);
|
||||||
mViewPager.setAdapter(mSectionsPagerAdapter);
|
viewPager.setAdapter(sectionsPagerAdapter);
|
||||||
|
|
||||||
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
|
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
|
||||||
tabLayout.setupWithViewPager(mViewPager);
|
tabLayout.setupWithViewPager(viewPager);
|
||||||
/* END NEW STUFF */
|
/* END NEW STUFF */
|
||||||
|
|
||||||
// get reference to fragment
|
// get reference to fragment
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* MainActivityMapFragment.java
|
* MainActivityMapFragment.java
|
||||||
* Implements the main fragment of the main activity
|
* Implements the map fragment used in the map tab of the main activity
|
||||||
* This fragment displays a map using osmdroid
|
* This fragment displays a map using osmdroid
|
||||||
*
|
*
|
||||||
* This file is part of
|
* This file is part of
|
||||||
|
@ -557,7 +557,7 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
toggleLocationOffBar();
|
toggleLocationOffBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
// start / stop perliminary tracking
|
// start / stop preliminary tracking
|
||||||
if (!mLocationSystemSetting) {
|
if (!mLocationSystemSetting) {
|
||||||
stopPreliminaryTracking();
|
stopPreliminaryTracking();
|
||||||
} else if (!mTrackerServiceRunning && mFragmentVisible) {
|
} else if (!mTrackerServiceRunning && mFragmentVisible) {
|
||||||
|
|
|
@ -1,3 +1,19 @@
|
||||||
|
/**
|
||||||
|
* MainActivityTrackFragment.java
|
||||||
|
* Implements the track fragment used in the track tab of the main activity
|
||||||
|
* This fragment displays a saved track
|
||||||
|
*
|
||||||
|
* This file is part of
|
||||||
|
* TRACKBOOK - Movement Recorder for Android
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 - Y20K.org
|
||||||
|
* Licensed under the MIT-License
|
||||||
|
* http://opensource.org/licenses/MIT
|
||||||
|
*
|
||||||
|
* Trackbook uses osmdroid - OpenStreetMap-Tools for Android
|
||||||
|
* https://github.com/osmdroid/osmdroid
|
||||||
|
*/
|
||||||
|
|
||||||
package org.y20k.trackbook;
|
package org.y20k.trackbook;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -7,11 +23,15 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by solaris on 16/09/16.
|
* MainActivityTrackFragment class
|
||||||
*/
|
*/
|
||||||
public class MainActivityTrackFragment extends Fragment {
|
public class MainActivityTrackFragment extends Fragment {
|
||||||
|
|
||||||
|
/* Define log tag */
|
||||||
|
private static final String LOG_TAG = MainActivityTrackFragment.class.getSimpleName();
|
||||||
|
|
||||||
|
|
||||||
/* Main class variables */
|
/* Main class variables */
|
||||||
private View mRootView;
|
private View mRootView;
|
||||||
|
|
|
@ -83,12 +83,6 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
|
||||||
// create content observer for changes in System Settings
|
// create content observer for changes in System Settings
|
||||||
mSettingsContentObserver = new SettingsContentObserver( new Handler());
|
mSettingsContentObserver = new SettingsContentObserver( new Handler());
|
||||||
|
|
||||||
// checking for empty intent
|
|
||||||
if (intent == null) {
|
|
||||||
LogHelper.v(LOG_TAG, "Null-Intent received. Stopping self.");
|
|
||||||
stopSelf();
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if user did turn off location in device settings
|
// check if user did turn off location in device settings
|
||||||
if (!mLocationSystemSetting) {
|
if (!mLocationSystemSetting) {
|
||||||
LogHelper.v(LOG_TAG, "Location Setting is turned off.");
|
LogHelper.v(LOG_TAG, "Location Setting is turned off.");
|
||||||
|
@ -97,11 +91,16 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// checking for empty intent
|
||||||
|
if (intent == null) {
|
||||||
|
LogHelper.v(LOG_TAG, "Null-Intent received. Stopping self.");
|
||||||
|
stopSelf();
|
||||||
|
}
|
||||||
|
|
||||||
// ACTION START
|
// ACTION START
|
||||||
else if (intent.getAction().equals(ACTION_START) && mLocationSystemSetting) {
|
else if (intent.getAction().equals(ACTION_START) && mLocationSystemSetting) {
|
||||||
startTracking(intent);
|
startTracking(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACTION STOP
|
// ACTION STOP
|
||||||
else if (intent.getAction().equals(ACTION_STOP) || !mLocationSystemSetting) {
|
else if (intent.getAction().equals(ACTION_STOP) || !mLocationSystemSetting) {
|
||||||
|
|
|
@ -155,11 +155,11 @@ public class NotificationHelper implements TrackbookKeys {
|
||||||
int width = (int) resources.getDimension(android.R.dimen.notification_large_icon_width);
|
int width = (int) resources.getDimension(android.R.dimen.notification_large_icon_width);
|
||||||
|
|
||||||
Bitmap bitmap;
|
Bitmap bitmap;
|
||||||
if (tracking) {
|
if (tracking) {
|
||||||
bitmap = getBitmap(R.drawable.ic_notification_large_tracking_48dp);
|
bitmap = getBitmap(R.drawable.ic_notification_large_tracking_48dp);
|
||||||
} else {
|
} else {
|
||||||
bitmap = getBitmap(R.drawable.ic_notification_large_not_tracking_48dp);
|
bitmap = getBitmap(R.drawable.ic_notification_large_not_tracking_48dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Bitmap.createScaledBitmap(bitmap, width, height, false);
|
return Bitmap.createScaledBitmap(bitmap, width, height, false);
|
||||||
}
|
}
|
||||||
|
@ -179,6 +179,4 @@ public class NotificationHelper implements TrackbookKeys {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,35 +26,37 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/infosheet_about_h2_recorder"
|
android:text="@string/infosheet_about_h2_recorder"
|
||||||
android:textAppearance="@android:style/TextAppearance.Medium"
|
android:textAppearance="@android:style/TextAppearance.Medium"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
|
android:layout_marginTop="4dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/infosheet_about_h3_version"
|
android:text="@string/infosheet_about_h3_version"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small"
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold"
|
||||||
|
android:layout_marginTop="8dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/infosheet_about_p_bare"
|
android:text="@string/infosheet_about_p_bare"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small"
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
android:layout_marginTop="4dp" />
|
android:layout_marginTop="8dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/infosheet_about_p_free"
|
android:text="@string/infosheet_about_p_free"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small"
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
android:layout_marginTop="2dp" />
|
android:layout_marginTop="4dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/infosheet_about_p_github"
|
android:text="@string/infosheet_about_p_github"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small"
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="8dp"
|
||||||
android:autoLink="web" />
|
android:autoLink="web" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -76,7 +78,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/infosheet_about_h2_permissions"
|
android:text="@string/infosheet_about_h2_permissions"
|
||||||
android:textAppearance="@android:style/TextAppearance.Medium"
|
android:textAppearance="@android:style/TextAppearance.Medium"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="16dp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -85,12 +87,13 @@
|
||||||
android:text="@string/infosheet_about_h3_internet"
|
android:text="@string/infosheet_about_h3_internet"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small"
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:layout_marginTop="2dp" />
|
android:layout_marginTop="4dp" />
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/infosheet_about_p_internet"
|
android:text="@string/infosheet_about_p_internet"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small" />
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
|
android:layout_marginTop="2dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -98,12 +101,13 @@
|
||||||
android:text="@string/infosheet_about_h3_network"
|
android:text="@string/infosheet_about_h3_network"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small"
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:layout_marginTop="2dp" />
|
android:layout_marginTop="8dp" />
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/infosheet_about_p_network"
|
android:text="@string/infosheet_about_p_network"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small" />
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
|
android:layout_marginTop="2dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -111,12 +115,13 @@
|
||||||
android:text="@string/infosheet_about_h3_location"
|
android:text="@string/infosheet_about_h3_location"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small"
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:layout_marginEnd="2dp" />
|
android:layout_marginTop="8dp" />
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/infosheet_about_p_location"
|
android:text="@string/infosheet_about_p_location"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small" />
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
|
android:layout_marginTop="2dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -124,12 +129,13 @@
|
||||||
android:text="@string/infosheet_about_h3_external"
|
android:text="@string/infosheet_about_h3_external"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small"
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:layout_marginTop="2dp" />
|
android:layout_marginTop="8dp" />
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/infosheet_about_p_external"
|
android:text="@string/infosheet_about_p_external"
|
||||||
android:textAppearance="@android:style/TextAppearance.Small" />
|
android:textAppearance="@android:style/TextAppearance.Small"
|
||||||
|
android:layout_marginTop="2dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
<!-- menu entries -->
|
<!-- menu entries -->
|
||||||
<string name="menu_my_location">Mein Standort</string>
|
<string name="menu_my_location">Mein Standort</string>
|
||||||
<string name="menu_about">Über</string>
|
<string name="menu_about">Über Trackbook</string>
|
||||||
|
|
||||||
<!-- headers -->
|
<!-- headers -->
|
||||||
<string name="header_about">Über</string>
|
<string name="header_about">Über Trackbook</string>
|
||||||
|
|
||||||
<!-- tabs -->
|
<!-- tabs -->
|
||||||
<string name="tab_map">KARTE</string>
|
<string name="tab_map">KARTE</string>
|
||||||
|
@ -19,13 +19,13 @@
|
||||||
<string name="notification_title_trackbook_not_running">Trackbook ist aktiv</string>
|
<string name="notification_title_trackbook_not_running">Trackbook ist aktiv</string>
|
||||||
<string name="notification_title_trackbook_running">Trackbook ist inaktiv</string>
|
<string name="notification_title_trackbook_running">Trackbook ist inaktiv</string>
|
||||||
<string name="notification_stop">Stopp</string>
|
<string name="notification_stop">Stopp</string>
|
||||||
<string name="notification_swipe_to_clear_map">AUSBLENDEN um Kartenansicht zurückzusetzen</string>
|
<string name="notification_swipe_to_clear_map">(Ausblenden setzt Kartenansicht zurück)</string>
|
||||||
<string name="notification_content_duration">Dauer</string>
|
<string name="notification_content_duration">Dauer</string>
|
||||||
<string name="notification_content_distance">Entfernung</string>
|
<string name="notification_content_distance">Entfernung</string>
|
||||||
|
|
||||||
<!-- snackbar messages -->
|
<!-- snackbar messages -->
|
||||||
<string name="snackbar_message_tracking_stopped">Tracking wurde deaktiviert</string>
|
<string name="snackbar_message_tracking_stopped">Tracking deaktiviert</string>
|
||||||
<string name="snackbar_message_tracking_started">Tracking wurde aktiviert</string>
|
<string name="snackbar_message_tracking_started">Tracking aktiviert</string>
|
||||||
<string name="snackbar_message_location_offline">Standortdienste sind deaktiviert. Trackbook kann nicht aufzeichnen.</string>
|
<string name="snackbar_message_location_offline">Standortdienste sind deaktiviert. Trackbook kann nicht aufzeichnen.</string>
|
||||||
|
|
||||||
<!-- toast messages -->
|
<!-- toast messages -->
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- activities -->
|
<!-- activities -->
|
||||||
<string name="app_name">Trackbook</string> <!-- please do not translate app_name - transcription into different alphabet types is fine though -->
|
<string name="app_name">Trackbook</string> <!-- please do not translate app_name - transcription into different alphabet types is fine though -->
|
||||||
|
@ -8,7 +9,7 @@
|
||||||
<string name="menu_about">About</string>
|
<string name="menu_about">About</string>
|
||||||
|
|
||||||
<!-- headers -->
|
<!-- headers -->
|
||||||
<string name="header_about">About</string>
|
<string name="header_about">About Trackbook</string>
|
||||||
|
|
||||||
<!-- tabs -->
|
<!-- tabs -->
|
||||||
<string name="tab_map">MAP</string>
|
<string name="tab_map">MAP</string>
|
||||||
|
@ -18,7 +19,7 @@
|
||||||
<string name="notification_title_trackbook_running">Trackbook running</string>
|
<string name="notification_title_trackbook_running">Trackbook running</string>
|
||||||
<string name="notification_title_trackbook_not_running">Trackbook not running</string>
|
<string name="notification_title_trackbook_not_running">Trackbook not running</string>
|
||||||
<string name="notification_stop">Stop</string>
|
<string name="notification_stop">Stop</string>
|
||||||
<string name="notification_swipe_to_clear_map">SWIPE to clear map.</string>
|
<string name="notification_swipe_to_clear_map">(swipe to clear map)</string>
|
||||||
<string name="notification_content_duration">Duration</string>
|
<string name="notification_content_duration">Duration</string>
|
||||||
<string name="notification_content_distance">Distance</string>
|
<string name="notification_content_distance">Distance</string>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ buildscript {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.1.3'
|
classpath 'com.android.tools.build:gradle:2.2.0'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|
Loading…
Reference in a new issue