[AND] Resources cleanup, fixed some lint warnings.
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 190 B |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="#E0E0E0"
|
||||
android:endColor="#E0E0E0"
|
||||
android:angle="270" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#171717" />
|
||||
<corners
|
||||
android:radius="4dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:padding="@dimen/dp_x_3" >
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:src="@drawable/placemark_red" />
|
||||
android:paddingTop="5dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pi_name"
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="5dp"
|
||||
android:src="@drawable/placemark_red" />
|
||||
android:paddingTop="5dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:padding="3dp"
|
||||
android:singleLine="true"
|
||||
android:text="sdfjdslkfjdsklf"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/cell_arrow_black"/>
|
||||
android:src="@drawable/ic_next_item"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/menu_settings"
|
||||
android:title="@string/bookmarks"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never" />
|
||||
</menu>
|
|
@ -1,6 +0,0 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/pinsets_add"
|
||||
android:title="@string/add_new_set"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never" />
|
||||
</menu>
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="background_gray">#FFEEEEDD</color>
|
||||
<color name="background_placepage">#ECECEC</color>
|
||||
<color name="base_green">#66CC33</color>
|
||||
<color name="text_primary">#333333</color>
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
<dimen name="icon_size">24dp</dimen>
|
||||
<dimen name="circle_size">16dp</dimen>
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="margin_tiny">4dp</dimen>
|
||||
<dimen name="margin_small">8dp</dimen>
|
||||
<dimen name="margin_medium">16dp</dimen>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<string name="pref_allow_stat">AllowStat</string>
|
||||
<string name="pref_munits">MeasurementUnits</string>
|
||||
<string name="pref_storage_activity">StorageActivity</string>
|
||||
<string name="pref_yota">Yota</string>
|
||||
<string name="pref_allow_stat" tools:ignore="MissingTranslation">AllowStat</string>
|
||||
<string name="pref_munits" tools:ignore="MissingTranslation,MissingTranslation">MeasurementUnits</string>
|
||||
<string name="pref_storage_activity" translatable="false">StorageActivity</string>
|
||||
<string name="pref_yota" translatable="false">Yota</string>
|
||||
|
||||
</resources>
|
|
@ -5,7 +5,7 @@
|
|||
<item>@string/kilometres</item>
|
||||
<item>@string/miles</item>
|
||||
</string-array>
|
||||
<string-array name="measument_units_values">
|
||||
<string-array name="measument_units_values" translatable="false">
|
||||
<item>0</item>
|
||||
<item>2</item>
|
||||
</string-array>
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.io.OutputStream;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Intent;
|
||||
|
@ -38,6 +39,7 @@ import com.mapswithme.util.ConnectionState;
|
|||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
@SuppressLint("StringFormatMatches")
|
||||
public class DownloadResourcesActivity extends MapsWithMeBaseActivity
|
||||
implements LocationService.Listener, MapStorage.Listener
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.mapswithme.maps;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActionBar;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -39,7 +40,7 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
|
||||
public static void startForSearch(Context context, String query, int scope)
|
||||
{
|
||||
Intent i = new Intent(context, SearchActivity.class);
|
||||
final Intent i = new Intent(context, SearchActivity.class);
|
||||
i.putExtra(EXTRA_SCOPE, scope).putExtra(EXTRA_QUERY, query);
|
||||
context.startActivity(i);
|
||||
}
|
||||
|
@ -407,6 +408,7 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
private ProgressBar m_progress;
|
||||
private Spinner m_modesSpinner;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
|
@ -414,7 +416,7 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
|
||||
if (Utils.apiEqualOrGreaterThan(11))
|
||||
{
|
||||
ActionBar actionBar = getActionBar();
|
||||
final ActionBar actionBar = getActionBar();
|
||||
if (actionBar != null)
|
||||
actionBar.hide();
|
||||
}
|
||||
|
@ -474,7 +476,7 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
// Initialize search modes spinner.
|
||||
m_modesSpinner = (Spinner) findViewById(R.id.search_modes_spinner);
|
||||
|
||||
ArrayAdapter<CharSequence> adapter =
|
||||
final ArrayAdapter<CharSequence> adapter =
|
||||
ArrayAdapter.createFromResource(this, R.array.search_modes, R.layout.simple_spinner_item);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
m_modesSpinner.setAdapter(adapter);
|
||||
|
@ -631,7 +633,7 @@ public class SearchActivity extends MapsWithMeBaseListActivity implements Locati
|
|||
if (isShowCategories())
|
||||
return;
|
||||
|
||||
double north[] = { magneticNorth, trueNorth };
|
||||
final double north[] = { magneticNorth, trueNorth };
|
||||
m_location.correctCompassAngles(getWindowManager().getDefaultDisplay(), north);
|
||||
final double ret = (north[1] >= 0.0 ? north[1] : north[0]);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.mapswithme.maps.base;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
@ -43,7 +44,8 @@ public class MapsWithMeBaseActivity extends FragmentActivity
|
|||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
protected void onCreate(Bundle arg0)
|
||||
{
|
||||
super.onCreate(arg0);
|
||||
|
@ -51,7 +53,7 @@ public class MapsWithMeBaseActivity extends FragmentActivity
|
|||
if (Utils.apiEqualOrGreaterThan(11))
|
||||
{
|
||||
// http://stackoverflow.com/questions/6867076/getactionbar-returns-null
|
||||
ActionBar bar = getActionBar();
|
||||
final ActionBar bar = getActionBar();
|
||||
if (bar != null)
|
||||
bar.setDisplayHomeAsUpEnabled(true);
|
||||
}
|
||||
|
@ -81,7 +83,7 @@ public class MapsWithMeBaseActivity extends FragmentActivity
|
|||
{
|
||||
if (item.getItemId() == android.R.id.home)
|
||||
{
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
final InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
|
||||
onBackPressed();
|
||||
return true;
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package com.mapswithme.maps.base;
|
||||
|
||||
import com.mapswithme.maps.MWMApplication;
|
||||
import com.mapswithme.maps.state.SuppotedState;
|
||||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActionBar;
|
||||
import android.app.ListActivity;
|
||||
import android.content.Context;
|
||||
|
@ -13,9 +9,15 @@ import android.support.v4.app.ListFragment;
|
|||
import android.view.MenuItem;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import com.mapswithme.maps.MWMApplication;
|
||||
import com.mapswithme.maps.state.SuppotedState;
|
||||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
/**
|
||||
* TODO use simple activity and {@link ListFragment} instead.
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
public class MapsWithMeBaseListActivity extends ListActivity
|
||||
{
|
||||
|
||||
|
|
|
@ -198,7 +198,8 @@ public class BookmarkListActivity extends AbstractBookmarkListActivity
|
|||
final int itemId = item.getItemId();
|
||||
if (itemId == R.id.set_edit)
|
||||
{
|
||||
startPinActivity(mEditedSet.getId(), mSelectedPosition);
|
||||
final Bookmark bmk = (Bookmark) mPinAdapter.getItem(mSelectedPosition);
|
||||
startPinActivity(mEditedSet.getId(), bmk.getBookmarkId());
|
||||
}
|
||||
else if (itemId == R.id.set_delete)
|
||||
{
|
||||
|
@ -208,8 +209,7 @@ public class BookmarkListActivity extends AbstractBookmarkListActivity
|
|||
else if (ShareAction.ACTIONS.containsKey(itemId))
|
||||
{
|
||||
final ShareAction shareAction = ShareAction.ACTIONS.get(itemId);
|
||||
final Bookmark bmk = mManager.getBookmark(mEditedSet.getId(), mSelectedPosition);
|
||||
|
||||
final Bookmark bmk = (Bookmark) mPinAdapter.getItem(mSelectedPosition);
|
||||
shareAction.shareMapObject(this, bmk);
|
||||
}
|
||||
else if (itemId == MENU_DELETE_TRACK)
|
||||
|
@ -291,7 +291,7 @@ public class BookmarkListActivity extends AbstractBookmarkListActivity
|
|||
// Menu routines
|
||||
private static final int ID_SEND_BY_EMAIL = 0x01;
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
@SuppressLint({ "InlinedApi", "NewApi" })
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu)
|
||||
{
|
||||
|
|
|
@ -72,7 +72,8 @@ public class Bookmark extends MapObject
|
|||
|
||||
private Icon getIconInternal()
|
||||
{
|
||||
return BookmarkManager.getBookmarkManager().getIconByName((mCategoryId >= 0) ? getIcon(mCategoryId, mBookmark) : "");
|
||||
return BookmarkManager.getBookmarkManager()
|
||||
.getIconByName((mCategoryId >= 0) ? getIcon(mCategoryId, mBookmark) : "");
|
||||
}
|
||||
|
||||
public Icon getIcon()
|
||||
|
|
|
@ -1,74 +1,27 @@
|
|||
package com.mapswithme.maps.bookmarks.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
|
||||
public class BookmarkIconManager
|
||||
{
|
||||
private Context mContext;
|
||||
private Bitmap mEmptyBitmap = null;
|
||||
private static String[] ICONS = {
|
||||
"placemark-red", "placemark-blue", "placemark-purple", "placemark-yellow",
|
||||
"placemark-pink", "placemark-brown", "placemark-green", "placemark-orange"
|
||||
};
|
||||
private WeakHashMap<String, Bitmap> mIcons;
|
||||
|
||||
public BookmarkIconManager(Context context)
|
||||
|
||||
static Icon getIcon(String type)
|
||||
{
|
||||
mContext = context.getApplicationContext();
|
||||
mIcons = new WeakHashMap<String, Bitmap>();
|
||||
mEmptyBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.placemark_red);
|
||||
return new Icon(type, type);
|
||||
}
|
||||
|
||||
Icon getIcon(String type)
|
||||
static HashMap<String, Icon> getAll()
|
||||
{
|
||||
Bitmap iconB = getIconBitmap(type);
|
||||
//Maybe we can find a better way to store icons?
|
||||
if (iconB == null)
|
||||
{
|
||||
return new Icon("placemark-red", "placemark-red", mEmptyBitmap);
|
||||
}
|
||||
return new Icon(type, type, iconB);
|
||||
}
|
||||
|
||||
HashMap<String, Icon> getAll()
|
||||
{
|
||||
HashMap<String, Icon> all = new HashMap<String, Icon>();
|
||||
final HashMap<String, Icon> all = new HashMap<String, Icon>();
|
||||
for (int i = 0; i < ICONS.length; i++)
|
||||
{
|
||||
all.put(ICONS[i], getIcon(ICONS[i]));
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
private Bitmap getIconBitmap(String type)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Bitmap icon = null;
|
||||
icon = mIcons.get(type);
|
||||
if (icon==null)
|
||||
{
|
||||
//It's not take a lot of time to load this icon, so, now i'm not implementing icon loading in background thread.
|
||||
mIcons.put(type, icon = BitmapFactory.decodeResource(
|
||||
mContext.getResources(),
|
||||
mContext.getResources().
|
||||
getIdentifier(type.replace("-", "_"), "drawable", mContext.getPackageName())
|
||||
)
|
||||
);
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return mEmptyBitmap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,11 @@ public class BookmarkManager
|
|||
private List<Bookmark> mPins;
|
||||
private List<BookmarkCategory> mPinSets;
|
||||
private final Context mContext;
|
||||
private final BookmarkIconManager mIconManager;
|
||||
|
||||
private BookmarkManager(Context context)
|
||||
{
|
||||
mContext = context;
|
||||
loadBookmarks();
|
||||
mIconManager = new BookmarkIconManager(context);
|
||||
}
|
||||
|
||||
public static BookmarkManager getBookmarkManager(Context context)
|
||||
|
@ -81,12 +79,12 @@ public class BookmarkManager
|
|||
|
||||
public Icon getIconByName(String name)
|
||||
{
|
||||
return mIconManager.getIcon(name);
|
||||
return BookmarkIconManager.getIcon(name);
|
||||
}
|
||||
|
||||
public List<Icon> getIcons()
|
||||
{
|
||||
return new ArrayList<Icon>(mIconManager.getAll().values());
|
||||
return new ArrayList<Icon>(BookmarkIconManager.getAll().values());
|
||||
}
|
||||
|
||||
public static native Point getBookmark(double px, double py);
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package com.mapswithme.maps.bookmarks.data;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
public class Icon
|
||||
{
|
||||
private final String mName;
|
||||
private final String mType;
|
||||
|
||||
public Icon(String Name, String type, Bitmap Icon)
|
||||
public Icon(String Name, String type)
|
||||
{
|
||||
super();
|
||||
this.mName = Name;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.mapswithme.maps.settings;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
|
@ -24,7 +25,8 @@ public class SettingsActivity extends PreferenceActivity
|
|||
{
|
||||
private native boolean isDownloadingActive();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressLint("NewApi")
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
|
@ -46,14 +47,14 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
private static final int TYPES_COUNT = 2;
|
||||
//@}
|
||||
|
||||
private LayoutInflater m_inflater;
|
||||
private Activity m_context;
|
||||
private final LayoutInflater m_inflater;
|
||||
private final Activity m_context;
|
||||
|
||||
private String m_currPath;
|
||||
private String m_defPath;
|
||||
private final String m_defPath;
|
||||
private long m_sizeNeeded;
|
||||
|
||||
private int m_listItemHeight;
|
||||
private final int m_listItemHeight;
|
||||
|
||||
public StoragePathAdapter(Activity context, String currPath, String defPath)
|
||||
{
|
||||
|
@ -66,9 +67,10 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
m_listItemHeight = (int)Utils.getAttributeDimension(context, android.R.attr.listPreferredItemHeight);
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
private String getSizeString(long size)
|
||||
{
|
||||
String arrS[] = { "Kb", "Mb", "Gb" };
|
||||
final String arrS[] = { "Kb", "Mb", "Gb" };
|
||||
|
||||
long current = 1024;
|
||||
int i = 0;
|
||||
|
@ -91,7 +93,7 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
long m_size;
|
||||
}
|
||||
|
||||
private List<StorageItem> m_items = new ArrayList<StorageItem>();
|
||||
private final List<StorageItem> m_items = new ArrayList<StorageItem>();
|
||||
private int m_current = -1;
|
||||
|
||||
private boolean isAvailable(int index)
|
||||
|
@ -142,11 +144,11 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
if (findItemByPath(path) != -1)
|
||||
return false;
|
||||
|
||||
StatFs stat = new StatFs(path);
|
||||
final StatFs stat = new StatFs(path);
|
||||
final long size = (long)stat.getAvailableBlocks() * (long)stat.getBlockSize();
|
||||
Log.i(TAG, "Available size = " + size);
|
||||
|
||||
StorageItem item = new StorageItem();
|
||||
final StorageItem item = new StorageItem();
|
||||
item.m_path = path;
|
||||
item.m_size = size;
|
||||
|
||||
|
@ -156,7 +158,7 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
else
|
||||
Log.i(TAG, "File error for storage: " + path);
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
catch (final IllegalArgumentException ex)
|
||||
{
|
||||
// Suppress exceptions for unavailable storages.
|
||||
Log.i(TAG, "StatFs error for storage: " + path);
|
||||
|
@ -182,11 +184,11 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
|
||||
while (true)
|
||||
{
|
||||
String line = reader.readLine();
|
||||
final String line = reader.readLine();
|
||||
if (line == null) break;
|
||||
|
||||
// standard regexp for all possible whitespaces (space, tab, etc)
|
||||
String[] arr = line.split("\\s+");
|
||||
final String[] arr = line.split("\\s+");
|
||||
|
||||
// split may return empty first strings
|
||||
int start = 0;
|
||||
|
@ -210,15 +212,15 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
assert(mode == MOUNTS_MODE);
|
||||
Log.i(TAG, "Label = " + arr[start + 0] + "; Path = " + arr[start + 1]);
|
||||
|
||||
String prefixes[] = { "tmpfs", "/dev/block/vold", "/dev/fuse" };
|
||||
for (String s : prefixes)
|
||||
final String prefixes[] = { "tmpfs", "/dev/block/vold", "/dev/fuse" };
|
||||
for (final String s : prefixes)
|
||||
if (arr[start + 0].startsWith(s))
|
||||
addStorage(arr[start + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (final IOException e)
|
||||
{
|
||||
Log.w(TAG, "Can't read file: " + file);
|
||||
}
|
||||
|
@ -232,12 +234,12 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
//@{
|
||||
private long getDirSize(String name)
|
||||
{
|
||||
File dir = new File(name);
|
||||
final File dir = new File(name);
|
||||
assert(dir.exists());
|
||||
assert(dir.isDirectory());
|
||||
|
||||
long size = 0;
|
||||
for (File f : dir.listFiles())
|
||||
for (final File f : dir.listFiles())
|
||||
{
|
||||
assert(f.isFile());
|
||||
size += f.length();
|
||||
|
@ -252,7 +254,7 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
assert(dir.exists());
|
||||
assert(dir.isDirectory());
|
||||
|
||||
for (File file : dir.listFiles())
|
||||
for (final File file : dir.listFiles())
|
||||
{
|
||||
assert(file.isFile());
|
||||
|
||||
|
@ -316,7 +318,7 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
convertView.setMinimumHeight(m_listItemHeight);
|
||||
}
|
||||
|
||||
TextView v = (TextView) convertView;
|
||||
final TextView v = (TextView) convertView;
|
||||
v.setText(m_context.getString(R.string.maps) + ": " + getSizeString(m_sizeNeeded));
|
||||
break;
|
||||
}
|
||||
|
@ -332,7 +334,7 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
convertView.setMinimumHeight(m_listItemHeight);
|
||||
}
|
||||
|
||||
CheckedTextView v = (CheckedTextView) convertView;
|
||||
final CheckedTextView v = (CheckedTextView) convertView;
|
||||
v.setText(item.m_path + ": " + getSizeString(item.m_size));
|
||||
v.setChecked(index == m_current);
|
||||
v.setEnabled((index == m_current) || isAvailable(index));
|
||||
|
@ -378,8 +380,8 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
|
||||
private class MoveFilesTask extends AsyncTask<String, Void, Boolean>
|
||||
{
|
||||
private ProgressDialog m_dlg;
|
||||
private String m_resPath;
|
||||
private final ProgressDialog m_dlg;
|
||||
private final String m_resPath;
|
||||
|
||||
public MoveFilesTask(Activity context, String path)
|
||||
{
|
||||
|
@ -413,7 +415,7 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
{
|
||||
m_dlg.dismiss();
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (final Exception e)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -429,7 +431,7 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
{
|
||||
final String path = getFullPath(index);
|
||||
|
||||
File f = new File(path);
|
||||
final File f = new File(path);
|
||||
if (!f.exists() && !f.mkdirs())
|
||||
{
|
||||
Log.e(TAG, "Can't create directory: " + path);
|
||||
|
@ -446,7 +448,7 @@ public class StoragePathActivity extends MapsWithMeBaseListActivity
|
|||
{
|
||||
Log.i(TAG, "Transfer data to storage: " + path);
|
||||
|
||||
MoveFilesTask task = new MoveFilesTask(m_context, m_items.get(index).m_path);
|
||||
final MoveFilesTask task = new MoveFilesTask(m_context, m_items.get(index).m_path);
|
||||
task.execute(path);
|
||||
|
||||
dlg.dismiss();
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.HashMap;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
|
@ -11,7 +12,6 @@ import android.graphics.Color;
|
|||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Pair;
|
||||
import android.view.View;
|
||||
|
||||
import com.mapswithme.maps.Framework;
|
||||
|
@ -99,6 +99,7 @@ public final class UiUtils
|
|||
}
|
||||
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public static final int colorByName(String name, int defColor)
|
||||
{
|
||||
if (COLOR_MAP.containsKey(name.trim().toLowerCase()))
|
||||
|
|