aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-09-03 10:28:53 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-09-03 10:28:53 +1200
commit5705bc2c909fb93ba18ac42ade6a450b72e32598 (patch)
treea223ce5f854e05b1806f2afd1f84c2406641ba78
parent56eb501b5e33dcd15f6d0f4c3af229ec75b433fd (diff)
downloadetbsa-traccar-manager-android-5705bc2c909fb93ba18ac42ade6a450b72e32598.tar.gz
etbsa-traccar-manager-android-5705bc2c909fb93ba18ac42ade6a450b72e32598.tar.bz2
etbsa-traccar-manager-android-5705bc2c909fb93ba18ac42ade6a450b72e32598.zip
Add Firebase and support lib
-rw-r--r--app/build.gradle23
-rw-r--r--app/src/google/AndroidManifest.xml12
-rw-r--r--app/src/google/java/org/traccar/client/GoogleMainApplication.java32
-rw-r--r--app/src/main/AndroidManifest.xml3
-rw-r--r--app/src/main/java/org/traccar/manager/MainActivity.java4
-rw-r--r--app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml2
-rw-r--r--app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml2
-rw-r--r--app/src/main/res/values-v21/styles.xml4
-rw-r--r--app/src/main/res/values/colors.xml9
-rw-r--r--app/src/main/res/values/ic_launcher_background.xml4
-rw-r--r--app/src/main/res/values/styles.xml4
-rw-r--r--app/src/main/res/values/themes.xml10
-rw-r--r--build.gradle1
13 files changed, 93 insertions, 17 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 0f0e8d8..c963ac4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -12,6 +12,11 @@ android {
versionName "2.3"
}
+ productFlavors {
+ regular
+ google
+ }
+
buildTypes {
release {
minifyEnabled false
@@ -21,6 +26,24 @@ android {
}
dependencies {
+ compile 'com.android.support:design:26.0.1'
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.0'
+ googleCompile 'com.google.firebase:firebase-core:11.2.0'
+ googleCompile 'com.google.firebase:firebase-crash:11.2.0'
+}
+
+if (getGradle().getStartParameter().getTaskRequests().toString().contains("Google")) {
+ apply plugin: 'com.google.gms.google-services'
+
+ task copyJson(type: Copy) {
+ from '../../traccar-shared/google-services'
+ into '.'
+ include 'traccar-manager-android.json'
+ rename('traccar-manager-android.json', 'google-services.json')
+ }
+
+ afterEvaluate {
+ preBuild.dependsOn copyJson
+ }
}
diff --git a/app/src/google/AndroidManifest.xml b/app/src/google/AndroidManifest.xml
new file mode 100644
index 0000000..d5b452b
--- /dev/null
+++ b/app/src/google/AndroidManifest.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools">
+
+ <application
+ android:name="org.traccar.client.GoogleMainApplication"
+ tools:replace="android:name">
+
+ </application>
+
+</manifest>
diff --git a/app/src/google/java/org/traccar/client/GoogleMainApplication.java b/app/src/google/java/org/traccar/client/GoogleMainApplication.java
new file mode 100644
index 0000000..5b6a51b
--- /dev/null
+++ b/app/src/google/java/org/traccar/client/GoogleMainApplication.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2017 Anton Tananaev (anton.tananaev@gmail.com)
+ *
+ * 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 org.traccar.client;
+
+import android.app.Application;
+
+import com.google.firebase.analytics.FirebaseAnalytics;
+
+public class GoogleMainApplication extends Application {
+
+ private FirebaseAnalytics firebaseAnalytics;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ firebaseAnalytics = FirebaseAnalytics.getInstance(this);
+ }
+
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 551a573..79cd006 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
package="org.traccar.manager">
<uses-permission android:name="android.permission.INTERNET" />
diff --git a/app/src/main/java/org/traccar/manager/MainActivity.java b/app/src/main/java/org/traccar/manager/MainActivity.java
index fd4c23b..719ff7c 100644
--- a/app/src/main/java/org/traccar/manager/MainActivity.java
+++ b/app/src/main/java/org/traccar/manager/MainActivity.java
@@ -15,11 +15,11 @@
*/
package org.traccar.manager;
-import android.app.Activity;
import android.os.Bundle;
import android.preference.PreferenceManager;
+import android.support.v7.app.AppCompatActivity;
-public class MainActivity extends Activity {
+public class MainActivity extends AppCompatActivity {
public static final String PREFERENCE_URL = "url";
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index 036d09b..7335274 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="@color/ic_launcher_background"/>
+ <background android:drawable="@color/primary"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon> \ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
index 036d09b..7335274 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
- <background android:drawable="@color/ic_launcher_background"/>
+ <background android:drawable="@color/primary"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon> \ No newline at end of file
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml
deleted file mode 100644
index 52f0d10..0000000
--- a/app/src/main/res/values-v21/styles.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<resources>
- <style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
- </style>
-</resources>
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..4cfa782
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <color name="primary">#1E88E5</color>
+ <color name="primary_dark">#1565C0</color>
+ <color name="accent">#1976D2</color>
+ <color name="white">#FFFFFF</color>
+
+</resources>
diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml
deleted file mode 100644
index 1de78b8..0000000
--- a/app/src/main/res/values/ic_launcher_background.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <color name="ic_launcher_background">#1E88E5</color>
-</resources> \ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
deleted file mode 100644
index 31ea1fb..0000000
--- a/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<resources>
- <style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar">
- </style>
-</resources>
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
new file mode 100644
index 0000000..c1b3366
--- /dev/null
+++ b/app/src/main/res/values/themes.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
+ <item name="colorPrimary">@color/primary</item>
+ <item name="colorPrimaryDark">@color/primary_dark</item>
+ <item name="colorAccent">@color/accent</item>
+ </style>
+
+</resources>
diff --git a/build.gradle b/build.gradle
index 3ac9c14..9327e1d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,6 +4,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
+ classpath 'com.google.gms:google-services:3.1.0'
}
}