fix small issues

git-svn-id: https://osmand.googlecode.com/svn/trunk@128 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-06-03 12:32:51 +00:00
parent 5bbdccdc98
commit 25900dca4a
9 changed files with 72 additions and 29 deletions

View file

@ -20,6 +20,7 @@ public class ToDoConstants {
// introduce one place where refreshMap will be called using postMessage mechanism (delay more than > 50 ? ms). // introduce one place where refreshMap will be called using postMessage mechanism (delay more than > 50 ? ms).
// Introducing cache of file names that are on disk (creating new File() consumes a lot of memory) // Introducing cache of file names that are on disk (creating new File() consumes a lot of memory)
// 31. Translation. // 31. Translation.
// 32. Introduce POI predefined filters (car filter(other-fuel, transportation-car_wash, show-car) and others)
// FIXME Bugs Android : // FIXME Bugs Android :

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

View file

@ -15,7 +15,7 @@
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:layout_width="140dip" android:layout_width="140dip"
android:layout_height="70dip" android:layout_height="90dip"
android:drawableLeft="@drawable/map"/> android:drawableLeft="@drawable/map"/>
<Button <Button
@ -25,7 +25,7 @@
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:layout_width="140dip" android:layout_width="140dip"
android:layout_height="70dip" android:layout_height="90dip"
android:drawableLeft="@drawable/find"/> android:drawableLeft="@drawable/find"/>
</TableRow> </TableRow>
<TableRow> <TableRow>
@ -36,7 +36,7 @@
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:layout_width="140dip" android:layout_width="140dip"
android:layout_height="70dip" android:layout_height="90dip"
android:drawableLeft="@drawable/favorites"/> android:drawableLeft="@drawable/favorites"/>
<Button <Button
android:id="@+id/SettingsButton" android:id="@+id/SettingsButton"
@ -45,7 +45,7 @@
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:layout_width="140dip" android:layout_width="140dip"
android:layout_height="70dip" android:layout_height="90dip"
android:drawableLeft="@drawable/settings"/> android:drawableLeft="@drawable/settings"/>
</TableRow> </TableRow>
</TableLayout> </TableLayout>

View file

@ -2,22 +2,42 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:orientation="vertical" android:layout_width="fill_parent" android:orientation="vertical"
android:layout_height="fill_parent" android:background="@color/menu_background"> android:layout_height="fill_parent" android:background="@drawable/background_rot">
<Button android:layout_height="45dp" android:textStyle="bold" <Button android:layout_height="45dp" android:layout_gravity="center"
android:layout_gravity="center" android:id="@+id/MapButton" android:id="@+id/MapButton"
android:text="@string/map_Button" android:layout_width="300dp" android:layout_marginTop="10dp"></Button> android:text="@string/map_Button"
android:background="@drawable/btn_orange"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:drawableLeft="@drawable/map"
android:layout_width="300dp" android:layout_marginTop="10dp"></Button>
<Button android:layout_height="45dp" android:id="@+id/SearchButton" android:text="@string/search_button" android:textStyle="bold" <Button android:layout_height="45dp" android:layout_gravity="center"
android:layout_width="300dp" android:layout_gravity="center" android:layout_marginTop="10dp"></Button> android:id="@+id/SearchButton"
android:text="@string/search_button"
<Button android:id="@+id/FavoritesButton" android:text="@string/favorites_Button" android:layout_marginTop="10dp" android:background="@drawable/btn_orange"
android:textStyle="bold" android:layout_width="300dp" android:layout_gravity="center" android:textColor="#FFFFFF"
android:layout_height="45dp"/> android:textStyle="bold"
android:drawableLeft="@drawable/find"
<Button android:layout_height="45dp" android:textStyle="bold" android:layout_width="300dp" android:layout_marginTop="10dp"></Button>
android:layout_gravity="center" android:id="@+id/SettingsButton" <Button android:layout_height="45dp" android:layout_gravity="center"
android:text="@string/settings_Button" android:layout_width="300dp" android:layout_marginTop="10dp"></Button> android:id="@+id/FavoritesButton"
android:text="@string/favorites_Button"
android:background="@drawable/btn_orange"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:drawableLeft="@drawable/favorites"
android:layout_width="300dp" android:layout_marginTop="10dp"></Button>
<Button android:layout_height="45dp" android:layout_gravity="center"
android:id="@+id/SettingsButton"
android:text="@string/settings_Button"
android:background="@drawable/btn_orange"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:drawableLeft="@drawable/settings"
android:layout_width="300dp" android:layout_marginTop="10dp"></Button>
<FrameLayout android:id="@+id/FrameLayout01" <FrameLayout android:id="@+id/FrameLayout01"
android:layout_height="fill_parent" android:layout_width="fill_parent"> android:layout_height="fill_parent" android:layout_width="fill_parent">
<Button android:layout_width="wrap_content" <Button android:layout_width="wrap_content"

View file

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen <PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/app_settings"><CheckBoxPreference android:summary="@string/use_english_names_descr" android:title="@string/use_english_names" android:key="use_english_names"></CheckBoxPreference>
</PreferenceCategory>
<PreferenceCategory android:title="@string/map_preferences"> <PreferenceCategory android:title="@string/map_preferences">
<CheckBoxPreference android:key="use_internet_to_download_tiles" android:title="@string/use_internet" android:summary="@string/use_internet_to_download_tile"></CheckBoxPreference> <CheckBoxPreference android:key="use_internet_to_download_tiles" android:title="@string/use_internet" android:summary="@string/use_internet_to_download_tile"></CheckBoxPreference>
@ -12,6 +14,5 @@
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/map_source"><ListPreference android:title="@string/map_tile_source" android:summary="@string/map_tile_source_descr" android:key="map_tile_sources"></ListPreference> <PreferenceCategory android:title="@string/map_source"><ListPreference android:title="@string/map_tile_source" android:summary="@string/map_tile_source_descr" android:key="map_tile_sources"></ListPreference>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/app_settings"><CheckBoxPreference android:summary="@string/use_english_names_descr" android:title="@string/use_english_names" android:key="use_english_names"></CheckBoxPreference>
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View file

@ -141,9 +141,14 @@ public class OsmandSettings {
return prefs.getString(LAST_SEARCHED_REGION, ""); return prefs.getString(LAST_SEARCHED_REGION, "");
} }
public static boolean setLastSearchedRegion(Context ctx, String region){ public static boolean setLastSearchedRegion(Context ctx, String region) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().putString(LAST_SEARCHED_REGION, region).commit(); Editor edit = prefs.edit().putString(LAST_SEARCHED_REGION, region).putLong(LAST_SEARCHED_CITY, -1).
putString(LAST_SEARCHED_STREET,"").putString(LAST_SEARCHED_BUILDING, "");
if (prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) {
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, "");
}
return edit.commit();
} }
public static Long getLastSearchedCity(Context ctx){ public static Long getLastSearchedCity(Context ctx){
@ -153,9 +158,12 @@ public class OsmandSettings {
public static boolean setLastSearchedCity(Context ctx, Long cityId){ public static boolean setLastSearchedCity(Context ctx, Long cityId){
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit(). Editor edit = prefs.edit().putLong(LAST_SEARCHED_CITY, cityId).putString(LAST_SEARCHED_STREET, "").
putLong(LAST_SEARCHED_CITY, cityId).putString(LAST_SEARCHED_STREET, "").putString(LAST_SEARCHED_BUILDING, ""). putString(LAST_SEARCHED_BUILDING, "");
commit(); if(prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)){
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, "");
}
return edit.commit();
} }
public static String getLastSearchedStreet(Context ctx){ public static String getLastSearchedStreet(Context ctx){
@ -165,7 +173,11 @@ public class OsmandSettings {
public static boolean setLastSearchedStreet(Context ctx, String street){ public static boolean setLastSearchedStreet(Context ctx, String street){
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().putString(LAST_SEARCHED_STREET, street).putString(LAST_SEARCHED_BUILDING, "").commit(); Editor edit = prefs.edit().putString(LAST_SEARCHED_STREET, street).putString(LAST_SEARCHED_BUILDING, "");
if(prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)){
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, "");
}
return edit.commit();
} }
public static String getLastSearchedBuilding(Context ctx){ public static String getLastSearchedBuilding(Context ctx){

View file

@ -97,12 +97,13 @@ public class MainMenuActivity extends Activity {
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Intent mapIndent = new Intent(MainMenuActivity.this, MapActivity.class); Intent notificationIndent = new Intent(MainMenuActivity.this, MapActivity.class);
notificationIndent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Notification notification = new Notification(R.drawable.icon, "", Notification notification = new Notification(R.drawable.icon, "",
System.currentTimeMillis()); System.currentTimeMillis());
notification.setLatestEventInfo(MainMenuActivity.this, "OsmAnd", notification.setLatestEventInfo(MainMenuActivity.this, "OsmAnd",
"OsmAnd is running in background", PendingIntent.getActivity( "OsmAnd is running in background", PendingIntent.getActivity(
this.getBaseContext(), 0, mapIndent, this.getBaseContext(), 0, notificationIndent,
PendingIntent.FLAG_UPDATE_CURRENT)); PendingIntent.FLAG_UPDATE_CURRENT));
mNotificationManager.notify(APP_NOTIFICATION_ID, notification); mNotificationManager.notify(APP_NOTIFICATION_ID, notification);

View file

@ -139,6 +139,7 @@ public class SearchAddressActivity extends Activity {
public void onClick(View v) { public void onClick(View v) {
street = null; street = null;
building = null; building = null;
street2 = null;
updateUI(); updateUI();
} }
}); });
@ -147,6 +148,7 @@ public class SearchAddressActivity extends Activity {
public void onClick(View v) { public void onClick(View v) {
city = null; city = null;
street = null; street = null;
street2 = null;
building = null; building = null;
updateUI(); updateUI();
} }
@ -157,6 +159,7 @@ public class SearchAddressActivity extends Activity {
region = null; region = null;
city = null; city = null;
street = null; street = null;
street2 = null;
building = null; building = null;
updateUI(); updateUI();
} }

View file

@ -86,11 +86,16 @@ public class SearchPOIActivity extends ListActivity {
.getLongitude(), zoom, maxCount); .getLongitude(), zoom, maxCount);
} else { } else {
amenityList = resourceManager.searchAmenities(amenityType, lastKnownMapLocation.getLatitude(), lastKnownMapLocation amenityList = resourceManager.searchAmenities(amenityType, lastKnownMapLocation.getLatitude(), lastKnownMapLocation
.getLongitude(), zoom, 30); .getLongitude(), zoom, maxCount);
} }
if (amenityList != null) { if (amenityList != null) {
MapUtils.sortListOfMapObject(amenityList, lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()); MapUtils.sortListOfMapObject(amenityList, lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude());
if(amenityType == null){
while (amenityList.size() > 30) {
amenityList.remove(amenityList.size() - 1);
}
}
amenityAdapter = new AmenityAdapter(amenityList); amenityAdapter = new AmenityAdapter(amenityList);
setListAdapter(amenityAdapter); setListAdapter(amenityAdapter);
} }