Skip to content

Commit 3fd5e8c

Browse files
committed
Updated Libs, Updated to Java 8 and Use English for Comments and Code
1 parent 40d6957 commit 3fd5e8c

File tree

11 files changed

+56
-69
lines changed

11 files changed

+56
-69
lines changed

.idea/.name

Lines changed: 0 additions & 1 deletion
This file was deleted.

.idea/modules.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 24
5-
buildToolsVersion "24.0.0"
4+
compileSdkVersion 25
5+
buildToolsVersion '25.0.2'
66

77
defaultConfig {
88
applicationId "de.schkola.kitchenscanner"
99
minSdkVersion 11
10-
targetSdkVersion 24
10+
targetSdkVersion 25
1111
versionCode 1
12-
versionName "1.0"
12+
versionName "1.0.0"
13+
jackOptions {
14+
enabled true
15+
}
16+
}
17+
compileOptions {
18+
sourceCompatibility JavaVersion.VERSION_1_8
19+
targetCompatibility JavaVersion.VERSION_1_8
1320
}
1421
buildTypes {
1522
release {
16-
minifyEnabled false
1723
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1824
}
1925
}
2026
}
2127

2228
dependencies {
2329
apk fileTree(include: ['*.jar'], dir: 'libs')
24-
compile 'com.android.support:appcompat-v7:24.0.0'
25-
compile 'com.android.support:design:24.0.0'
26-
compile 'com.android.support:support-v4:24.0.0'
30+
compile 'com.android.support:appcompat-v7:25.3.0'
31+
compile 'com.android.support:design:25.3.0'
32+
compile 'com.android.support:support-v4:25.3.0'
2733
compile 'com.journeyapps:zxing-android-embedded:3.4.0'
2834
}

app/src/main/java/de/schkola/kitchenscanner/activity/DisplayActivity.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,33 +65,33 @@ public static void setFlashLight(boolean b) {
6565

6666
@Override
6767
protected void onCreate(Bundle savedInstanceState) {
68-
//Beende den letzten Rescantask (Bug-Fix)
68+
//Stop last RescanTask (Bug-Fix)
6969
if (rct != null) {
7070
rct.cancel(true);
7171
}
7272
super.onCreate(savedInstanceState);
73-
//Setzte die Activity Vollbild
73+
//Set die Activity Fullscreen
7474
requestWindowFeature(Window.FEATURE_NO_TITLE);
7575
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
76-
//Setzte Content
76+
//Set Content
7777
setContentView(R.layout.activity_display);
7878
Intent intent = getIntent();
79-
//Bearbeite Content
79+
//Edit Content
8080
TextView tv_name = (TextView) findViewById(R.id.name);
8181
tv_name.setText(intent.getStringExtra("name"));
8282
TextView tv_clazz = (TextView) findViewById(R.id.clazz);
8383
tv_clazz.setText(intent.getStringExtra("class"));
8484
TextView tv_lunch = (TextView) findViewById(R.id.lunch);
8585
tv_lunch.setText(intent.getStringExtra("lunch"));
86-
TextView tv_gotĹunch = (TextView) findViewById(R.id.gotToday);
87-
if (intent.getIntExtra("gotĹunch", 0) > 1) {
88-
tv_gotĹunch.setText(String.format("%s%s%s", getString(R.string.gotLunch_2), String.valueOf(intent.getIntExtra("gotĹunch", 0)), getString(R.string.gotLunch_1)));
86+
TextView tv_gotLunch = (TextView) findViewById(R.id.gotToday);
87+
if (intent.getIntExtra("gotLunch", 0) > 1) {
88+
tv_gotLunch.setText(String.format("%s%s%s", getString(R.string.gotLunch_2), String.valueOf(intent.getIntExtra("gotLunch", 0)), getString(R.string.gotLunch_1)));
8989
}
90-
TextView tv_allergie = (TextView) findViewById(R.id.allergie);
91-
tv_allergie.setText(intent.getStringExtra("allergie"));
92-
//Starte FlashLightTask
90+
TextView tv_allergies = (TextView) findViewById(R.id.allergie);
91+
tv_allergies.setText(intent.getStringExtra("allergies"));
92+
//Start FlashLightTask
9393
new FlashLightTask().execute();
94-
//Starte neuen Rescan task
94+
//Start new Rescan task
9595
rct = new RescanTask(this);
9696
rct.execute();
9797
}

app/src/main/java/de/schkola/kitchenscanner/activity/MainActivity.java

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@
3131
import android.support.design.widget.FloatingActionButton;
3232
import android.support.v7.app.AppCompatActivity;
3333
import android.support.v7.widget.Toolbar;
34-
import android.util.Log;
3534
import android.view.Menu;
3635
import android.view.MenuItem;
37-
import android.view.View;
3836
import android.view.Window;
3937
import android.view.WindowManager;
4038

@@ -87,7 +85,7 @@ public static void loadDataIntoApp(Activity instance) {
8785
for (String[] line : allergie.read()) {
8886
Person person = Person.getByXBA(Integer.parseInt(line[0]));
8987
if (person != null) {
90-
person.addAllergie(line[1]);
88+
person.addAllergy(line[1]);
9189
}
9290
}
9391
} catch (UnsupportedEncodingException | FileNotFoundException | ArrayIndexOutOfBoundsException ignored) {
@@ -118,39 +116,33 @@ protected void onCreate(Bundle savedInstanceState) {
118116
super.onCreate(savedInstanceState);
119117
instance = this;
120118
lunch = this.getDir("Lunch", MainActivity.MODE_PRIVATE);
121-
//Setzte Activity Vollbild
119+
//Set Activity Fullscreen
122120
requestWindowFeature(Window.FEATURE_NO_TITLE);
123121
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
124-
//Setzte Content
122+
//Set Content
125123
setContentView(R.layout.activity_main);
126124
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
127125
setSupportActionBar(toolbar);
128126

129127
loadDataIntoApp(this);
130-
//Setzte Action des Buttons
128+
//Set Action Buttons
131129
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
132-
fab.setOnClickListener(new View.OnClickListener() {
133-
@Override
134-
public void onClick(View view) {
135-
startScan();
136-
}
137-
});
130+
fab.setOnClickListener(view -> startScan());
138131
}
139132

140133
@Override
141134
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
142135
try {
143136
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
144137
if (scanResult != null && scanResult.getContents() != null) {
145-
Log.d("BarCodeScan XBA-Nummer", scanResult.getContents());
146138
Person person = Person.getByXBA(Integer.parseInt(scanResult.getContents()));
147139
Intent intent = new Intent(this, DisplayActivity.class);
148140
if (person != null) {
149141
intent.putExtra("name", person.getPersonName());
150142
intent.putExtra("class", person.getClazz());
151143
intent.putExtra("lunch", person.getLunch());
152-
intent.putExtra("gotĹunch", person.getGotLunch() + 1);
153-
intent.putExtra("allergie", person.getAllergie());
144+
intent.putExtra("gotLunch", person.getGotLunch() + 1);
145+
intent.putExtra("allergies", person.getAllergies());
154146
person.gotLunch();
155147
} else {
156148
intent.putExtra("lunch", "X");
@@ -173,7 +165,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
173165
public boolean onOptionsItemSelected(MenuItem item) {
174166
switch (item.getItemId()) {
175167
case R.id.action_settings:
176-
//Startet die Einstellungen
168+
//Start Settings
177169
startActivity(new Intent(this, SettingsActivity.class));
178170
return true;
179171
default:

app/src/main/java/de/schkola/kitchenscanner/activity/SettingsActivity.java

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
package de.schkola.kitchenscanner.activity;
2626

2727
import android.app.AlertDialog;
28-
import android.content.DialogInterface;
2928
import android.os.Bundle;
3029
import android.support.v7.app.ActionBar;
3130
import android.support.v7.app.AppCompatActivity;
@@ -48,10 +47,10 @@ public class SettingsActivity extends AppCompatActivity {
4847
protected void onCreate(Bundle savedInstanceState) {
4948
super.onCreate(savedInstanceState);
5049
instance = this;
51-
//Setzte die Activity Vollbild
50+
//Set die Activity Fullscreen
5251
requestWindowFeature(Window.FEATURE_NO_TITLE);
5352
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
54-
//Setzte Content
53+
//Set Content
5554
setContentView(R.layout.activity_settings);
5655
getFragmentManager().beginTransaction().replace(R.id.content_frame, new SettingsFragment()).commit();
5756
setupActionBar();
@@ -67,30 +66,22 @@ public boolean onCreateOptionsMenu(Menu menu) {
6766
public boolean onOptionsItemSelected(MenuItem item) {
6867
switch (item.getItemId()) {
6968
case R.id.action_CSV_copy:
70-
//Startet das kopieren der CSV-Dateien
71-
new AlertDialog.Builder(instance)
69+
//Start copy CSV-Files
70+
new AlertDialog.Builder(this)
7271
.setTitle(R.string.copy_title)
7372
.setMessage(R.string.copy_request)
74-
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
75-
@Override
76-
public void onClick(DialogInterface dialogInterface, int i) {
77-
new CSVCopy(instance).execute();
78-
}
79-
})
73+
.setPositiveButton(android.R.string.yes, (dialogInterface, i) -> new CSVCopy(instance).execute())
8074
.setNegativeButton(android.R.string.no, null)
8175
.create().show();
8276
return true;
8377
case R.id.action_delete_data:
84-
//Löscht den Cache
85-
new AlertDialog.Builder(instance)
78+
//Delete Cache
79+
new AlertDialog.Builder(this)
8680
.setTitle(R.string.delete_title)
8781
.setMessage(R.string.delete_request)
88-
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
89-
@Override
90-
public void onClick(DialogInterface dialogInterface, int i) {
91-
for (File f : MainActivity.getLunchDir().listFiles()) {
92-
f.delete();
93-
}
82+
.setPositiveButton(android.R.string.yes, (dialogInterface, i) -> {
83+
for (File f : MainActivity.getLunchDir().listFiles()) {
84+
f.delete();
9485
}
9586
})
9687
.setNegativeButton(android.R.string.no, null)

app/src/main/java/de/schkola/kitchenscanner/task/CSVCopy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected void onPreExecute() {
6262
protected Boolean doInBackground(Void... voids) {
6363
boolean re = false;
6464
try {
65-
//Mountpoint -> Bei der verwendung eines anderen Gerätes ändern
65+
//MountPoint -> If you want to use an other Device CHANGE THIS!
6666
File usb = new File("/storage/usbdisk");
6767
if (usb.exists()) {
6868
File[] files = usb.listFiles();

app/src/main/java/de/schkola/kitchenscanner/util/CSVFile_Allergie.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ public List<String[]> read() throws UnsupportedEncodingException {
4949
try {
5050
String csvLine;
5151
while ((csvLine = reader.readLine()) != null) {
52-
String[] row = csvLine.split(",");
53-
resultList.add(row);
52+
resultList.add(csvLine.split(","));
5453
}
5554
} catch (IOException ex) {
5655
throw new RuntimeException("Error in reading CSV file: " + ex);

app/src/main/java/de/schkola/kitchenscanner/util/Person.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class Person {
4545
private final String clazz;
4646
private final int lunch;
4747
private final File f;
48-
private String allergie = "";
48+
private String allergies = "";
4949

5050
public Person(int xba, String clazz, String name, int lunch) {
5151
this.clazz = clazz;
@@ -95,15 +95,15 @@ public int getGotLunch() {
9595
}
9696
}
9797

98-
public String getAllergie() {
99-
return allergie;
98+
public String getAllergies() {
99+
return allergies;
100100
}
101101

102-
public void addAllergie(String s) {
103-
if (allergie.equals("")) {
104-
allergie = s;
102+
public void addAllergy(String s) {
103+
if (allergies.equals("")) {
104+
allergies = s;
105105
} else {
106-
allergie += ", " + s;
106+
allergies += ", " + s;
107107
}
108108
}
109109

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.3'
8+
classpath 'com.android.tools.build:gradle:2.3.0'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sun Sep 04 15:58:38 CEST 2016
1+
#Mon Mar 06 22:14:08 CET 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip

0 commit comments

Comments
 (0)