Этот коммит содержится в:
Anton Tananaev
2017-08-30 13:42:04 +12:00
родитель e0c5340d8b
Коммит f2e7ae7c21
11 изменённых файлов: 65 добавлений и 32 удалений
+6 -8
Просмотреть файл
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?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.client"> package="org.traccar.client">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
@@ -14,14 +15,12 @@
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/TraccarTheme" android:theme="@style/AppTheme"
android:name=".MainApplication"> android:name=".MainApplication">
<activity android:name=".MainFragment" android:launchMode="singleTask" /> <activity android:name=".MainActivity" android:launchMode="singleTask" />
<activity-alias <activity-alias android:name=".Launcher" android:targetActivity=".MainActivity">
android:name=".Launcher"
android:targetActivity=".MainFragment">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
@@ -32,8 +31,7 @@
<activity android:name=".AboutActivity"/> <activity android:name=".AboutActivity"/>
<activity <activity android:name=".ShortcutActivity">
android:name=".ShortcutActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
+1 -1
Просмотреть файл
@@ -28,7 +28,7 @@ public class DialLaunchReceiver extends BroadcastReceiver {
String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
if (phoneNumber.equals(LAUNCHER_NUMBER)) { if (phoneNumber.equals(LAUNCHER_NUMBER)) {
setResultData(null); setResultData(null);
Intent appIntent = new Intent(context, MainFragment.class); Intent appIntent = new Intent(context, MainActivity.class);
appIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); appIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(appIntent); context.startActivity(appIntent);
} }
+32
Просмотреть файл
@@ -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.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState == null) {
getFragmentManager().beginTransaction().replace(android.R.id.content, new MainFragment()).commit();
}
}
}
+3 -1
Просмотреть файл
@@ -73,6 +73,8 @@ public class MainFragment extends PreferenceFragment implements OnSharedPreferen
removeLauncherIcon(); removeLauncherIcon();
} }
setHasOptionsMenu(true);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
migrateLegacyPreferences(sharedPreferences); migrateLegacyPreferences(sharedPreferences);
addPreferencesFromResource(R.xml.preferences); addPreferencesFromResource(R.xml.preferences);
@@ -132,7 +134,7 @@ public class MainFragment extends PreferenceFragment implements OnSharedPreferen
} }
private void removeLauncherIcon() { private void removeLauncherIcon() {
String className = MainFragment.class.getCanonicalName().replace(".MainActivity", ".Launcher"); String className = MainActivity.class.getCanonicalName().replace(".MainActivity", ".Launcher");
ComponentName componentName = new ComponentName(getActivity().getPackageName(), className); ComponentName componentName = new ComponentName(getActivity().getPackageName(), className);
PackageManager packageManager = getActivity().getPackageManager(); PackageManager packageManager = getActivity().getPackageManager();
if (packageManager.getComponentEnabledSetting(componentName) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED) { if (packageManager.getComponentEnabledSetting(componentName) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
+1 -1
Просмотреть файл
@@ -36,7 +36,7 @@ public class TrackingService extends Service {
private TrackingController trackingController; private TrackingController trackingController;
private static Notification createNotification(Context context) { private static Notification createNotification(Context context) {
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, MainFragment.class), 0); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+6 -4
Просмотреть файл
@@ -1,19 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item <item
android:id="@+id/status" android:id="@+id/status"
android:title="@string/menu_status" android:title="@string/menu_status"
android:showAsAction="always" /> app:showAsAction="always" />
<item <item
android:id="@+id/shortcuts" android:id="@+id/shortcuts"
android:title="@string/menu_shortcuts" android:title="@string/menu_shortcuts"
android:showAsAction="never" /> app:showAsAction="never" />
<item <item
android:id="@+id/about" android:id="@+id/about"
android:title="@string/menu_about" android:title="@string/menu_about"
android:showAsAction="never" /> app:showAsAction="never" />
</menu> </menu>
+4 -2
Просмотреть файл
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item <item
android:id="@+id/clear" android:id="@+id/clear"
android:title="@string/menu_clear" android:title="@string/menu_clear"
android:showAsAction="always" /> app:showAsAction="always" />
</menu> </menu>
-7
Просмотреть файл
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TraccarTheme" parent="android:Theme.Holo.Light">
</style>
</resources>
-7
Просмотреть файл
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TraccarTheme" parent="android:Theme.Material.Light">
</style>
</resources>
+8
Просмотреть файл
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#43A047</color>
<color name="primary_dark">#2E7D32</color>
<color name="accent">#388E3C</color>
</resources>
+4 -1
Просмотреть файл
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="TraccarTheme" parent="android:Theme.Light"> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
</style> </style>
</resources> </resources>