Permalink
Browse files

renamed back to "mensa" (except for app_name string in Android Manife…

…st) and started to apply new theme

Eclipse refused to generate the R.java with the net.pherth.omnomagon
package but instead used net.pherth.mensa, so the name was changed back
to prevent problems.
  • Loading branch information...
1 parent 4197c89 commit 4f9221c2bfdff09ca73c675506c5afb3f300c116 @vIiRuS committed Feb 13, 2012
View
2 .project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>Omnomagon</name>
+ <name>Mensa</name>
<comment></comment>
<projects>
</projects>
View
2 AndroidManifest.xml
@@ -24,7 +24,7 @@
</intent-filter>
</activity>
<activity
- android:name="net.pherth.omnomagon.MainPreference"
+ android:name=".MainPreference"
android:label="@string/preferences"
android:theme="@style/MensaTheme">
</activity>
View
BIN assets/fonts/Bitter-Bold.otf
Binary file not shown.
View
BIN assets/fonts/Bitter-Italic.otf
Binary file not shown.
View
BIN assets/fonts/Bitter-Regular.otf
Binary file not shown.
View
12 res/anim/rolldown.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<scale xmlns:android="http://schemas.android.com/apk/res/android"
+android:fromYScale="0.0"
+android:toYScale="1.0"
+android:pivotX="50%"
+android:pivotY="0%"
+android:startOffset="0"
+android:duration="400"
+android:fillBefore="false">
+
+
+</scale>
View
BIN res/drawable-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-ldpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/aktion.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/beilagen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/biosiegel.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/desserts.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/essen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/salate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/schatten.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/suppen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/vegansiegel.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/vegetarischsiegel.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN res/drawable/vorspeisen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
14 res/layout/addition_list_item.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/TextSwitcher1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:textColor="@color/white"
+ android:typeface="serif"
+ android:paddingLeft="10dp"
+ android:paddingTop="2dp"
+ android:paddingBottom="2dp"
+ android:clickable="false"
+ android:focusable="false">
+
+</TextView>
View
23 res/layout/item_composer_header.xml
@@ -1,24 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/headerWrapper"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical" >
-
- <TextView
+ <ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header"
- style="@style/CustomListHeader"
- android:layout_width="fill_parent"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingLeft="2dp"
- android:paddingTop="9dp"
- android:paddingBottom="2dp"
- />
-
- <View
- android:id="@+id/headerBar"
- android:layout_width="wrap_content"
- android:layout_height="1dp"
- android:background="@color/grey" />
+ android:contentDescription="Header Image" />
-</LinearLayout>
View
80 res/layout/list_item.xml
@@ -5,59 +5,77 @@
android:layout_height="fill_parent"
android:orientation="vertical" >
- <include
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- layout="@layout/item_composer_header" />
+ <include
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ layout="@layout/item_composer_header" />
<RelativeLayout
android:id="@+id/listTextContainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:baselineAligned="true"
- android:orientation="horizontal"
- android:paddingTop="3dp"
- android:paddingBottom="3dp"
- android:paddingLeft="5dp"
- android:paddingRight="5dp"
- >
-
- <LinearLayout
- android:id="@+id/linearLayout1"
+ android:orientation="horizontal"
+ android:paddingBottom="5dp"
+ android:paddingLeft="30dp"
+ android:paddingRight="30dp" >
+
+ <TextView
+ android:id="@+id/itemViewBig"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:layout_alignParentRight="true" >
- </LinearLayout>
-
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true"
+ android:layout_toLeftOf="@+id/veganVegetarianImageView"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="@color/fontcolor"
+ android:textSize="14dp"
+ android:typeface="serif" />
+
+
+
<TextView
android:id="@+id/itemViewPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
- android:layout_below="@+id/include1"
- android:gravity="top"
- android:textAppearance="?android:attr/textAppearanceSmall"
+ android:layout_alignParentTop="true"
+ android:gravity="right"
+ android:paddingLeft="5dp"
+ android:textAppearance="?android:attr/textAppearanceMedium"
+ android:textColor="@color/priceColor"
+ android:textSize="14dp"
android:textStyle="bold"
- android:paddingLeft="5dp"/>
+ android:typeface="serif" />
- <TextView
- android:id="@+id/itemViewBig"
+ <ImageView
+ android:id="@+id/bioImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_below="@+id/include1"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textSize="16dp"
- android:layout_toLeftOf="@+id/itemViewPrice"/>
+ android:layout_alignParentTop="true"
+ android:layout_toLeftOf="@+id/itemViewPrice"
+ android:src="@drawable/biosiegel" />
- <TextView
- android:id="@+id/itemViewSmall"
+ <ImageView
+ android:id="@+id/veganVegetarianImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_marginLeft="14dp"
+ android:layout_toLeftOf="@+id/bioImageView"/>
+
+ <ListView
+ android:id="@+id/additionsListView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/itemViewBig"
- android:layout_toLeftOf="@+id/itemViewPrice"/>
+ android:background="@color/priceColor"
+ android:clickable="false"
+ android:focusable="false">
+
+ </ListView>
+
</RelativeLayout>
</LinearLayout>
View
3 res/layout/main.xml
@@ -15,7 +15,6 @@
android:id="@+id/mainpager"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp" />
+ android:background="@drawable/background" />
</LinearLayout>
View
2 res/values/colors.xml
@@ -2,4 +2,6 @@
<resources>
<color name="white">#FFFFFF</color>
<color name="grey">#DBDBDB</color>
+ <color name="fontcolor">#545454</color>
+ <color name="priceColor">#a2543f</color>
</resources>
View
23 src/net/pherth/mensa/AdditionAdapter.java
@@ -0,0 +1,23 @@
+package net.pherth.mensa;
+
+import java.util.List;
+
+import android.content.Context;
+import android.widget.ArrayAdapter;
+
+public class AdditionAdapter extends ArrayAdapter<String> {
+
+ public AdditionAdapter(Context context, int textViewResourceId) {
+ super(context, textViewResourceId);
+ }
+
+ public AdditionAdapter(Context context, int textViewResourceId, List<String> list) {
+ super(context, textViewResourceId, list);
+ }
+
+ @Override
+ public boolean isEnabled(int position) {
+ return false;
+ }
+
+}
View
10 src/net/pherth/omnomagon/Data.java → src/net/pherth/mensa/Data.java
@@ -1,4 +1,4 @@
-package net.pherth.omnomagon;
+package net.pherth.mensa;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -63,7 +63,7 @@ private void parseHTML(String htmlString) {
Elements rows = doc.getElementsByTag("tr");
for (int x=1; x < rows.size(); x++) {
Element row = rows.get(x);
- String groupname = row.getElementsByClass("mensa_week_speise_tag_title").get(0).ownText().toUpperCase();
+ String groupname = row.getElementsByClass("mensa_week_speise_tag_title").get(0).ownText();
Elements cols = row.getElementsByClass("mensa_week_speise_tag");
for (int y=0; y < cols.size(); y++) {
List<Meal> meals = new ArrayList<Meal>();
@@ -81,6 +81,12 @@ private void parseHTML(String htmlString) {
for (int number = 1; number < priceList.length; number++) {
priceFloatList[number] = Float.parseFloat(priceList[number]);
}
+
+ Elements additions = mealElement.getElementsByAttributeValue("href", "#zusatz");
+ for (int i=0; i<additions.size(); i++) {
+ meal.addAddition(additions.get(i).attributes().get("title"));
+ }
+
meal.setPrices(priceFloatList);
meals.add(meal);
View
2 src/net/pherth/omnomagon/Day.java → src/net/pherth/mensa/Day.java
@@ -1,4 +1,4 @@
-package net.pherth.omnomagon;
+package net.pherth.mensa;
import java.util.ArrayList;
import java.util.Date;
View
53 src/net/pherth/omnomagon/MainActivity.java → src/net/pherth/mensa/MainActivity.java
@@ -1,4 +1,4 @@
-package net.pherth.omnomagon;
+package net.pherth.mensa;
import java.util.ArrayList;
@@ -9,6 +9,7 @@
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Resources;
+import android.graphics.Typeface;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
@@ -17,7 +18,13 @@
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
+import android.widget.TextView;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
@@ -68,6 +75,11 @@ public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
pager.setAdapter( adapter );
indicator.setViewPager( pager );
+ final Typeface mFont = Typeface.createFromAsset(getAssets(), "fonts/Bitter-Regular.otf");
+ final ViewGroup mContainer = (ViewGroup) findViewById(
+ android.R.id.content).getRootView();
+ setAppFont(mContainer, mFont);
+
actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(true);
//actionBar.setHomeAction(new IntentAction(this, createIntent(this), R.drawable.ic_title_home_demo));
@@ -118,9 +130,23 @@ public Object instantiateItem(View collection, int position) {
( (ViewPager) collection ).addView( v, 0 );
v.setPinnedHeaderView(getLayoutInflater().inflate(R.layout.item_composer_header, v, false));
System.out.println(data);
- MealAdapter mAdapter;
v.setAdapter(mAdapterList.get(position));
+ v.setOnItemClickListener(new OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> arg0, View res,
+ int arg2, long arg3) {
+ ListView listView = (ListView) res.findViewById(R.id.additionsListView);
+ if (listView.getVisibility() == View.GONE) {
+ Animation rollDownAnimation = AnimationUtils.loadAnimation(cxt, R.anim.rolldown);
+ listView.setVisibility(View.VISIBLE);
+ listView.startAnimation(rollDownAnimation);
+ } else {
+ listView.setVisibility(View.GONE);
+ }
+ System.out.println(listView.getCount());
+ }
+ });
return v;
}
@@ -259,5 +285,28 @@ private boolean isNetworkAvailable() {
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null;
}
+
+ public static final void setAppFont(ViewGroup mContainer, Typeface mFont)
+ {
+ if (mContainer == null || mFont == null) return;
+
+ final int mCount = mContainer.getChildCount();
+
+ // Loop through all of the children.
+ for (int i = 0; i < mCount; ++i)
+ {
+ final View mChild = mContainer.getChildAt(i);
+ if (mChild instanceof TextView)
+ {
+ // Set the font if it is a TextView.
+ ((TextView) mChild).setTypeface(mFont);
+ }
+ else if (mChild instanceof ViewGroup)
+ {
+ // Recursively attempt another ViewGroup.
+ setAppFont((ViewGroup) mChild, mFont);
+ }
+ }
+ }
}
View
2 src/net/pherth/omnomagon/MainPreference.java → src/net/pherth/mensa/MainPreference.java
@@ -1,4 +1,4 @@
-package net.pherth.omnomagon;
+package net.pherth.mensa;
import net.pherth.mensa.R;
import android.os.Bundle;
View
115 src/net/pherth/mensa/Meal.java
@@ -0,0 +1,115 @@
+package net.pherth.mensa;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Meal {
+
+ private String name;
+ private String description;
+ private Float[] prices = new Float[] {(float) 0.1, (float) 0.2, (float) 0.3};
+ private Boolean vegetarianBool = new Boolean(false);
+ private Boolean veganBool = new Boolean(false);
+ private Boolean bioBool = new Boolean(false);
+ private Boolean mscBool = new Boolean(false);
+ private List<String> additions = new ArrayList<String>();
+
+ public Meal(String name, String description) {
+ this.name = name;
+ this.description = description;
+ }
+
+ public Meal(String name) {
+ this.name = name;
+ }
+
+ public Meal() {
+ }
+
+ public String getName() {
+ return this.name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getDescription() {
+ return this.description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setPrices(Float[] prices) {
+ this.prices = prices;
+ }
+
+ public Float[] getPrices(){
+ return this.prices;
+ }
+
+ public void setVegetarian(Boolean vegetarianBool) {
+ this.vegetarianBool = vegetarianBool;
+ }
+
+ public Boolean getVegetarian() {
+ return this.vegetarianBool;
+ }
+
+ public void setVegan(Boolean veganBool) {
+ this.veganBool = veganBool;
+ }
+
+ public Boolean getVegan() {
+ return this.veganBool;
+ }
+
+ public void setBio(Boolean bioBool) {
+ this.bioBool = bioBool;
+ }
+
+ public Boolean getBio() {
+ return this.bioBool;
+ }
+
+ public void setMsc(Boolean mscBool) {
+ this.mscBool = mscBool;
+ }
+
+ public Boolean getMsc() {
+ return this.mscBool;
+ }
+
+ public int getVeganterianMsc() {
+ if (this.vegetarianBool) {
+ return R.drawable.vegetarischsiegel;
+ } else if (this.veganBool) {
+ return R.drawable.vegansiegel;
+ } else if (this.mscBool) {
+ return 0;
+ }
+
+ return 0;
+ }
+
+ public void addAddition(String addition) {
+ this.additions.add(addition);
+ }
+
+ public List<String> getAdditions() {
+ System.out.println(this.additions);
+ return this.additions;
+ }
+
+ public float getCorrectPrice(int type) {
+ return this.prices[type];
+ }
+
+ public String getCorrectPriceString(int type) {
+ DecimalFormat dec = new DecimalFormat();
+ dec.setMinimumFractionDigits(2);
+ return dec.format(this.prices[type]) + " Û";
+ }
+
+
+}
View
63 src/net/pherth/omnomagon/MealAdapter.java → src/net/pherth/mensa/MealAdapter.java
@@ -1,4 +1,4 @@
-package net.pherth.omnomagon;
+package net.pherth.mensa;
import java.util.ArrayList;
import java.util.List;
@@ -12,6 +12,9 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.ListView;
import android.widget.TextView;
import com.foound.widget.AmazingAdapter;
@@ -70,12 +73,30 @@ protected void onNextPageRequested(int page) {
protected void bindSectionHeader(View view, int position, boolean displaySectionHeader) {
if (displaySectionHeader) {
view.findViewById(R.id.header).setVisibility(View.VISIBLE);
- view.findViewById(R.id.headerBar).setVisibility(View.VISIBLE);
- TextView lSectionTitle = (TextView) view.findViewById(R.id.header);
- lSectionTitle.setText(getSections()[getSectionForPosition(position)]);
+ ImageView lSectionTitle = (ImageView) view.findViewById(R.id.header);
+ String section = getSections()[getSectionForPosition(position)];
+ int drawable;
+ if (section.equals("Aktionsstand")) {
+ drawable = R.drawable.aktion;
+ } else if (section.equals("Beilagen")) {
+ drawable = R.drawable.beilagen;
+ } else if (section.equals("Desserts")) {
+ drawable = R.drawable.desserts;
+ } else if (section.equals("Essen")) {
+ drawable = R.drawable.essen;
+ } else if (section.equals("Salate")) {
+ drawable = R.drawable.salate;
+ } else if (section.equals("Suppen")) {
+ drawable = R.drawable.suppen;
+ } else if (section.equals("Vorspeisen")) {
+ drawable = R.drawable.vorspeisen;
+ } else {
+ drawable = R.drawable.essen;
+ }
+ System.out.println(drawable);
+ lSectionTitle.setImageResource(drawable);
} else {
view.findViewById(R.id.header).setVisibility(View.GONE);
- view.findViewById(R.id.headerBar).setVisibility(View.GONE);
}
}
@@ -88,28 +109,38 @@ public View getAmazingView(int position, View convertView, ViewGroup parent) {
}
TextView itemBig = (TextView) res.findViewById(R.id.itemViewBig);
- TextView itemSmall = (TextView) res.findViewById(R.id.itemViewSmall);
TextView itemPrice = (TextView) res.findViewById(R.id.itemViewPrice);
+ ImageView bioImageView = (ImageView) res.findViewById(R.id.bioImageView);
+ ImageView veganVegetarianImageView = (ImageView) res.findViewById(R.id.veganVegetarianImageView);
+ ListView additionsListView = (ListView) res.findViewById(R.id.additionsListView);
+
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.context);
Meal meal = getItem(position);
itemBig.setText(meal.getName());
- if (meal.getDescription() == "") {
- itemSmall.setText(meal.getDescription());
+ itemPrice.setText(meal.getCorrectPriceString(Integer.parseInt(sharedPrefs.getString("priceCategory", "2"))));
+ if (meal.getBio()) {
+ bioImageView.setVisibility(View.VISIBLE);
} else {
- itemSmall.setTextSize((float) 5.0);
+ bioImageView.setVisibility(View.GONE);
}
- itemPrice.setText(meal.getCorrectPriceString(Integer.parseInt(sharedPrefs.getString("priceCategory", "2"))));
-
+ if (meal.getVeganterianMsc() != 0) {
+ veganVegetarianImageView.setVisibility(View.VISIBLE);
+ veganVegetarianImageView.setImageResource(meal.getVeganterianMsc());
+ } else {
+ veganVegetarianImageView.setVisibility(View.GONE);
+ }
+ List<String> additionList = meal.getAdditions();
+ if (!additionList.isEmpty()) {
+ AdditionAdapter additionAdapter = new AdditionAdapter(context, R.layout.addition_list_item, additionList);
+ additionsListView.setAdapter(additionAdapter);
+ }
+ additionsListView.setVisibility(View.GONE);
+ Util.setListViewHeightBasedOnChildren(additionsListView);
return res;
}
@Override
public void configurePinnedHeader(View header, int position, int alpha) {
- TextView lSectionHeader = (TextView)header.findViewById(R.id.header);
- header.findViewById(R.id.headerBar).setVisibility(View.GONE);
- lSectionHeader.setText(getSections()[getSectionForPosition(position)]);
- lSectionHeader.setBackgroundColor(alpha << 24 | (0x000000));
- lSectionHeader.setTextColor(alpha << 24 | (0xFFFFFF));
}
@Override
View
2 src/net/pherth/omnomagon/RSSHandler.java → src/net/pherth/mensa/RSSHandler.java
@@ -1,4 +1,4 @@
-package net.pherth.omnomagon;
+package net.pherth.mensa;
import java.io.IOException;
import java.net.URL;
View
28 src/net/pherth/mensa/Util.java
@@ -0,0 +1,28 @@
+package net.pherth.mensa;
+
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+
+public class Util {
+ public static void setListViewHeightBasedOnChildren(ListView listView) {
+ ListAdapter listAdapter = listView.getAdapter();
+ if (listAdapter == null) {
+ // pre-condition
+ return;
+ }
+
+ int totalHeight = 0;
+ for (int i = 0; i < listAdapter.getCount(); i++) {
+ View listItem = listAdapter.getView(i, null, listView);
+ listItem.measure(0, 0);
+ totalHeight += listItem.getMeasuredHeight();
+ }
+
+ ViewGroup.LayoutParams params = listView.getLayoutParams();
+ params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
+ listView.setLayoutParams(params);
+ listView.requestLayout();
+ }
+}
View
53 src/net/pherth/omnomagon/Meal.java
@@ -1,53 +0,0 @@
-package net.pherth.omnomagon;
-
-import java.text.DecimalFormat;
-
-public class Meal {
-
- private String name;
- private String description;
- private Float[] prices = new Float[] {(float) 0.1, (float) 0.2, (float) 0.3};
-
- public Meal(String name, String description) {
- this.name = name;
- this.description = description;
- }
-
- public Meal(String name) {
- this.name = name;
- }
-
- public Meal() {
- }
-
- public String getName() {
- return this.name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String getDescription() {
- return this.description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setPrices(Float[] prices) {
- this.prices = prices;
- }
-
- public Float[] getPrices(){
- return this.prices;
- }
-
- public float getCorrectPrice(int type) {
- return this.prices[type];
- }
-
- public String getCorrectPriceString(int type) {
- DecimalFormat dec = new DecimalFormat();
- dec.setMinimumFractionDigits(2);
- return dec.format(this.prices[type]) + " Û";
- }
-}

0 comments on commit 4f9221c

Please sign in to comment.