Prices more beautiful

This commit is contained in:
Caesar2011
2018-07-30 01:11:47 +02:00
parent b60336295e
commit 36ead37021
3 changed files with 9 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
package de.sebse.fuplanner.fragments.canteen; package de.sebse.fuplanner.fragments.canteen;
import android.content.Context;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@@ -17,6 +18,11 @@ import de.sebse.fuplanner.tools.ui.StringViewHolder;
public class MealAdapter extends BaseExpandableListAdapter { public class MealAdapter extends BaseExpandableListAdapter {
private Day mDay = null; private Day mDay = null;
private Context mContext;
public MealAdapter(Context context) {
mContext = context;
}
@Override @Override
public String getChild(int groupPosition, int childPosititon) { public String getChild(int groupPosition, int childPosititon) {
@@ -90,7 +96,7 @@ public class MealAdapter extends BaseExpandableListAdapter {
ItemViewHolder itemHolder = new ItemViewHolder(convertView); ItemViewHolder itemHolder = new ItemViewHolder(convertView);
itemHolder.mTitle.setText(meal.getName()); itemHolder.mTitle.setText(meal.getName());
itemHolder.mSubLeft.setText(meal.getCategory()); itemHolder.mSubLeft.setText(meal.getCategory());
itemHolder.mSubRight.setText(meal.getPriceStdnt()+"/"+meal.getPriceEmply()+"/"+meal.getPriceOther()); itemHolder.mSubRight.setText(mContext.getResources().getString(R.string.prices, meal.getPriceStdnt(), meal.getPriceEmply(), meal.getPriceOther()));
return convertView; return convertView;
} }

View File

@@ -72,7 +72,7 @@ public class MealFragment extends Fragment {
View view = inflater.inflate(R.layout.fragment_expandable_list_view, container, false); View view = inflater.inflate(R.layout.fragment_expandable_list_view, container, false);
// Set the adapter // Set the adapter
ExpandableListView expandableListView = view.findViewById(R.id.list); ExpandableListView expandableListView = view.findViewById(R.id.list);
adapter = new MealAdapter(); adapter = new MealAdapter(getContext());
expandableListView.setAdapter(adapter); expandableListView.setAdapter(adapter);
// Getting SwipeContainerLayout // Getting SwipeContainerLayout

View File

@@ -45,4 +45,5 @@
<string name="refresh">Refresh</string> <string name="refresh">Refresh</string>
<string name="go_to_today">Go to today</string> <string name="go_to_today">Go to today</string>
<string name="canteens">Canteens</string> <string name="canteens">Canteens</string>
<string name="prices">%1$.2f / %2$.2f / %3$.2f</string>
</resources> </resources>