experimental tab switcher (for upcoming last track tab) + german translation of some strings
This commit is contained in:
parent
c852e91717
commit
81b8219b93
20 changed files with 525 additions and 72 deletions
|
@ -41,7 +41,7 @@ public final class InfosheetActivity extends AppCompatActivity implements Trackb
|
||||||
|
|
||||||
// set activity view
|
// set activity view
|
||||||
if (intent.hasExtra(EXTRA_INFOSHEET_CONTENT) && intent.getIntExtra(EXTRA_INFOSHEET_CONTENT, -1) == INFOSHEET_CONTENT_ABOUT) {
|
if (intent.hasExtra(EXTRA_INFOSHEET_CONTENT) && intent.getIntExtra(EXTRA_INFOSHEET_CONTENT, -1) == INFOSHEET_CONTENT_ABOUT) {
|
||||||
setContentView(R.layout.fragment_infosheet_about);
|
setContentView(R.layout.activity_infosheet_about);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,13 @@ import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
|
import android.support.design.widget.TabLayout;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
|
import android.support.v4.view.ViewPager;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -63,8 +68,10 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
private boolean mPermissionsGranted;
|
private boolean mPermissionsGranted;
|
||||||
private List<String> mMissingPermissions;
|
private List<String> mMissingPermissions;
|
||||||
private FloatingActionButton mFloatingActionButton;
|
private FloatingActionButton mFloatingActionButton;
|
||||||
private MainActivityFragment mMainActivityFragment;
|
private MainActivityMapFragment mMainActivityMapFragment;
|
||||||
private BroadcastReceiver mTrackingStoppedReceiver;
|
private BroadcastReceiver mTrackingStoppedReceiver;
|
||||||
|
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||||
|
private ViewPager mViewPager;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -92,6 +99,7 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
|
|
||||||
// set up main layout
|
// set up main layout
|
||||||
setupLayout();
|
setupLayout();
|
||||||
|
// setupTestLayout();
|
||||||
|
|
||||||
// register broadcast receiver for stopped tracking
|
// register broadcast receiver for stopped tracking
|
||||||
mTrackingStoppedReceiver = createTrackingStoppedReceiver();
|
mTrackingStoppedReceiver = createTrackingStoppedReceiver();
|
||||||
|
@ -157,6 +165,7 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
LogHelper.v(LOG_TAG, "onDestroy called.");
|
||||||
|
|
||||||
// disable broadcast receiver
|
// disable broadcast receiver
|
||||||
LocalBroadcastManager.getInstance(this).unregisterReceiver(mTrackingStoppedReceiver);
|
LocalBroadcastManager.getInstance(this).unregisterReceiver(mTrackingStoppedReceiver);
|
||||||
|
@ -207,7 +216,7 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
// get reference to fragment
|
// get reference to fragment
|
||||||
mMainActivityFragment = (MainActivityFragment)getSupportFragmentManager().findFragmentById(R.id.content_main);
|
mMainActivityMapFragment = (MainActivityMapFragment)getSupportFragmentManager().findFragmentById(R.id.content_main);
|
||||||
|
|
||||||
// show the record button and attach listener
|
// show the record button and attach listener
|
||||||
mFloatingActionButton = (FloatingActionButton) findViewById(R.id.fab);
|
mFloatingActionButton = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
|
@ -222,10 +231,10 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View view) {
|
public boolean onLongClick(View view) {
|
||||||
// onLongClick: clear map
|
// onLongClick: clear map
|
||||||
if (mTrackerServiceRunning || mMainActivityFragment == null) {
|
if (mTrackerServiceRunning || mMainActivityMapFragment == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
mMainActivityFragment.clearMap();
|
mMainActivityMapFragment.clearMap();
|
||||||
NotificationHelper.stop();
|
NotificationHelper.stop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +243,7 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// point to the on main onboarding layout
|
// point to the on main onboarding layout
|
||||||
setContentView(R.layout.onboarding_main);
|
setContentView(R.layout.activity_main_onboarding);
|
||||||
|
|
||||||
// show the okay button and attach listener
|
// show the okay button and attach listener
|
||||||
Button okButton = (Button) findViewById(R.id.button_okay);
|
Button okButton = (Button) findViewById(R.id.button_okay);
|
||||||
|
@ -255,6 +264,80 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* TEST: Set up main layout */
|
||||||
|
private void setupTestLayout() {
|
||||||
|
if (mPermissionsGranted) {
|
||||||
|
// point to the main map layout
|
||||||
|
setContentView(R.layout.activity_main_test);
|
||||||
|
|
||||||
|
// show action bar
|
||||||
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
/* 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());
|
||||||
|
|
||||||
|
// Set up the ViewPager with the sections adapter.
|
||||||
|
mViewPager = (ViewPager) findViewById(R.id.container);
|
||||||
|
mViewPager.setAdapter(mSectionsPagerAdapter);
|
||||||
|
|
||||||
|
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
|
||||||
|
tabLayout.setupWithViewPager(mViewPager);
|
||||||
|
/* END NEW STUFF */
|
||||||
|
|
||||||
|
// get reference to fragment
|
||||||
|
mMainActivityMapFragment = (MainActivityMapFragment)getSupportFragmentManager().findFragmentById(R.id.content_main);
|
||||||
|
|
||||||
|
// show the record button and attach listener
|
||||||
|
mFloatingActionButton = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
|
mFloatingActionButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
// onClick: start / stop tracking
|
||||||
|
handleFloatingActionButtonClick(view);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mFloatingActionButton.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View view) {
|
||||||
|
// onLongClick: clear map
|
||||||
|
if (mTrackerServiceRunning || mMainActivityMapFragment == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
mMainActivityMapFragment.clearMap();
|
||||||
|
NotificationHelper.stop();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// point to the on main onboarding layout
|
||||||
|
setContentView(R.layout.activity_main_onboarding);
|
||||||
|
|
||||||
|
// show the okay button and attach listener
|
||||||
|
Button okButton = (Button) findViewById(R.id.button_okay);
|
||||||
|
okButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@TargetApi(Build.VERSION_CODES.M)
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (mMissingPermissions != null && !mMissingPermissions.isEmpty()) {
|
||||||
|
// request permissions
|
||||||
|
String[] params = mMissingPermissions.toArray(new String[mMissingPermissions.size()]);
|
||||||
|
requestPermissions(params, REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Handles tap on the record button */
|
/* Handles tap on the record button */
|
||||||
private void handleFloatingActionButtonClick(View view) {
|
private void handleFloatingActionButtonClick(View view) {
|
||||||
if (mTrackerServiceRunning) {
|
if (mTrackerServiceRunning) {
|
||||||
|
@ -278,7 +361,7 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
setFloatingActionButtonState();
|
setFloatingActionButtonState();
|
||||||
|
|
||||||
// get last location from MainActivity Fragment
|
// get last location from MainActivity Fragment
|
||||||
Location lastLocation = mMainActivityFragment.getCurrentBestLocation();
|
Location lastLocation = mMainActivityMapFragment.getCurrentBestLocation();
|
||||||
|
|
||||||
// start tracker service
|
// start tracker service
|
||||||
Intent intent = new Intent(this, TrackerService.class);
|
Intent intent = new Intent(this, TrackerService.class);
|
||||||
|
@ -287,8 +370,8 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
startService(intent);
|
startService(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update tracking state in MainActivityFragment
|
// update tracking state in MainActivityMapFragment
|
||||||
mMainActivityFragment.setTrackingState(mTrackerServiceRunning);
|
mMainActivityMapFragment.setTrackingState(mTrackerServiceRunning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,13 +392,13 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
|
|
||||||
switch (intentAction) {
|
switch (intentAction) {
|
||||||
case ACTION_SHOW_MAP:
|
case ACTION_SHOW_MAP:
|
||||||
if (intent.hasExtra(EXTRA_TRACKING_STATE) && mMainActivityFragment != null) {
|
if (intent.hasExtra(EXTRA_TRACKING_STATE) && mMainActivityMapFragment != null) {
|
||||||
mTrackerServiceRunning = intent.getBooleanExtra(EXTRA_TRACKING_STATE, false);
|
mTrackerServiceRunning = intent.getBooleanExtra(EXTRA_TRACKING_STATE, false);
|
||||||
mMainActivityFragment.setTrackingState(mTrackerServiceRunning);
|
mMainActivityMapFragment.setTrackingState(mTrackerServiceRunning);
|
||||||
// prevent multiple reactions to intent
|
// prevent multiple reactions to intent
|
||||||
intent.setAction(ACTION_DEFAULT);
|
intent.setAction(ACTION_DEFAULT);
|
||||||
} else if (intent.hasExtra(EXTRA_CLEAR_MAP) && mMainActivityFragment != null) {
|
} else if (intent.hasExtra(EXTRA_CLEAR_MAP) && mMainActivityMapFragment != null) {
|
||||||
mMainActivityFragment.clearMap();
|
mMainActivityMapFragment.clearMap();
|
||||||
// prevent multiple reactions to intent
|
// prevent multiple reactions to intent
|
||||||
intent.setAction(ACTION_DEFAULT);
|
intent.setAction(ACTION_DEFAULT);
|
||||||
}
|
}
|
||||||
|
@ -358,10 +441,63 @@ public class MainActivity extends AppCompatActivity implements TrackbookKeys {
|
||||||
mTrackerServiceRunning = false;
|
mTrackerServiceRunning = false;
|
||||||
setFloatingActionButtonState();
|
setFloatingActionButtonState();
|
||||||
|
|
||||||
// pass tracking state to MainActivityFragment
|
// pass tracking state to MainActivityMapFragment
|
||||||
mMainActivityFragment.setTrackingState(false);
|
mMainActivityMapFragment.setTrackingState(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inner class: SectionsPagerAdapter that returns a fragment corresponding to one of the tabs.
|
||||||
|
* see also: https://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html
|
||||||
|
*/
|
||||||
|
public class SectionsPagerAdapter extends FragmentPagerAdapter {
|
||||||
|
|
||||||
|
public SectionsPagerAdapter(FragmentManager fm) {
|
||||||
|
super(fm);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Fragment getItem(int position) {
|
||||||
|
// getItem is called to instantiate the fragment for the given page.
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
// if (mMainActivityMapFragment == null) {
|
||||||
|
// mMainActivityMapFragment = new MainActivityMapFragment();
|
||||||
|
// }
|
||||||
|
// return mMainActivityMapFragment;
|
||||||
|
return new MainActivityMapFragment();
|
||||||
|
case 1:
|
||||||
|
// if (mMainActivityMapFragment == null) {
|
||||||
|
// mMainActivityMapFragment = new MainActivityMapFragment();
|
||||||
|
// }
|
||||||
|
// return mMainActivityMapFragment;
|
||||||
|
return new MainActivityTrackFragment();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
// Show 2 total pages.
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getPageTitle(int position) {
|
||||||
|
switch (position) {
|
||||||
|
case 0:
|
||||||
|
return getString(R.string.tab_map);
|
||||||
|
case 1:
|
||||||
|
return getString(R.string.tab_last_track);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* End of inner class
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* MainActivityFragment.java
|
* MainActivityMapFragment.java
|
||||||
* Implements the main fragment of the main activity
|
* Implements the main fragment of the main activity
|
||||||
* This fragment displays a map using osmdroid
|
* This fragment displays a map using osmdroid
|
||||||
*
|
*
|
||||||
|
@ -53,12 +53,12 @@ import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MainActivityFragment class
|
* MainActivityMapFragment class
|
||||||
*/
|
*/
|
||||||
public class MainActivityFragment extends Fragment implements TrackbookKeys {
|
public class MainActivityMapFragment extends Fragment implements TrackbookKeys {
|
||||||
|
|
||||||
/* Define log tag */
|
/* Define log tag */
|
||||||
private static final String LOG_TAG = MainActivityFragment.class.getSimpleName();
|
private static final String LOG_TAG = MainActivityMapFragment.class.getSimpleName();
|
||||||
|
|
||||||
|
|
||||||
/* Main class variables */
|
/* Main class variables */
|
||||||
|
@ -80,7 +80,7 @@ public class MainActivityFragment extends Fragment implements TrackbookKeys {
|
||||||
|
|
||||||
|
|
||||||
/* Constructor (default) */
|
/* Constructor (default) */
|
||||||
public MainActivityFragment() {
|
public MainActivityMapFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,6 +247,8 @@ public class MainActivityFragment extends Fragment implements TrackbookKeys {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
LogHelper.v(LOG_TAG, "onDestroy called.");
|
||||||
|
|
||||||
// reset first start state
|
// reset first start state
|
||||||
mFirstStart = true;
|
mFirstStart = true;
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package org.y20k.trackbook;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by solaris on 16/09/16.
|
||||||
|
*/
|
||||||
|
public class MainActivityTrackFragment extends Fragment {
|
||||||
|
|
||||||
|
|
||||||
|
/* Main class variables */
|
||||||
|
private View mRootView;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// action bar has options menu
|
||||||
|
setHasOptionsMenu(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
// inflate root view from xml
|
||||||
|
mRootView = inflater.inflate(R.layout.fragment_main_track, container, false);
|
||||||
|
|
||||||
|
return mRootView;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroyView() {
|
||||||
|
super.onDestroyView();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -275,7 +275,7 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
|
||||||
// remove listeners
|
// remove listeners
|
||||||
LocationHelper.removeLocationListeners(mLocationManager, mGPSListener, mNetworkListener);
|
LocationHelper.removeLocationListeners(mLocationManager, mGPSListener, mNetworkListener);
|
||||||
|
|
||||||
// notify MainActivityFragment
|
// notify MainActivityMapFragment
|
||||||
Intent i = new Intent();
|
Intent i = new Intent();
|
||||||
i.setAction(ACTION_TRACKING_STOPPED);
|
i.setAction(ACTION_TRACKING_STOPPED);
|
||||||
i.putExtra(EXTRA_TRACK, mTrack);
|
i.putExtra(EXTRA_TRACK, mTrack);
|
||||||
|
|
14
app/src/main/res/layout-land/fragment_main_track.xml
Normal file
14
app/src/main/res/layout-land/fragment_main_track.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<!-- LEFT: map of track -->
|
||||||
|
<include layout="@layout/content_main_track_map" />
|
||||||
|
|
||||||
|
<!-- RIGHT: map of track -->
|
||||||
|
<include layout="@layout/content_main_track_statistics" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -21,7 +21,19 @@
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
<include layout="@layout/content_main" />
|
|
||||||
|
<!-- include MainActivityMapFragment -->
|
||||||
|
<fragment
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/content_main"
|
||||||
|
android:name="org.y20k.trackbook.MainActivityMapFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
|
tools:layout="@layout/fragment_main_map" />
|
||||||
|
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
<android.support.design.widget.FloatingActionButton
|
||||||
android:id="@+id/fab"
|
android:id="@+id/fab"
|
||||||
|
|
57
app/src/main/res/layout/activity_main_test.xml
Normal file
57
app/src/main/res/layout/activity_main_test.xml
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.design.widget.CoordinatorLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/main_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
tools:context="org.y20k.trackbook.MainActivity">
|
||||||
|
|
||||||
|
<android.support.design.widget.AppBarLayout
|
||||||
|
android:id="@+id/appbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="@dimen/appbar_padding_top"
|
||||||
|
android:theme="@style/TrackbookAppTheme.AppBarOverlay">
|
||||||
|
|
||||||
|
<android.support.v7.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
app:layout_scrollFlags="scroll|enterAlways"
|
||||||
|
app:popupTheme="@style/TrackbookAppTheme.PopupOverlay">
|
||||||
|
|
||||||
|
</android.support.v7.widget.Toolbar>
|
||||||
|
|
||||||
|
<android.support.design.widget.TabLayout
|
||||||
|
android:id="@+id/tabs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:tabMaxWidth="0dp"
|
||||||
|
app:tabGravity="fill"
|
||||||
|
app:tabMode="fixed" />
|
||||||
|
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<android.support.v4.view.ViewPager
|
||||||
|
android:id="@+id/container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||||
|
<!-- MainActivityMapFragment and MainActivityTrackFragment are included at runtime -->
|
||||||
|
|
||||||
|
|
||||||
|
<android.support.design.widget.FloatingActionButton
|
||||||
|
android:id="@+id/fab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_margin="@dimen/fab_margin"
|
||||||
|
app:srcCompat="@drawable/ic_fiber_manual_record_white_24dp"
|
||||||
|
app:fabSize="auto"/>
|
||||||
|
|
||||||
|
</android.support.design.widget.CoordinatorLayout>
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<fragment
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/content_main"
|
|
||||||
android:name="org.y20k.trackbook.MainActivityFragment"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
|
||||||
tools:layout="@layout/fragment_main" />
|
|
||||||
|
|
12
app/src/main/res/layout/content_main_track_map.xml
Normal file
12
app/src/main/res/layout/content_main_track_map.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="50">
|
||||||
|
|
||||||
|
<org.osmdroid.views.MapView android:id="@+id/track_map"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
133
app/src/main/res/layout/content_main_track_statistics.xml
Normal file
133
app/src/main/res/layout/content_main_track_statistics.xml
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/trackbook_grey"
|
||||||
|
android:layout_weight="50">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
android:scrollbars="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Large.Inverse"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:text="Statistics"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginTop="12dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Total distance: "
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Small.Inverse" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="track data missing"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginTop="4dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Steps taken: "
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Small.Inverse" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="track data missing"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginTop="4dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Recorded waypoints: "
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Small.Inverse" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="track data missing"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginTop="8dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Total duration: "
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Small.Inverse" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="track data missing"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginTop="4dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Recording sterted: "
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Small.Inverse" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="track data missing"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_marginTop="4dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Recording stopped: "
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Small.Inverse" />
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="track data missing"
|
||||||
|
android:textAppearance="@android:style/TextAppearance.Medium.Inverse" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</ScrollView>
|
|
@ -1,35 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/fragment_main"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
tools:context="org.y20k.trackbook.MainActivityFragment"
|
|
||||||
tools:showIn="@layout/activity_main">
|
|
||||||
|
|
||||||
<org.osmdroid.views.MapView android:id="@+id/map"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
|
||||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
|
||||||
tools:context="org.y20k.trackbook.MainActivityFragment"
|
|
||||||
tools:showIn="@layout/activity_main">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Hello World!" />
|
|
||||||
|
|
||||||
</RelativeLayout> -->
|
|
16
app/src/main/res/layout/fragment_main_map.xml
Normal file
16
app/src/main/res/layout/fragment_main_map.xml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/fragment_main"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
tools:context=".MainActivityMapFragment"
|
||||||
|
tools:showIn="@layout/activity_main">
|
||||||
|
|
||||||
|
<org.osmdroid.views.MapView android:id="@+id/map"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
14
app/src/main/res/layout/fragment_main_track.xml
Normal file
14
app/src/main/res/layout/fragment_main_track.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<!-- TOP: map of track -->
|
||||||
|
<include layout="@layout/content_main_track_map" />
|
||||||
|
|
||||||
|
<!-- BOTTOM: map of track -->
|
||||||
|
<include layout="@layout/content_main_track_statistics" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
42
app/src/main/res/values-de/strings.xml
Normal file
42
app/src/main/res/values-de/strings.xml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Trackbook</string> <!-- please do not translate app_name - transcription into different alphabet types is fine though -->
|
||||||
|
<string name="header_about">Über</string>
|
||||||
|
<string name="infosheet_about_h1_about">Über Trackbook</string>
|
||||||
|
<string name="infosheet_about_h2_permissions">Welche Berechtigungen benötigt Trackbook</string>
|
||||||
|
<string name="infosheet_about_h2_recorder">Bewegungsrekorder für Android</string>
|
||||||
|
<string name="infosheet_about_h3_external">Berechtigung WRITE_EXTERNAL_STORAGE</string>
|
||||||
|
<string name="infosheet_about_h3_internet">Berechtigung INTERNET</string>
|
||||||
|
<string name="infosheet_about_h3_location">Berechtigung ACCESS_COARSE_LOCATION und ACCESS_FINE_LOCATION</string>
|
||||||
|
<string name="infosheet_about_h3_network">Berechtigung ACCESS_WIFI_STATE and ACCESS_NETWORK_STATE</string>
|
||||||
|
<string name="infosheet_about_h3_version">Version 0.9 ("The Great Gig in the Sky")</string>
|
||||||
|
<string name="infosheet_about_p_github">https://github.com/y20k/trackbook</string>
|
||||||
|
<string name="infosheet_about_p_license">https://opensource.org/licenses/MIT</string>
|
||||||
|
<string name="infosheet_about_p_osmdroid">https://github.com/osmdroid/osmdroid</string>
|
||||||
|
<string name="layout_onboarding_button_okay">Alles klar!</string>
|
||||||
|
<string name="layout_onboarding_description_app_icon">Trackbook App Icon</string>
|
||||||
|
<string name="layout_onboarding_h1_welcome">Hallo</string>
|
||||||
|
<string name="layout_onboarding_h2_app_name">Trackbook</string>
|
||||||
|
<string name="layout_onboarding_h2_request_permissions">Trackbook kann ohne die folgenden Berechtigungen nicht starten:</string>
|
||||||
|
<string name="layout_onboarding_p_app_claim">Bewegungsrekorder für Android</string>
|
||||||
|
<string name="menu_about">Über</string>
|
||||||
|
<string name="marker_description_accuracy">Genauigkeit</string>
|
||||||
|
<string name="marker_description_source">Quelle</string>
|
||||||
|
<string name="menu_my_location">Mein Standort</string>
|
||||||
|
<string name="notification_content_distance">Entfernung</string>
|
||||||
|
<string name="notification_content_duration">Dauer</string>
|
||||||
|
<string name="notification_stop">Stopp</string>
|
||||||
|
<string name="notification_swipe_to_clear_map"><![CDATA[… Ausblenden um Kartenansicht zurückzusetzen]]></string>
|
||||||
|
<string name="notification_title_trackbook_not_running">Trackbook ist aktiv</string>
|
||||||
|
<string name="notification_title_trackbook_running">Trackbook ist inaktiv</string>
|
||||||
|
<string name="snackbar_message_tracking_started">Tracking wurde aktiviert</string>
|
||||||
|
<string name="snackbar_message_tracking_stopped">Tracking wurde deaktiviert</string>
|
||||||
|
<string name="title_activity_infosheet">Infosheet</string>
|
||||||
|
<string name="toast_message_acquiring_location">Suche aktuelle Position</string>
|
||||||
|
<string name="toast_message_clear_map">Kartenansicht wird zurück gesetzt</string>
|
||||||
|
<string name="toast_message_last_location">Letzte Position</string>
|
||||||
|
<string name="toast_message_last_location_age_one_hour">über eine Stunde</string>
|
||||||
|
<string name="toast_message_location_offline">Standortdienste sind deaktiviert</string>
|
||||||
|
<string name="toast_message_permissions_granted">Berechtigungen erteilt</string>
|
||||||
|
<string name="toast_message_unable_to_start_app">Trackbook kann nicht starten.</string>
|
||||||
|
</resources>
|
|
@ -3,4 +3,5 @@
|
||||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
<dimen name="fab_margin">16dp</dimen>
|
<dimen name="fab_margin">16dp</dimen>
|
||||||
|
<dimen name="appbar_padding_top">8dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<resources>
|
<resources>
|
||||||
<!-- activities -->
|
<!-- activities -->
|
||||||
<string name="app_name">Trackbook</string>
|
<string name="app_name">Trackbook</string> <!-- please do not translate app_name - transcription into different alphabet types is fine though -->
|
||||||
<string name="title_activity_infosheet">Info Sheet</string>
|
<string name="title_activity_infosheet">Info Sheet</string>
|
||||||
|
|
||||||
<!-- menu entries -->
|
<!-- menu entries -->
|
||||||
|
@ -10,6 +10,10 @@
|
||||||
<!-- headers -->
|
<!-- headers -->
|
||||||
<string name="header_about">About</string>
|
<string name="header_about">About</string>
|
||||||
|
|
||||||
|
<!-- tabs -->
|
||||||
|
<string name="tab_map">MAP</string>
|
||||||
|
<string name="tab_last_track">LAST TRACK</string>
|
||||||
|
|
||||||
<!-- notification -->
|
<!-- notification -->
|
||||||
<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>
|
||||||
|
@ -50,7 +54,7 @@
|
||||||
<!-- infosheet about -->
|
<!-- infosheet about -->
|
||||||
<string name="infosheet_about_h1_about">About Trackbook</string>
|
<string name="infosheet_about_h1_about">About Trackbook</string>
|
||||||
<string name="infosheet_about_h2_recorder">Movement Recorder for Android</string>
|
<string name="infosheet_about_h2_recorder">Movement Recorder for Android</string>
|
||||||
<string name="infosheet_about_h3_version">Version 0.1 ("The Great Gig in the Sky")</string>
|
<string name="infosheet_about_h3_version">Version 0.9 ("The Great Gig in the Sky")</string>
|
||||||
<string name="infosheet_about_p_bare">Trackbook is a bare bones app for recording your movements. Trackbook is great for hiking, vacation or workout. Once started it traces your movements on a map. The map data is provided by OpenStreetMap (OSM).</string>
|
<string name="infosheet_about_p_bare">Trackbook is a bare bones app for recording your movements. Trackbook is great for hiking, vacation or workout. Once started it traces your movements on a map. The map data is provided by OpenStreetMap (OSM).</string>
|
||||||
<string name="infosheet_about_p_free">Trackbook is free software. You can find the code on GitHub. GitHub is also a good place to file bugs or even to contribute, if you are interested. Trackbook is published under the MIT open source license. Trackbook uses osmdroid to display the map, which is also free software published under the Apache License.</string>
|
<string name="infosheet_about_p_free">Trackbook is free software. You can find the code on GitHub. GitHub is also a good place to file bugs or even to contribute, if you are interested. Trackbook is published under the MIT open source license. Trackbook uses osmdroid to display the map, which is also free software published under the Apache License.</string>
|
||||||
<string name="infosheet_about_p_github">https://github.com/y20k/trackbook</string>
|
<string name="infosheet_about_p_github">https://github.com/y20k/trackbook</string>
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TrackbookAppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
<style name="TrackbookAppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||||
|
|
||||||
<style name="TrackbookAppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
<style name="TrackbookAppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue