forked from upstream-mirrors/OpenTracks
fix various lint warnings
This commit is contained in:
@@ -59,12 +59,10 @@ public class TabsAdapter extends FragmentPagerAdapter
|
|||||||
*/
|
*/
|
||||||
private static final class TabInfo {
|
private static final class TabInfo {
|
||||||
|
|
||||||
private final String tag;
|
|
||||||
private final Class<?> clss;
|
private final Class<?> clss;
|
||||||
private final Bundle bundle;
|
private final Bundle bundle;
|
||||||
|
|
||||||
public TabInfo(String tag, Class<?> clss, Bundle bunlde) {
|
public TabInfo(Class<?> clss, Bundle bunlde) {
|
||||||
this.tag = tag;
|
|
||||||
this.clss = clss;
|
this.clss = clss;
|
||||||
this.bundle = bunlde;
|
this.bundle = bunlde;
|
||||||
}
|
}
|
||||||
@@ -106,8 +104,7 @@ public class TabsAdapter extends FragmentPagerAdapter
|
|||||||
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle bundle) {
|
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle bundle) {
|
||||||
tabSpec.setContent(new DummyTabFactory(context));
|
tabSpec.setContent(new DummyTabFactory(context));
|
||||||
|
|
||||||
String tag = tabSpec.getTag();
|
TabInfo info = new TabInfo(clss, bundle);
|
||||||
TabInfo info = new TabInfo(tag, clss, bundle);
|
|
||||||
|
|
||||||
tabInfos.add(info);
|
tabInfos.add(info);
|
||||||
tabHost.addTab(tabSpec);
|
tabHost.addTab(tabSpec);
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ public class TrackEditActivity extends AbstractMyTracksActivity
|
|||||||
*
|
*
|
||||||
* @param value the icon value
|
* @param value the icon value
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void setActivityTypeIcon(String value) {
|
private void setActivityTypeIcon(String value) {
|
||||||
iconValue = value;
|
iconValue = value;
|
||||||
ArrayAdapter<StringBuilder> adapter =
|
ArrayAdapter<StringBuilder> adapter =
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.location.Location;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
@@ -80,7 +81,7 @@ public class SearchEngine {
|
|||||||
public static class SearchQuery {
|
public static class SearchQuery {
|
||||||
public SearchQuery(String textQuery, Location currentLocation, long currentTrackId,
|
public SearchQuery(String textQuery, Location currentLocation, long currentTrackId,
|
||||||
long currentTimestamp) {
|
long currentTimestamp) {
|
||||||
this.textQuery = textQuery.toLowerCase();
|
this.textQuery = textQuery.toLowerCase(Locale.getDefault());
|
||||||
this.currentLocation = currentLocation;
|
this.currentLocation = currentLocation;
|
||||||
this.currentTrackId = currentTrackId;
|
this.currentTrackId = currentTrackId;
|
||||||
this.currentTimestamp = currentTimestamp;
|
this.currentTimestamp = currentTimestamp;
|
||||||
@@ -333,13 +334,13 @@ public class SearchEngine {
|
|||||||
String name, String description, String category) {
|
String name, String description, String category) {
|
||||||
// Title boost: track name > description > category.
|
// Title boost: track name > description > category.
|
||||||
double boost = 1.0;
|
double boost = 1.0;
|
||||||
if (name.toLowerCase().contains(query.textQuery)) {
|
if (name.toLowerCase(Locale.getDefault()).contains(query.textQuery)) {
|
||||||
boost *= TRACK_NAME_PROMOTION;
|
boost *= TRACK_NAME_PROMOTION;
|
||||||
}
|
}
|
||||||
if (description.toLowerCase().contains(query.textQuery)) {
|
if (description.toLowerCase(Locale.getDefault()).contains(query.textQuery)) {
|
||||||
boost *= TRACK_DESCRIPTION_PROMOTION;
|
boost *= TRACK_DESCRIPTION_PROMOTION;
|
||||||
}
|
}
|
||||||
if (category.toLowerCase().contains(query.textQuery)) {
|
if (category.toLowerCase(Locale.getDefault()).contains(query.textQuery)) {
|
||||||
boost *= TRACK_CATEGORY_PROMOTION;
|
boost *= TRACK_CATEGORY_PROMOTION;
|
||||||
}
|
}
|
||||||
return boost;
|
return boost;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import com.google.android.apps.mytracks.widgets.TrackWidgetProvider;
|
|||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.appwidget.AppWidgetManager;
|
import android.appwidget.AppWidgetManager;
|
||||||
import android.appwidget.AppWidgetProviderInfo;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,10 +35,12 @@ public class Api16Adapter extends Api14Adapter {
|
|||||||
@Override
|
@Override
|
||||||
public int getAppWidgetSize(AppWidgetManager appWidgetManager, int appWidgetId) {
|
public int getAppWidgetSize(AppWidgetManager appWidgetManager, int appWidgetId) {
|
||||||
Bundle bundle = appWidgetManager.getAppWidgetOptions(appWidgetId);
|
Bundle bundle = appWidgetManager.getAppWidgetOptions(appWidgetId);
|
||||||
boolean isKeyguard = bundle.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, -1)
|
return bundle.getInt(APP_WIDGET_SIZE_KEY, getAppWidgetSizeDefault(bundle));
|
||||||
== AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD;
|
}
|
||||||
return bundle.getInt(APP_WIDGET_SIZE_KEY, isKeyguard ? TrackWidgetProvider.KEYGUARD_DEFAULT_SIZE
|
|
||||||
: TrackWidgetProvider.HOME_SCREEN_DEFAULT_SIZE);
|
@SuppressWarnings("unused")
|
||||||
|
protected int getAppWidgetSizeDefault(Bundle bundle) {
|
||||||
|
return TrackWidgetProvider.HOME_SCREEN_DEFAULT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013 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 com.google.android.apps.mytracks.util;
|
||||||
|
|
||||||
|
import com.google.android.apps.mytracks.widgets.TrackWidgetProvider;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.appwidget.AppWidgetManager;
|
||||||
|
import android.appwidget.AppWidgetProviderInfo;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API level 17 specific implementation of the {@link ApiAdapter}.
|
||||||
|
*
|
||||||
|
* @author Jimmy Shih
|
||||||
|
*/
|
||||||
|
@TargetApi(17)
|
||||||
|
public class Api17Adapter extends Api16Adapter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getAppWidgetSizeDefault(Bundle bundle) {
|
||||||
|
boolean isKeyguard = bundle.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, -1)
|
||||||
|
== AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD;
|
||||||
|
return isKeyguard ? TrackWidgetProvider.KEYGUARD_DEFAULT_SIZE
|
||||||
|
: TrackWidgetProvider.HOME_SCREEN_DEFAULT_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,7 +31,9 @@ public class ApiAdapterFactory {
|
|||||||
*/
|
*/
|
||||||
public static ApiAdapter getApiAdapter() {
|
public static ApiAdapter getApiAdapter() {
|
||||||
if (apiAdapter == null) {
|
if (apiAdapter == null) {
|
||||||
if (Build.VERSION.SDK_INT >= 16) {
|
if (Build.VERSION.SDK_INT >= 17) {
|
||||||
|
apiAdapter = new Api17Adapter();
|
||||||
|
} else if (Build.VERSION.SDK_INT >= 16) {
|
||||||
apiAdapter = new Api16Adapter();
|
apiAdapter = new Api16Adapter();
|
||||||
} else if (Build.VERSION.SDK_INT >= 14) {
|
} else if (Build.VERSION.SDK_INT >= 14) {
|
||||||
apiAdapter = new Api14Adapter();
|
apiAdapter = new Api14Adapter();
|
||||||
|
|||||||
+2
-1
@@ -29,6 +29,7 @@ import android.widget.Spinner;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity to configure the track widget.
|
* Activity to configure the track widget.
|
||||||
@@ -124,7 +125,7 @@ public class TrackWidgetConfigActivity extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addItem(List<CharSequence> list, int id) {
|
private void addItem(List<CharSequence> list, int id) {
|
||||||
list.add(getString(id).toUpperCase());
|
list.add(getString(id).toUpperCase(Locale.getDefault()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configSpinner(Spinner spinner, List<CharSequence> list, int position) {
|
private void configSpinner(Spinner spinner, List<CharSequence> list, int position) {
|
||||||
|
|||||||
Reference in New Issue
Block a user