Fixed issue with favorite points duplicates

This commit is contained in:
Bars107 2014-11-13 17:42:39 +02:00
parent e83ef8cb51
commit 6b62ef5536
3 changed files with 7 additions and 5 deletions

View file

@ -3,7 +3,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:background="@color/color_white" android:background="@drawable/dashboard_button"
android:layout_marginTop="1dp" android:layout_marginTop="1dp"
android:layout_height="50dp"> android:layout_height="50dp">
<ImageView android:id="@+id/icon" <ImageView android:id="@+id/icon"

View file

@ -11,7 +11,7 @@
<LinearLayout android:id="@+id/search" <LinearLayout android:id="@+id/search"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/bg_cardui" android:background="@drawable/bg_cardui"
android:layout_marginBottom="6dp"> android:layout_marginBottom="6dp">
@ -22,7 +22,7 @@
android:layout_height="38dp" android:layout_height="38dp"
android:layout_width="wrap_content"/> android:layout_width="wrap_content"/>
<LinearLayout android:orientation="horizontal" <LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:background="@color/dashboard_divider" android:background="@color/dashboard_divider"
android:layout_height="90dp"> android:layout_height="90dp">
<Button android:id="@+id/poi" <Button android:id="@+id/poi"

View file

@ -37,7 +37,7 @@ public class DashboardActivity extends SherlockFragmentActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.dashboard); setContentView(R.layout.dashboard);
getSupportActionBar().setTitle(R.string.app_version); getSupportActionBar().setTitle(R.string.app_name);
ColorDrawable color = new ColorDrawable(Color.parseColor("#ff8f00")); ColorDrawable color = new ColorDrawable(Color.parseColor("#ff8f00"));
getSupportActionBar().setBackgroundDrawable(color); getSupportActionBar().setBackgroundDrawable(color);
getSupportActionBar().setIcon(android.R.color.transparent); getSupportActionBar().setIcon(android.R.color.transparent);
@ -64,6 +64,8 @@ public class DashboardActivity extends SherlockFragmentActivity {
private void setupFavorites(){ private void setupFavorites(){
final FavouritesDbHelper helper = getMyApplication().getFavorites(); final FavouritesDbHelper helper = getMyApplication().getFavorites();
final List<FavouritePoint> points = helper.getFavouritePoints(); final List<FavouritePoint> points = helper.getFavouritePoints();
LinearLayout favorites = (LinearLayout) findViewById(R.id.favorites);
favorites.removeAllViews();
if (points.size() == 0){ if (points.size() == 0){
(findViewById(R.id.main_fav)).setVisibility(View.GONE); (findViewById(R.id.main_fav)).setVisibility(View.GONE);
return; return;
@ -75,7 +77,7 @@ public class DashboardActivity extends SherlockFragmentActivity {
} }
} }
LinearLayout favorites = (LinearLayout) findViewById(R.id.favorites);
for (final FavouritePoint point : points) { for (final FavouritePoint point : points) {
LayoutInflater inflater = getLayoutInflater(); LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(R.layout.dash_fav_list, null, false); View view = inflater.inflate(R.layout.dash_fav_list, null, false);