fine tuning UI for favorites activity

This commit is contained in:
Pavol Zibrita 2012-03-09 04:24:36 +01:00
parent 7c54ef450f
commit df389ed289
21 changed files with 60 additions and 40 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -2,10 +2,10 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- checked --> <!-- checked -->
<item android:drawable="@drawable/list_activities_dot_marker1_pressed" android:state_expanded="true"/> <item android:state_expanded="true" android:drawable="@drawable/list_activities_dot_marker1_pressed"/>
<!-- unchecked --> <!-- unchecked empty -->
<item android:drawable="@drawable/list_activities_dot_marker1_unpressed" android:state_expanded="false"/> <item android:state_expanded="false" android:state_empty="false" android:drawable="@drawable/list_activities_dot_marker1_content"/>
<!-- default --> <!-- unchecked nonempty -->
<item android:drawable="@drawable/list_activities_dot_marker1_unpressed"/> <item android:drawable="@drawable/list_activities_dot_marker1_empty"/>
</selector> </selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

@ -58,11 +58,11 @@
android:id="@android:id/list" android:id="@android:id/list"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="3dp" android:layout_marginLeft="0dp"
android:layout_marginRight="3dp" android:layout_marginRight="0dp"
android:layout_marginTop="3dp" android:layout_marginTop="0dp"
android:layout_weight="1" android:layout_weight="1"
android:groupIndicator="@drawable/indicator_custom_gray" android:groupIndicator="@android:color/transparent"
style="@style/OsmandListView"> style="@style/OsmandListView">
</ExpandableListView> </ExpandableListView>

View file

@ -1,14 +1,30 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<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:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="fill_parent"
android:paddingLeft="40dp"
android:paddingTop="3dp"
android:background="@drawable/tab_menu_item_small" > android:background="@drawable/tab_menu_item_small" >
<LinearLayout <ImageView android:src="@drawable/indicator_custom_gray"
android:id="@+id/explist_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:layout_gravity="center_vertical"
/>
<TextView
android:paddingLeft="10dp"
android:id="@+id/category_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" > android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textSize="24sp" >
</TextView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right" >
<CheckBox <CheckBox
android:id="@+id/check_item" android:id="@+id/check_item"
@ -19,12 +35,4 @@
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/category_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textSize="24sp" >
</TextView>
</LinearLayout> </LinearLayout>

View file

@ -82,7 +82,7 @@
<item name="android:background">@color/activity_background</item> <item name="android:background">@color/activity_background</item>
</style> </style>
<style name="CustomTitleTheme" parent="OsmandTheme"> <style name="CustomTitleTheme" parent="OsmandTheme">
<item name="android:windowTitleSize">46dp</item> <item name="android:windowTitleSize">52dp</item>
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item> <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style> </style>
<style name="CustomTitleTheme.Preference" parent="CustomTitleTheme"> <style name="CustomTitleTheme.Preference" parent="CustomTitleTheme">

View file

@ -59,7 +59,7 @@ public class ContributionVersionActivity extends OsmandListActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
CustomTitleBar titleBar = new CustomTitleBar(this, R.string.download_files, R.drawable.tab_favorites_screen_icon); CustomTitleBar titleBar = new CustomTitleBar(this, R.string.download_files, R.drawable.tab_download_screen_icon);
setContentView(R.layout.download_builds); setContentView(R.layout.download_builds);
titleBar.afterSetContentView(); titleBar.afterSetContentView();

View file

@ -194,11 +194,10 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
private void updateLoadedFiles() { private void updateLoadedFiles() {
indexActivatedFileNames = ((OsmandApplication)getApplication()).getResourceManager().getIndexFileNames(); indexActivatedFileNames = getMyApplication().getResourceManager().getIndexFileNames();
indexFileNames = ((OsmandApplication)getApplication()).getResourceManager().getIndexFileNames(); indexFileNames = getMyApplication().getResourceManager().getIndexFileNames();
((OsmandApplication)getApplication()).getResourceManager().getBackupIndexes(indexFileNames); getMyApplication().getResourceManager().getBackupIndexes(indexFileNames);
} }
private void downloadIndexList() { private void downloadIndexList() {
showDialog(DIALOG_PROGRESS_LIST); showDialog(DIALOG_PROGRESS_LIST);
@ -716,7 +715,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
} }
// reindex vector maps all at one time // reindex vector maps all at one time
if (vectorMapsToReindex) { if (vectorMapsToReindex) {
ResourceManager manager = ((OsmandApplication) getApplication()).getResourceManager(); ResourceManager manager = getMyApplication().getResourceManager();
List<String> warnings = manager.indexingMaps(progress); List<String> warnings = manager.indexingMaps(progress);
if (warnings.isEmpty() && !OsmandSettings.getOsmandSettings(getApplicationContext()).MAP_VECTOR_DATA.get()) { if (warnings.isEmpty() && !OsmandSettings.getOsmandSettings(getApplicationContext()).MAP_VECTOR_DATA.get()) {
warnings.add(getString(R.string.binary_map_download_success)); warnings.add(getString(R.string.binary_map_download_success));

View file

@ -79,11 +79,12 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
setContentView(R.layout.favourites_list); setContentView(R.layout.favourites_list);
titleBar.afterSetContentView(); titleBar.afterSetContentView();
helper = ((OsmandApplication)getApplication()).getFavorites();
helper = getMyApplication().getFavorites();
favouritesAdapter = new FavouritesAdapter(); favouritesAdapter = new FavouritesAdapter();
favouritesAdapter.setFavoriteGroups(helper.getFavoriteGroups()); favouritesAdapter.setFavoriteGroups(helper.getFavoriteGroups());
getExpandableListView().setAdapter(favouritesAdapter); getExpandableListView().setAdapter(favouritesAdapter);
/* Add Context-Menu listener to the ListView. */ /* Add Context-Menu listener to the ListView. */
getExpandableListView().setOnCreateContextMenuListener(new View.OnCreateContextMenuListener(){ getExpandableListView().setOnCreateContextMenuListener(new View.OnCreateContextMenuListener(){
@ -559,7 +560,7 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
public boolean isChildSelectable(int groupPosition, int childPosition) { public boolean isChildSelectable(int groupPosition, int childPosition) {
return true; return true;
} }
@Override @Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
View row = convertView; View row = convertView;
@ -567,11 +568,19 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
LayoutInflater inflater = getLayoutInflater(); LayoutInflater inflater = getLayoutInflater();
row = inflater.inflate(R.layout.favourites_list_category, parent, false); row = inflater.inflate(R.layout.favourites_list_category, parent, false);
} }
ImageView indicator = (ImageView) row.findViewById(R.id.explist_indicator);
if (!isExpanded) {
if (getChildrenCount(groupPosition) == 0) {
indicator.setImageResource(R.drawable.list_activities_dot_marker1_empty);
} else {
indicator.setImageResource(R.drawable.list_activities_dot_marker1_content);
}
} else {
indicator.setImageResource(R.drawable.list_activities_dot_marker1_pressed);
}
TextView label = (TextView) row.findViewById(R.id.category_name); TextView label = (TextView) row.findViewById(R.id.category_name);
final String model = getGroup(groupPosition); final String model = getGroup(groupPosition);
List<FavouritePoint> ms = helper.getFavoriteGroups().get(model); label.setText(model);
int sz = ms != null ? ms.size() : 0;
label.setText(model + " [" + sz +"]");
final CheckBox ch = (CheckBox) row.findViewById(R.id.check_item); final CheckBox ch = (CheckBox) row.findViewById(R.id.check_item);
if(selectionMode){ if(selectionMode){

View file

@ -162,7 +162,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
OsmandSettings settings = OsmandSettings.getOsmandSettings(LocalIndexesActivity.this); OsmandSettings settings = OsmandSettings.getOsmandSettings(LocalIndexesActivity.this);
settings.setMapLocationToShow(loc.lat, loc.lon, settings.getLastKnownMapZoom()); settings.setMapLocationToShow(loc.lat, loc.lon, settings.getLastKnownMapZoom());
} }
((OsmandApplication) getApplication()).setGpxFileToDisplay(info.getGpxFile(), false); getMyApplication().setGpxFileToDisplay(info.getGpxFile(), false);
MapActivity.launchMapActivityMoveToTop(LocalIndexesActivity.this); MapActivity.launchMapActivityMoveToTop(LocalIndexesActivity.this);
} }
} else if (resId == R.string.local_index_mi_rename) { } else if (resId == R.string.local_index_mi_rename) {
@ -239,7 +239,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
@Override @Override
protected List<LocalIndexInfo> doInBackground(Activity... params) { protected List<LocalIndexInfo> doInBackground(Activity... params) {
LocalIndexHelper helper = new LocalIndexHelper((OsmandApplication) getApplication()); LocalIndexHelper helper = new LocalIndexHelper(getMyApplication());
return helper.getAllLocalIndexData(this); return helper.getAllLocalIndexData(this);
} }
@ -460,7 +460,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
@Override @Override
protected LocalIndexInfo[] doInBackground(LocalIndexInfo... params) { protected LocalIndexInfo[] doInBackground(LocalIndexInfo... params) {
LocalIndexHelper helper = new LocalIndexHelper((OsmandApplication) getApplication()); LocalIndexHelper helper = new LocalIndexHelper(getMyApplication());
for (LocalIndexInfo i : params) { for (LocalIndexInfo i : params) {
helper.updateDescription(i); helper.updateDescription(i);
} }
@ -713,7 +713,7 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
} }
@Override @Override
protected List<String> doInBackground(Void... params) { protected List<String> doInBackground(Void... params) {
return ((OsmandApplication) getApplication()).getResourceManager().reloadIndexes(IProgress.EMPTY_PROGRESS); return getMyApplication().getResourceManager().reloadIndexes(IProgress.EMPTY_PROGRESS);
} }
}; };

View file

@ -261,7 +261,7 @@ public class LocalOpenstreetmapActivity extends OsmandExpandableListActivity {
} }
public void delete(OpenstreetmapPoint i) { public void delete(OpenstreetmapPoint i) {
final AmenityIndexRepositoryOdb repo = ((OsmandApplication) getApplication()).getResourceManager().getUpdatablePoiDb(); final AmenityIndexRepositoryOdb repo = getMyApplication().getResourceManager().getUpdatablePoiDb();
android.util.Log.d(LogUtil.TAG, "Delete " + i); android.util.Log.d(LogUtil.TAG, "Delete " + i);
db.deleteOpenstreetmap(i); db.deleteOpenstreetmap(i);
String c = i.getType(); String c = i.getType();

View file

@ -15,4 +15,8 @@ public abstract class OsmandExpandableListActivity extends
view.setCacheColorHint(getResources().getColor(R.color.activity_background)); view.setCacheColorHint(getResources().getColor(R.color.activity_background));
view.setDivider(getResources().getDrawable(R.drawable.tab_text_separator)); view.setDivider(getResources().getDrawable(R.drawable.tab_text_separator));
} }
protected OsmandApplication getMyApplication() {
return (OsmandApplication)getApplication();
}
} }