diff --git a/AUTHORS b/AUTHORS index 428d1c1..b069ce7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,3 @@ leleDroid by George Vasilakos -http://linuxteam.cs.teilar.gr/~forfolias/leleDroid \ No newline at end of file +http://linuxteam.cs.teilar.gr/~forfolias/leleDroid diff --git a/AndroidManifest.xml b/AndroidManifest.xml index ca5a441..3e9c0cf 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,20 +1,22 @@ - - - - - - - - - - - - - - + package="com.forfolias.leleDroid" android:versionCode="2" + android:versionName="1.2"> + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/COPYING b/COPYING index 94a9ed0..20d40b6 100644 --- a/COPYING +++ b/COPYING @@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. \ No newline at end of file diff --git a/res/drawable-hdpi/icon.png b/res/drawable-hdpi/icon.png deleted file mode 100644 index 2c4459d..0000000 Binary files a/res/drawable-hdpi/icon.png and /dev/null differ diff --git a/res/drawable-hdpi/img1.png b/res/drawable-hdpi/img1.png deleted file mode 100644 index bc5f9f5..0000000 Binary files a/res/drawable-hdpi/img1.png and /dev/null differ diff --git a/res/drawable-hdpi/img10.png b/res/drawable-hdpi/img10.png deleted file mode 100644 index 699dc56..0000000 Binary files a/res/drawable-hdpi/img10.png and /dev/null differ diff --git a/res/drawable-hdpi/img11.png b/res/drawable-hdpi/img11.png deleted file mode 100644 index 45eada9..0000000 Binary files a/res/drawable-hdpi/img11.png and /dev/null differ diff --git a/res/drawable-hdpi/img12.png b/res/drawable-hdpi/img12.png deleted file mode 100644 index 76cfe00..0000000 Binary files a/res/drawable-hdpi/img12.png and /dev/null differ diff --git a/res/drawable-hdpi/img13.png b/res/drawable-hdpi/img13.png deleted file mode 100644 index 193e1bf..0000000 Binary files a/res/drawable-hdpi/img13.png and /dev/null differ diff --git a/res/drawable-hdpi/img14.png b/res/drawable-hdpi/img14.png deleted file mode 100644 index 1bc1b17..0000000 Binary files a/res/drawable-hdpi/img14.png and /dev/null differ diff --git a/res/drawable-hdpi/img15.png b/res/drawable-hdpi/img15.png deleted file mode 100644 index b8a1212..0000000 Binary files a/res/drawable-hdpi/img15.png and /dev/null differ diff --git a/res/drawable-hdpi/img16.png b/res/drawable-hdpi/img16.png deleted file mode 100644 index 3025cc7..0000000 Binary files a/res/drawable-hdpi/img16.png and /dev/null differ diff --git a/res/drawable-hdpi/img17.png b/res/drawable-hdpi/img17.png deleted file mode 100644 index 4aaa699..0000000 Binary files a/res/drawable-hdpi/img17.png and /dev/null differ diff --git a/res/drawable-hdpi/img18.png b/res/drawable-hdpi/img18.png deleted file mode 100644 index 6fd70af..0000000 Binary files a/res/drawable-hdpi/img18.png and /dev/null differ diff --git a/res/drawable-hdpi/img2.png b/res/drawable-hdpi/img2.png deleted file mode 100644 index 8c42c27..0000000 Binary files a/res/drawable-hdpi/img2.png and /dev/null differ diff --git a/res/drawable-hdpi/img3.png b/res/drawable-hdpi/img3.png deleted file mode 100644 index 3318ec4..0000000 Binary files a/res/drawable-hdpi/img3.png and /dev/null differ diff --git a/res/drawable-hdpi/img4.png b/res/drawable-hdpi/img4.png deleted file mode 100644 index bf7ec0d..0000000 Binary files a/res/drawable-hdpi/img4.png and /dev/null differ diff --git a/res/drawable-hdpi/img5.png b/res/drawable-hdpi/img5.png deleted file mode 100644 index 85fc528..0000000 Binary files a/res/drawable-hdpi/img5.png and /dev/null differ diff --git a/res/drawable-hdpi/img6.png b/res/drawable-hdpi/img6.png deleted file mode 100644 index ca29738..0000000 Binary files a/res/drawable-hdpi/img6.png and /dev/null differ diff --git a/res/drawable-hdpi/img7.png b/res/drawable-hdpi/img7.png deleted file mode 100644 index 02e14d8..0000000 Binary files a/res/drawable-hdpi/img7.png and /dev/null differ diff --git a/res/drawable-hdpi/img8.png b/res/drawable-hdpi/img8.png deleted file mode 100644 index b5a6120..0000000 Binary files a/res/drawable-hdpi/img8.png and /dev/null differ diff --git a/res/drawable-hdpi/img9.png b/res/drawable-hdpi/img9.png deleted file mode 100644 index dd40bcf..0000000 Binary files a/res/drawable-hdpi/img9.png and /dev/null differ diff --git a/res/drawable-ldpi/icon.png b/res/drawable-ldpi/icon.png deleted file mode 100644 index 9e8de84..0000000 Binary files a/res/drawable-ldpi/icon.png and /dev/null differ diff --git a/res/drawable-mdpi/icon.png b/res/drawable-mdpi/icon.png deleted file mode 100644 index 0e31b7b..0000000 Binary files a/res/drawable-mdpi/icon.png and /dev/null differ diff --git a/res/layout-land/details.xml b/res/layout-land/details.xml index 018c396..cbceb16 100644 --- a/res/layout-land/details.xml +++ b/res/layout-land/details.xml @@ -1,141 +1,149 @@ - - - - - - - + android:layout_width="fill_parent" android:layout_height="fill_parent"> + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + diff --git a/res/layout-land/info.xml b/res/layout-land/info.xml deleted file mode 100644 index d4e6b4b..0000000 --- a/res/layout-land/info.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/layout-land/properties.xml b/res/layout-land/properties.xml deleted file mode 100644 index b3e2d68..0000000 --- a/res/layout-land/properties.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/layout-port/details.xml b/res/layout-port/details.xml deleted file mode 100644 index 59a6b5b..0000000 --- a/res/layout-port/details.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/layout-port/info.xml b/res/layout-port/info.xml deleted file mode 100644 index 181ef5a..0000000 --- a/res/layout-port/info.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/layout-port/properties.xml b/res/layout-port/properties.xml deleted file mode 100644 index db24b73..0000000 --- a/res/layout-port/properties.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/layout/details.xml b/res/layout/details.xml index c06be5d..be2dd05 100644 --- a/res/layout/details.xml +++ b/res/layout/details.xml @@ -1,139 +1,150 @@ - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_alignParentLeft="true" android:gravity="center_horizontal" + android:layout_width="150dip" android:layout_height="150dip"> + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/res/layout/info.xml b/res/layout/info.xml index 181ef5a..36884d8 100644 --- a/res/layout/info.xml +++ b/res/layout/info.xml @@ -1,42 +1,47 @@ - - - - - - - - - + + + + + + + + + + - + - - - + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/res/layout/main.xml b/res/layout/main.xml index 1a5b1c9..48a96ac 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -1,10 +1,10 @@ + android:layout_height="fill_parent" android:paddingTop="10dip"> - - - - + diff --git a/res/layout/properties.xml b/res/layout/properties.xml index ef95130..771fadb 100644 --- a/res/layout/properties.xml +++ b/res/layout/properties.xml @@ -1,109 +1,97 @@ - + + - - - - - + + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - - - - - - - - - + + + + - + \ No newline at end of file diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml deleted file mode 100644 index 749d8cf..0000000 --- a/res/values-el/strings.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - 1.1 - LeleDroid - Προσθήκη στρατιώτη - Στρατιώτης - Όνομα στρατιώτη - Ημερομηνία κατάταξης - Ημερομηνία απόλυσης - Ημέρες άδειας - Ημέρες φυλακής - Όπλο / Σώμα - Όνομα - Kατάταξη - Aπόλυση - Άδεια - Φυλακή - Όπλο - Εντάξει - Άκυρο - Πληροφορίες - Επιστροφή - Δωρεά - Ημέρες που υπηρετήθηκαν - Ημέρες που απομένουν - Ημέρες άδειας - Επιλέξτε όπλο/σώμα - Επιλογή στρατιώτη : - Λεπτομέρειες στρατιώτη - Δευτερόλεπτα... - Λεπτά... - Ώρες... - Μέρες... - Εβδομάδες... - Μήνες... - Ποσοστό... - Διαγραφή - Επεξεργασία - Η λίστα είναι άδεια - Παρακαλώ συμπληρώστε της ημέρες άδειας - Παρακαλώ συμπληρώστε το όνομα στρατιώτη - Παρακαλώ συμπληρώστε τις ημέρες φυλακής - Η ημερομηνία κατάταξης είναι πιο μπροστά από την - ημερομηνία απόλυσης. Παρακαλώ διορθώστε. - Copyright (c) 2011 Βασιλάκος Γεώργιος - http://linuxteam.cs.teilar.gr/~forfolias/leleDroid - - Επικοινωνία : - Άδεια χρήσης - Να διαγραφεί ο επιλεγμένος στρατιώτης; - This program is free software: you can redistribute - it and/or modify - it under the terms of the GNU General Public License - as published by - the Free Software Foundation, either version 3 of the - License, or - (at your option) any later version. - - This program is - distributed in the hope that it will be useful, - but WITHOUT ANY - WARRANTY; without even the implied warranty of - MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License - for more details. - - You should have received a copy of the GNU General - Public License - along with this program. If not, see - http://www.gnu.org/licenses/ - Το leleDroid εμφανίζει πληροφορίες σχετικά με το - υπόλοιπο της θητείας ενός στρατιώτη. - - diff --git a/res/values-en/strings.xml b/res/values-en/strings.xml index cd48161..6e89afd 100644 --- a/res/values-en/strings.xml +++ b/res/values-en/strings.xml @@ -1,31 +1,25 @@ - 1.1 - LeleDroid + 1.2 + leleDroid + Information + Soldier Add soldier - Soldier details - Name - Start date - End date - Days off - Extra days - Army corps - Name - Start - End - Days off - Extra days - Army corps - Ok - Cancel - Information - Back - Donate + Select soldier : + + Delete + View + Edit + + End date + Start date + Name + Days off + Extra days Days served Remaining days - Days off - Select army corps - Select soldier : + + Soldier details Seconds... Minutes... @@ -34,18 +28,26 @@ Weeks... Months... Percentage... - Delete - Edit - List is empty + + Are you sure you want to delete the selected soldier? + + Ok + Cancel + Back + Please fill in the days off Please fill in the name of the soldier Please fill in the extra days Start date is ahead of end date. Please check the dates. - Copyright (c) 2011 George Vasilakos - http://linuxteam.cs.teilar.gr/~forfolias/leleDroid + + Donate Contact : + http://linuxteam.cs.teilar.gr/~forfolias/leleDroid + + Copyright (c) 2011 Βασιλάκος Γεώργιος + LeleDroid displays information about + the remaining military service of a soldier. Licence - Are you sure you want to delete the selected soldier? This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -67,7 +69,4 @@ Public License along with this program. If not, see http://www.gnu.org/licenses/ - LeleDroid displays information about - the remaining military service of a soldier. - diff --git a/res/values/oplo.xml b/res/values/oplo.xml deleted file mode 100644 index 6984eda..0000000 --- a/res/values/oplo.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - "Πεζικό" - "Πυροβολικό" - "Τεθωρακισμένα" - "Μηχανικό" - "Διαβιβάσεις" - "Αεροπορία_Στρατού" - "Εφοδιασμού_Μεταφορών" - "Υλικού_Πολέμου" - "Τεχνικό" - "Υγειονομικό" - - \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 749d8cf..60df9b2 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,31 +1,25 @@ - 1.1 - LeleDroid + 1.2 + leleDroid + Πληροφορίες + Στρατιώτης Προσθήκη στρατιώτη - Στρατιώτης - Όνομα στρατιώτη - Ημερομηνία κατάταξης - Ημερομηνία απόλυσης - Ημέρες άδειας - Ημέρες φυλακής - Όπλο / Σώμα - Όνομα - Kατάταξη - Aπόλυση - Άδεια - Φυλακή - Όπλο - Εντάξει - Άκυρο - Πληροφορίες - Επιστροφή - Δωρεά + Επιλογή στρατιώτη : + + Διαγραφή + Προβολή + Επεξεργασία + + Ημερομηνία απόλυσης + Ημερομηνία κατάταξης + Όνομα στρατιώτη + Ημέρες άδειας + Ημέρες φυλακής Ημέρες που υπηρετήθηκαν Ημέρες που απομένουν - Ημέρες άδειας - Επιλέξτε όπλο/σώμα - Επιλογή στρατιώτη : + + Λεπτομέρειες στρατιώτη Δευτερόλεπτα... Λεπτά... @@ -34,20 +28,27 @@ Εβδομάδες... Μήνες... Ποσοστό... - Διαγραφή - Επεξεργασία - Η λίστα είναι άδεια + + Να διαγραφεί ο επιλεγμένος στρατιώτης; + + Εντάξει + Άκυρο + Επιστροφή + Παρακαλώ συμπληρώστε της ημέρες άδειας Παρακαλώ συμπληρώστε το όνομα στρατιώτη Παρακαλώ συμπληρώστε τις ημέρες φυλακής Η ημερομηνία κατάταξης είναι πιο μπροστά από την ημερομηνία απόλυσης. Παρακαλώ διορθώστε. - Copyright (c) 2011 Βασιλάκος Γεώργιος + + Δωρεά + Επικοινωνία : http://linuxteam.cs.teilar.gr/~forfolias/leleDroid - Επικοινωνία : + Copyright (c) 2011 Βασιλάκος Γεώργιος + Το leleDroid εμφανίζει πληροφορίες σχετικά με το + υπόλοιπο της θητείας ενός στρατιώτη. Άδεια χρήσης - Να διαγραφεί ο επιλεγμένος στρατιώτης; This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -69,7 +70,4 @@ Public License along with this program. If not, see http://www.gnu.org/licenses/ - Το leleDroid εμφανίζει πληροφορίες σχετικά με το - υπόλοιπο της θητείας ενός στρατιώτη. - diff --git a/src/com/forfolias/leledroid/details.java b/src/com/forfolias/leledroid/details.java deleted file mode 100644 index 6c69f1a..0000000 --- a/src/com/forfolias/leledroid/details.java +++ /dev/null @@ -1,451 +0,0 @@ -package com.forfolias.leledroid; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; - -import org.achartengine.ChartFactory; -import org.achartengine.GraphicalView; -import org.achartengine.model.CategorySeries; -import org.achartengine.renderer.DefaultRenderer; -import org.achartengine.renderer.SimpleSeriesRenderer; -import org.joda.time.DateTime; -import org.joda.time.Days; -import org.joda.time.Hours; -import org.joda.time.Minutes; -import org.joda.time.Seconds; - -import android.app.Activity; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.content.Intent; -import android.graphics.Color; -import android.os.Bundle; -import android.os.CountDownTimer; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.ProgressBar; -import android.widget.TextView; -import android.widget.Toast; - -public class details extends Activity { - - int selectedItem; - - TextView nameTv; - TextView secondsTv; - TextView minutesTv; - TextView hoursTv; - TextView daysTv; - TextView weeksTv; - TextView monthsTv; - TextView posostoTv; - ProgressBar posostoPB; - Bundle b; - - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.details); - b = this.getIntent().getExtras(); - - nameTv = (TextView) findViewById(R.id.onoma); - secondsTv = (TextView) findViewById(R.id.secs); - minutesTv = (TextView) findViewById(R.id.mins); - hoursTv = (TextView) findViewById(R.id.hours); - daysTv = (TextView) findViewById(R.id.days); - weeksTv = (TextView) findViewById(R.id.weeks); - monthsTv = (TextView) findViewById(R.id.months); - posostoPB = (ProgressBar) findViewById(R.id.posostoProgress); - posostoTv = (TextView) findViewById(R.id.pososto); - - setLabels(); - - MyCount counter = new MyCount(Long.parseLong((String) secondsTv - .getText()) * 1000, 1000); - counter.start(); - - } - - public class MyCount extends CountDownTimer { - int secs = 0; - int mins = 0; - - public MyCount(long millisInFuture, long countDownInterval) { - super(millisInFuture, countDownInterval); - } - - public void onFinish() { - secondsTv.setText("0"); - minutesTv.setText("0"); - hoursTv.setText("0"); - daysTv.setText("0"); - weeksTv.setText("0"); - monthsTv.setText("0"); - posostoPB.setProgress(100); - posostoTv.setText("100%"); - } - - public void onTick(long millisUntilFinished) { - secondsTv.setText("" + millisUntilFinished / 1000); - secs++; - if (secs > 59) { - secs = 0; - mins++; - minutesTv.setText("" - + (Integer.parseInt((String) minutesTv.getText()) - 1)); - if (mins > 59){ - mins = 0; - hoursTv.setText("" - + (Integer.parseInt((String) hoursTv.getText()) - 1)); - } - } - } - } - - public void setLabels() { - - DateTime curDate = new DateTime(); - DateTime inDate = setDateFromString(b.getString("indate")); - DateTime outDate = setDateFromString(b.getString("outdate")); - - outDate = setFilakes(inDate, outDate, - Integer.parseInt(b.getString("filaki"))); - - Float totalPososto = getPososto(Seconds.secondsBetween(inDate, curDate) - .getSeconds(), Seconds.secondsBetween(inDate, outDate) - .getSeconds()); - setName(totalPososto); - setPososto(totalPososto); - setRestOfTv(curDate, outDate); - Integer ipolipo = Days.daysBetween(curDate, outDate).getDays() - - Integer.parseInt(b.getString("adeia")); - Integer perasan = Days.daysBetween(inDate, curDate).getDays(); - - setChart(Integer.parseInt(b.getString("adeia")), ipolipo, perasan); - - } - - public void setChart(Integer adeia, Integer ipolipo, Integer perasan) { - if (ipolipo < 0) { - adeia += ipolipo; - ipolipo = 0; - } - if (adeia < 0) { - adeia = 0; - } - if (perasan < 0) { - perasan = 0; - } - String[] labels = { adeia.toString(), ipolipo.toString(), - perasan.toString() }; - GraphicalView mChartView; - LinearLayout layout = (LinearLayout) findViewById(R.id.pieChart); - - double[] values = new double[] { adeia, ipolipo, perasan }; - int[] colors = new int[] { Color.BLUE, Color.RED, Color.GREEN }; - DefaultRenderer renderer = buildCategoryRenderer(colors); - mChartView = ChartFactory.getPieChartView(this, - buildCategoryDataset("Γράφημα", labels, values), renderer); - - layout.addView(mChartView); - layout.setOnClickListener(new View.OnClickListener() { - - public void onClick(View v) { - LayoutInflater inflater = getLayoutInflater(); - View layout = inflater.inflate(R.layout.chart, - (ViewGroup) findViewById(R.id.LL1)); - - Toast toastView = new Toast(getBaseContext()); - toastView.setGravity(Gravity.CENTER_VERTICAL, 0, 0); - toastView.setView(layout); - toastView.setDuration(Toast.LENGTH_LONG); - toastView.show(); - } - }); - } - - public void backButtonClicked(View v) { - finish(); - } - - public void editButtonClicked(View v) { - Intent str = new Intent(this, com.forfolias.leledroid.properties.class); - str.putExtras(b); - startActivity(str); - finish(); - } - - public void deleteButtonClicked(View v) { - DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - switch (which) { - case DialogInterface.BUTTON_POSITIVE: - deleteButtonOk(); - break; - - case DialogInterface.BUTTON_NEGATIVE: - return; - } - } - }; - - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setMessage(getResources().getString(R.string.delete)) - .setPositiveButton("Yes", dialogClickListener) - .setMessage(getResources().getString(R.string.deleteMessage)) - .setNegativeButton("No", dialogClickListener).show(); - - } - - public void deleteButtonOk() { - Toast toast = null; - - try { - OutputStreamWriter out = new OutputStreamWriter(openFileOutput( - "data.txt.tmp", MODE_PRIVATE)); - InputStream instream = openFileInput("data.txt"); - String line = null; - int counter = 0; - - if (instream != null) { - InputStreamReader inputreader = new InputStreamReader(instream); - BufferedReader buffreader = new BufferedReader(inputreader); - - while ((line = buffreader.readLine()) != null) { - if (counter != Integer.parseInt(b.getString("selected"))) { - out.write(line + "\n"); - } - counter++; - } - } - instream.close(); - out.close(); - - if (deleteFile("data.txt") == false) { - toast = Toast.makeText(getApplicationContext(), - "Error deleting data.txt", Toast.LENGTH_SHORT); - toast.show(); - } - - } catch (java.io.FileNotFoundException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), - Toast.LENGTH_SHORT); - toast.show(); - } catch (IOException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), - Toast.LENGTH_SHORT); - toast.show(); - - } - - try { - OutputStreamWriter out = new OutputStreamWriter(openFileOutput( - "data.txt", MODE_PRIVATE)); - InputStream instream = openFileInput("data.txt.tmp"); - String line = null; - - if (instream != null) { - InputStreamReader inputreader = new InputStreamReader(instream); - BufferedReader buffreader = new BufferedReader(inputreader); - - while ((line = buffreader.readLine()) != null) { - out.write(line + "\n"); - } - } - instream.close(); - out.close(); - - if (deleteFile("data.txt.tmp") == false) { - toast = Toast.makeText(getApplicationContext(), - "Error deleting data.txt.tmp", Toast.LENGTH_SHORT); - toast.show(); - } - } catch (java.io.FileNotFoundException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), - Toast.LENGTH_SHORT); - toast.show(); - } catch (IOException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), - Toast.LENGTH_SHORT); - toast.show(); - } - finish(); - } - - public void setName(Float totalPososto) { - - String vath = "", oplo = ""; - ImageView vathmosI = (ImageView) findViewById(R.id.vathmosImg); - - if (b.getString("oplo").equals("Πεζικό")) { - oplo = "ΠΖ"; - } else if (b.getString("oplo").equals("Πυροβολικό")) { - oplo = "ΠΒ"; - } else if (b.getString("oplo").equals("Τεθωρακισμένα")) { - oplo = "ΤΘ"; - } else if (b.getString("oplo").equals("Μηχανικό")) { - oplo = "ΜΧ"; - } else if (b.getString("oplo").equals("Διαβιβάσεις")) { - oplo = "ΔΒ"; - } else if (b.getString("oplo").equals("Αεροπορία_Στρατού")) { - oplo = "ΑΣ"; - } else if (b.getString("oplo").equals("Εφοδιασμού_Μεταφορών")) { - oplo = "ΕΜ"; - } else if (b.getString("oplo").equals("Υλικού_Πολέμου")) { - oplo = "ΥΠ"; - } else if (b.getString("oplo").equals("Τεχνικό")) { - oplo = "ΤΧ"; - } else if (b.getString("oplo").equals("Υγειονομικό")) { - oplo = "ΥΓ"; - } - - if (totalPososto < 8) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img1)); - vath = "ΣΤΡ"; - } else if (totalPososto < 14) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img2)); - vath = "ΥΔΝΕΑΣ"; - } else if (totalPososto < 20) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img3)); - vath = "ΔΝΕΑΣ"; - } else if (totalPososto < 22) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img4)); - vath = "ΛΧΙΑΣ"; - } else if (totalPososto < 28) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img5)); - vath = "ΕΠΧΙΑΣ"; - } else if (totalPososto < 34) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img6)); - vath = "ΑΛΧΙΑΣ"; - } else if (totalPososto < 40) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img7)); - vath = "ΑΝΘΣΤΗΣ"; - } else if (totalPososto < 45) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img8)); - vath = "ΑΝΘΛΓΟΣ"; - } else if (totalPososto < 50) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img9)); - vath = "ΥΠΛΓΟΣ"; - } else if (totalPososto < 56) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img10)); - vath = "ΛΓΟΣ"; - } else if (totalPososto < 62) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img11)); - vath = "ΤΧΗΣ"; - } else if (totalPososto < 68) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img12)); - vath = "ΑΝΧΗΣ"; - } else if (totalPososto < 73) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img13)); - vath = "ΣΧΗΣ"; - } else if (totalPososto < 79) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img14)); - vath = "ΤΞΧΟΣ"; - } else if (totalPososto < 85) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img15)); - vath = "ΥΣΤΓΟΣ"; - } else if (totalPososto < 91) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img16)); - vath = "ΑΝΤΓΟΣ"; - } else if (totalPososto < 97) { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img17)); - vath = "ΣΤΓΟΣ"; - } else { - vathmosI.setImageDrawable(getResources().getDrawable( - R.drawable.img18)); - vath = "ΠΟΛΙΤΗΣ"; - oplo = "ΚΟΣΜΟΥ"; - } - nameTv.setText(vath + "(" + oplo + ") " + b.getString("onoma")); - } - - public void setPososto(Float totalPososto) { - if (totalPososto < 0) - totalPososto = (float) 0; - posostoPB.setProgress(totalPososto.intValue()); - posostoTv.setText(totalPososto.intValue() + "%"); - } - - public Float getPososto(Integer a, Integer b) { - return (float) a * 100 / b; - } - - public void setRestOfTv(DateTime curDate, DateTime outDate) { - - Integer meres = Days.daysBetween(curDate, outDate).getDays(); - - secondsTv.setText(Integer.toString(Seconds.secondsBetween(curDate, - outDate).getSeconds())); - minutesTv.setText(Integer.toString(Minutes.minutesBetween(curDate, - outDate).getMinutes())); - hoursTv.setText(Integer.toString(Hours.hoursBetween(curDate, outDate) - .getHours())); - daysTv.setText(Integer.toString(meres)); - weeksTv.setText(String.format("%.2f", (float) meres / 7)); - monthsTv.setText(String.format("%.2f", (float) meres / 30)); - } - - public DateTime setDateFromString(String temp) { - Integer d = Integer.parseInt(temp.split("/")[0]); - Integer m = Integer.parseInt(temp.split("/")[1]); - Integer y = Integer.parseInt(temp.split("/")[2]); - - return new DateTime(y, m, d, 12, 0, 0, 0); - } - - public DateTime setFilakes(DateTime inDate, DateTime outDate, Integer fil) { - if (fil > 0) { - if (fil > 40) { - return outDate.plusDays(fil); - } else if (fil > 20) { - return outDate.plusDays(fil - 20); - } - } - return outDate; - } - - protected DefaultRenderer buildCategoryRenderer(int[] colors) { - DefaultRenderer renderer = new DefaultRenderer(); - for (int color : colors) { - SimpleSeriesRenderer r = new SimpleSeriesRenderer(); - r.setColor(color); - renderer.addSeriesRenderer(r); - } - renderer.setLabelsTextSize(10); - renderer.setShowLegend(false); - return renderer; - } - - protected CategorySeries buildCategoryDataset(String title, - String[] labels, double[] values) { - CategorySeries series = new CategorySeries(title); - series.add(labels[0], values[0]); - series.add(labels[1], values[1]); - series.add(labels[2], values[2]); - return series; - } - -} diff --git a/src/com/forfolias/leledroid/info.java b/src/com/forfolias/leledroid/info.java deleted file mode 100644 index c5b1f0a..0000000 --- a/src/com/forfolias/leledroid/info.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.forfolias.leledroid; - -import java.util.regex.Pattern; - -import android.app.Activity; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.text.Html; -import android.text.method.LinkMovementMethod; -import android.text.util.Linkify; -import android.view.Gravity; -import android.view.View; -import android.widget.ImageView; -import android.widget.TextView; -import android.widget.Toast; - -public class info extends Activity { - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.info); - - TextView link = (TextView) findViewById(R.id.site); - TextView cont = (TextView) findViewById(R.id.contact); - - link.setText("" + link.getText() - + ""); - cont.setText(cont.getText() - + " "); - Linkify.addLinks(cont, Pattern.compile("forfolias@gmail.com"), - "http://"); - Linkify.addLinks(link, - Pattern.compile(getResources().getString(R.id.site)), "http://"); - cont.setText(Html.fromHtml(cont.getText() - + "forfolias@gmail.com")); - link.setText(Html.fromHtml((String) link.getText())); - cont.setMovementMethod(LinkMovementMethod.getInstance()); - link.setMovementMethod(LinkMovementMethod.getInstance()); - - ImageView img = (ImageView) findViewById(R.id.infoImage); - img.setOnLongClickListener(new View.OnLongClickListener() { - - public boolean onLongClick(View v) { - Toast toast = Toast.makeText(getApplicationContext(), - "Άκυρο ψαρά!", Toast.LENGTH_SHORT); - toast.setGravity(Gravity.TOP, 75, 35); - toast.show(); - return true; - } - }); - - } - - public void donateButtonClicked(View v) { - Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=M5HYBKFQYS84S&lc=GR&item_name=Donation%20to%20LeleDroid%20application¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted") ); - startActivity(browse); - } - - public void licenceButtonClicked(View v) { - AlertDialog.Builder alertbox = new AlertDialog.Builder(this); - alertbox.setMessage(getResources().getString(R.string.licenceText)) - .setTitle(getResources().getString(R.string.licence)); - alertbox.setNeutralButton(getResources().getString(R.string.back), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface arg0, int arg1) { - } - }); - alertbox.show(); - } -} diff --git a/src/com/forfolias/leledroid/leledroid.java b/src/com/forfolias/leledroid/leledroid.java deleted file mode 100644 index 67c7780..0000000 --- a/src/com/forfolias/leledroid/leledroid.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.forfolias.leledroid; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.BufferedReader; - -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; -import android.widget.ListView; -import android.widget.Toast; - -public class leledroid extends Activity { - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - } - - public void onStart() { - Toast toast = null; - ArrayAdapter adapter; - ListView strList; - super.onStart(); - strList = (ListView) findViewById(R.id.strList); - String line = null; - adapter = new ArrayAdapter(this, - android.R.layout.simple_list_item_1); - - try { - InputStream instream = openFileInput("data.txt"); - if (instream != null) { - Integer c = 0; - InputStreamReader inputreader = new InputStreamReader(instream); - BufferedReader buffreader = new BufferedReader(inputreader); - - while ((line = buffreader.readLine()) != null) { - adapter.add(line.split(" * ")[0].replace('_', ' ')); - c++; - } - if (c == 0) adapter.add(getResources().getString(R.string.emptyList)); - } - instream.close(); - } catch (java.io.FileNotFoundException e) { - adapter.add(getResources().getString(R.string.emptyList)); - } catch (IOException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), - Toast.LENGTH_SHORT); - toast.show(); - } - strList.setOnItemClickListener(new ListView.OnItemClickListener() { - public void onItemClick(AdapterView a, View v, int i, long l) { - try { - Intent inte = new Intent(leledroid.this, details.class); - Bundle b = new Bundle(); - String line1 = null; - Toast toast; - - try { - InputStream instream = openFileInput("data.txt"); - if (instream != null) { - InputStreamReader inputreader = new InputStreamReader( - instream); - BufferedReader buffreader = new BufferedReader( - inputreader); - for (int k = 0; k < i + 1; k++) { - line1 = buffreader.readLine(); - } - } - instream.close(); - } catch (java.io.FileNotFoundException e) { - ; - } catch (IOException e) { - toast = Toast.makeText(getApplicationContext(), - e.getMessage(), Toast.LENGTH_SHORT); - toast.show(); - - } - - b.putString("selected", (String) Integer.toString(i)); - b.putString("onoma", (String) line1.split(" * ")[0].replace('_', ' ')); - b.putString("indate", (String) line1.split(" * ")[2]); - b.putString("outdate", (String) line1.split(" * ")[4]); - b.putString("adeia", (String) line1.split(" * ")[6]); - b.putString("filaki", (String) line1.split(" * ")[8]); - b.putString("oplo", (String) line1.split(" * ")[10]); - inte.putExtras(b); - startActivity(inte); - } catch (Exception e) { - ; - } - } - }); - strList.setAdapter(adapter); - } - - public void onAddButtonClick(View v) { - Intent str = new Intent(this, com.forfolias.leledroid.properties.class); - startActivity(str); - } - - public void onInfoButtonClick(View v) { - Intent str = new Intent(this, com.forfolias.leledroid.info.class); - startActivity(str); - } -} diff --git a/src/com/forfolias/leledroid/properties.java b/src/com/forfolias/leledroid/properties.java deleted file mode 100644 index fc21c54..0000000 --- a/src/com/forfolias/leledroid/properties.java +++ /dev/null @@ -1,319 +0,0 @@ -package com.forfolias.leledroid; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -import android.app.Activity; -import android.app.DatePickerDialog; -import android.app.Dialog; -import android.app.DatePickerDialog.OnDateSetListener; -import android.os.Bundle; -import android.view.View; -import android.widget.ArrayAdapter; -import android.widget.DatePicker; -import android.widget.EditText; -import android.widget.Spinner; -import android.widget.Toast; - -public class properties extends Activity { - - EditText str_name; - EditText str_indate; - EditText str_outdate; - EditText str_adeia; - EditText str_filaki; - Spinner str_oplo; - - static final int DATE_DIALOG_ID = 0; - - private EditText activeDateDisplay; - private Calendar activeDate; - - int selectedItem; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.properties); - Bundle b = this.getIntent().getExtras(); - - str_name = (EditText) findViewById(R.id.str_name_et); - str_indate = (EditText) findViewById(R.id.str_indate_et); - str_outdate = (EditText) findViewById(R.id.str_outdate_et); - str_adeia = (EditText) findViewById(R.id.str_adeia_et); - str_filaki = (EditText) findViewById(R.id.str_filaki_et); - str_oplo = (Spinner) findViewById(R.id.oploSpinner); - - ArrayAdapter adapter = ArrayAdapter.createFromResource( - this, R.array.opla, android.R.layout.simple_spinner_item); - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); - str_oplo.setAdapter(adapter); - - str_indate.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - showDateDialog(str_indate, Calendar.getInstance()); - } - }); - - str_outdate.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - showDateDialog(str_outdate, Calendar.getInstance()); - } - }); - - updateDisplay(str_indate, Calendar.getInstance()); - updateDisplay(str_outdate, Calendar.getInstance()); - - if (b == null) { - selectedItem = -1; - } else { - selectedItem = Integer.parseInt(b.getString("selected")); - str_name.setText(b.getString("onoma")); - str_indate.setText(b.getString("indate")); - str_outdate.setText(b.getString("outdate")); - str_adeia.setText(b.getString("adeia")); - str_filaki.setText(b.getString("filaki")); - - String[] oplo = getResources().getStringArray(R.array.opla); - - for (int i = 0; i < oplo.length; i++) { - if (oplo[i].equals(b.getString("oplo"))) { - str_oplo.setSelection(i); - } - } - } - } - - private void updateDisplay(EditText dateDisplay, Calendar date) { - dateDisplay.setText(new StringBuilder() - .append(date.get(Calendar.DAY_OF_MONTH)).append("/") - .append(date.get(Calendar.MONTH) + 1).append("/") - .append(date.get(Calendar.YEAR)).append(" ")); - - } - - public void showDateDialog(EditText dateDisplay, Calendar date) { - activeDateDisplay = dateDisplay; - activeDate = date; - showDialog(DATE_DIALOG_ID); - } - - private OnDateSetListener dateSetListener = new OnDateSetListener() { - public void onDateSet(DatePicker view, int year, int monthOfYear, - int dayOfMonth) { - activeDate.set(Calendar.YEAR, year); - activeDate.set(Calendar.MONTH, monthOfYear); - activeDate.set(Calendar.DAY_OF_MONTH, dayOfMonth); - updateDisplay(activeDateDisplay, activeDate); - unregisterDateDisplay(); - } - }; - - private void unregisterDateDisplay() { - activeDateDisplay = null; - activeDate = null; - } - - @Override - protected Dialog onCreateDialog(int id) { - switch (id) { - case DATE_DIALOG_ID: - return new DatePickerDialog(this, dateSetListener, - activeDate.get(Calendar.YEAR), - activeDate.get(Calendar.MONTH), - activeDate.get(Calendar.DAY_OF_MONTH)); - } - return null; - } - - @Override - protected void onPrepareDialog(int id, Dialog dialog) { - super.onPrepareDialog(id, dialog); - switch (id) { - case DATE_DIALOG_ID: - ((DatePickerDialog) dialog).updateDate( - activeDate.get(Calendar.YEAR), - activeDate.get(Calendar.MONTH), - activeDate.get(Calendar.DAY_OF_MONTH)); - break; - } - } - - public void okButtonClicked(View v) { - String dataToWrite = null; - Toast toast = null; - - if (!checkOnoma()) - return; - if (!checkAdeia()) - return; - if (!checkFilak()) - return; - if (!checkDates(str_indate.getText().toString(), str_outdate.getText().toString())) - return; - - - dataToWrite = str_name.getText().toString().replace(' ', '_') + " * " - + str_indate.getText().toString() + " * " - + str_outdate.getText().toString() + " * " - + str_adeia.getText().toString() + " * " - + str_filaki.getText().toString() + " * " - + str_oplo.getSelectedItem().toString(); - - try { - OutputStreamWriter out = new OutputStreamWriter(openFileOutput( - "data.txt.tmp", MODE_PRIVATE)); - InputStream instream = openFileInput("data.txt"); - String line = null; - int counter = 0; - - if (instream != null) { - InputStreamReader inputreader = new InputStreamReader(instream); - BufferedReader buffreader = new BufferedReader(inputreader); - - while ((line = buffreader.readLine()) != null) { - if (counter != selectedItem) { - out.write(line + "\n"); - } - counter++; - } - } - instream.close(); - out.close(); - - if (deleteFile("data.txt") == false) { - toast = Toast.makeText(getApplicationContext(), - "Error deleting data.txt", Toast.LENGTH_SHORT); - toast.show(); - } - - } catch (java.io.FileNotFoundException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), - Toast.LENGTH_SHORT); - toast.show(); - - } catch (IOException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), - Toast.LENGTH_SHORT); - toast.show(); - } - - try { - OutputStreamWriter out = new OutputStreamWriter(openFileOutput( - "data.txt", MODE_PRIVATE)); - InputStream instream = openFileInput("data.txt.tmp"); - String line = null; - - if (instream != null) { - InputStreamReader inputreader = new InputStreamReader(instream); - BufferedReader buffreader = new BufferedReader(inputreader); - - while ((line = buffreader.readLine()) != null) { - out.write(line + "\n"); - } - } - instream.close(); - out.close(); - - if (deleteFile("data.txt.tmp") == false) { - toast = Toast.makeText(getApplicationContext(), - "Error deleting data.txt.tmp", Toast.LENGTH_SHORT); - toast.show(); - } - } catch (java.io.FileNotFoundException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), - Toast.LENGTH_SHORT); - toast.show(); - } catch (IOException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), - Toast.LENGTH_SHORT); - toast.show(); - } - - try { - OutputStreamWriter out = new OutputStreamWriter(openFileOutput( - "data.txt", MODE_APPEND)); - out.write(dataToWrite + "\n"); - out.close(); - } catch (java.io.IOException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), - Toast.LENGTH_SHORT); - toast.show(); - } - - finish(); - } - - public void cancelButtonClicked(View v) { - finish(); - } - - public boolean checkAdeia() { - Toast toast = null; - if (str_adeia.getText().toString().equals(new String(""))) { - toast = Toast.makeText(getApplicationContext(), getResources() - .getString(R.string.emptyAdeia), Toast.LENGTH_SHORT); - toast.show(); - return false; - } - return true; - } - - public boolean checkOnoma() { - Toast toast = null; - if (str_name.getText().toString().equals(new String(""))) { - toast = Toast.makeText(getApplicationContext(), getResources() - .getString(R.string.emptyName), Toast.LENGTH_SHORT); - toast.show(); - return false; - } - return true; - } - - public boolean checkFilak() { - Toast toast = null; - if (str_filaki.getText().toString().equals(new String(""))) { - toast = Toast.makeText(getApplicationContext(), getResources() - .getString(R.string.emptyFilaki), Toast.LENGTH_SHORT); - toast.show(); - return false; - } - return true; - } - - public boolean checkDates(String dateIn, String dateOut) { - Toast toast = null; - String myFormatString = "dd/MM/yyyy"; - SimpleDateFormat df = new SimpleDateFormat(myFormatString); - Date date1 = null; - Date date2 = null; - - try { - date1 = df.parse(dateIn); - } catch (ParseException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT); - toast.show(); - } - - try { - date2 = df.parse(dateOut); - } catch (ParseException e) { - toast = Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT); - toast.show(); - } - if (date1.compareTo(date2) >= 0 ){ - toast = Toast.makeText(getApplicationContext(), getResources() - .getString(R.string.dateForward), Toast.LENGTH_LONG); - toast.show(); - return false; - } - return true; - } -}