mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 06:17:27 +00:00
merged upstream features of android_apps branch into this branch
This commit is contained in:
commit
3051b9b0d7
44 files changed
+1418
-101
No files matched your search
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/com.sap.sailing.android.tracking.app"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.sap.sailing.android.tracking.app.test</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>com.sap.sailing.android.tracking.app</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.sap.sailing.android.tracking.app.test"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="14" />
|
||||
|
||||
<instrumentation
|
||||
android:name="android.test.InstrumentationTestRunner"
|
||||
android:targetPackage="com.sap.sailing.android.tracking.app" />
|
||||
|
||||
<application
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name" >
|
||||
<uses-library android:name="android.test.runner" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.sap.sailing.android.tracking.app.test"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="14" />
|
||||
|
||||
<instrumentation
|
||||
android:name="android.test.InstrumentationTestRunner"
|
||||
android:targetPackage="com.sap.sailing.android.tracking.app" />
|
||||
|
||||
<application
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name" >
|
||||
<uses-library android:name="android.test.runner" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1 @@
|
||||
/com/
|
||||
@@ -0,0 +1,20 @@
|
||||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
@@ -0,0 +1,14 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system edit
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
#
|
||||
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-21
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">Com.sap.sailing.android.tracking.app.testTest</string>
|
||||
|
||||
</resources>
|
||||
+343
@@ -0,0 +1,343 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.sap.sailing.android.tracking.app.test;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.test.ActivityInstrumentationTestCase;
|
||||
import android.test.ActivityTestCase;
|
||||
import android.test.mock.MockApplication;
|
||||
import android.view.Window;
|
||||
|
||||
/**
|
||||
* This class provides isolated testing of a single activity. The activity under test will
|
||||
* be created with minimal connection to the system infrastructure, and you can inject mocked or
|
||||
* wrappered versions of many of Activity's dependencies. Most of the work is handled
|
||||
* automatically here by {@link #setUp} and {@link #tearDown}.
|
||||
*
|
||||
* <p>If you prefer a functional test, see {@link android.test.ActivityInstrumentationTestCase}.
|
||||
*
|
||||
* <p>It must be noted that, as a true unit test, your Activity will not be running in the
|
||||
* normal system and will not participate in the normal interactions with other Activities.
|
||||
* The following methods should not be called in this configuration - most of them will throw
|
||||
* exceptions:
|
||||
* <ul>
|
||||
* <li>{@link android.app.Activity#createPendingResult(int, Intent, int)}</li>
|
||||
* <li>{@link android.app.Activity#startActivityIfNeeded(Intent, int)}</li>
|
||||
* <li>{@link android.app.Activity#startActivityFromChild(Activity, Intent, int)}</li>
|
||||
* <li>{@link android.app.Activity#startNextMatchingActivity(Intent)}</li>
|
||||
* <li>{@link android.app.Activity#getCallingActivity()}</li>
|
||||
* <li>{@link android.app.Activity#getCallingPackage()}</li>
|
||||
* <li>{@link android.app.Activity#createPendingResult(int, Intent, int)}</li>
|
||||
* <li>{@link android.app.Activity#getTaskId()}</li>
|
||||
* <li>{@link android.app.Activity#isTaskRoot()}</li>
|
||||
* <li>{@link android.app.Activity#moveTaskToBack(boolean)}</li>
|
||||
* <li>{@link android.app.Activity#setPersistent(boolean)}</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>The following methods may be called but will not do anything. For test purposes, you can use
|
||||
* the methods {@link #getStartedActivityIntent()} and {@link #getStartedActivityRequest()} to
|
||||
* inspect the parameters that they were called with.
|
||||
* <ul>
|
||||
* <li>{@link android.app.Activity#startActivity(Intent)}</li>
|
||||
* <li>{@link android.app.Activity#startActivityForResult(Intent, int)}</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>The following methods may be called but will not do anything. For test purposes, you can use
|
||||
* the methods {@link #isFinishCalled()} and {@link #getFinishedActivityRequest()} to inspect the
|
||||
* parameters that they were called with.
|
||||
* <ul>
|
||||
* <li>{@link android.app.Activity#finish()}</li>
|
||||
* <li>{@link android.app.Activity#finishFromChild(Activity child)}</li>
|
||||
* <li>{@link android.app.Activity#finishActivity(int requestCode)}</li>
|
||||
* </ul>
|
||||
*
|
||||
*/
|
||||
public abstract class ActivityUnitTestCase<T extends Activity>
|
||||
extends ActivityTestCase {
|
||||
|
||||
private Class<T> mActivityClass;
|
||||
|
||||
private Context mActivityContext;
|
||||
private Application mApplication;
|
||||
private MockParent mMockParent;
|
||||
|
||||
private boolean mAttached = false;
|
||||
private boolean mCreated = false;
|
||||
|
||||
public ActivityUnitTestCase(Class<T> activityClass) {
|
||||
mActivityClass = activityClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getActivity() {
|
||||
return (T) super.getActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
// default value for target context, as a default
|
||||
mActivityContext = getInstrumentation().getTargetContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the activity under test, in the same way as if it was started by
|
||||
* {@link android.content.Context#startActivity Context.startActivity()}, providing the
|
||||
* arguments it supplied. When you use this method to start the activity, it will automatically
|
||||
* be stopped by {@link #tearDown}.
|
||||
*
|
||||
* <p>This method will call onCreate(), but if you wish to further exercise Activity life
|
||||
* cycle methods, you must call them yourself from your test case.
|
||||
*
|
||||
* <p><i>Do not call from your setUp() method. You must call this method from each of your
|
||||
* test methods.</i>
|
||||
*
|
||||
* @param intent The Intent as if supplied to {@link android.content.Context#startActivity}.
|
||||
* @param savedInstanceState The instance state, if you are simulating this part of the life
|
||||
* cycle. Typically null.
|
||||
* @param lastNonConfigurationInstance This Object will be available to the
|
||||
* Activity if it calls {@link android.app.Activity#getLastNonConfigurationInstance()}.
|
||||
* Typically null.
|
||||
* @return Returns the Activity that was created
|
||||
*/
|
||||
protected T startActivity(Intent intent, Bundle savedInstanceState,
|
||||
Object lastNonConfigurationInstance) {
|
||||
assertFalse("Activity already created", mCreated);
|
||||
|
||||
if (!mAttached) {
|
||||
assertNotNull(mActivityClass);
|
||||
setActivity(null);
|
||||
T newActivity = null;
|
||||
try {
|
||||
IBinder token = null;
|
||||
if (mApplication == null) {
|
||||
setApplication(new MockApplication());
|
||||
}
|
||||
// ComponentName cn = new ComponentName(mActivityClass.getPackage().getName(),
|
||||
// mActivityClass.getName());
|
||||
ComponentName cn = new ComponentName(getInstrumentation().getTargetContext(), mActivityClass);
|
||||
intent.setComponent(cn);
|
||||
ActivityInfo info = new ActivityInfo();
|
||||
CharSequence title = mActivityClass.getName();
|
||||
mMockParent = new MockParent();
|
||||
String id = null;
|
||||
|
||||
newActivity = (T) getInstrumentation().newActivity(mActivityClass, mActivityContext,
|
||||
token, mApplication, intent, info, title, mMockParent, id,
|
||||
lastNonConfigurationInstance);
|
||||
} catch (Exception e) {
|
||||
assertNotNull(newActivity);
|
||||
}
|
||||
|
||||
assertNotNull(newActivity);
|
||||
setActivity(newActivity);
|
||||
|
||||
mAttached = true;
|
||||
}
|
||||
|
||||
T result = getActivity();
|
||||
if (result != null) {
|
||||
getInstrumentation().callActivityOnCreate(getActivity(), savedInstanceState);
|
||||
mCreated = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
|
||||
setActivity(null);
|
||||
|
||||
// Scrub out members - protects against memory leaks in the case where someone
|
||||
// creates a non-static inner class (thus referencing the test case) and gives it to
|
||||
// someone else to hold onto
|
||||
scrubClass(ActivityInstrumentationTestCase.class);
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the application for use during the test. You must call this function before calling
|
||||
* {@link #startActivity}. If your test does not call this method,
|
||||
* @param application The Application object that will be injected into the Activity under test.
|
||||
*/
|
||||
public void setApplication(Application application) {
|
||||
mApplication = application;
|
||||
}
|
||||
|
||||
/**
|
||||
* If you wish to inject a Mock, Isolated, or otherwise altered context, you can do so
|
||||
* here. You must call this function before calling {@link #startActivity}. If you wish to
|
||||
* obtain a real Context, as a building block, use getInstrumentation().getTargetContext().
|
||||
*/
|
||||
public void setActivityContext(Context activityContext) {
|
||||
mActivityContext = activityContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will return the value if your Activity under test calls
|
||||
* {@link android.app.Activity#setRequestedOrientation}.
|
||||
*/
|
||||
public int getRequestedOrientation() {
|
||||
if (mMockParent != null) {
|
||||
return mMockParent.mRequestedOrientation;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will return the launch intent if your Activity under test calls
|
||||
* {@link android.app.Activity#startActivity(Intent)} or
|
||||
* {@link android.app.Activity#startActivityForResult(Intent, int)}.
|
||||
* @return The Intent provided in the start call, or null if no start call was made.
|
||||
*/
|
||||
public Intent getStartedActivityIntent() {
|
||||
if (mMockParent != null) {
|
||||
return mMockParent.mStartedActivityIntent;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will return the launch request code if your Activity under test calls
|
||||
* {@link android.app.Activity#startActivityForResult(Intent, int)}.
|
||||
* @return The request code provided in the start call, or -1 if no start call was made.
|
||||
*/
|
||||
public int getStartedActivityRequest() {
|
||||
if (mMockParent != null) {
|
||||
return mMockParent.mStartedActivityRequest;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will notify you if the Activity under test called
|
||||
* {@link android.app.Activity#finish()},
|
||||
* {@link android.app.Activity#finishFromChild(Activity)}, or
|
||||
* {@link android.app.Activity#finishActivity(int)}.
|
||||
* @return Returns true if one of the listed finish methods was called.
|
||||
*/
|
||||
public boolean isFinishCalled() {
|
||||
if (mMockParent != null) {
|
||||
return mMockParent.mFinished;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will return the request code if the Activity under test called
|
||||
* {@link android.app.Activity#finishActivity(int)}.
|
||||
* @return The request code provided in the start call, or -1 if no finish call was made.
|
||||
*/
|
||||
public int getFinishedActivityRequest() {
|
||||
if (mMockParent != null) {
|
||||
return mMockParent.mFinishedActivityRequest;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This mock Activity represents the "parent" activity. By injecting this, we allow the user
|
||||
* to call a few more Activity methods, including:
|
||||
* <ul>
|
||||
* <li>{@link android.app.Activity#getRequestedOrientation()}</li>
|
||||
* <li>{@link android.app.Activity#setRequestedOrientation(int)}</li>
|
||||
* <li>{@link android.app.Activity#finish()}</li>
|
||||
* <li>{@link android.app.Activity#finishActivity(int requestCode)}</li>
|
||||
* <li>{@link android.app.Activity#finishFromChild(Activity child)}</li>
|
||||
* </ul>
|
||||
*
|
||||
* TODO: Make this overrideable, and the unit test can look for calls to other methods
|
||||
*/
|
||||
private static class MockParent extends Activity {
|
||||
|
||||
public int mRequestedOrientation = 0;
|
||||
public Intent mStartedActivityIntent = null;
|
||||
public int mStartedActivityRequest = -1;
|
||||
public boolean mFinished = false;
|
||||
public int mFinishedActivityRequest = -1;
|
||||
|
||||
/**
|
||||
* Implementing in the parent allows the user to call this function on the tested activity.
|
||||
*/
|
||||
@Override
|
||||
public void setRequestedOrientation(int requestedOrientation) {
|
||||
mRequestedOrientation = requestedOrientation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementing in the parent allows the user to call this function on the tested activity.
|
||||
*/
|
||||
@Override
|
||||
public int getRequestedOrientation() {
|
||||
return mRequestedOrientation;
|
||||
}
|
||||
|
||||
/**
|
||||
* By returning null here, we inhibit the creation of any "container" for the window.
|
||||
*/
|
||||
@Override
|
||||
public Window getWindow() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* By defining this in the parent, we allow the tested activity to call
|
||||
* <ul>
|
||||
* <li>{@link android.app.Activity#startActivity(Intent)}</li>
|
||||
* <li>{@link android.app.Activity#startActivityForResult(Intent, int)}</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Override
|
||||
public void startActivityFromChild(Activity child, Intent intent, int requestCode) {
|
||||
mStartedActivityIntent = intent;
|
||||
mStartedActivityRequest = requestCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* By defining this in the parent, we allow the tested activity to call
|
||||
* <ul>
|
||||
* <li>{@link android.app.Activity#finish()}</li>
|
||||
* <li>{@link android.app.Activity#finishFromChild(Activity child)}</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Override
|
||||
public void finishFromChild(Activity child) {
|
||||
mFinished = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* By defining this in the parent, we allow the tested activity to call
|
||||
* <ul>
|
||||
* <li>{@link android.app.Activity#finishActivity(int requestCode)}</li>
|
||||
* </ul>
|
||||
*/
|
||||
@Override
|
||||
public void finishActivityFromChild(Activity child, int requestCode) {
|
||||
mFinished = true;
|
||||
mFinishedActivityRequest = requestCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.sap.sailing.android.tracking.app.test;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.sap.sailing.android.tracking.app.R;
|
||||
import com.sap.sailing.android.tracking.app.ui.activities.StartActivity;
|
||||
|
||||
public class StartActivityTest extends ActivityUnitTestCase<StartActivity> {
|
||||
private Intent mStartIntent;
|
||||
private FragmentManager fragmentManager;
|
||||
|
||||
public StartActivityTest() {
|
||||
super(StartActivity.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
ContextThemeWrapper context = new ContextThemeWrapper(
|
||||
getInstrumentation().getTargetContext(), R.style.AppTheme);
|
||||
setActivityContext(context);
|
||||
|
||||
mStartIntent = new Intent(Intent.ACTION_MAIN);
|
||||
startActivity(mStartIntent, null, null);
|
||||
fragmentManager = getActivity().getSupportFragmentManager();
|
||||
}
|
||||
|
||||
public void testHasTwoButtons() {
|
||||
|
||||
getInstrumentation().callActivityOnStart(getActivity());
|
||||
getInstrumentation().callActivityOnResume(getActivity());
|
||||
getActivity().getFragmentManager().executePendingTransactions();
|
||||
|
||||
fragmentManager.executePendingTransactions();
|
||||
|
||||
Button scanButton = (Button) getActivity().findViewById(R.id.scanQr);
|
||||
Button noQRButton = (Button) getActivity().findViewById(R.id.noQrCode);
|
||||
|
||||
assertNotNull(getActivity());
|
||||
assertNotNull(scanButton);
|
||||
assertNotNull(noQRButton);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
@@ -36,7 +35,7 @@
|
||||
<activity
|
||||
android:name=".ui.activities.StartActivity"
|
||||
android:label="@string/title_activity_start"
|
||||
android:screenOrientation="portrait" >
|
||||
android:screenOrientation="unspecified" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
@@ -52,7 +51,7 @@
|
||||
<activity
|
||||
android:name=".ui.activities.RegattaActivity"
|
||||
android:label="@string/title_activity_regatta"
|
||||
android:screenOrientation="portrait" >
|
||||
android:screenOrientation="unspecified" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.activities.StartActivity" />
|
||||
@@ -60,14 +59,14 @@
|
||||
<activity
|
||||
android:name=".ui.activities.TrackingActivity"
|
||||
android:label="@string/title_activity_tracking"
|
||||
android:screenOrientation="portrait" >
|
||||
android:screenOrientation="unspecified" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".ui.activities.StartActivity" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.activities.StartTrackingActivity"
|
||||
android:screenOrientation="portrait" >
|
||||
android:screenOrientation="unspecified" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
@@ -82,13 +81,13 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.activities.SystemInformationActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="unspecified" />
|
||||
<activity
|
||||
android:name=".ui.activities.SettingsActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="unspecified" />
|
||||
<activity
|
||||
android:name=".ui.activities.StopTrackingActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
android:screenOrientation="unspecified" />
|
||||
|
||||
<service
|
||||
android:name=".services.TrackingService"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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:background="@color/black" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/homeBackground"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:contentDescription="@string/empty"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/working_title" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/bottomLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@color/black_transparent"
|
||||
>
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/scan_hint"
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/two_buttons_layout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_above="@+id/bottomLayout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansButton
|
||||
android:id="@+id/scanQr"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/rounded_btn_yellow"
|
||||
android:textAllCaps="true"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/scan_qr" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansButton
|
||||
android:id="@+id/noQrCode"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:background="@drawable/rounded_btn_white"
|
||||
android:textColor="@color/black"
|
||||
android:text="@string/no_qr_code" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ListView
|
||||
android:id="@+id/listRegatta"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/two_buttons_layout"
|
||||
android:layout_alignParentTop="true"
|
||||
>
|
||||
</ListView>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,337 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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:background="@color/black" >
|
||||
|
||||
<View
|
||||
android:id="@+id/top_bar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="4dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/sap_yellow" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/two_panels_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_above="@id/start_tracking_box"
|
||||
android:layout_below="@id/top_bar"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/image"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/userImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/picture" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/add_photo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@color/white_transparent"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/add_photo_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:src="@drawable/ic_menu_camera" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/add_photo_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:text="Add Team Photo"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/competitor_info_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@color/black_transparent"
|
||||
android:baselineAligned="false"
|
||||
android:measureWithLargestChild="false"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp" >
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/competitor_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center_vertical"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:text="Peter von Mustermann"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/flag_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.53"
|
||||
android:cropToPadding="true"
|
||||
android:gravity="right|center_vertical"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingRight="5dp"
|
||||
android:scaleType="fitEnd"
|
||||
android:src="@drawable/ar"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/sail_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="right|center_vertical"
|
||||
android:padding="0dp"
|
||||
android:text="GER 13"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/change_photo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/competitor_info_layout"
|
||||
android:layout_toRightOf="@+id/add_photo"
|
||||
android:background="@drawable/background_lighter_box"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp" >
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/change_photo_button"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:src="@android:drawable/ic_menu_edit" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- RIGHT SIDE -->
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/right_side_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/thank_you_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:baselineAligned="false"
|
||||
android:measureWithLargestChild="false"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible" >
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/thank_you_note"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left"
|
||||
android:padding="0dp"
|
||||
android:text="@string/thank_you_you_successfully_participated"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/start_date_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:baselineAligned="false"
|
||||
android:measureWithLargestChild="false"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp" >
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/regatta_starts_in"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="0dp"
|
||||
android:text="@string/regatta_starts_in"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/three_boxes_regatta_starts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center"
|
||||
android:measureWithLargestChild="false"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/three_boxes_days_box"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/regatta_starts_in"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/background_box"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center"
|
||||
android:measureWithLargestChild="false"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp" >
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_days"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="0dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="40sp" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_days_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="0dp"
|
||||
android:text="@string/days"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/three_boxes_hours_box"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/regatta_starts_in"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/background_box"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center"
|
||||
android:measureWithLargestChild="false"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp" >
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_hours"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="0dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="40sp" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_hours_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="0dp"
|
||||
android:text="@string/hours"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/three_boxes_minutes_box"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/regatta_starts_in"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/background_box"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center"
|
||||
android:measureWithLargestChild="false"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp" >
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_minutes"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="0dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="40sp" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_minutes_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="0dp"
|
||||
android:text="@string/minutes"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/bottom_bar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="4dp"
|
||||
android:layout_above="@+id/start_tracking_box"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@color/sap_yellow" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/start_tracking_box"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_above="@id/bottomLayout"
|
||||
android:background="@color/gray" >
|
||||
|
||||
<View
|
||||
android:id="@+id/white_bar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/white_transparent" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansButton
|
||||
android:id="@+id/start_tracking"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:background="@drawable/rounded_btn_green"
|
||||
android:padding="10dp"
|
||||
android:text="@string/start_tracking"
|
||||
android:textAllCaps="true"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/bottomLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@color/darker_gray" >
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/bottom_announcement"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/please_listen_to_announcements"
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:custom="http://schemas.android.com/apk/res/com.sap.sailing.android.tracking.app.views"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res/com.sap.sailing.android.tracking.app"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black" >
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/mode_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/qps_quality"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/tracking_mode" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/mode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/mode_label"
|
||||
android:layout_alignBottom="@id/mode_label"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingRight="10dp"
|
||||
android:text="@string/tracking_mode_caching"
|
||||
android:textColor="@color/sap_green" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/tracking_status_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/mode_label"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/tracking_status" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/tracking_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/tracking_status_label"
|
||||
android:layout_alignBottom="@id/tracking_status_label"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingRight="10dp"
|
||||
android:text="@string/tracking_status_tracking"
|
||||
android:textColor="@color/sap_green" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/tracking_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:layout_below="@+id/tracking_status_label"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/tracking_qps_quality" />
|
||||
|
||||
<!-- Separators -->
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@id/mode_label"
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@id/tracking_status_label"
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
<View
|
||||
android:id="@+id/white_bar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignTop="@+id/tracking_time_info_label"
|
||||
android:background="@android:color/darker_gray" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/start_tracking_box"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_above="@id/bottomLayout"
|
||||
android:background="@color/gray" >
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansButton
|
||||
android:id="@+id/stop_tracking"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:background="@drawable/rounded_btn_red"
|
||||
android:padding="10dp"
|
||||
android:text="@string/stop_tracking"
|
||||
android:textAllCaps="true"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/bottomLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@color/darker_gray" >
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/tracking_time_info_label"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/tracking_time"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/tracking_time" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.views.AutoResizeTextView
|
||||
android:id="@+id/tracking_time_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignBaseline="@+id/tracking_time_info_label"
|
||||
android:layout_alignBottom="@+id/tracking_time_info_label"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:gravity="right"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="00:00:00" />
|
||||
|
||||
<com.sap.sailing.android.tracking.app.views.SignalQualityIndicatorView
|
||||
android:id="@+id/qps_quality_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@+id/tracking_time"
|
||||
android:layout_alignBottom="@+id/tracking_time"
|
||||
android:layout_alignParentRight="true"
|
||||
android:contentDescription="@string/signal_quality_indicator_view_description"
|
||||
android:focusable="true"
|
||||
android:paddingRight="10dp"
|
||||
app:signalQuality="none" />
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_above="@+id/start_tracking_box"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@color/white_transparent" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -13,15 +13,17 @@
|
||||
android:contentDescription="@string/empty"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/working_title" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/bottomLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@+color/black_transparent"
|
||||
android:layout_alignParentLeft="true" >
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
@@ -31,7 +33,7 @@
|
||||
android:textColor="@color/white" />
|
||||
</RelativeLayout>
|
||||
|
||||
<Button
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansButton
|
||||
android:id="@+id/scanQr"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="80dp"
|
||||
@@ -44,7 +46,7 @@
|
||||
android:textStyle="bold"
|
||||
android:text="@string/scan_qr" />
|
||||
|
||||
<Button
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansButton
|
||||
android:id="@+id/noQrCode"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:src="@drawable/ic_menu_camera" />
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/add_photo_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -55,7 +55,7 @@
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp" >
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/competitor_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -78,7 +78,7 @@
|
||||
android:src="@drawable/ar"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/sail_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -124,8 +124,8 @@
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/sap_yellow" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/thank_you_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
@@ -134,10 +134,10 @@
|
||||
android:baselineAligned="false"
|
||||
android:measureWithLargestChild="false"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible"
|
||||
android:padding="10dp" >
|
||||
android:padding="10dp"
|
||||
android:visibility="invisible" >
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/thank_you_note"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -146,7 +146,6 @@
|
||||
android:text="@string/thank_you_you_successfully_participated"
|
||||
android:textColor="@color/white"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
@@ -160,7 +159,7 @@
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp" >
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/regatta_starts_in"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -194,7 +193,7 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp" >
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_days"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -202,7 +201,7 @@
|
||||
android:textColor="@color/white"
|
||||
android:textSize="40sp" />
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_days_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -224,7 +223,7 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp" >
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_hours"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -232,7 +231,7 @@
|
||||
android:textColor="@color/white"
|
||||
android:textSize="40sp" />
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_hours_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -254,7 +253,7 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp" >
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_minutes"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -262,7 +261,7 @@
|
||||
android:textColor="@color/white"
|
||||
android:textSize="40sp" />
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/starts_in_minutes_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -288,7 +287,7 @@
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/white_transparent" />
|
||||
|
||||
<Button
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansButton
|
||||
android:id="@+id/start_tracking"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
@@ -301,16 +300,16 @@
|
||||
android:textAllCaps="true"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/bottomLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/darker_gray"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true" >
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@color/darker_gray" >
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/bottom_announcement"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black" >
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/mode_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
@@ -17,7 +17,7 @@
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/tracking_mode" />
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/mode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -28,7 +28,7 @@
|
||||
android:textColor="@color/sap_green"
|
||||
android:text="@string/tracking_mode_caching" />
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/tracking_status_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
@@ -37,7 +37,7 @@
|
||||
android:paddingLeft="10dp"
|
||||
android:text="@string/tracking_status" />
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/tracking_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -60,7 +60,7 @@
|
||||
android:paddingRight="10dp"
|
||||
app:signalQuality="none" />
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/qps_quality"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
@@ -78,7 +78,7 @@
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="20sp" >
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/tracking_time_info_label"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="50dp"
|
||||
@@ -134,7 +134,7 @@
|
||||
android:background="@color/white_transparent" />
|
||||
|
||||
|
||||
<Button
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansButton
|
||||
android:id="@+id/stop_tracking"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
@@ -157,7 +157,7 @@
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true" >
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
android:layout_marginRight="10dp"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:id="@+id/regattaName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@color/sap_yellow" />
|
||||
|
||||
<TextView
|
||||
<com.sap.sailing.android.tracking.app.customviews.OpenSansTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/top_bar"
|
||||
|
||||
@@ -71,5 +71,6 @@
|
||||
<string name="thank_you_you_successfully_participated">Vielen Dank, Sie haben erfolgreich an der Regatta teilgenommen.\n\nIhr SAP Sailing Team</string>
|
||||
<string name="no_qr_code_popup_title">Kein QR-Code?</string>
|
||||
<string name="no_qr_code_popup_message">Bitte kontaktieren Sie die Rennleitung, falls Sie keinen QR-Code erhalten haben.</string>
|
||||
<string name="tracking_colon">Tracke:</string>
|
||||
|
||||
</resources>
|
||||
@@ -63,5 +63,6 @@
|
||||
<string name="thank_you_you_successfully_participated">Thank you, you have successfully taken part in the regatta.\n\nYour SAP Sailing Team</string>
|
||||
<string name="no_qr_code_popup_title">No QR-Code?</string>
|
||||
<string name="no_qr_code_popup_message">Please contact race management if you have not received a QR-Code.</string>
|
||||
<string name="tracking_colon">Tracking:</string>
|
||||
|
||||
</resources>
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="tracking_activity_event_id_parameter">trackingActivityEventId</string>
|
||||
<string name="tracking_activity_started_by_start_activity_parameter">startedByStartActivity</string>
|
||||
</resources>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.sap.sailing.android.tracking.app.customviews;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.Button;
|
||||
|
||||
public class OpenSansButton extends Button {
|
||||
|
||||
public OpenSansButton(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public OpenSansButton(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public OpenSansButton(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
public OpenSansButton(Context context, AttributeSet attrs,
|
||||
int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
init();
|
||||
}
|
||||
|
||||
protected void init()
|
||||
{
|
||||
setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/OpenSans-Regular.ttf"));
|
||||
}
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.sap.sailing.android.tracking.app.customviews;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class OpenSansTextView extends TextView {
|
||||
|
||||
public OpenSansTextView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public OpenSansTextView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public OpenSansTextView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
init();
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/OpenSans-Regular.ttf"));
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package com.sap.sailing.android.tracking.app.customviews;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class OpenSansToolbar extends Toolbar {
|
||||
|
||||
public OpenSansToolbar(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public OpenSansToolbar(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public OpenSansToolbar(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
TextView titleTextView = getActionBarTextView();
|
||||
if (titleTextView != null)
|
||||
{
|
||||
System.out.println("NOT NULL");
|
||||
titleTextView.setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/Admiration Pains.ttf"));
|
||||
}
|
||||
System.out.println("NULL");
|
||||
}
|
||||
|
||||
private TextView getActionBarTextView() {
|
||||
TextView titleTextView = null;
|
||||
|
||||
ArrayList<Field> fields = getAllFields(new ArrayList<Field>(), this.getClass());
|
||||
for (Field fld : fields)
|
||||
System.out.println(" " + fld);
|
||||
|
||||
try {
|
||||
Field f = this.getClass().getSuperclass().getDeclaredField("mTitleTextView");
|
||||
f.setAccessible(true);
|
||||
titleTextView = (TextView) f.get(this);
|
||||
} catch (NoSuchFieldException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
}
|
||||
return titleTextView;
|
||||
}
|
||||
|
||||
public static ArrayList<Field> getAllFields(ArrayList<Field> fields, Class<?> type) {
|
||||
fields.addAll(Arrays.asList(type.getDeclaredFields()));
|
||||
|
||||
if (type.getSuperclass() != null) {
|
||||
fields = getAllFields(fields, type.getSuperclass());
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
}
|
||||
+6
@@ -53,6 +53,12 @@ public class AnalyticsContract {
|
||||
private static final String PATH_LEADERBOARD = "leaderboards";
|
||||
private static final String PATH_SENSOR_GPS = "sensor_gps";
|
||||
|
||||
|
||||
public static class LeaderboardsEventsJoined {
|
||||
public final static Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
|
||||
.appendPath("leaderboards_events_joined").build();
|
||||
}
|
||||
|
||||
public static class EventGpsFixesJoined {
|
||||
public final static Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
|
||||
.appendPath("event_gps_fix_joined").build();
|
||||
|
||||
+1
@@ -33,6 +33,7 @@ public class AnalyticsDatabase extends SQLiteOpenHelper {
|
||||
" INNER JOIN " + Tables.EVENTS + " ON (" + Tables.LEADERBOARDS + "." + BaseColumns._ID + " = " + Tables.EVENTS + ".leaderboard_id ) " +
|
||||
" INNER JOIN " + Tables.COMPETITORS + " ON (" + Tables.LEADERBOARDS + "."+ BaseColumns._ID + " = " + Tables.COMPETITORS + ".leaderboard_id ) ";
|
||||
String GPS_FIXES_JOIN_EVENTS = "sensor_gps LEFT JOIN events ON sensor_gps.event_id = events._id ";
|
||||
String LEADERBOARDS_JOIN_EVENTS = "events LEFT JOIN leaderboards ON events.leaderboard_id = leaderboards._id ";
|
||||
}
|
||||
|
||||
public AnalyticsDatabase(Context context) {
|
||||
|
||||
+10
@@ -48,6 +48,8 @@ public class AnalyticsProvider extends ContentProvider {
|
||||
|
||||
private static final int EVENT_GPS_FIXES_JOINED = 700;
|
||||
|
||||
private static final int LEADERBOARDS_EVENTS_JOINED = 800;
|
||||
|
||||
private static UriMatcher buildUriMatcher() {
|
||||
final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
|
||||
final String authority = AnalyticsContract.CONTENT_AUTHORITY;
|
||||
@@ -71,6 +73,8 @@ public class AnalyticsProvider extends ContentProvider {
|
||||
|
||||
matcher.addURI(authority, "event_gps_fix_joined", EVENT_GPS_FIXES_JOINED);
|
||||
|
||||
matcher.addURI(authority, "leaderboards_events_joined", LEADERBOARDS_EVENTS_JOINED);
|
||||
|
||||
return matcher;
|
||||
}
|
||||
|
||||
@@ -113,6 +117,12 @@ public class AnalyticsProvider extends ContentProvider {
|
||||
cursor = eb.query(db, projection, selection, selectionArgs, null, null, sortOrder);
|
||||
return cursor;
|
||||
|
||||
case LEADERBOARDS_EVENTS_JOINED:
|
||||
SQLiteQueryBuilder el = new SQLiteQueryBuilder();
|
||||
el.setTables(Tables.LEADERBOARDS_JOIN_EVENTS);
|
||||
cursor = el.query(db, projection, selection, selectionArgs, null, null, sortOrder);
|
||||
return cursor;
|
||||
|
||||
default:
|
||||
final SelectionBuilder builder = buildExpandedSelection(uri);
|
||||
|
||||
|
||||
+5
-12
@@ -15,7 +15,6 @@ import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
@@ -23,9 +22,6 @@ import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.BaseColumns;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
@@ -35,7 +31,6 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.volley.Request.Method;
|
||||
import com.android.volley.Response.ErrorListener;
|
||||
import com.android.volley.Response.Listener;
|
||||
import com.android.volley.VolleyError;
|
||||
@@ -95,15 +90,13 @@ public class RegattaActivity extends BaseActivity {
|
||||
toolbar.setNavigationIcon(R.drawable.sap_logo_64_sq);
|
||||
toolbar.setPadding(20, 0, 0, 0);
|
||||
getSupportActionBar().setTitle(leaderboardName);
|
||||
Spannable subtitle = new SpannableString("Registered for: " + eventName);
|
||||
StyleSpan styleBold = new StyleSpan(Typeface.BOLD);
|
||||
subtitle.setSpan(styleBold, 16, 20, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
getSupportActionBar().setSubtitle(subtitle);
|
||||
getSupportActionBar().setSubtitle(eventName);
|
||||
}
|
||||
|
||||
replaceFragment(R.id.content_frame, new RegattaFragment());
|
||||
|
||||
replaceFragment(R.id.content_frame, new RegattaFragment());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
|
||||
+3
-4
@@ -18,18 +18,18 @@ public class StartActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
setContentView(R.layout.fragment_container);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
if (toolbar != null) {
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
toolbar.setNavigationIcon(R.drawable.sap_logo_64_sq);
|
||||
toolbar.setPadding(20, 0, 0, 0);
|
||||
toolbar.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
}
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().setHomeButtonEnabled(false);
|
||||
getSupportActionBar().setTitle(getString(R.string.title_activity_start));
|
||||
getSupportActionBar().setHomeButtonEnabled(false);
|
||||
}
|
||||
|
||||
replaceFragment(R.id.content_frame, new HomeFragment());
|
||||
@@ -77,7 +77,6 @@ public class StartActivity extends BaseActivity {
|
||||
private void startTrackingActivity(int eventId) {
|
||||
Intent intent = new Intent(this, TrackingActivity.class);
|
||||
intent.putExtra(getString(R.string.tracking_activity_event_id_parameter), eventId);
|
||||
intent.putExtra(getString(R.string.tracking_activity_started_by_start_activity_parameter), true);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
+55
-18
@@ -1,16 +1,25 @@
|
||||
package com.sap.sailing.android.tracking.app.ui.activities;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.provider.BaseColumns;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.StyleSpan;
|
||||
|
||||
import com.sap.sailing.android.shared.logging.ExLog;
|
||||
import com.sap.sailing.android.tracking.app.BuildConfig;
|
||||
import com.sap.sailing.android.tracking.app.R;
|
||||
import com.sap.sailing.android.tracking.app.provider.AnalyticsContract.Event;
|
||||
import com.sap.sailing.android.tracking.app.provider.AnalyticsContract.LeaderboardsEventsJoined;
|
||||
import com.sap.sailing.android.tracking.app.services.TrackingService;
|
||||
import com.sap.sailing.android.tracking.app.services.TrackingService.GPSQuality;
|
||||
import com.sap.sailing.android.tracking.app.services.TrackingService.GPSQualityListener;
|
||||
@@ -28,10 +37,10 @@ public class TrackingActivity extends BaseActivity implements GPSQualityListener
|
||||
|
||||
TransmittingService transmittingService;
|
||||
boolean transmittingServiceBound;
|
||||
boolean startedByStartActivity;
|
||||
|
||||
private final static String TAG = TrackingActivity.class.getName();
|
||||
|
||||
private final static String SIS_FRAGMENT = "savedInstanceTrackingFragment";
|
||||
|
||||
private int eventId;
|
||||
|
||||
@Override
|
||||
@@ -39,8 +48,7 @@ public class TrackingActivity extends BaseActivity implements GPSQualityListener
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Intent intent = getIntent();
|
||||
eventId = intent.getExtras().getInt(getString(R.string.tracking_activity_event_id_parameter));
|
||||
startedByStartActivity = intent.getExtras().getBoolean(getString(R.string.tracking_activity_started_by_start_activity_parameter));
|
||||
eventId = intent.getExtras().getInt(getString(R.string.tracking_activity_event_id_parameter));
|
||||
|
||||
setContentView(R.layout.fragment_container);
|
||||
|
||||
@@ -51,16 +59,54 @@ public class TrackingActivity extends BaseActivity implements GPSQualityListener
|
||||
toolbar.setPadding(20, 0, 0, 0);
|
||||
toolbar.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
}
|
||||
|
||||
if (getSupportActionBar() != null) {
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
|
||||
getSupportActionBar().setHomeButtonEnabled(false);
|
||||
getSupportActionBar().setTitle(R.string.title_activity_tracking);
|
||||
|
||||
String leaderboardName = "";
|
||||
String eventName = "";
|
||||
ContentResolver cr = getContentResolver();
|
||||
String projectionStr = "events._id,leaderboards.leaderboard_name,events.event_name";
|
||||
String[] projection = projectionStr.split(",");
|
||||
Cursor cursor = cr.query(LeaderboardsEventsJoined.CONTENT_URI, projection, "events._id = " + eventId, null, null);
|
||||
if (cursor.moveToFirst())
|
||||
{
|
||||
eventName = cursor.getString(cursor.getColumnIndex("event_name"));
|
||||
leaderboardName = cursor.getString(cursor.getColumnIndex("leaderboard_name"));
|
||||
}
|
||||
|
||||
cursor.close();
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
toolbar.setNavigationIcon(R.drawable.sap_logo_64_sq);
|
||||
toolbar.setPadding(20, 0, 0, 0);
|
||||
getSupportActionBar().setTitle(leaderboardName);
|
||||
getSupportActionBar().setSubtitle(getString(R.string.tracking_colon) + " " + eventName);
|
||||
}
|
||||
|
||||
replaceFragment(R.id.content_frame, new TrackingFragment());
|
||||
|
||||
TrackingFragment fragment;
|
||||
if (savedInstanceState != null)
|
||||
{
|
||||
fragment = (TrackingFragment)getSupportFragmentManager().getFragment(savedInstanceState, SIS_FRAGMENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
fragment = new TrackingFragment();
|
||||
}
|
||||
|
||||
replaceFragment(R.id.content_frame, fragment);
|
||||
startTrackingService(eventId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
TrackingFragment fragment = (TrackingFragment)getSupportFragmentManager()
|
||||
.findFragmentById(R.id.content_frame);
|
||||
getSupportFragmentManager().putFragment(outState, SIS_FRAGMENT, fragment);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
@@ -176,13 +222,4 @@ public class TrackingActivity extends BaseActivity implements GPSQualityListener
|
||||
trackingServiceBound = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* the fragment can call this to know if tracking was running before, so it doesn't reset the timer.
|
||||
* @return
|
||||
*/
|
||||
public boolean getStartedByStartActivity()
|
||||
{
|
||||
return startedByStartActivity;
|
||||
}
|
||||
}
|
||||
+1
@@ -104,6 +104,7 @@ public class HomeFragment extends BaseFragment implements
|
||||
if (listView != null) {
|
||||
listView.addHeaderView(inflater.inflate(
|
||||
R.layout.regatta_listview_header, null));
|
||||
|
||||
adapter = new RegattaAdapter(getActivity(),
|
||||
R.layout.ragatta_listview_row, null, 0);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
+18
-19
@@ -36,7 +36,7 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
|
||||
private final int SELECT_PHOTO_REQUEST_CODE = 1693;
|
||||
|
||||
private boolean showingThankYouNote;
|
||||
|
||||
|
||||
private TimerRunnable timer;
|
||||
|
||||
@Override
|
||||
@@ -65,21 +65,19 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void checkAndSwitchToThankYouScreenIfRegattaOver()
|
||||
{
|
||||
|
||||
private void checkAndSwitchToThankYouScreenIfRegattaOver() {
|
||||
RegattaActivity regattaActivity = (RegattaActivity) getActivity();
|
||||
long regattaEnd = regattaActivity.getEventEndMillis();
|
||||
|
||||
if (System.currentTimeMillis() > regattaEnd)
|
||||
{
|
||||
|
||||
if (System.currentTimeMillis() > regattaEnd) {
|
||||
switchToThankYouScreen();
|
||||
}
|
||||
}
|
||||
|
||||
private void switchToThankYouScreen() {
|
||||
showingThankYouNote = true;
|
||||
|
||||
|
||||
RelativeLayout startsInLayout = (RelativeLayout) getActivity()
|
||||
.findViewById(R.id.start_date_layout);
|
||||
startsInLayout.setVisibility(View.INVISIBLE);
|
||||
@@ -90,10 +88,12 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
|
||||
.getColor(R.color.sap_yellow));
|
||||
startTrackingButton.setText(getActivity().getString(R.string.close));
|
||||
|
||||
TextView bottomAnnouncement = (TextView) getActivity().findViewById(R.id.bottom_announcement);
|
||||
TextView bottomAnnouncement = (TextView) getActivity().findViewById(
|
||||
R.id.bottom_announcement);
|
||||
bottomAnnouncement.setVisibility(View.INVISIBLE);
|
||||
|
||||
RelativeLayout thankYouLayout = (RelativeLayout)getActivity().findViewById(R.id.thank_you_layout);
|
||||
|
||||
RelativeLayout thankYouLayout = (RelativeLayout) getActivity()
|
||||
.findViewById(R.id.thank_you_layout);
|
||||
thankYouLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@@ -115,14 +115,11 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.start_tracking:
|
||||
if (showingThankYouNote)
|
||||
{
|
||||
RegattaActivity regattaActivity = (RegattaActivity)getActivity();
|
||||
if (showingThankYouNote) {
|
||||
RegattaActivity regattaActivity = (RegattaActivity) getActivity();
|
||||
regattaActivity.checkout();
|
||||
}
|
||||
else
|
||||
{
|
||||
startTrackingActivity();
|
||||
} else {
|
||||
startTrackingActivity();
|
||||
}
|
||||
break;
|
||||
case R.id.add_photo_button:
|
||||
@@ -218,7 +215,9 @@ public class RegattaFragment extends BaseFragment implements OnClickListener {
|
||||
private void startTrackingActivity() {
|
||||
RegattaActivity regattaActivity = (RegattaActivity) getActivity();
|
||||
Intent intent = new Intent(getActivity(), TrackingActivity.class);
|
||||
intent.putExtra(getString(R.string.tracking_activity_event_id_parameter), regattaActivity.getEventId());
|
||||
intent.putExtra(
|
||||
getString(R.string.tracking_activity_event_id_parameter),
|
||||
regattaActivity.getEventId());
|
||||
getActivity().startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
+39
-5
@@ -33,6 +33,10 @@ import com.sap.sailing.android.tracking.app.views.SignalQualityIndicatorView;
|
||||
|
||||
public class TrackingFragment extends BaseFragment implements OnClickListener {
|
||||
|
||||
static final String SIS_MODE = "instanceStateMode";
|
||||
static final String SIS_STATUS = "instanceStateStatus";
|
||||
static final String SIS_GPS_QUALITY = "instanceStateGpsQuality";
|
||||
|
||||
private TimerRunnable timer;
|
||||
private AppPreferences prefs;
|
||||
private long lastGPSQualityUpdate;
|
||||
@@ -50,8 +54,7 @@ public class TrackingFragment extends BaseFragment implements OnClickListener {
|
||||
stopTracking.setOnClickListener(this);
|
||||
|
||||
prefs = new AppPreferences(getActivity());
|
||||
|
||||
if (((TrackingActivity)getActivity()).getStartedByStartActivity() == false)
|
||||
if (prefs.getTrackingTimerStarted() == 0)
|
||||
{
|
||||
prefs.setTrackingTimerStarted(System.currentTimeMillis());
|
||||
}
|
||||
@@ -84,9 +87,38 @@ public class TrackingFragment extends BaseFragment implements OnClickListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
timer.stop();
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
System.out.println("ON ACTIVITY CREATED");
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
if (savedInstanceState != null)
|
||||
{
|
||||
System.out.println("NOT NULL");
|
||||
TextView modeText = (TextView)getActivity().findViewById(R.id.mode);
|
||||
TextView statusText = (TextView)getActivity().findViewById(R.id.tracking_status);
|
||||
SignalQualityIndicatorView qualityIndicator = (SignalQualityIndicatorView)getActivity().findViewById(R.id.qps_quality_indicator);
|
||||
|
||||
modeText.setText(savedInstanceState.getString(SIS_MODE));
|
||||
statusText.setText(savedInstanceState.getString(SIS_STATUS));
|
||||
qualityIndicator.setSignalQuality(savedInstanceState.getInt(SIS_GPS_QUALITY));
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("NULL");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
System.out.println("ON SAVE INSTANCE STATE");
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
TextView modeText = (TextView)getActivity().findViewById(R.id.mode);
|
||||
TextView statusText = (TextView)getActivity().findViewById(R.id.tracking_status);
|
||||
SignalQualityIndicatorView qualityIndicator = (SignalQualityIndicatorView)getActivity().findViewById(R.id.qps_quality_indicator);
|
||||
|
||||
outState.putString(SIS_MODE, modeText.getText().toString());
|
||||
outState.putString(SIS_STATUS, statusText.getText().toString());
|
||||
outState.putInt(SIS_GPS_QUALITY, qualityIndicator.getSignalQuality());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,6 +246,8 @@ public class TrackingFragment extends BaseFragment implements OnClickListener {
|
||||
}
|
||||
|
||||
private void stopTracking() {
|
||||
prefs.setTrackingTimerStarted(0);
|
||||
|
||||
Intent intent = new Intent(getActivity(), TrackingService.class);
|
||||
intent.setAction(getString(R.string.tracking_service_stop));
|
||||
getActivity().startService(intent);
|
||||
|
||||
+2
@@ -19,6 +19,7 @@ package com.sap.sailing.android.tracking.app.views;
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.text.Layout.Alignment;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
@@ -85,6 +86,7 @@ public class AutoResizeTextView extends TextView {
|
||||
// Default constructor override
|
||||
public AutoResizeTextView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
setTypeface(Typeface.createFromAsset(getContext().getAssets(), "fonts/OpenSans-Regular.ttf"));
|
||||
mTextSize = getTextSize();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user