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

Different improvements

parent c656eb54
No related branches found
No related tags found
No related merge requests found
Showing
with 60 additions and 312 deletions
......@@ -2,3 +2,6 @@ WarpDrinkApi/.settings/
WarpDrinkApi/.classpath
WarpDrinkApi/.project
WarpDrinkApi/target/
WarpDrinkApp/.idea/compiler.xml
WarpDrinkApp/.idea/
*.iml
WarpDrinkApp
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.8" />
<option name="gradleJvm" value="1.7" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintRtlHardcoded" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/WarpDrinkApp.iml" filepath="$PROJECT_DIR$/WarpDrinkApp.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="WarpDrinkApp" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="WarpDrinkApp" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":app" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
<option name="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
<afterSyncTasks>
<task>generateDebugAndroidTestSources</task>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
<output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="scribe-codepath-0.0.3" level="project" />
<orderEntry type="library" exported="" name="httpclient-android-4.3.5.1" level="project" />
<orderEntry type="library" exported="" name="activeandroid-3.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
<orderEntry type="library" exported="" name="okio-1.9.0" level="project" />
<orderEntry type="library" exported="" name="retrofit-2.0.0-beta2" level="project" />
<orderEntry type="library" exported="" name="converter-gson-2.0.0-beta2" level="project" />
<orderEntry type="library" exported="" name="jackson-databind-2.0.1" level="project" />
<orderEntry type="library" exported="" name="jackson-annotations-2.0.1" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.7.5" level="project" />
<orderEntry type="library" exported="" name="spring-android-rest-template-1.0.1.RELEASE" level="project" />
<orderEntry type="library" exported="" name="antlr4-runtime-4.5.3" level="project" />
<orderEntry type="library" exported="" name="gson-2.7" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
<orderEntry type="library" exported="" name="spring-android-core-1.0.1.RELEASE" level="project" />
<orderEntry type="library" exported="" name="codepath-utils" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-22.2.0" level="project" />
<orderEntry type="library" exported="" name="jackson-core-2.0.1" level="project" />
</component>
</module>
\ No newline at end of file
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '23.0.1'
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "ms.itsecteam.warpdrink"
......
......@@ -10,11 +10,13 @@ import android.nfc.tech.NfcF;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import ms.warpzone.warppay.R;
......@@ -28,7 +30,7 @@ import ms.warpzone.warppay.manager.UiManager;
import ms.warpzone.warppay.orderList.Order;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
public class MainActivity extends AppCompatActivity implements View.OnClickListener, View.OnKeyListener{
private MainManager manager;
private NfcAdapter nfcAdapter;
......@@ -52,6 +54,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
this.manager = MainManager.getInstance();
this.manager.init(this);
this.findViewById(android.R.id.content).setOnKeyListener(this);
this.nfcAdapter = NfcAdapter.getDefaultAdapter(this);
this.mPendingIntent = PendingIntent.getActivity(this, 0,
new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
......@@ -101,12 +105,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_settings:
new SettingsDialog(this).show();
break;
case R.id.action_new_user:
new NewUserDialog().show();
break;
case R.id.action_learn_card_id:
if (this.manager.getCurrentUser() != null){
new AlertDialog.Builder(this)
......@@ -132,6 +130,17 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
MainManager.getInstance().removeOrder((Order) v.getTag());
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_ENTER:
TextView t = (TextView) this.findViewById(R.id.txtCredit);
t.setText("asdasdasd");
return true;
}
return false;
}
/*
@Override
......
......@@ -50,7 +50,6 @@ public class SQLiteService {
usr.save();
ret_val.add(usr);
}
Log.d("App", Arrays.toString(u.toArray()));
return ret_val;
}
......@@ -62,7 +61,6 @@ public class SQLiteService {
cat.save();
ret_val.add(cat);
}
Log.d("App", Arrays.toString(c.toArray()));
return ret_val;
}
......@@ -72,7 +70,6 @@ public class SQLiteService {
for (RestProduct anU : body) {
Product prod = anU.toLocalProduct();
prod.save();
Log.d("HALLO",String.valueOf(prod.getPid()));
ret_val.add(prod);
}
......
......@@ -5,19 +5,19 @@ import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import ms.warpzone.warppay.R;
import ms.warpzone.warppay.manager.DataManager;
import ms.warpzone.warppay.manager.MainManager;
public class PayChoiceDialog extends Dialog implements
View.OnClickListener {
public class PayChoiceDialog extends Dialog implements View.OnClickListener {
private Button btnCredit,btnCash;
private TextView txtTotalAmountConfirm;
public PayChoiceDialog() {
super(MainManager.getInstance().getMainActivity());
;
}
@Override
......@@ -26,10 +26,14 @@ public class PayChoiceDialog extends Dialog implements
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.pay_choice_dialog);
btnCredit = (Button) findViewById(R.id.btnCredit);
btnCash = (Button) findViewById(R.id.btnCash);
txtTotalAmountConfirm = (TextView) findViewById(R.id.txtTotalAmountConfirm);
txtTotalAmountConfirm.setText("Gesamtbetrag: "+String.valueOf(DataManager.getInstance().getTotalAmount())+" Euro");
btnCredit.setOnClickListener(this);
btnCash.setOnClickListener(this);
......@@ -41,10 +45,10 @@ public class PayChoiceDialog extends Dialog implements
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnCredit:
MainManager.getInstance().performPayment(true);
MainManager.getInstance().performPayment(false);
break;
case R.id.btnCash:
MainManager.getInstance().performPayment(false);
MainManager.getInstance().performPayment(true);
break;
default:
......
......@@ -72,8 +72,10 @@ public class DataManager {
}
});
}
this.currentUser.setCredit(this.currentUser.getCredit()-this.totalAmount);
this.currentUser.save();
if(!this.is_guest && !cash) {
this.currentUser.setCredit(this.currentUser.getCredit() - this.totalAmount);
this.currentUser.save();
}
this.totalAmount = 0.0;
}
......
......@@ -111,30 +111,7 @@ public class MainManager {
});
}
/**
public boolean addUser(String name) {
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;
}
**/
public void setCurrentUser(User user) {
if (user != null) {
this.dataManager.setCurrentUser(user);
......@@ -145,6 +122,7 @@ public class MainManager {
public User getCurrentUser() {
return this.dataManager.getCurrentUser();
}
public void clearCurrentUser() {
this.dataManager.clearCurrentUser();
this.uiManager.clearCurrentUser();
......@@ -198,7 +176,7 @@ public class MainManager {
if (totalAmount > 0.0 && user != null){
if (DataManager.getInstance().getCurrentUser().getCredit()>=totalAmount || cash){
DataManager.getInstance().performPayment(true);
DataManager.getInstance().performPayment(cash);
MainManager.getInstance().clearCurrentUser();
} else {
Toast.makeText(mainActivity, mainActivity.getResources().getString(R.string.please_charge), Toast.LENGTH_LONG).show();
......
......@@ -2,10 +2,13 @@ package ms.warpzone.warppay.manager;
import android.annotation.TargetApi;
import android.os.Build;
import android.provider.Contacts;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
......@@ -35,7 +38,7 @@ import ms.warpzone.warppay.orderList.Order;
public class UiManager implements View.OnKeyListener, View.OnClickListener, AdapterView.OnItemClickListener {
private MainActivity mainActivity;
private Button btnPay, btnCharge, btnLogout;
private Button btnPay, btnCharge, btnLogout, btnGuest;
private ImageButton btnRefresh;
private TextView txtSum,txtCredit;
private ListView lstOrdered;
......@@ -68,10 +71,12 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
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.txtBarcode = (EditText) mainActivity.findViewById(R.id.txtBarcode);
/* this.txtBarcode = (EditText) mainActivity.findViewById(R.id.txtBarcode);
this.txtBarcode.setShowSoftInputOnFocus(false);
this.txtBarcode.setOnKeyListener(this);
*/
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());
......@@ -87,6 +92,7 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
this.atxvName.setOnItemClickListener(this);
this.atxvName.setFocusableInTouchMode(true);
this.atxvName.setFocusable(true);
this.atxvName.requestFocus();
this.gridProducts = (GridLayout) mainActivity.findViewById(R.id.gridProducts);
this.btnLogout.setVisibility(View.INVISIBLE);
......@@ -94,6 +100,13 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
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_IMPLICIT);
}
}
protected void refreshTotalTextView(double totalAmount) {
this.txtSum.setText(this.mainActivity.getResources().getString(R.string.total,totalAmount));
}
......@@ -112,7 +125,7 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
protected void clearCurrentUser() {
this.atxvName.setText("");
if(this.atxvName.requestFocus()) {
this.mainActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
this.showSoftKeyboard(this.mainActivity.getCurrentFocus());
}
this.lstOrderedAdapter.clear();
this.enableControls(false);
......@@ -122,12 +135,12 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
}
private void enableControls(boolean enable) {
this.txtBarcode.requestFocus();
this.atxvName.setEnabled(!enable);
this.btnRefresh.setEnabled(!enable);
this.btnCharge.setEnabled(enable);
this.btnPay.setEnabled(enable);
this.btnLogout.setEnabled(enable);
}
protected void refreshUserData(List<User> userList) {
......@@ -165,6 +178,8 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
break;
case R.id.btnGuest:
MainManager.getInstance().setCurrentUser(new User("Guest",0,""));
this.atxvName.setText("Gast");
this.atxvName.dismissDropDown();
DataManager.getInstance().setIs_guest(true);
}
}
......@@ -174,9 +189,9 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction()==KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
Log.d("APP", String.valueOf(v.getId())+" "+R.id.txtUsername);
if(v.getId() == R.id.txtBarcode) {
/*if(v.getId() == R.id.txtBarcode) {
Log.d("APP", this.txtBarcode.getText().toString());
} else if (v.getId() == R.id.txtUsername) {
} else*/ if (v.getId() == R.id.txtUsername) {
if (this.atxvAdapter.getCount() == 1) {
MainManager.getInstance().setCurrentUser((User) this.atxvAdapter.getItem(0));
this.atxvName.setText(this.atxvAdapter.getItem(0).toString());
......@@ -205,6 +220,7 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
catButton.setText(c.getName());
catButton.setHeight(120);
catButton.setWidth(150);
catButton.setGravity(0);
catButton.setOnClickListener(new CategoryOnClickListener());
this.gridProducts.addView(catButton);
}
......@@ -212,6 +228,7 @@ public class UiManager implements View.OnKeyListener, View.OnClickListener, Adap
Button btn = new Button(this.mainActivity.getApplicationContext());
btn.setHeight(120);
btn.setWidth(150);
btn.setGravity(0);
btn.setText("");
btn.setEnabled(false);
this.gridProducts.addView(btn);
......
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