some clean-up

master
y20k 2016-09-20 13:51:17 +02:00
parent 90273d0d0d
commit da82360625
9 changed files with 67 additions and 45 deletions

View File

@ -70,8 +70,6 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
private FloatingActionButton mFloatingActionButton;
private MainActivityMapFragment mMainActivityMapFragment;
private BroadcastReceiver mTrackingStoppedReceiver;
private SectionsPagerAdapter mSectionsPagerAdapter;
private ViewPager mViewPager;
@Override
@ -277,14 +275,14 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
/* BEGIN NEW STUFF */
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
ViewPager viewPager = (ViewPager) findViewById(R.id.container);
viewPager.setAdapter(sectionsPagerAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
tabLayout.setupWithViewPager(viewPager);
/* END NEW STUFF */
// get reference to fragment

View File

@ -1,6 +1,6 @@
/**
* 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 file is part of
@ -557,7 +557,7 @@ public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
toggleLocationOffBar();
}
// start / stop perliminary tracking
// start / stop preliminary tracking
if (!mLocationSystemSetting) {
stopPreliminaryTracking();
} else if (!mTrackerServiceRunning && mFragmentVisible) {

View File

@ -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;
import android.os.Bundle;
@ -7,11 +23,15 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by solaris on 16/09/16.
* MainActivityTrackFragment class
*/
public class MainActivityTrackFragment extends Fragment {
/* Define log tag */
private static final String LOG_TAG = MainActivityTrackFragment.class.getSimpleName();
/* Main class variables */
private View mRootView;

View File

@ -83,12 +83,6 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
// create content observer for changes in System Settings
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
if (!mLocationSystemSetting) {
LogHelper.v(LOG_TAG, "Location Setting is turned off.");
@ -97,11 +91,16 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
return START_STICKY;
}
// checking for empty intent
if (intent == null) {
LogHelper.v(LOG_TAG, "Null-Intent received. Stopping self.");
stopSelf();
}
// ACTION START
else if (intent.getAction().equals(ACTION_START) && mLocationSystemSetting) {
startTracking(intent);
}
}
// ACTION STOP
else if (intent.getAction().equals(ACTION_STOP) || !mLocationSystemSetting) {

View File

@ -155,11 +155,11 @@ public class NotificationHelper implements TrackbookKeys {
int width = (int) resources.getDimension(android.R.dimen.notification_large_icon_width);
Bitmap bitmap;
if (tracking) {
bitmap = getBitmap(R.drawable.ic_notification_large_tracking_48dp);
} else {
bitmap = getBitmap(R.drawable.ic_notification_large_not_tracking_48dp);
}
if (tracking) {
bitmap = getBitmap(R.drawable.ic_notification_large_tracking_48dp);
} else {
bitmap = getBitmap(R.drawable.ic_notification_large_not_tracking_48dp);
}
return Bitmap.createScaledBitmap(bitmap, width, height, false);
}
@ -179,6 +179,4 @@ public class NotificationHelper implements TrackbookKeys {
}
}
}

View File

@ -26,35 +26,37 @@
android:layout_height="wrap_content"
android:text="@string/infosheet_about_h2_recorder"
android:textAppearance="@android:style/TextAppearance.Medium"
android:textStyle="bold" />
android:textStyle="bold"
android:layout_marginTop="4dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/infosheet_about_h3_version"
android:textAppearance="@android:style/TextAppearance.Small"
android:textStyle="bold" />
android:textStyle="bold"
android:layout_marginTop="8dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/infosheet_about_p_bare"
android:textAppearance="@android:style/TextAppearance.Small"
android:layout_marginTop="4dp" />
android:layout_marginTop="8dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/infosheet_about_p_free"
android:textAppearance="@android:style/TextAppearance.Small"
android:layout_marginTop="2dp" />
android:layout_marginTop="4dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/infosheet_about_p_github"
android:textAppearance="@android:style/TextAppearance.Small"
android:layout_marginTop="4dp"
android:layout_marginTop="8dp"
android:autoLink="web" />
<TextView
@ -76,7 +78,7 @@
android:layout_height="wrap_content"
android:text="@string/infosheet_about_h2_permissions"
android:textAppearance="@android:style/TextAppearance.Medium"
android:layout_marginTop="8dp"
android:layout_marginTop="16dp"
android:textStyle="bold" />
<TextView
@ -85,12 +87,13 @@
android:text="@string/infosheet_about_h3_internet"
android:textAppearance="@android:style/TextAppearance.Small"
android:textStyle="bold"
android:layout_marginTop="2dp" />
android:layout_marginTop="4dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/infosheet_about_p_internet"
android:textAppearance="@android:style/TextAppearance.Small" />
android:textAppearance="@android:style/TextAppearance.Small"
android:layout_marginTop="2dp" />
<TextView
android:layout_width="match_parent"
@ -98,12 +101,13 @@
android:text="@string/infosheet_about_h3_network"
android:textAppearance="@android:style/TextAppearance.Small"
android:textStyle="bold"
android:layout_marginTop="2dp" />
android:layout_marginTop="8dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/infosheet_about_p_network"
android:textAppearance="@android:style/TextAppearance.Small" />
android:textAppearance="@android:style/TextAppearance.Small"
android:layout_marginTop="2dp" />
<TextView
android:layout_width="match_parent"
@ -111,12 +115,13 @@
android:text="@string/infosheet_about_h3_location"
android:textAppearance="@android:style/TextAppearance.Small"
android:textStyle="bold"
android:layout_marginEnd="2dp" />
android:layout_marginTop="8dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/infosheet_about_p_location"
android:textAppearance="@android:style/TextAppearance.Small" />
android:textAppearance="@android:style/TextAppearance.Small"
android:layout_marginTop="2dp" />
<TextView
android:layout_width="match_parent"
@ -124,12 +129,13 @@
android:text="@string/infosheet_about_h3_external"
android:textAppearance="@android:style/TextAppearance.Small"
android:textStyle="bold"
android:layout_marginTop="2dp" />
android:layout_marginTop="8dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/infosheet_about_p_external"
android:textAppearance="@android:style/TextAppearance.Small" />
android:textAppearance="@android:style/TextAppearance.Small"
android:layout_marginTop="2dp" />
</LinearLayout>

View File

@ -6,10 +6,10 @@
<!-- menu entries -->
<string name="menu_my_location">Mein Standort</string>
<string name="menu_about">Über</string>
<string name="menu_about">Über Trackbook</string>
<!-- headers -->
<string name="header_about">Über</string>
<string name="header_about">Über Trackbook</string>
<!-- tabs -->
<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_running">Trackbook ist inaktiv</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_distance">Entfernung</string>
<!-- snackbar messages -->
<string name="snackbar_message_tracking_stopped">Tracking wurde deaktiviert</string>
<string name="snackbar_message_tracking_started">Tracking wurde aktiviert</string>
<string name="snackbar_message_tracking_stopped">Tracking deaktiviert</string>
<string name="snackbar_message_tracking_started">Tracking aktiviert</string>
<string name="snackbar_message_location_offline">Standortdienste sind deaktiviert. Trackbook kann nicht aufzeichnen.</string>
<!-- toast messages -->

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- activities -->
<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>
<!-- headers -->
<string name="header_about">About</string>
<string name="header_about">About Trackbook</string>
<!-- tabs -->
<string name="tab_map">MAP</string>
@ -18,7 +19,7 @@
<string name="notification_title_trackbook_running">Trackbook running</string>
<string name="notification_title_trackbook_not_running">Trackbook not running</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_distance">Distance</string>

View File

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
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
// in the individual module build.gradle files