Merge pull request #220 from rogere66/master

Favorite Dialog and Gpx Save Improvements
This commit is contained in:
Pavol Zibrita 2012-04-17 05:44:56 -07:00
commit b2af420b1d
4 changed files with 8 additions and 4 deletions

View file

@ -6,12 +6,12 @@
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@string/favourites_edit_dialog_name"/>
<EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="3dp"
android:id="@+id/Name"/>
android:id="@+id/Name" android:inputType="textCapWords" android:selectAllOnFocus="true"/>
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@string/favourites_edit_dialog_category"/>
<AutoCompleteTextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="3dp"
android:id="@+id/Category" android:completionThreshold="1"/>
android:id="@+id/Category" android:completionThreshold="1" android:inputType="textCapWords" android:selectAllOnFocus="true"/>
</TableRow>
</TableLayout>

View file

@ -81,7 +81,10 @@ public class FavouritesDbHelper extends SQLiteOpenHelper {
WptPt pt = new WptPt();
pt.lat = p.getLatitude();
pt.lon = p.getLongitude();
pt.name = p.getName() + "_" + p.getCategory();
if (p.getCategory().length() > 0)
pt.name = p.getName() + "_" + p.getCategory();
else
pt.name = p.getName();
gpx.points.add(pt);
}
}

View file

@ -406,7 +406,7 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
}
for(WptPt p : res.points){
if(!existedPoints.contains(p.name)){
String categoryName = FavouritesActivity.this.getString(R.string.favorite_default_category);
String categoryName = "";
int c;
String name = p.name;
if(name == null){

View file

@ -112,6 +112,7 @@ public class MapActivityActions implements DialogProvider {
resources.getString(R.string.favorite_default_category));
args.putSerializable(KEY_FAVORITE, point);
final EditText editText = (EditText) dialog.findViewById(R.id.Name);
editText.requestFocus();
editText.setText(point.getName());
final AutoCompleteTextView cat = (AutoCompleteTextView) dialog.findViewById(R.id.Category);
cat.setText(point.getCategory());