Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • infrastruktur/warppay-app
  • HoelShare/warppay-app
2 results
Show changes
Showing
with 1454 additions and 330 deletions
package ms.warpzone.warppay.listener;
import android.view.View;
import android.widget.Button;
import ms.warpzone.warppay.dialogs.ProductDialog;
import ms.warpzone.warppay.manager.MainManager;
import ms.warpzone.warppay.manager.UiManager;
public class CategoryOnClickListener implements View.OnClickListener {
@Override
public void onClick(View view) {
//MainManager.getInstance().startTimer();
Button clicked = (Button) view;
String category = (String) clicked.getText();
ProductDialog p = new ProductDialog(category);
UiManager.getInstance().setProductDialog(p);
p.show();
}
}
package ms.warpzone.warppay.manager;
import android.util.Log;
import android.widget.Toast;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import ms.warpzone.warppay.data.models.local.User;
import ms.warpzone.warppay.data.models.rest.RestProduct;
import ms.warpzone.warppay.data.models.rest.RestTransaction;
import ms.warpzone.warppay.data.models.rest.RestUser;
import ms.warpzone.warppay.orderList.Order;
import retrofit.Callback;
import retrofit.Response;
import retrofit.Retrofit;
public class DataManager {
private static DataManager ourInstance = new DataManager();
private User currentUser;
private Boolean is_guest=false;
private BigDecimal totalAmount = new BigDecimal(0.0);
public ArrayList<Order> getOrderList() {
return orderList;
}
private ArrayList<Order> orderList;
private String lastCardId;
public static DataManager getInstance() {
return ourInstance;
}
private DataManager() {
this.orderList = new ArrayList<Order>();
}
public void saveCurrentUser() {
RestUser rest_user = RestUser.fromLocalUser(this.currentUser);
RestManager.getInstance().getRestService().saveUser(rest_user.getUserid(), rest_user).enqueue(new Callback<RestUser>() {
@Override
public void onResponse(Response<RestUser> response, Retrofit retrofit) {
if(response.code() == 403) {
Toast.makeText(MainManager.getInstance().getMainActivity(), "Eine Karte ist für den User schon vorhanden", Toast.LENGTH_LONG).show();
} else {
MainManager.getInstance().getCurrentUser().save();
}
}
@Override
public void onFailure(Throwable t) {
Log.d("REST", t.getMessage());
}
});
}
public Boolean getIs_guest() {
return is_guest;
}
public void setIs_guest(Boolean is_guest) {
this.is_guest = is_guest;
}
public void clearCurrentUser() {
this.currentUser = null;
this.totalAmount = new BigDecimal(0.0);
this.is_guest=false;
this.orderList = new ArrayList<>();
}
public User getCurrentUser() {
return currentUser;
}
public void setCurrentUser(User currentUser) {
this.currentUser = currentUser;
}
public BigDecimal getTotalAmount() {
return totalAmount;
}
public void addOrder(Order order) {
this.orderList.add(order);
this.totalAmount = this.totalAmount.add(order.getProduct().getPrice());
}
public void removeOrder(Order order) {
this.orderList.remove(order);
this.totalAmount = this.totalAmount.subtract(order.getProduct().getPrice());
}
public void setLastCardId(String lastCardId) {
this.lastCardId = lastCardId;
}
public String getLastCardId() {
return lastCardId;
}
}
package ms.warpzone.warppay.manager;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.util.Log;
import com.activeandroid.query.Select;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.StringTokenizer;
import ms.warpzone.warppay.MainActivity;
import ms.warpzone.warppay.R;
import ms.warpzone.warppay.data.SQLiteService;
import ms.warpzone.warppay.data.models.local.Product;
import ms.warpzone.warppay.data.models.local.User;
import ms.warpzone.warppay.data.models.rest.RestProduct;
import ms.warpzone.warppay.data.models.rest.RestTransaction;
import ms.warpzone.warppay.data.models.rest.RestUser;
import ms.warpzone.warppay.dialogs.PinCodesDialog;
import ms.warpzone.warppay.orderList.Order;
import retrofit.Callback;
import retrofit.Response;
import retrofit.Retrofit;
public class MainManager {
private static MainManager instance = new MainManager();
private MainActivity mainActivity;
private SQLiteService sqLiteService;
private UiManager uiManager;
private DataManager dataManager;
private boolean barcodeLearning=false;
public static MainManager getInstance() {
return instance;
}
private MainManager() {
}
public void init(MainActivity mainActivity) {
this.mainActivity = mainActivity;
this.sqLiteService = SQLiteService.getInstance();
this.uiManager = UiManager.getInstance();
this.dataManager = DataManager.getInstance();
this.uiManager.initUi(this.mainActivity);
RestManager restManager = RestManager.getInstance();
restManager.initRestService();
RefreshManager.getInstance().refreshData();
RefreshManager.getInstance().startRefreshTimer();
}
SQLiteService getSqLiteService() {
return sqLiteService;
}
void setCurrentUser(User user) {
this.setCurrentUser(user,false);
}
public void setCurrentUser(final User user, boolean authorized) {
if (user != null) {
if(!user.getPinCode().isEmpty() && !authorized) {
PinCodesDialog p = new PinCodesDialog(user);
p.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
if(MainManager.getInstance().getCurrentUser() == null)
MainManager.getInstance().clearCurrentUser();
}
});
p.show();
return;
}
if (user.getUserid() != "Guest") {
final ProgressDialog pd = ProgressDialog.show(MainManager.getInstance().getMainActivity(), "Processing...", "Loading...");
RestManager.getInstance().getRestService().getSingleUser(user.getUserid()).enqueue(new Callback<RestUser>() {
@Override
public void onResponse(Response<RestUser> response, Retrofit retrofit) {
if (response.code() == 200) {
user.setCredit(response.body().getCredit());
user.save();
DataManager.getInstance().setCurrentUser(user);
UiManager.getInstance().setCurrentUser(user);
pd.dismiss();
} else {
pd.dismiss();
Log.d("REST_3", String.valueOf(response.code()));
UiManager.getInstance().showWarning("Transaction Error. Please try again", 4000);
}
}
@Override
public void onFailure(Throwable t) {
Log.d("REST_4", String.valueOf(t.getMessage()));
UiManager.getInstance().showWarning("Transaction Error. Please try again", 4000);
}
});
} else {
DataManager.getInstance().setCurrentUser(user);
UiManager.getInstance().setCurrentUser(user);
}
RefreshManager.getInstance().startTimer();
RefreshManager.getInstance().stopRefreshTimer();
}
}
public User getCurrentUser() {
return this.dataManager.getCurrentUser();
}
void clearCurrentUser() {
DataManager.getInstance().setLastCardId("");
this.dataManager.clearCurrentUser();
this.uiManager.clearCurrentUser();
}
public void addOrder(Order order) {
DataManager.getInstance().addOrder(order);
this.uiManager.refreshTotalTextView(DataManager.getInstance().getTotalAmount());
}
public void removeOrder(Order order) {
DataManager.getInstance().removeOrder(order);
this.uiManager.removeOrder(order);
this.uiManager.refreshTotalTextView(DataManager.getInstance().getTotalAmount());
}
public void chargeAmount(BigDecimal amount) {
User currentUser = this.dataManager.getCurrentUser();
if(amount.compareTo(new BigDecimal(0)) < 0 || amount.scale() > 2) {
UiManager.getInstance().showWarning("Fehlerhafter Betrag angegeben.",4000);
return;
}
if(currentUser.getCredit().add(amount).compareTo(new BigDecimal(50.0)) > 0) {
UiManager.getInstance().showWarning("Maximal 50 Euro Guthaben erlaubt!",4000);
return;
}
RestTransaction t = new RestTransaction();
t.setAmount(amount);
t.setTrans_type(1);
t.setCash_paid(true);
ArrayList<RestTransaction> transactions = new ArrayList<>();
transactions.add(t);
TransactionManager.getInstance().perform_transactions(transactions,true,false);
}
public void performPayment(Boolean cash) {
User currentUser = DataManager.getInstance().getCurrentUser();
BigDecimal totalAmount = DataManager.getInstance().getTotalAmount();
if (totalAmount.compareTo(new BigDecimal(0.0)) > 0 && currentUser != null){
if (currentUser.getCredit().compareTo(totalAmount) >= 0 || cash){
ArrayList<RestTransaction> transactions = new ArrayList<>();
for (Order order:DataManager.getInstance().getOrderList()) {
RestTransaction transaction = new RestTransaction();
transaction.setProduct(RestProduct.fromLocalProduct(order.getProduct()));
transaction.setTrans_type(2);
if (DataManager.getInstance().getIs_guest() || cash)
transaction.setCash_paid(true);
transactions.add(transaction);
}
TransactionManager.getInstance().perform_transactions(transactions, !cash, true);
} else {
UiManager.getInstance().showWarning(mainActivity.getResources().getString(R.string.please_charge), 2500);
}
}
}
public MainActivity getMainActivity() {
return mainActivity;
}
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_learn_card))
.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();
}
}
public void setBarcodeLearning(boolean barcodeLearning) {
this.barcodeLearning = barcodeLearning;
}
}
package ms.warpzone.warppay.manager;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Handler;
import android.util.Log;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import ms.warpzone.warppay.data.models.local.Category;
import ms.warpzone.warppay.data.models.local.User;
import ms.warpzone.warppay.data.models.rest.RestCategory;
import ms.warpzone.warppay.data.models.rest.RestProduct;
import ms.warpzone.warppay.data.models.rest.RestUser;
import ms.warpzone.warppay.dialogs.NotificationDialog;
import ms.warpzone.warppay.dialogs.NyanCatDialog;
import retrofit.Callback;
import retrofit.Response;
import retrofit.Retrofit;
public class RefreshManager {
private static RefreshManager ourInstance = new RefreshManager();
private Timer timer;
private Timer screenSaverTimer;
private Timer tmrRefresh;
public ProgressDialog pdProcess;
private NotificationDialog ndRefreshError = null;
private RefreshManager() {}
public static RefreshManager getInstance() {
return ourInstance;
}
void refreshData() {
this.refreshData(false);
}
public void refreshData(boolean disableDialog) {
if(this.ndRefreshError != null)
this.ndRefreshError.dismiss();
this.ndRefreshError = null;
if(!disableDialog)
pdProcess = ProgressDialog.show(MainManager.getInstance().getMainActivity(), "Processing...", "Loading...");
RestManager.getInstance().getRestService().getAllUser().enqueue(new Callback<List<RestUser>>() {
@Override
public void onResponse(Response<List<RestUser>> response, Retrofit retrofit) {
if(response.code() == 200 ) {
List<User> userList = MainManager.getInstance().getSqLiteService().refreshUserData(response.body());
if (userList != null) {
UiManager.getInstance().refreshUserData(userList);
}
} else {
RefreshManager.getInstance().showRefreshError();
}
}
@Override
public void onFailure(Throwable t) {
Log.d("REST", t.getMessage());
RefreshManager.getInstance().showRefreshError();
}
});
RestManager.getInstance().getRestService().getAllCategories().enqueue(new Callback<List<RestCategory>>() {
@Override
public void onResponse(Response<List<RestCategory>> response, Retrofit retrofit) {
if(response.code() == 200 ) {
List<Category> categoryList = MainManager.getInstance().getSqLiteService().refreshCategoryData(response.body());
if (categoryList != null) {
UiManager.getInstance().showCategoryButtons();
}
} else {
RefreshManager.getInstance().showRefreshError();
}
}
@Override
public void onFailure(Throwable t) {
Log.d("REST", t.getMessage());
RefreshManager.getInstance().showRefreshError();
}
});
RestManager.getInstance().getRestService().getAllProducts().enqueue(new Callback<List<RestProduct>>() {
@Override
public void onResponse(Response<List<RestProduct>> response, Retrofit retrofit) {
if(response.code() == 200 ) {
List<ms.warpzone.warppay.data.models.local.Product> productList = MainManager.getInstance().getSqLiteService().refreshProductData(response.body());
if (productList != null) {
UiManager.getInstance().refreshProductData(productList);
}
if(RefreshManager.getInstance().pdProcess != null ) {
RefreshManager.getInstance().pdProcess.dismiss();
RefreshManager.getInstance().pdProcess = null;
}
} else {
RefreshManager.getInstance().showRefreshError();
}
}
@Override
public void onFailure(Throwable t) {
Log.d("REST", t.getMessage());
RefreshManager.getInstance().showRefreshError();
}
});
}
public void showRefreshError() {
if(ndRefreshError == null) {
RefreshManager.getInstance().stopRefreshTimer();
if (RefreshManager.getInstance().pdProcess != null) {
RefreshManager.getInstance().pdProcess.dismiss();
RefreshManager.getInstance().pdProcess = null;
}
ndRefreshError = new NotificationDialog(MainManager.getInstance().getMainActivity(),"WARNING","Refresh failed. Please retry!");
ndRefreshError.setWarning();
ndRefreshError.getBuilder().setNeutralButton("Refresh", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
RefreshManager.getInstance().refreshData();
}
});
ndRefreshError.show();
final Handler handler = new Handler();
final Runnable runnable = new Runnable() {
@Override
public void run() {
RefreshManager.getInstance().refreshData();
}
};
ndRefreshError.getDialog().setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
handler.removeCallbacks(runnable);
}
});
handler.postDelayed(runnable, 10000);
}
}
public void stopTimer() {
if (this.timer != null) {
this.timer.cancel();
this.timer.purge();
}
}
public void startTimer() {
this.stopTimer();
this.timer = new Timer();
TimerTask t = new TimerTask() {
@Override
public void run() {
Handler mainHandler = new Handler(MainManager.getInstance().getMainActivity().getApplicationContext().getMainLooper());
Runnable myRunnable = new Runnable() {
@Override
public void run() {
MainManager.getInstance().clearCurrentUser();
}
};
mainHandler.post(myRunnable);
}
};
this.timer.schedule(t, 60000);
}
public void startRefreshTimer() {
this.tmrRefresh = new Timer();
TimerTask t = new TimerTask() {
@Override
public void run() {
Handler mainHandler = new Handler(MainManager.getInstance().getMainActivity().getApplicationContext().getMainLooper());
Runnable myRunnable = new Runnable() {
@Override
public void run() {
Log.d("REST","REFRESH TIMER RUNNING");
if(MainManager.getInstance().getCurrentUser() == null)
RefreshManager.getInstance().refreshData(true);
}
};
mainHandler.post(myRunnable);
}
};
Log.d("REST","STARTING REFRESH TIMER");
this.tmrRefresh.schedule(t, 60000,60000);
}
public void stopRefreshTimer() {
if (this.tmrRefresh != null) {
this.tmrRefresh.cancel();
this.tmrRefresh.purge();
}
}
public void resetScreenSaverTimer() {
this.stopScreenSaverTimer();
this.screenSaverTimer = new Timer();
TimerTask t = new TimerTask() {
@Override
public void run() {
Handler mainHandler = new Handler(MainManager.getInstance().getMainActivity().getApplicationContext().getMainLooper());
Runnable myRunnable = new Runnable() {
@Override
public void run() {
new NyanCatDialog().show();
}
};
mainHandler.post(myRunnable);
}
};
this.screenSaverTimer.schedule(t, 4000);
}
public void stopScreenSaverTimer() {
if (this.screenSaverTimer != null) {
this.screenSaverTimer.cancel();
this.screenSaverTimer.purge();
}
}
}
package ms.warpzone.warppay.manager;
import android.content.Context;
import com.squareup.okhttp.Interceptor;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManagerFactory;
import ms.warpzone.warppay.R;
import ms.warpzone.warppay.data.RestService;
import retrofit.GsonConverterFactory;
import retrofit.Retrofit;
public class RestManager {
private static RestManager ourInstance = new RestManager();
RestService restService;
private RestManager() {}
public static RestManager getInstance() {
return ourInstance;
}
public void initRestService() {
this.restService = this.createRestService();
}
public RestService getRestService() {
return restService;
}
private RestService createRestService() {
Retrofit.Builder builder = new Retrofit.Builder()
.baseUrl("http://infra-test.warpzone/api/")
.addConverterFactory(GsonConverterFactory.create());
OkHttpClient okHttp = new OkHttpClient();
try {
okHttp.setSslSocketFactory(getSSLConfig(MainManager.getInstance().getMainActivity().getBaseContext()).getSocketFactory());
okHttp.networkInterceptors().add(new Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Request newRequest;
newRequest = request.newBuilder()
.addHeader("Authorization", "Token cdcca01b29316e993477b32f1a86274804318fa0")
.build();
return chain.proceed(newRequest);
}
});
} catch (CertificateException | NoSuchAlgorithmException | KeyManagementException | IOException | KeyStoreException e) {
e.printStackTrace();
}
Retrofit retrofit = builder.client(okHttp).build();
return retrofit.create(RestService.class);
}
private static SSLContext getSSLConfig(Context context) throws CertificateException, IOException,
KeyStoreException, NoSuchAlgorithmException, KeyManagementException {
String password = "e44r4dv9z1d0vwr9erotafxe66114v31jwhjlvttc8qkoa3nrskcj4ml0pwrh8aw";
KeyStore keyStore = KeyStore.getInstance("BKS");
keyStore.load(context.getResources().openRawResource(R.raw.keystore_old), password.toCharArray());
String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm();
TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmfAlgorithm);
tmf.init(keyStore);
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, tmf.getTrustManagers(), null);
return sslContext;
}
}
package ms.warpzone.warppay.manager;
import android.util.Log;
import java.util.ArrayList;
import ms.warpzone.warppay.data.models.local.User;
import ms.warpzone.warppay.data.models.rest.RestTransaction;
import ms.warpzone.warppay.data.models.rest.RestUser;
import retrofit.Callback;
import retrofit.Response;
import retrofit.Retrofit;
public class TransactionManager {
private static TransactionManager ourInstance = new TransactionManager();
private TransactionManager() {}
public static TransactionManager getInstance() {
return ourInstance;
}
/***
* Perform a Transaction and update the User.
* @param transactions
* @return
*/
public void perform_transactions(ArrayList<RestTransaction> transactions, final boolean show_credit_dialog, final boolean logout) {
User currentUser = DataManager.getInstance().getCurrentUser();
RestManager.getInstance().getRestService().saveTransaction(currentUser.getUserid(), transactions).enqueue(new Callback<Void>() {
@Override
public void onResponse(Response<Void> response, Retrofit retrofit) {
if(response.code() != 200) {
Log.d("REST_1", String.valueOf(response.code()));
UiManager.getInstance().showWarning("Transaction Error. Please try Again", 4000);
}
}
@Override
public void onFailure(Throwable t) {
Log.d("REST", t.getMessage());
UiManager.getInstance().showWarning("Transaction Error. Please try Again", 4000);
}
});
if(currentUser.getUserid() == "Guest") {
if (logout)
MainManager.getInstance().clearCurrentUser();
return;
}
RestManager.getInstance().getRestService().getSingleUser(currentUser.getUserid()).enqueue(new Callback<RestUser>() {
@Override
public void onResponse(Response<RestUser> response, Retrofit retrofit) {
if(response.code() == 200) {
DataManager.getInstance().getCurrentUser().setCredit(response.body().getCredit());
UiManager.getInstance().refreshCreditTextView(DataManager.getInstance().getCurrentUser().getCredit());
DataManager.getInstance().getCurrentUser().save();
if (show_credit_dialog) {
UiManager.getInstance().showMessage("Neues Guthaben: " + DataManager.getInstance().getCurrentUser().getCredit() + " Euro", 2500);
}
if (logout)
MainManager.getInstance().clearCurrentUser();
} else {
Log.d("REST_2", String.valueOf(response.code()));
UiManager.getInstance().showWarning("Transaction Error. Please try again", 4000);
}
}
@Override
public void onFailure(Throwable t) {
UiManager.getInstance().showWarning("Transaction Error. Please try again", 4000);
Log.d("REST", t.getMessage());
}
});
}
}
package ms.warpzone.warppay.manager;
import android.annotation.TargetApi;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Build;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Button;
import android.widget.GridLayout;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.PopupMenu;
import android.widget.TextView;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import ms.warpzone.warppay.MainActivity;
import ms.warpzone.warppay.R;
import ms.warpzone.warppay.data.models.local.Category;
import ms.warpzone.warppay.data.models.local.Product;
import ms.warpzone.warppay.data.models.local.User;
import ms.warpzone.warppay.dialogs.ChargeCustomDialog;
import ms.warpzone.warppay.dialogs.ChargeDialog;
import ms.warpzone.warppay.dialogs.NotificationDialog;
import ms.warpzone.warppay.dialogs.PayChoiceDialog;
import ms.warpzone.warppay.dialogs.PinCodesDialog;
import ms.warpzone.warppay.dialogs.ProductDialog;
import ms.warpzone.warppay.listener.CategoryOnClickListener;
import ms.warpzone.warppay.orderList.ListViewAdapter;
import ms.warpzone.warppay.orderList.ListViewAdapterProducts;
import ms.warpzone.warppay.orderList.Order;
public class UiManager implements View.OnKeyListener, View.OnClickListener, AdapterView.OnItemClickListener {
private MainActivity mainActivity;
private Button btnPay, btnCharge, btnLogout, btnGuest, btnSettings;
private ImageButton btnRefresh;
private TextView txtSum,txtCredit;
private ListView lstOrdered;
private GridLayout gridCategories;
private AutoCompleteTextView atxvName;
private ListViewAdapter lstOrderedAdapter;
private ListViewAdapterProducts lstProductAdapter;
private ArrayAdapter atxvAdapter;
private ArrayList<Double> order;
private List<User> users;
private ProgressDialog processDialog = null;
private PayChoiceDialog payChoiceDialog;
private ProductDialog productDialog;
private ChargeDialog chargeDialog;
private ChargeCustomDialog chargeCustomDialog;
private PinCodesDialog pinCodesDialog;
private PopupMenu popupMenuSettings;
private static UiManager ourInstance = new UiManager();
public static UiManager getInstance() {
return ourInstance;
}
private UiManager() {}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
protected void initUi(MainActivity mainActivity) {
this.txtSum = (TextView) mainActivity.findViewById(R.id.txtSum);
this.txtCredit = (TextView)mainActivity.findViewById(R.id.txtCredit);
this.txtCredit.setText(mainActivity.getResources().getString(R.string.credit,"0.0"));
this.txtSum.setText(mainActivity.getResources().getString(R.string.total,"0.0"));
this.btnLogout = (Button) mainActivity.findViewById(R.id.btnLogout);
this.btnRefresh = (ImageButton) mainActivity.findViewById(R.id.btnRefresh);
this.btnPay = (Button) mainActivity.findViewById(R.id.btnPay);
this.btnCharge = (Button) mainActivity.findViewById(R.id.btnCharge);
this.btnGuest = (Button) mainActivity.findViewById(R.id.btnGuest);
this.btnSettings = (Button) mainActivity.findViewById(R.id.btnSettings);
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.users = User.getAll();
this.atxvAdapter = new ArrayAdapter(mainActivity, android.R.layout.select_dialog_item, this.users);
this.atxvName = (AutoCompleteTextView) mainActivity.findViewById(R.id.atxvName);
this.atxvName.setAdapter(atxvAdapter);
this.atxvName.setThreshold(1);
this.atxvName.setOnKeyListener(this);
this.atxvName.setOnItemClickListener(this);
this.atxvName.setFocusableInTouchMode(true);
this.atxvName.setFocusable(true);
this.atxvName.requestFocus();
this.gridCategories = (GridLayout) mainActivity.findViewById(R.id.gridCategories);
this.btnLogout.setVisibility(View.INVISIBLE);
this.enableControls(false);
this.mainActivity = mainActivity;
}
public void showSoftKeyboard(View view) {
if (view.requestFocus()) {
InputMethodManager imm = (InputMethodManager)
this.mainActivity.getSystemService(this.mainActivity.getApplicationContext().INPUT_METHOD_SERVICE);
imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
}
protected void refreshTotalTextView(BigDecimal totalAmount) {
this.txtSum.setText(this.mainActivity.getResources().getString(R.string.total,totalAmount.toString()));
}
protected void refreshCreditTextView(BigDecimal credit) {
this.txtCredit.setText(this.mainActivity.getResources().getString(R.string.credit, credit.toString()));
}
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());
}
protected void clearCurrentUser() {
this.atxvName.setText("");
this.lstOrderedAdapter.clear();
this.enableControls(false);
this.btnLogout.setVisibility(View.INVISIBLE);
this.refreshCreditTextView(new BigDecimal(0.0));
this.refreshTotalTextView(new BigDecimal(0.0));
if(this.atxvName.requestFocus()) {
this.showSoftKeyboard(this.mainActivity.getCurrentFocus());
}
if(this.payChoiceDialog != null)
this.payChoiceDialog.dismiss();
if(this.chargeCustomDialog != null)
this.chargeCustomDialog.dismiss();
if(this.chargeDialog != null)
this.chargeDialog.dismiss();
if(this.productDialog != null)
this.productDialog.dismiss();
if(this.popupMenuSettings != null)
this.popupMenuSettings.dismiss();
}
private void enableControls(boolean enable) {
int visible;
if(enable)
visible= View.VISIBLE;
else
visible= View.INVISIBLE;
this.atxvName.setEnabled(!enable);
this.btnRefresh.setEnabled(!enable);
this.btnLogout.setEnabled(enable);
this.gridCategories.setVisibility(visible);
this.btnPay.setEnabled(enable);
this.btnPay.setVisibility(visible);
this.txtSum.setVisibility(visible);
this.btnSettings.setVisibility(visible);
if(DataManager.getInstance().getIs_guest()) {
this.btnCharge.setEnabled(false);
this.btnCharge.setVisibility(View.INVISIBLE);
} else {
this.btnCharge.setEnabled(enable);
this.btnCharge.setVisibility(visible);
}
}
protected void refreshUserData(List<User> userList) {
this.atxvAdapter.clear();
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.lstOrderedAdapter.remove(order);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnCharge:
this.chargeDialog = new ChargeDialog();
this.chargeDialog.show();
break;
case R.id.btnPay:
this.payChoiceDialog = new PayChoiceDialog();
this.payChoiceDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if (MainManager.getInstance().getCurrentUser() == null)
MainManager.getInstance().clearCurrentUser();
}
});
this.payChoiceDialog.show();
break;
case R.id.btnLogout:
MainManager.getInstance().clearCurrentUser();
break;
case R.id.btnSettings:
this.popupMenuSettings = new PopupMenu(this.mainActivity.getApplicationContext(), v);
this.popupMenuSettings.setOnMenuItemClickListener(this.mainActivity);
this.popupMenuSettings.inflate(R.menu.menu_main);
if((!MainManager.getInstance().getCurrentUser().getCardId().equals("") || DataManager.getInstance().getIs_guest())) {
this.popupMenuSettings.getMenu().getItem(0).setEnabled(false);
}
this.popupMenuSettings.show();
break;
case R.id.btnRefresh:
RefreshManager.getInstance().refreshData();
break;
case R.id.btnGuest:
if(MainManager.getInstance().getCurrentUser() == null) {
DataManager.getInstance().setIs_guest(true);
MainManager.getInstance().setCurrentUser(new User("Guest", "", new BigDecimal(0), ""));
this.atxvName.setText("Gast");
this.atxvName.dismissDropDown();
}
}
}
//@ToDo: Custom Charge spinnt
// @ToDo: payment dismiss spinnt
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP) {
if (KeyEvent.KEYCODE_ENTER == event.getKeyCode()) {
if (this.atxvAdapter.getCount() == 1) {
MainManager.getInstance().setCurrentUser((User) this.atxvAdapter.getItem(0));
this.atxvName.setText(this.atxvAdapter.getItem(0).toString());
this.atxvName.dismissDropDown();
DataManager.getInstance().setIs_guest(false);
}
return false;
}
}
return false;
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch (parent.getId()) {
case -1:
MainManager.getInstance().setCurrentUser((User) this.atxvAdapter.getItem(position));
break;
}
}
public void showCategoryButtons() {
List<Category> categoryList = Category.getAll();
this.gridCategories.removeAllViews();
for (Category c: categoryList) {
Button catButton = new Button(this.mainActivity.getApplicationContext());
catButton.setText(c.getName());
catButton.setHeight(120);
catButton.setWidth(150);
catButton.setGravity(0);
catButton.setOnClickListener(new CategoryOnClickListener());
this.gridCategories.addView(catButton);
}
for (int i=categoryList.size();i<12;i++) {
Button btn = new Button(this.mainActivity.getApplicationContext());
btn.setHeight(120);
btn.setWidth(150);
btn.setGravity(0);
btn.setText("");
btn.setEnabled(false);
this.gridCategories.addView(btn);
}
}
public void addOrder(Order order) {
this.lstOrderedAdapter.insert(order, this.lstOrderedAdapter.getCount());
}
public void setProductDialog(ProductDialog productDialog) {
this.productDialog = productDialog;
}
public void setChargeCustomDialog(ChargeCustomDialog chargeCustomDialog) {
this.chargeCustomDialog = chargeCustomDialog;
}
public void showWarning(String message, int time) {
this.showMessageBox(message, true, time);
}
public void showMessage(String message, int time) {
this.showMessageBox(message, false, time);
}
private void showMessageBox(String message, boolean warning, int time) {
NotificationDialog ndTransfer = new NotificationDialog(MainManager.getInstance().getMainActivity());
if(warning)
ndTransfer.setWarning();
ndTransfer.setMessage(message);
ndTransfer.show(time);
}
}
package ms.itsecteam.warpdrink.orderList;
package ms.warpzone.warppay.orderList;
import android.app.Activity;
import android.content.Context;
......@@ -6,12 +6,12 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.Button;
import android.widget.TextView;
import java.util.List;
import ms.itsecteam.warpdrink.R;
import ms.warpzone.warppay.R;
public class ListViewAdapter extends ArrayAdapter<Order> {
......@@ -36,10 +36,11 @@ public class ListViewAdapter extends ArrayAdapter<Order> {
holder = new OrderHolder();
holder.order = items.get(position);
holder.btnRemoveOrder = (ImageButton)row.findViewById(R.id.btnRemoveOrder);
holder.btnRemoveOrder = (Button) row.findViewById(R.id.btnRemoveOrder);
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,12 +49,14 @@ 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;
Button btnRemoveOrder;
}
}
\ No newline at end of file
package ms.warpzone.warppay.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.warpzone.warppay.R;
import ms.warpzone.warppay.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
package ms.itsecteam.warpdrink.orderList;
package ms.warpzone.warppay.orderList;
import android.widget.ImageButton;
import android.widget.Button;
import java.io.Serializable;
import ms.warpzone.warppay.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;
private Button btn;
public ImageButton getBtn() {
public Button getBtn() {
return btn;
}
public void setBtn(ImageButton btn) {
public void setBtn(Button btn) {
this.btn = 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;
}
}
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid
android:color="#449def" />
<stroke
android:width="1dp"
android:color="#2f6699" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item android:state_enabled="false">
<shape>
<solid
android:color="#bbbbbb" />
<stroke
android:width="1dp"
android:color="#bbbbbb" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<gradient
android:startColor="#449def"
android:endColor="#2f6699"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#2f6699" />
<corners
android:radius="4dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid
android:color="#70c656" />
<stroke
android:width="1dp"
android:color="#53933f" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item android:state_enabled="false">
<shape>
<solid
android:color="#bbbbbb" />
<stroke
android:width="1dp"
android:color="#bbbbbb" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<gradient
android:startColor="#70c656"
android:endColor="#53933f"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#53933f" />
<corners
android:radius="4dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid
android:color="#ef4444" />
<stroke
android:width="1dp"
android:color="#992f2f" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item android:state_enabled="false">
<shape>
<solid
android:color="#bbbbbb" />
<stroke
android:width="1dp"
android:color="#bbbbbb" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<gradient
android:startColor="#ef4444"
android:endColor="#992f2f"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#992f2f" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid
android:color="#f3ae1b" />
<stroke
android:width="1dp"
android:color="#bb6008" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item android:state_enabled="false">
<shape>
<solid
android:color="#bbbbbb" />
<stroke
android:width="1dp"
android:color="#bbbbbb" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<gradient
android:startColor="#f3ae1b"
android:endColor="#bb6008"
android:angle="270" />
<stroke
android:width="1dp"
android:color="#bb6008" />
<corners
android:radius="4dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
</selector>
\ No newline at end of file
WarpDrinkApp/app/src/main/res/drawable/ic_dialog_alert_holo_light.png

1018 B

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
android:keepScreenOn="true"
tools:context="ms.warpzone.warppay.MainActivity">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:orientation="vertical"
android:layout_width="464dp"
android:layout_height="wrap_content">
android:layout_height="361dp"
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_row="0"
android:layout_column="1"
android:layout_row="0"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="center_vertical"
android:text="@string/name"
android:id="@+id/textView2"
android:layout_gravity="center_vertical" />
android:textAppearance="?android:attr/textAppearanceMedium" />
<Space
android:layout_width="20px"
android:layout_height="20px" />
<AutoCompleteTextView
android:layout_width="340dp"
android:layout_height="wrap_content"
android:id="@+id/atxvName"
android:imeOptions="actionNext"
android:singleLine="true"
android:layout_width="254dp"
android:layout_height="match_parent"
android:layout_column="0"
android:layout_columnSpan="1"
android:layout_row="0"
android:layout_column="0"
android:layout_weight="0.54" />
android:imeOptions="actionNext"
android:inputType="textNoSuggestions"
android:singleLine="true" />
<Space
android:layout_width="8dp"
android:layout_height="wrap_content"
android:layout_weight="0.43" />
<Button
android:id="@+id/btnGuest"
android:layout_width="72dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:onClick="onClick"
android:text="Gast" />
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.52" />
<ImageButton
android:layout_width="30dp"
android:layout_height="30dp"
android:id="@+id/btnRefresh"
android:scaleType="fitXY"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_gravity="center_vertical"
android:background="@drawable/ic_menu_refresh"
android:onClick="onClick"
android:layout_gravity="center_vertical" />
android:onClick="onClick" />
</LinearLayout>
<Space
......@@ -67,24 +92,15 @@
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" />
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridCategories"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="left"
android:columnCount="4"
android:orientation="horizontal"
android:rowCount="3"
android:visibility="invisible"></GridLayout>
<Space
android:layout_width="20px"
......@@ -93,63 +109,72 @@
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="363dp"
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="60dp">
android:layout_height="60dp"
android:orientation="horizontal">
<Space
android:layout_width="20px"
android:layout_height="20px" />
<TextView
android:id="@+id/txtCredit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="center_vertical"
android:text="Guthaben: "
android:id="@+id/txtCredit"
android:layout_gravity="center_vertical" />
<View android:layout_width="0dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<Space
android:layout_width="20px"
android:layout_height="20px"
android:layout_weight="1" />
<Button
style="@style/ButtonText"
android:text="@string/btnLogout"
android:id="@+id/btnLogout"
android:background="@drawable/btn_red"
android:layout_row="3"
style="@style/ButtonText"
android:layout_width="140dp"
android:layout_height="30dp"
android:layout_column="1"
android:layout_gravity="center_vertical"
android:layout_row="3"
android:width="10dp"
android:layout_width="140dp"
android:layout_height="50dp"
android:layout_gravity="right"
android:background="@color/flatui_red"
android:onClick="onClick"
android:text="@string/btnLogout"
android:textSize="20dp" />
</LinearLayout>
<ListView
android:layout_width="wrap_content"
android:layout_height="291dp"
android:id="@+id/lstOrdered"
android:layout_row="2"
android:layout_width="wrap_content"
android:layout_height="255dp"
android:layout_column="12"
android:layout_row="2"
android:choiceMode="singleChoice" />
<Space
android:layout_width="20px"
android:layout_height="50px" />
android:layout_height="25px" />
<TextView
android:id="@+id/txtSum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/sum"
android:id="@+id/txtSum" />
android:textAppearance="?android:attr/textAppearanceMedium" />
<Space
android:layout_width="wrap_content"
......@@ -163,38 +188,58 @@
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
style="@style/ButtonText"
android:text="@string/btnCharge"
android:id="@+id/btnCharge"
android:background="@drawable/btn_yellow"
style="@style/ButtonText"
android:layout_width="263dp"
android:layout_height="50dp"
android:layout_column="1"
android:layout_gravity="center_vertical"
android:layout_row="40"
android:width="10dp"
android:background="@color/flatui_yellow"
android:onClick="onClick"
android:text="@string/btnCharge" />
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
android:id="@+id/btnSettings"
android:layout_width="173dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_gravity="center_vertical"
android:layout_row="40"
android:width="10dp"
android:layout_width="300dp"
android:onClick="onClick"
android:layout_height="60dp" />
android:text="@string/btnSettings" />
<Space
android:layout_width="200px"
android:layout_height="20px" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
style="@style/ButtonText"
android:text="@string/btn_pay"
android:id="@+id/btnPay"
android:background="@drawable/btn_green"
android:layout_row="4"
style="@style/ButtonText"
android:layout_width="295dp"
android:layout_height="50dp"
android:layout_column="0"
android:layout_gravity="center_vertical"
android:layout_row="4"
android:width="10dp"
android:layout_width="355dp"
android:background="@color/flatui_green"
android:onClick="onClick"
android:layout_height="wrap_content" />
android:text="@string/btn_pay" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="489dp"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@+id/lstBarcodeProducts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_column="12"
android:layout_row="2"
android:choiceMode="singleChoice" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Space
android:layout_width="wrap_content"
android:layout_height="10dp" />
<TextView
android:id="@+id/txtBarcodeProductName"
android:layout_width="413dp"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="36sp" />
<Space
android:layout_width="match_parent"
android:layout_height="30dp" />
<TextView
android:id="@+id/txtBarcodeProductBarcode"
android:layout_width="416dp"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="36sp" />
<Space
android:layout_width="match_parent"
android:layout_height="30dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/btnBarcodeSubmit"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_weight="0.48"
android:text="Bestätigen" />
<Button
android:id="@+id/btnBarcodeDelete"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:background="@color/flatui_red"
android:text="Löschen" />
</LinearLayout>
<Space
android:layout_width="match_parent"
android:layout_height="30dp" />
<Button
android:id="@+id/btnBarcodeExit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Beenden" />
<Space
android:layout_width="match_parent"
android:layout_height="100dp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -4,21 +4,25 @@
android:layout_height="match_parent"
android:gravity="center_horizontal">
<NumberPicker
android:layout_width="wrap_content"
<EditText
android:id="@+id/etxtCustomAmount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/numPick" />
android:ems="10"
android:inputType="numberDecimal"
android:digits="0123456789.,"
android:text="" />
<Button
style="@style/ButtonText"
android:text="@string/btnCharge"
android:id="@+id/btnCustomCharge"
android:background="@drawable/btn_blue"
android:layout_row="3"
style="@style/ButtonText"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="3"
android:width="10dp"
android:layout_width="300dp"
android:layout_height="wrap_content" />
android:background="@color/flatui_blue"
android:text="@string/btnCharge" />
</LinearLayout>
\ No newline at end of file
......@@ -9,26 +9,26 @@
android:layout_height="wrap_content">
<Button
style="@style/ButtonText"
android:text="@string/btnFiveEuro"
android:id="@+id/btnFiveEuro"
android:background="@drawable/btn_blue"
android:layout_row="3"
style="@style/ButtonText"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="3"
android:width="10dp"
android:layout_width="300dp"
android:layout_height="wrap_content" />
android:background="@color/flatui_blue"
android:text="@string/btnFiveEuro" />
<Button
style="@style/ButtonText"
android:text="@string/btnTenEuro"
android:id="@+id/btnTenEuro"
android:background="@drawable/btn_blue"
android:layout_row="3"
style="@style/ButtonText"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="3"
android:width="10dp"
android:layout_width="300dp"
android:layout_height="wrap_content" />
android:background="@color/flatui_blue"
android:text="@string/btnTenEuro" />
</LinearLayout>
<LinearLayout
......@@ -37,26 +37,26 @@
android:layout_height="fill_parent" >
<Button
style="@style/ButtonText"
android:text="@string/btnTwentyEuro"
android:id="@+id/btnTwentyEuro"
android:background="@drawable/btn_blue"
android:layout_row="3"
style="@style/ButtonText"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="3"
android:width="10dp"
android:layout_width="300dp"
android:layout_height="wrap_content" />
android:background="@color/flatui_blue"
android:text="@string/btnTwentyEuro" />
<Button
style="@style/ButtonText"
android:text="@string/btnOther"
android:id="@+id/btnOther"
android:background="@drawable/btn_blue"
android:layout_row="3"
style="@style/ButtonText"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_row="3"
android:width="10dp"
android:layout_width="300dp"
android:layout_height="wrap_content" />
android:background="@color/flatui_blue"
android:text="@string/btnOther" />
</LinearLayout>
......
<?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:background="@android:color/black"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<VideoView
android:id="@+id/vvNyanCat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file