diff --git a/metadata/en-US/changelogs/next_release.txt b/metadata/en-US/changelogs/next_release.txt
index fff23ccfa..fcdcd91b9 100644
--- a/metadata/en-US/changelogs/next_release.txt
+++ b/metadata/en-US/changelogs/next_release.txt
@@ -1,10 +1,11 @@
(tbd): OpenTracks
Changes:
--
+- Removed Widget
Bugfix:
-
Developer:
-- Fixed (some) test cases
\ No newline at end of file
+- Fixed (some) test cases
+- Major cleanup and reformatting
\ No newline at end of file
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index 23dda8f9c..a5ac8fc4b 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -136,13 +136,6 @@ limitations under the License.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
list = new ArrayList<>();
- addItem(list, R.string.stats_distance);
- addItem(list, R.string.stats_total_time);
- addItem(list, reportSpeed ? R.string.stats_average_speed : R.string.stats_average_pace);
- addItem(list, R.string.stats_moving_time);
- addItem(list, reportSpeed ? R.string.stats_average_moving_speed : R.string.stats_average_moving_pace);
-
- configSpinner(item1, list, PreferencesUtils.getInt(this, R.string.track_widget_item1, PreferencesUtils.TRACK_WIDGET_ITEM1_DEFAULT));
- configSpinner(item2, list, PreferencesUtils.getInt(this, R.string.track_widget_item2, PreferencesUtils.TRACK_WIDGET_ITEM2_DEFAULT));
- configSpinner(item3, list, PreferencesUtils.getInt(this, R.string.track_widget_item3, PreferencesUtils.TRACK_WIDGET_ITEM3_DEFAULT));
- configSpinner(item4, list, PreferencesUtils.getInt(this, R.string.track_widget_item4, PreferencesUtils.TRACK_WIDGET_ITEM4_DEFAULT));
-
- findViewById(R.id.track_widget_config_add).setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- // Push widget update to surface with newly set prefix
- AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(TrackWidgetConfigActivity.this);
- TrackWidgetProvider.updateAppWidget(TrackWidgetConfigActivity.this, appWidgetManager, appWidgetId, -1L);
- PreferencesUtils.setInt(TrackWidgetConfigActivity.this, R.string.track_widget_item1, item1.getSelectedItemPosition());
- PreferencesUtils.setInt(TrackWidgetConfigActivity.this, R.string.track_widget_item2, item2.getSelectedItemPosition());
- PreferencesUtils.setInt(TrackWidgetConfigActivity.this, R.string.track_widget_item3, item3.getSelectedItemPosition());
- PreferencesUtils.setInt(TrackWidgetConfigActivity.this, R.string.track_widget_item4, item4.getSelectedItemPosition());
-
- // Make sure we pass back the original appWidgetId
- Intent resultValue = new Intent();
- resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
- setResult(RESULT_OK, resultValue);
- finish();
- }
- });
- findViewById(R.id.track_widget_config_cancel).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- finish();
- }
- });
-
- // Find the app widget id from the intent.
- Intent intent = getIntent();
- Bundle extras = intent.getExtras();
- appWidgetId = extras != null ? extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID) : AppWidgetManager.INVALID_APPWIDGET_ID;
-
- // If they gave us an intent without the widget id, just bail.
- if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
- finish();
- }
- }
-
- private void addItem(List list, int id) {
- list.add(getString(id).toUpperCase(Locale.getDefault()));
- }
-
- private void configSpinner(Spinner spinner, List list, int position) {
- ArrayAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, list);
- adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
- spinner.setAdapter(adapter);
- spinner.setSelection(position);
- }
-}
diff --git a/src/main/java/de/dennisguse/opentracks/widgets/TrackWidgetProvider.java b/src/main/java/de/dennisguse/opentracks/widgets/TrackWidgetProvider.java
deleted file mode 100644
index 8660088c5..000000000
--- a/src/main/java/de/dennisguse/opentracks/widgets/TrackWidgetProvider.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * 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 de.dennisguse.opentracks.widgets;
-
-import android.annotation.TargetApi;
-import android.app.PendingIntent;
-import android.appwidget.AppWidgetManager;
-import android.appwidget.AppWidgetProvider;
-import android.appwidget.AppWidgetProviderInfo;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.SystemClock;
-import android.view.View;
-import android.widget.RemoteViews;
-
-import androidx.core.app.TaskStackBuilder;
-
-import de.dennisguse.opentracks.R;
-import de.dennisguse.opentracks.TrackDetailActivity;
-import de.dennisguse.opentracks.TrackListActivity;
-import de.dennisguse.opentracks.content.ContentProviderUtils;
-import de.dennisguse.opentracks.content.Track;
-import de.dennisguse.opentracks.services.ControlRecordingService;
-import de.dennisguse.opentracks.stats.TripStatistics;
-import de.dennisguse.opentracks.util.IntentUtils;
-import de.dennisguse.opentracks.util.PreferencesUtils;
-import de.dennisguse.opentracks.util.StringUtils;
-
-/**
- * A track widget to start/stop/pause/resume recording, launch the main activity, and display track statistics (total distance, total time, average speed, and moving time) for the recording track, the selected track or the last track.
- *
- * @author Sandor Dornbush
- * @author Paul R. Saxman
- */
-public class TrackWidgetProvider extends AppWidgetProvider {
-
- public static final int HOME_SCREEN_DEFAULT_SIZE = 2;
-
- private static final String APP_WIDGET_SIZE_KEY = "app_widget_size_key";
-
- private static final int TWO_CELLS = 110;
- private static final int THREE_CELLS = 180;
- private static final int FOUR_CELLS = 250;
-
- private static final int[] ITEM1_IDS = {R.id.track_widget_item1_label, R.id.track_widget_item1_value, R.id.track_widget_item1_unit, R.id.track_widget_item1_chronometer};
- private static final int[] ITEM2_IDS = {R.id.track_widget_item2_label, R.id.track_widget_item2_value, R.id.track_widget_item2_unit, R.id.track_widget_item2_chronometer};
- private static final int[] ITEM3_IDS = {R.id.track_widget_item3_label, R.id.track_widget_item3_value, R.id.track_widget_item3_unit, R.id.track_widget_item3_chronometer};
- private static final int[] ITEM4_IDS = {R.id.track_widget_item4_label, R.id.track_widget_item4_value, R.id.track_widget_item4_unit, R.id.track_widget_item4_chronometer};
-
- /**
- * Updates an app widget.
- *
- * @param context the context
- * @param appWidgetManager the app widget manager
- * @param appWidgetId the app widget id
- * @param trackId the track id. -1L to not specify one
- */
- public static void updateAppWidget(Context context, AppWidgetManager appWidgetManager, int appWidgetId, long trackId) {
- int size = getAppWidgetSize(appWidgetManager, appWidgetId);
- RemoteViews remoteViews = getRemoteViews(context, trackId, size);
- appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
- }
-
- /**
- * Updates all app widgets.
- *
- * @param context the context
- * @param trackId track id
- */
- private static void updateAllAppWidgets(Context context, long trackId) {
- AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
- int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, TrackWidgetProvider.class));
- for (int appWidgetId : appWidgetIds) {
- updateAppWidget(context, appWidgetManager, appWidgetId, trackId);
- }
- }
-
- /**
- * Gets the remote views.
- *
- * @param context the context
- * @param trackId the track id
- * @param heightSize the layout height size
- */
- private static RemoteViews getRemoteViews(Context context, long trackId, int heightSize) {
- int layout;
- switch (heightSize) {
- case 4:
- layout = R.layout.track_widget_4x4;
- break;
- case 3:
- layout = R.layout.track_widget_4x3;
- break;
- case 2:
- layout = R.layout.track_widget_4x2;
- break;
- case 1:
- layout = R.layout.track_widget_4x1;
- break;
- default:
- layout = R.layout.track_widget_4x2;
- break;
- }
- RemoteViews remoteViews = new RemoteViews(context.getPackageName(), layout);
-
- // Get the preferences
- long recordingTrackId = PreferencesUtils.getLong(context, R.string.recording_track_id_key);
- boolean isRecording = recordingTrackId != PreferencesUtils.RECORDING_TRACK_ID_DEFAULT;
- boolean isPaused = PreferencesUtils.getBoolean(context, R.string.recording_track_paused_key, PreferencesUtils.RECORDING_TRACK_PAUSED_DEFAULT);
- boolean metricUnits = PreferencesUtils.isMetricUnits(context);
- boolean reportSpeed = PreferencesUtils.isReportSpeed(context);
- int item1 = PreferencesUtils.getInt(context, R.string.track_widget_item1, PreferencesUtils.TRACK_WIDGET_ITEM1_DEFAULT);
- int item2 = PreferencesUtils.getInt(context, R.string.track_widget_item2, PreferencesUtils.TRACK_WIDGET_ITEM2_DEFAULT);
-
- // Get track and trip statistics
- ContentProviderUtils contentProviderUtils = ContentProviderUtils.Factory.get(context);
- if (trackId == -1L) {
- trackId = recordingTrackId;
- }
- Track track = trackId != -1L ? contentProviderUtils.getTrack(trackId) : contentProviderUtils.getLastTrack();
- TripStatistics tripStatistics = track == null ? null : track.getTripStatistics();
-
- updateStatisticsContainer(context, remoteViews, track);
- setItem(context, remoteViews, ITEM1_IDS, item1, tripStatistics, isRecording, isPaused, metricUnits, reportSpeed);
- setItem(context, remoteViews, ITEM2_IDS, item2, tripStatistics, isRecording, isPaused, metricUnits, reportSpeed);
-
- updateRecordButton(context, remoteViews, isRecording, isPaused);
- updateStopButton(context, remoteViews, isRecording);
- if (heightSize > 1) {
- int item3 = PreferencesUtils.getInt(context, R.string.track_widget_item3, PreferencesUtils.TRACK_WIDGET_ITEM3_DEFAULT);
- int item4 = PreferencesUtils.getInt(context, R.string.track_widget_item4, PreferencesUtils.TRACK_WIDGET_ITEM4_DEFAULT);
- setItem(context, remoteViews, ITEM3_IDS, item3, tripStatistics, isRecording, isPaused, metricUnits, reportSpeed);
- setItem(context, remoteViews, ITEM4_IDS, item4, tripStatistics, isRecording, isPaused, metricUnits, reportSpeed);
- updateRecordStatus(context, remoteViews, isRecording, isPaused);
- }
- return remoteViews;
- }
-
- /**
- * Gets the app widget size.
- *
- * @param appWidgetManager the app widget manager
- * @param appWidgetId the app widget id
- */
- private static int getAppWidgetSize(AppWidgetManager appWidgetManager, int appWidgetId) {
- Bundle bundle = appWidgetManager.getAppWidgetOptions(appWidgetId);
- return bundle.getInt(APP_WIDGET_SIZE_KEY, HOME_SCREEN_DEFAULT_SIZE);
- }
-
- /**
- * Sets a widget item.
- *
- * @param context the context
- * @param remoteViews the remote view
- * @param ids the item's ids
- * @param value the item value
- * @param tripStatistics the trip statistics
- * @param metricUnits true to use metric units
- * @param reportSpeed try to report speed
- */
- private static void setItem(Context context, RemoteViews remoteViews, int[] ids, int value, TripStatistics tripStatistics, boolean isRecording, boolean isPaused, boolean metricUnits, boolean reportSpeed) {
- switch (value) {
- case 0:
- updateDistance(context, remoteViews, ids, tripStatistics, metricUnits);
- break;
- case 1:
- updateTotalTime(context, remoteViews, ids, tripStatistics, isRecording, isPaused);
- break;
- case 2:
- updateAverageSpeed(context, remoteViews, ids, tripStatistics, metricUnits, reportSpeed);
- break;
- case 3:
- updateMovingTime(context, remoteViews, ids, tripStatistics);
- break;
- case 4:
- updateAverageMovingSpeed(context, remoteViews, ids, tripStatistics, metricUnits, reportSpeed);
- break;
- default:
- updateDistance(context, remoteViews, ids, tripStatistics, metricUnits);
- break;
-
- }
- if (value != 1) {
- remoteViews.setViewVisibility(ids[1], View.VISIBLE);
- remoteViews.setViewVisibility(ids[2], View.VISIBLE);
- remoteViews.setViewVisibility(ids[3], View.GONE);
- remoteViews.setChronometer(ids[3], SystemClock.elapsedRealtime(), null, false);
- }
- }
-
- /**
- * Updates the statistics container.
- *
- * @param context the context
- * @param remoteViews the remote views
- * @param track the track
- */
- private static void updateStatisticsContainer(Context context, RemoteViews remoteViews, Track track) {
- PendingIntent pendingIntent;
- if (track != null) {
- Intent intent = IntentUtils.newIntent(context, TrackDetailActivity.class)
- .putExtra(TrackDetailActivity.EXTRA_TRACK_ID, track.getId());
- pendingIntent = TaskStackBuilder.create(context)
- .addParentStack(TrackDetailActivity.class).addNextIntent(intent).getPendingIntent(0, 0);
- } else {
- Intent intent = IntentUtils.newIntent(context, TrackListActivity.class);
- pendingIntent = TaskStackBuilder.create(context).addNextIntent(intent).getPendingIntent(0, 0);
- }
- remoteViews.setOnClickPendingIntent(R.id.track_widget_stats_container, pendingIntent);
- }
-
- /**
- * Updates distance.
- *
- * @param context the context
- * @param remoteViews the remote views
- * @param ids the item's ids
- * @param tripStatistics the trip statistics
- * @param metricUnits true to use metric units
- */
- private static void updateDistance(Context context, RemoteViews remoteViews, int[] ids, TripStatistics tripStatistics, boolean metricUnits) {
- double totalDistance = tripStatistics == null ? Double.NaN : tripStatistics.getTotalDistance();
- String[] totalDistanceParts = StringUtils.getDistanceParts(context, totalDistance, metricUnits);
- if (totalDistanceParts[0] == null) {
- totalDistanceParts[0] = context.getString(R.string.value_unknown);
- }
- remoteViews.setTextViewText(ids[0], context.getString(R.string.stats_distance));
- remoteViews.setTextViewText(ids[1], totalDistanceParts[0]);
- remoteViews.setTextViewText(ids[2], totalDistanceParts[1]);
- }
-
- /**
- * Updates total time.
- *
- * @param context the context
- * @param remoteViews the remote views
- * @param ids the item's ids
- * @param tripStatistics the trip statistics
- */
- private static void updateTotalTime(Context context, RemoteViews remoteViews, int[] ids, TripStatistics tripStatistics, boolean isRecording, boolean isPaused) {
- if (isRecording && !isPaused && tripStatistics != null) {
- long time = tripStatistics.getTotalTime() + System.currentTimeMillis() - tripStatistics.getStopTime();
- remoteViews.setChronometer(ids[3], SystemClock.elapsedRealtime() - time, null, true);
- remoteViews.setViewVisibility(ids[1], View.GONE);
- remoteViews.setViewVisibility(ids[2], View.GONE);
- remoteViews.setViewVisibility(ids[3], View.VISIBLE);
- } else {
- remoteViews.setChronometer(ids[3], SystemClock.elapsedRealtime(), null, false);
- remoteViews.setViewVisibility(ids[1], View.VISIBLE);
- remoteViews.setViewVisibility(ids[2], View.GONE);
- remoteViews.setViewVisibility(ids[3], View.GONE);
-
- String totalTime = tripStatistics == null ? context.getString(R.string.value_unknown) : StringUtils.formatElapsedTime(tripStatistics.getTotalTime());
- remoteViews.setTextViewText(ids[0], context.getString(R.string.stats_total_time));
- remoteViews.setTextViewText(ids[1], totalTime);
- }
- }
-
- /**
- * Updates average speed.
- *
- * @param context the context
- * @param remoteViews the remote views
- * @param ids the item's ids
- * @param tripStatistics the trip statistics
- * @param metricUnits true to use metric units
- * @param reportSpeed true to report speed
- */
- private static void updateAverageSpeed(Context context, RemoteViews remoteViews, int[] ids, TripStatistics tripStatistics, boolean metricUnits, boolean reportSpeed) {
- String averageSpeedLabel = context.getString(reportSpeed ? R.string.stats_average_speed : R.string.stats_average_pace);
- remoteViews.setTextViewText(ids[0], averageSpeedLabel);
-
- double speed = tripStatistics == null ? Double.NaN : tripStatistics.getAverageSpeed();
- String[] speedParts = StringUtils.getSpeedParts(context, speed, metricUnits, reportSpeed);
-
- if (speedParts[0] == null) {
- speedParts[0] = context.getString(R.string.value_unknown);
- }
-
- remoteViews.setTextViewText(ids[1], speedParts[0]);
- remoteViews.setTextViewText(ids[2], speedParts[1]);
- }
-
- /**
- * Updates moving time.
- *
- * @param context the context
- * @param remoteViews the remote views
- * @param ids the item's ids
- * @param tripStatistics the trip statistics
- */
- private static void updateMovingTime(Context context, RemoteViews remoteViews, int[] ids, TripStatistics tripStatistics) {
- String movingTime = tripStatistics == null ? context.getString(R.string.value_unknown) : StringUtils.formatElapsedTime(tripStatistics.getMovingTime());
- remoteViews.setTextViewText(ids[0], context.getString(R.string.stats_moving_time));
- remoteViews.setTextViewText(ids[1], movingTime);
- remoteViews.setViewVisibility(ids[2], View.GONE);
- }
-
- /**
- * Updates average moving speed.
- *
- * @param context the context
- * @param remoteViews the remote views
- * @param ids the item's ids
- * @param tripStatistics the trip statistics
- * @param metricUnits true to use metric units
- * @param reportSpeed true to report speed
- */
- private static void updateAverageMovingSpeed(Context context, RemoteViews remoteViews, int[] ids, TripStatistics tripStatistics, boolean metricUnits, boolean reportSpeed) {
- String averageMovingSpeedLabel = context.getString(reportSpeed ? R.string.stats_average_moving_speed : R.string.stats_average_moving_pace);
- remoteViews.setTextViewText(ids[0], averageMovingSpeedLabel);
-
- double speed = tripStatistics == null ? Double.NaN : tripStatistics.getAverageMovingSpeed();
- String[] speedParts = StringUtils.getSpeedParts(context, speed, metricUnits, reportSpeed);
-
- if (speedParts[0] == null) {
- speedParts[0] = context.getString(R.string.value_unknown);
- }
-
- remoteViews.setTextViewText(ids[1], speedParts[0]);
- remoteViews.setTextViewText(ids[2], speedParts[1]);
- }
-
- /**
- * Updates the record button.
- *
- * @param context the context
- * @param remoteViews the remote views
- * @param isRecording true if recording
- * @param recordingTrackPaused true if recording track is paused
- */
- private static void updateRecordButton(Context context, RemoteViews remoteViews, boolean isRecording, boolean recordingTrackPaused) {
- remoteViews.setImageViewResource(R.id.track_widget_record_button, isRecording && !recordingTrackPaused ? R.drawable.button_pause : R.drawable.button_record);
- int recordActionId;
- if (isRecording) {
- recordActionId = recordingTrackPaused ? R.string.track_action_resume : R.string.track_action_pause;
- } else {
- recordActionId = R.string.track_action_start;
- }
- Intent intent = new Intent(context, ControlRecordingService.class).setAction(context.getString(recordActionId));
- PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
- remoteViews.setOnClickPendingIntent(R.id.track_widget_record_button, pendingIntent);
- }
-
- /**
- * Updates the stop button.
- *
- * @param context the context
- * @param remoteViews the remote views
- * @param isRecording true if recording
- */
- private static void updateStopButton(Context context, RemoteViews remoteViews, boolean isRecording) {
- remoteViews.setImageViewResource(R.id.track_widget_stop_button, isRecording ? R.drawable.button_stop : R.drawable.ic_button_stop_disabled);
- remoteViews.setBoolean(R.id.track_widget_stop_button, "setEnabled", isRecording);
- if (isRecording) {
- Intent intent = new Intent(context, ControlRecordingService.class).setAction(context.getString(R.string.track_action_end));
- PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
- remoteViews.setOnClickPendingIntent(R.id.track_widget_stop_button, pendingIntent);
- }
- }
-
- /**
- * Updates recording status.
- *
- * @param context the context
- * @param remoteViews the remote views
- * @param isRecording true if recording
- * @param recordingTrackPaused true if recording track is paused
- */
- private static void updateRecordStatus(Context context, RemoteViews remoteViews, boolean isRecording, boolean recordingTrackPaused) {
- String status;
- int colorId;
- if (isRecording) {
- status = context.getString(recordingTrackPaused ? R.string.generic_paused : R.string.generic_recording);
- colorId = recordingTrackPaused ? android.R.color.white : R.color.recording_text;
- } else {
- status = "";
- colorId = android.R.color.white;
- }
- remoteViews.setTextColor(R.id.track_widget_record_status, context.getResources().getColor(colorId));
- remoteViews.setTextViewText(R.id.track_widget_record_status, status);
- }
-
- @Override
- public void onReceive(Context context, Intent intent) {
- super.onReceive(context, intent);
- String action = intent.getAction();
- if (context.getString(R.string.track_paused_broadcast_action).equals(action)
- || context.getString(R.string.track_resumed_broadcast_action).equals(action)
- || context.getString(R.string.track_started_broadcast_action).equals(action)
- || context.getString(R.string.track_stopped_broadcast_action).equals(action)
- || context.getString(R.string.track_update_broadcast_action).equals(action)) {
- long trackId = intent.getLongExtra(context.getString(R.string.track_id_broadcast_extra), -1L);
- updateAllAppWidgets(context, trackId);
- }
- }
-
- @Override
- public void onEnabled(Context context) {
- super.onEnabled(context);
- // Need to update all app widgets after phone reboot
- updateAllAppWidgets(context, -1L);
- }
-
- @Override
- public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
- super.onUpdate(context, appWidgetManager, appWidgetIds);
- // Need to update all app widgets after software update
- updateAllAppWidgets(context, -1L);
- }
-
- @TargetApi(16)
- @Override
- public void onAppWidgetOptionsChanged(Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle newOptions) {
- super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions);
- if (newOptions != null) {
- int newSize;
- if (newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, -1) == AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) {
- newSize = 1;
- } else {
- int height = newOptions.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT);
- if (height == 0) {
- newSize = 2;
- } else if (height >= FOUR_CELLS) {
- newSize = 4;
- } else if (height >= THREE_CELLS) {
- newSize = 3;
- } else if (height >= TWO_CELLS) {
- newSize = 2;
- } else {
- newSize = 1;
- }
- }
- int size = getAppWidgetSize(appWidgetManager, appWidgetId);
-
- if (size != newSize) {
- Bundle bundle = new Bundle();
- bundle.putInt(APP_WIDGET_SIZE_KEY, size);
- appWidgetManager.updateAppWidgetOptions(appWidgetId, bundle);
-
- updateAppWidget(context, appWidgetManager, appWidgetId, -1L);
- }
- }
- }
-}
diff --git a/src/main/res/layout/track_widget_4x1.xml b/src/main/res/layout/track_widget_4x1.xml
deleted file mode 100644
index e489de442..000000000
--- a/src/main/res/layout/track_widget_4x1.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/track_widget_4x2.xml b/src/main/res/layout/track_widget_4x2.xml
deleted file mode 100644
index cf5fd2790..000000000
--- a/src/main/res/layout/track_widget_4x2.xml
+++ /dev/null
@@ -1,196 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/track_widget_4x3.xml b/src/main/res/layout/track_widget_4x3.xml
deleted file mode 100644
index a5020df36..000000000
--- a/src/main/res/layout/track_widget_4x3.xml
+++ /dev/null
@@ -1,196 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/track_widget_4x4.xml b/src/main/res/layout/track_widget_4x4.xml
deleted file mode 100644
index b38adb06e..000000000
--- a/src/main/res/layout/track_widget_4x4.xml
+++ /dev/null
@@ -1,203 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/track_widget_config.xml b/src/main/res/layout/track_widget_config.xml
deleted file mode 100644
index 0eacd582f..000000000
--- a/src/main/res/layout/track_widget_config.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/layout/track_widget_config_buttons.xml b/src/main/res/layout/track_widget_config_buttons.xml
deleted file mode 100644
index f61294cf6..000000000
--- a/src/main/res/layout/track_widget_config_buttons.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/values/preference_keys.xml b/src/main/res/values/preference_keys.xml
index 027c0d96d..d9f2e3265 100644
--- a/src/main/res/values/preference_keys.xml
+++ b/src/main/res/values/preference_keys.xml
@@ -35,10 +35,6 @@ limitations under the License.
statsUnits
trackdetail_show_on_lockscreen_while_recording
trackName
- trackWidgetItem1
- trackWidgetItem2
- trackWidgetItem3
- trackWidgetItem4
voiceFrequency
autoResumeTrackCurrentRetry
diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml
index f363067b0..3ff741fd6 100644
--- a/src/main/res/values/styles.xml
+++ b/src/main/res/values/styles.xml
@@ -269,201 +269,4 @@ limitations under the License.
- wrap_content
- wrap_content
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/res/xml/track_widget_info.xml b/src/main/res/xml/track_widget_info.xml
deleted file mode 100644
index f81cc4456..000000000
--- a/src/main/res/xml/track_widget_info.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-