Skip to content
Snippets Groups Projects
Commit a425f0af authored by Christian Dresen's avatar Christian Dresen
Browse files

no message

parent 3638bdcd
No related branches found
No related tags found
No related merge requests found
Showing
with 340 additions and 252 deletions
package ms.itsecteam.warpdrink.data.rest.http;
import android.os.AsyncTask;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import ms.itsecteam.warpdrink.manager.DatabaseManager;
// this.url = "http://10.0.2.2:8080/warpdrink/rest/";
public class HttpGetRequest extends AsyncTask<Void, Void, String> {
String url;
public HttpGetRequest initTask(String url) {
this.url = DatabaseManager.getInstance().getSetting("api_url")+"/"+ url;
return this;
}
@Override
protected String doInBackground(Void... params) {
try {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(this.url);
HttpResponse response = client.execute(request);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line = "";
String responsestr="";
while ((line = rd.readLine()) != null) {
responsestr += line;
}
return responsestr;
} catch (Exception e) {
}
return null;
}
}
package ms.itsecteam.warpdrink.data.rest.http;
import android.os.AsyncTask;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import ms.itsecteam.warpdrink.manager.DatabaseManager;
public class HttpPostRequest extends AsyncTask<Void, Void, String> {
String url;
List<NameValuePair> postParams;
public HttpPostRequest initTask(String url, List<NameValuePair> postParams) {
this.url = DatabaseManager.getInstance().getSetting("api_url")+"/"+ url;
this.postParams =postParams;
return this;
}
@Override
protected String doInBackground(Void... params) {
try {
HttpClient client = new DefaultHttpClient();
HttpPost request = new HttpPost(this.url);
request.setEntity(new UrlEncodedFormEntity(this.postParams, "UTF-8"));
HttpResponse response = client.execute(request);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line = "";
String responsestr="";
while ((line = rd.readLine()) != null) {
responsestr += line;
}
return responsestr;
} catch (Exception e) {
}
return null;
}
}
package ms.itsecteam.warpdrink.data.rest.http;
import android.os.AsyncTask;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.impl.client.DefaultHttpClient;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import ms.itsecteam.warpdrink.manager.DatabaseManager;
public class HttpPutRequest extends AsyncTask<Void, Void, String> {
String url;
List<NameValuePair> postParams;
public HttpPutRequest initTask(String url, List<NameValuePair> postParams) {
this.url = DatabaseManager.getInstance().getSetting("api_url")+"/"+ url;
this.postParams = postParams;
return this;
}
@Override
protected String doInBackground(Void... params) {
try {
HttpClient client = new DefaultHttpClient();
HttpPut request = new HttpPut(this.url);
request.setEntity(new UrlEncodedFormEntity(this.postParams, "UTF-8"));
HttpResponse response = client.execute(request);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line = "";
String responsestr="";
while ((line = rd.readLine()) != null) {
responsestr += line;
}
return responsestr;
} catch (Exception e) {
}
return null;
}
}
......@@ -9,8 +9,6 @@ import android.widget.NumberPicker;
import ms.itsecteam.warpdrink.MainActivity;
import ms.itsecteam.warpdrink.R;
import ms.itsecteam.warpdrink.data.objects.User;
import ms.itsecteam.warpdrink.data.rest.RestClient;
import ms.itsecteam.warpdrink.manager.MainManager;
public class ChargeCustomDialog extends Dialog implements
......
......@@ -8,8 +8,6 @@ import android.widget.Button;
import ms.itsecteam.warpdrink.MainActivity;
import ms.itsecteam.warpdrink.R;
import ms.itsecteam.warpdrink.data.objects.User;
import ms.itsecteam.warpdrink.data.rest.RestClient;
import ms.itsecteam.warpdrink.manager.MainManager;
public class ChargeDialog extends Dialog implements
......
......@@ -10,7 +10,6 @@ import android.widget.Toast;
import ms.itsecteam.warpdrink.MainActivity;
import ms.itsecteam.warpdrink.R;
import ms.itsecteam.warpdrink.manager.DatabaseManager;
import ms.itsecteam.warpdrink.manager.MainManager;
public class NewUserDialog extends Dialog implements
......
......@@ -9,7 +9,7 @@ import android.widget.TextView;
import ms.itsecteam.warpdrink.MainActivity;
import ms.itsecteam.warpdrink.R;
import ms.itsecteam.warpdrink.manager.DatabaseManager;
import ms.itsecteam.warpdrink.data.SQLiteService;
public class SettingsDialog extends Dialog implements
View.OnClickListener {
......@@ -34,7 +34,7 @@ public class SettingsDialog extends Dialog implements
this.btnAbort.setOnClickListener(this);
this.txtApiUrl = (TextView) findViewById(R.id.txtApiUrl);
this.txtApiUrl.setText(DatabaseManager.getInstance().getSetting("api_url"));
this.txtApiUrl.setText(SQLiteService.getInstance().getSetting("api_url"));
}
......@@ -42,7 +42,7 @@ public class SettingsDialog extends Dialog implements
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnSave:
DatabaseManager.getInstance().saveSetting("api_url",txtApiUrl.getText().toString());
SQLiteService.getInstance().saveSetting("api_url",txtApiUrl.getText().toString());
this.dismiss();
break;
case R.id.btnAbort:
......
package ms.itsecteam.warpdrink.manager;
import ms.itsecteam.warpdrink.data.objects.User;
import ms.itsecteam.warpdrink.data.rest.RestClient;
import android.util.Log;
import ms.itsecteam.warpdrink.data.models.local.User;
import ms.itsecteam.warpdrink.data.models.rest.RestUser;
import retrofit.Callback;
import retrofit.Response;
import retrofit.Retrofit;
public class DataManager {
private User currentUser;
private double totalAmount;
private static DataManager ourInstance = new DataManager();
private String lastCardId;
protected static DataManager getInstance() {
public static DataManager getInstance() {
return ourInstance;
}
......@@ -20,9 +24,20 @@ public class DataManager {
public void saveCurrentUser() {
this.currentUser.save();
RestClient.getInstance().saveUserCredit(this.currentUser);
RestUser rest_user = RestUser.fromLocalUser(this.currentUser);
MainManager.getInstance().getRestService().saveUser(rest_user.getUserid(), rest_user).enqueue(new Callback<RestUser>() {
@Override
public void onResponse(Response<RestUser> response, Retrofit retrofit) {
}
@Override
public void onFailure(Throwable t) {
Log.d("REST", t.getMessage());
}
});
}
public void performPayment() {
this.currentUser.setCredit(this.currentUser.getCredit()-this.totalAmount);
this.saveCurrentUser();
......@@ -30,7 +45,7 @@ public class DataManager {
}
public void clearCurrentUser() {
this.currentUser = null;
}
public User getCurrentUser() {
......@@ -53,7 +68,11 @@ public class DataManager {
this.totalAmount = totalAmount;
}
public void setLastCardId(String lastCardId) {
this.lastCardId = lastCardId;
}
public String getLastCardId() {
return lastCardId;
}
}
......@@ -3,58 +3,116 @@ package ms.itsecteam.warpdrink.manager;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.util.Log;
import android.view.WindowManager;
import android.widget.Toast;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;
import ms.itsecteam.warpdrink.MainActivity;
import ms.itsecteam.warpdrink.R;
import ms.itsecteam.warpdrink.data.objects.User;
import ms.itsecteam.warpdrink.data.rest.RestClient;
import ms.itsecteam.warpdrink.data.SQLiteService;
import ms.itsecteam.warpdrink.data.models.local.Product;
import ms.itsecteam.warpdrink.data.models.local.User;
import ms.itsecteam.warpdrink.data.RestService;
import ms.itsecteam.warpdrink.data.models.rest.RestProduct;
import ms.itsecteam.warpdrink.data.models.rest.RestUser;
import ms.itsecteam.warpdrink.orderList.Order;
import retrofit.Callback;
import retrofit.GsonConverterFactory;
import retrofit.Response;
import retrofit.Retrofit;
public class MainManager {
private RestService restService;
private MainActivity mainActivity;
private DatabaseManager databaseManager;
private SQLiteService sqLiteService;
private UiManager uiManager;
private DataManager dataManager;
private static MainManager ourInstance = new MainManager();
private static MainManager instance = new MainManager();
public static MainManager getInstance() {
return ourInstance;
return instance;
}
private MainManager() {
this.databaseManager = DatabaseManager.getInstance();
this.sqLiteService = SQLiteService.getInstance();
this.uiManager = UiManager.getInstance();
this.dataManager = DataManager.getInstance();
this.restService = this.createRestService();
}
private RestService createRestService() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://infra-test.warpzone.ms/api/")
// .baseUrl("http://10.0.2.92:8000/api/")
.addConverterFactory(GsonConverterFactory.create())
.build();
return retrofit.create(RestService.class);
}
public void init(MainActivity mainActivity) {
this.mainActivity = mainActivity;
this.uiManager.initUi(this.mainActivity);
this.refreshUserData();
this.refreshData();
}
public void refreshUserData() {
List<User> userList = RestClient.getInstance().getAllUser();
this.databaseManager.refreshUserData(userList);
if(userList != null) {
this.uiManager.refreshUserData(userList);
}
public void refreshData() {
Log.d("REST", "Refreshing user data");
this.restService.getAllUser().enqueue(new Callback<List<RestUser>>() {
@Override
public void onResponse(Response<List<RestUser>> response, Retrofit retrofit) {
List<User> userList = MainManager.getInstance().sqLiteService.refreshUserData(response.body());
if (userList != null) {
MainManager.getInstance().uiManager.refreshUserData(userList);
}
Toast.makeText(MainManager.getInstance().mainActivity, "Refresh successful", Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(Throwable t) {
Log.d("REST", t.getMessage());
}
});
this.restService.getAllProducts().enqueue(new Callback<List<RestProduct>>() {
@Override
public void onResponse(Response<List<RestProduct>> response, Retrofit retrofit) {
List<ms.itsecteam.warpdrink.data.models.local.Product> productList = MainManager.getInstance().sqLiteService.refreshProductData(response.body());
if (productList != null) {
MainManager.getInstance().uiManager.refreshProductData(productList);
}
}
@Override
public void onFailure(Throwable t) {
Log.d("REST", t.getMessage());
}
});
}
public boolean addUser(String name) {
if(this.databaseManager.getUserByName(name) == null) {
User u = new User();
u.setName(name);
RestClient.getInstance().createUser(u);
this.refreshUserData();
return true;
}
Log.d("USER", "Start");
if(User.getByName(name) == null) {
User user = new User();
user.setUserid(name);
Log.d("USER", "Weter");
this.restService.addUser(RestUser.fromLocalUser(user)).enqueue(new Callback<RestUser>() {
@Override
public void onResponse(Response<RestUser> response, Retrofit retrofit) {
MainManager.getInstance().refreshData();
}
@Override
public void onFailure(Throwable t) {
Log.d("Error", t.getMessage());
}
});
return true;
}
return false;
}
......@@ -65,27 +123,30 @@ public class MainManager {
}
}
public User getCurrentUser() {
return this.dataManager.getCurrentUser();
}
public void clearCurrentUser() {
this.dataManager.clearCurrentUser();
this.uiManager.clearCurrentUser();
}
public void addOrder(double amount) {
DataManager.getInstance().addToTotalAmount(amount);
public void addOrder(Product product) {
DataManager.getInstance().addToTotalAmount(product.getPrice());
this.uiManager.refreshTotalTextView(DataManager.getInstance().getTotalAmount());
}
public void removeOrder(Order order) {
DataManager.getInstance().addToTotalAmount((-1)*order.getValue());
DataManager.getInstance().addToTotalAmount((-1)*order.getProduct().getPrice());
this.uiManager.removeOrder(order);
this.uiManager.refreshTotalTextView(DataManager.getInstance().getTotalAmount());
}
public void chargeAmount(double amount) {
User user = this.dataManager.getCurrentUser();
user.setCredit(user.getCredit()+amount);
user.save();
RestClient.getInstance().saveUserCredit(user);
this.uiManager.refreshCreditTextView(user.getCredit());
User currentUser = this.dataManager.getCurrentUser();
currentUser.setCredit(currentUser.getCredit() + amount);
this.dataManager.saveCurrentUser();
MainManager.getInstance().uiManager.refreshCreditTextView(currentUser.getCredit());
}
public void performPayment() {
User user = DataManager.getInstance().getCurrentUser();
......@@ -122,7 +183,32 @@ public class MainManager {
public void setMainActivity(MainActivity mainActivity) {
this.mainActivity = mainActivity;
}
}
public RestService getRestService() { return restService; }
public void saveCardId() {
final String card_id = this.dataManager.getLastCardId();
if (card_id != null) {
new AlertDialog.Builder(this.mainActivity)
.setTitle(this.mainActivity.getResources().getString(R.string.confirm_payment_title))
.setMessage("Die karten id "+card_id+" wird dem Nutzer "+this.getCurrentUser()+" hinzugefügt")
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
MainManager.getInstance().getCurrentUser().setCardId(card_id);
MainManager.getInstance().dataManager.saveCurrentUser();
}
})
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
})
.setIcon(android.R.drawable.ic_dialog_alert)
.show();
}
}
}
......@@ -2,8 +2,8 @@ package ms.itsecteam.warpdrink.manager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
......@@ -11,24 +11,20 @@ import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
import ms.itsecteam.warpdrink.MainActivity;
import ms.itsecteam.warpdrink.R;
import ms.itsecteam.warpdrink.data.objects.User;
import ms.itsecteam.warpdrink.data.models.local.Product;
import ms.itsecteam.warpdrink.data.models.local.User;
import ms.itsecteam.warpdrink.dialogs.ChargeDialog;
import ms.itsecteam.warpdrink.dialogs.NewUserDialog;
import ms.itsecteam.warpdrink.dialogs.SettingsDialog;
import ms.itsecteam.warpdrink.orderList.ListViewAdapter;
import ms.itsecteam.warpdrink.orderList.ListViewAdapterProducts;
import ms.itsecteam.warpdrink.orderList.Order;
/**
* Created by chris on 29.06.2015.
*/
public class UiManager implements View.OnKeyListener, View.OnClickListener, AdapterView.OnItemClickListener {
private MainActivity mainActivity;
......@@ -36,9 +32,11 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
private ImageButton btnRefresh;
private TextView txtSum,txtCredit;
private ListView lstOrdered;
private ListView lstProduct;
private AutoCompleteTextView atxvName;
private ListViewAdapter lstAdapter;
private ListViewAdapter lstOrderedAdapter;
private ListViewAdapterProducts lstProductAdapter;
private ArrayAdapter atxvAdapter;
private ArrayList<Double> order;
private List<User> users;
......@@ -62,11 +60,15 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
this.btnPay = (Button) mainActivity.findViewById(R.id.btnPay);
this.btnCharge = (Button) mainActivity.findViewById(R.id.btnCharge);
this.lstAdapter = new ListViewAdapter(mainActivity, R.layout.order_list_item, new ArrayList<Order>());
this.lstOrdered = (ListView) mainActivity.findViewById(R.id.lstOrdered);
this.lstOrdered.setAdapter(this.lstAdapter);
this.lstOrderedAdapter = new ListViewAdapter(mainActivity, R.layout.order_list_item, new ArrayList<Order>());
this.lstProductAdapter = new ListViewAdapterProducts(mainActivity, R.layout.product_list_item, Product.getAll());
this.lstOrdered = (ListView) mainActivity.findViewById(R.id.lstOrdered);
this.lstOrdered.setAdapter(this.lstOrderedAdapter);
this.lstProduct = (ListView) mainActivity.findViewById(R.id.lstProduct);
this.lstProduct.setAdapter(this.lstProductAdapter);
this.lstProduct.setOnItemClickListener(this);
this.users = User.getAll();
this.atxvAdapter = new ArrayAdapter(mainActivity, android.R.layout.select_dialog_item, this.users);
this.atxvName = (AutoCompleteTextView) mainActivity.findViewById(R.id.atxvName);
......@@ -74,6 +76,8 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
this.atxvName.setThreshold(1);
this.atxvName.setOnKeyListener(this);
this.atxvName.setOnItemClickListener(this);
this.atxvName.setFocusableInTouchMode(true);
this.atxvName.setFocusable(true);
this.btnLogout.setVisibility(View.INVISIBLE);
this.enableControls(false);
......@@ -89,6 +93,7 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
protected void setCurrentUser(User user) {
this.enableControls(true);
this.atxvName.setText(user.getUserid());
this.atxvName.dismissDropDown();
this.btnLogout.setVisibility(View.VISIBLE);
this.refreshCreditTextView(user.getCredit());
......@@ -96,7 +101,10 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
protected void clearCurrentUser() {
this.atxvName.setText("");
this.lstAdapter.clear();
if(this.atxvName.requestFocus()) {
this.mainActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
this.lstOrderedAdapter.clear();
this.enableControls(false);
this.btnLogout.setVisibility(View.INVISIBLE);
this.refreshCreditTextView(0.0);
......@@ -109,30 +117,36 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
this.btnCharge.setEnabled(enable);
this.btnPay.setEnabled(enable);
this.btnLogout.setEnabled(enable);
this.lstProduct.setEnabled(enable);
}
protected void refreshUserData(List<User> userList) {
this.atxvAdapter.clear();
ListIterator<User> userListIterator = userList.listIterator();
while(userListIterator.hasNext()) {
this.atxvAdapter.add(userListIterator.next());
for (User anUserList : userList) {
this.atxvAdapter.add(anUserList);
}
}
public void refreshProductData(List<Product> productList) {
this.lstProductAdapter.clear();
this.lstProductAdapter.addAll(productList);
}
protected void removeOrder(Order order) {
this.lstAdapter.remove(order);
this.lstOrderedAdapter.remove(order);
}
@Override
public void onClick(View v) {
Log.d("HALLO", Integer.toString(v.getId()));
switch (v.getId()) {
case R.id.btnOneEuro:
this.lstAdapter.insert(new Order(1.0), this.lstAdapter.getCount());
/* case R.id.btnOneEuro:
this.lstOrderedAdapter.insert(new Order(1.0), this.lstOrderedAdapter.getCount());
MainManager.getInstance().addOrder(1.0);
break;
case R.id.btnFiftyCent:
this.lstAdapter.insert(new Order(0.5), this.lstAdapter.getCount());
this.lstOrderedAdapter.insert(new Order(0.5), this.lstOrderedAdapter.getCount());
MainManager.getInstance().addOrder(0.5);
break;
break;*/
case R.id.btnCharge:
new ChargeDialog().show();
break;
......@@ -146,8 +160,7 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
new NewUserDialog().show();
break;
case R.id.btnRefresh:
MainManager.getInstance().refreshUserData();
Toast.makeText(this.mainActivity, "Refresh successful", Toast.LENGTH_LONG).show();
MainManager.getInstance().refreshData();
break;
}
}
......@@ -166,6 +179,17 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
MainManager.getInstance().setCurrentUser((User) this.atxvAdapter.getItem(position));
switch (parent.getId()) {
case R.id.lstProduct:
Product p = this.lstProductAdapter.getItem(position);
this.lstOrderedAdapter.insert(new Order(p), this.lstOrderedAdapter.getCount());
MainManager.getInstance().addOrder(p);
break;
case -1:
MainManager.getInstance().setCurrentUser((User) this.atxvAdapter.getItem(position));
break;
}
}
}
......@@ -40,6 +40,7 @@ public class ListViewAdapter extends ArrayAdapter<Order> {
holder.btnRemoveOrder.setTag(holder.order);
holder.value = (TextView)row.findViewById(R.id.txtOrderValue);
holder.name = (TextView)row.findViewById(R.id.txtOrderName);
row.setTag(holder);
......@@ -48,11 +49,13 @@ public class ListViewAdapter extends ArrayAdapter<Order> {
}
private void setupItem(OrderHolder holder) {
holder.value.setText(String.valueOf(holder.order.getValue())+" Euro");
holder.name.setText(holder.order.getProduct().getName());
holder.value.setText(String.valueOf(holder.order.getProduct().getPrice()));
}
public static class OrderHolder {
Order order;
TextView name;
TextView value;
ImageButton btnRemoveOrder;
}
......
package ms.itsecteam.warpdrink.orderList;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
import ms.itsecteam.warpdrink.R;
import ms.itsecteam.warpdrink.data.models.local.Product;
public class ListViewAdapterProducts extends ArrayAdapter<Product>{
private List<Product> items;
private int layoutResourceId;
private Context context;
public ListViewAdapterProducts(Context context, int layoutResourceId, List<Product> items) {
super(context, layoutResourceId, items);
this.layoutResourceId = layoutResourceId;
this.context = context;
this.items = items;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row;
ProductHolder holder;
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
row = inflater.inflate(layoutResourceId, parent, false);
holder = new ProductHolder();
holder.product = items.get(position);
holder.name = (TextView)row.findViewById(R.id.txtProductName);
holder.price = (TextView)row.findViewById(R.id.txtProductPrice);
row.setTag(holder);
setupItem(holder);
return row;
}
private void setupItem(ProductHolder holder) {
holder.name.setText(String.valueOf(holder.product.getName()));
holder.price.setText(String.valueOf(holder.product.getPrice())+" Euro");
}
public static class ProductHolder {
Product product;
TextView name;
TextView price;
}
}
\ No newline at end of file
......@@ -4,11 +4,13 @@ import android.widget.ImageButton;
import java.io.Serializable;
import ms.itsecteam.warpdrink.data.models.local.Product;
public class Order implements Serializable {
private static final long serialVersionUID = -5435670920302756945L;
private double value = 0;
private Product product;
private double position=0;
private ImageButton btn;
......@@ -28,16 +30,16 @@ public class Order implements Serializable {
this.position = position;
}
public Order(double value) {
this.setValue(value);
}
public Order(Product p) {
this.product = p;
}
public double getValue() {
return value;
}
public Product getProduct() {
return product;
}
public void setValue(double value) {
this.value = value;
}
public void setProduct(Product value) {
this.product = product;
}
}
......@@ -18,7 +18,7 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="464dp"
android:layout_height="wrap_content">
android:layout_height="361dp">
<LinearLayout
android:orientation="horizontal"
......@@ -67,24 +67,13 @@
android:layout_column="1"
android:layout_row="2" />
<Button android:text="@string/btn_oneEuro" android:id="@+id/btnOneEuro" android:background="@drawable/btn_blue" style="@style/ButtonText"
android:layout_row="3"
android:layout_column="1"
android:width="10dp"
android:onClick="onClick"
android:layout_width="300dp"></Button>
<Button
style="@style/ButtonText"
android:text="@string/btn_fiftyCent"
android:id="@+id/btnFiftyCent"
android:background="@drawable/btn_blue"
android:layout_row="4"
android:layout_column="1"
android:width="10dp"
android:layout_width="300dp"
android:onClick="onClick"
android:layout_height="wrap_content" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/lstProduct"
android:layout_row="2"
android:layout_column="12"
android:choiceMode="singleChoice" />
<Space
android:layout_width="20px"
......@@ -95,7 +84,7 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="363dp">
<LinearLayout
......
......@@ -4,12 +4,26 @@
android:layout_height="fill_parent"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="@+id/txtOrderValue" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/txtOrderName" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="@+id/txtOrderValue" />
</LinearLayout>
<ImageButton
android:id="@+id/btnRemoveOrder"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/txtProductName"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="68dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="1.0"
android:id="@+id/txtProductPrice" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -10,4 +10,10 @@
android:icon="@drawable/ic_menu_refresh"
android:title="@string/addNewUser" />
<item
android:id="@+id/action_learn_card_id"
android:orderInCategory="200"
android:icon="@drawable/ic_menu_refresh"
android:title="@string/lernCardId" />
</menu>
......@@ -26,6 +26,7 @@
<string name="rest_config_header">REST-API Konfiguration</string>
<string name="save">Speichern</string>
<string name="abort">Abbrechen</string>
<string name="lernCardId">Learn Card ID</string>
<style name="ButtonText">
<item name="android:layout_width">fill_parent</item>
......
......@@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......@@ -17,4 +17,4 @@ allprojects {
}
dependencies {
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment