Finish app modernization
Этот коммит содержится в:
@@ -28,7 +28,7 @@ public class DialLaunchReceiver extends BroadcastReceiver {
|
||||
String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
|
||||
if (phoneNumber.equals(LAUNCHER_NUMBER)) {
|
||||
setResultData(null);
|
||||
Intent appIntent = new Intent(context, MainFragment.class);
|
||||
Intent appIntent = new Intent(context, MainActivity.class);
|
||||
appIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(appIntent);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,6 +73,8 @@ public class MainFragment extends PreferenceFragment implements OnSharedPreferen
|
||||
removeLauncherIcon();
|
||||
}
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
migrateLegacyPreferences(sharedPreferences);
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
@@ -132,7 +134,7 @@ public class MainFragment extends PreferenceFragment implements OnSharedPreferen
|
||||
}
|
||||
|
||||
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);
|
||||
PackageManager packageManager = getActivity().getPackageManager();
|
||||
if (packageManager.getComponentEnabledSetting(componentName) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class TrackingService extends Service {
|
||||
private TrackingController trackingController;
|
||||
|
||||
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) {
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user