diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index 058649a..c37a10a 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser
index 0e01335..f0fae09 100644
Binary files a/.idea/caches/gradle_models.ser and b/.idea/caches/gradle_models.ser differ
diff --git a/UniTools.iml b/UniTools.iml
index 85a1ede..871d9cc 100644
--- a/UniTools.iml
+++ b/UniTools.iml
@@ -12,9 +12,8 @@
-
-
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 91937da..e8e3cc8 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -6,9 +6,9 @@ android {
applicationId "com.github.ali77gh.unitools"
minSdkVersion 19
targetSdkVersion 28
- versionName '1.6.1'
+ versionName '1.7.0'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- versionCode 3
+ versionCode 4
}
buildTypes {
release {
diff --git a/app/release/app-release.apk b/app/release/app-release.apk
index 4f36b5b..22d3ab5 100644
Binary files a/app/release/app-release.apk and b/app/release/app-release.apk differ
diff --git a/app/release/output.json b/app/release/output.json
index 930cf28..f7107d4 100644
--- a/app/release/output.json
+++ b/app/release/output.json
@@ -1,19 +1 @@
-[
- {
- "outputType": {
- "type": "APK"
- },
- "apkInfo": {
- "type": "MAIN",
- "splits": [],
- "versionCode": 3,
- "versionName": "1.6.1",
- "enabled": true,
- "outputFile": "app-release.apk",
- "fullName": "release",
- "baseName": "release"
- },
- "path": "app-release.apk",
- "properties": {}
- }
-]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":4,"versionName":"1.7.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
\ No newline at end of file
diff --git a/app/src/main/analyze.py b/app/src/main/analyze.py
new file mode 100644
index 0000000..2e5cf96
--- /dev/null
+++ b/app/src/main/analyze.py
@@ -0,0 +1,103 @@
+#!/usr/bin/python3
+# i write all codes on 1 file because its easy to move for users ;)
+
+from fnmatch import filter
+import os
+import sys
+
+
+def ShowHelp():
+ print()
+ print(" " + 62 * "-")
+ print("| ProjectAnalyzer |")
+ print("| |")
+ print("| github:https://github.com/ali77gh/ProjectAnalyzer |")
+ print("| |")
+ print("| how to use : |")
+ print("| > python3 analyze.py 'postfix' |")
+ print("| > python3 analyze.py 'postfix' --ignore 'dir or files names'|")
+ print(" " + 62 * "-")
+ print()
+
+
+def ShowInBox(str):
+ print("| " + str + ((51-len(str)) * " ") + "|")
+
+
+def Line():
+ print(" " + 52 * "-")
+
+
+def getFileList(path, filePostfix):
+ array = []
+ file_name = "*."+filePostfix
+ for root, dirs, files in os.walk(path):
+ for filename in filter(files, file_name):
+ array.append(os.path.join(root, filename))
+ return array
+
+
+def getLineNumbers(Files):
+ lines = 0
+ for i in Files:
+ lines += sum(1 for line in open(i))
+ return lines
+
+
+
+def RemoveIgnores(allFiles, ignores):
+ for i in allFiles:
+ for j in ignores:
+ if i.find(j)>0:
+ allFiles.remove(i)
+
+
+def ValidateInputs():
+ firstMode = len(sys.argv) == 2 and (not sys.argv[1] == "--ignore")
+ secondMode = len(sys.argv) > 3 and sys.argv[2] == "--ignore"
+ if (not firstMode) and (not secondMode):
+ print("bad way to use")
+ ShowHelp()
+ exit(0)
+
+# main
+if len(sys.argv) == 1 or sys.argv[1] == "--help" :
+ ShowHelp()
+ exit(0)
+
+ValidateInputs()
+
+ignores = []
+if len(sys.argv) > 3 and sys.argv[2] == "--ignore":
+ ignores = sys.argv[3:]
+
+postfix = sys.argv[1]
+
+Line()
+ShowInBox(" ProjectAnalyzer")
+ShowInBox("")
+ShowInBox("https://github.com/ali77gh/ProjectAnalyzer")
+ShowInBox("")
+ShowInBox("searching...")
+files = getFileList(os.getcwd(), postfix)
+RemoveIgnores(files, ignores)
+if len(files) == 0:
+ ShowInBox("there is no " + postfix + " file")
+ Line()
+ exit()
+
+try:
+ lines = getLineNumbers(files)
+except UnicodeDecodeError as e:
+ ShowInBox("this file type is not unicode :|")
+ Line()
+ exit()
+
+linePerFile = round(lines / len(files), 2)
+ShowInBox("you have " + str(len(files)) + " " + postfix + " files")
+ShowInBox("you have " + str(lines) + " " + " lines of " + postfix)
+ShowInBox("lines per file average: " + str(linePerFile))
+ShowInBox("")
+Line()
+
+# todo --ignore param
diff --git a/app/src/main/java/com/github/ali77gh/unitools/core/Translator.java b/app/src/main/java/com/github/ali77gh/unitools/core/Translator.java
index 5f62186..0eeee51 100644
--- a/app/src/main/java/com/github/ali77gh/unitools/core/Translator.java
+++ b/app/src/main/java/com/github/ali77gh/unitools/core/Translator.java
@@ -27,8 +27,10 @@ public static String getUClassReadable(UClass uClass, boolean widget) {
if (diff > 0 & diff < 60) {
toClass = "(" + CH.getString(R.string.started) + ")";
} else if (diff < 0) {
- toClass = "(" + String.valueOf(uClass.time.getMins() - DateTimeTools.getCurrentTime().getMins()) + " " + CH.getString(R.string.minute_later) + " )";
- } else day = CH.getString(R.string.today);
+ toClass = "(" + ToNextClassString(uClass.time.getMins() - DateTimeTools.getCurrentTime().getMins()) + " " + CH.getString(R.string.later) + " )";
+ } else
+ day = CH.getString(R.string.today);
+
} else if (DateTimeTools.getCurrentDayOfWeek() + 1 == uClass.time.dayOfWeek | (DateTimeTools.getCurrentDayOfWeek() == 6 & 0 == uClass.time.dayOfWeek)) {
day = CH.getString(R.string.tomorrow);
} else {
@@ -101,6 +103,21 @@ public static String NumToString(Number s) {
return NumToString(String.valueOf(s));
}
+ public static String NumToStringClockMode(int value){
+ if (value < 10)
+ return "0" + String.valueOf(value);
+ else
+ return String.valueOf(value);
+ }
+
+ private static String ToNextClassString(int mins){
+
+ final int hour = mins / 60;
+ final int min = mins % 60;
+
+ return NumToStringClockMode(hour) + ":" + NumToStringClockMode(min);
+ }
+
public static String getWeekNumberString(int weekNumber) {
if (weekNumber > 38) {
diff --git a/app/src/main/java/com/github/ali77gh/unitools/uI/dialogs/ClassInfoDialog.java b/app/src/main/java/com/github/ali77gh/unitools/uI/dialogs/ClassInfoDialog.java
index 4ed59f3..6831970 100644
--- a/app/src/main/java/com/github/ali77gh/unitools/uI/dialogs/ClassInfoDialog.java
+++ b/app/src/main/java/com/github/ali77gh/unitools/uI/dialogs/ClassInfoDialog.java
@@ -140,6 +140,10 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {
@Override
public void afterTextChanged(Editable s) {
+ if (s.toString().equals("")){
+ editText.setText("0");
+ return;
+ }
uClass.reminder = Integer.valueOf(s.toString()) * 60 * 1000;
UClassRepo.Update(uClass);
}
diff --git a/app/src/main/java/com/github/ali77gh/unitools/uI/dialogs/SetupWeekCounterDialog.java b/app/src/main/java/com/github/ali77gh/unitools/uI/dialogs/SetupWeekCounterDialog.java
index 41bd5ae..5a26a36 100644
--- a/app/src/main/java/com/github/ali77gh/unitools/uI/dialogs/SetupWeekCounterDialog.java
+++ b/app/src/main/java/com/github/ali77gh/unitools/uI/dialogs/SetupWeekCounterDialog.java
@@ -8,8 +8,12 @@
import android.widget.Toast;
import com.github.ali77gh.unitools.R;
+import com.github.ali77gh.unitools.data.model.Event;
+import com.github.ali77gh.unitools.data.repo.EventRepo;
import com.github.ali77gh.unitools.data.repo.UserInfoRepo;
+import java.util.List;
+
/**
* Created by ali77gh on 10/27/18.
*/
@@ -31,6 +35,8 @@ protected void onCreate(Bundle savedInstanceState) {
Button ok = findViewById(R.id.btn_setup_week_counter_dialog_ok);
cancel.setOnClickListener(view -> dismiss());
+
+ //load current
int current = UserInfoRepo.getWeekNumber();
if (current < 38)
input.setText(String.valueOf(current));
@@ -46,10 +52,22 @@ protected void onCreate(Bundle savedInstanceState) {
return;
}
UserInfoRepo.setWeekNumber(selectedWeek);
+
+ MoveEvents(selectedWeek - current);
+
dismiss();
});
}
+ private void MoveEvents(int moveForward){
+ List events = EventRepo.getAll();
+
+ for (Event e : events){
+ e.WeekNumber += moveForward;
+ EventRepo.Update(e);
+ }
+ }
+
private boolean IsInt(String s) {
try {
int a = Integer.valueOf(s);
diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml
index 93c1fa4..a13d59e 100644
--- a/app/src/main/res/layout/fragment_settings.xml
+++ b/app/src/main/res/layout/fragment_settings.xml
@@ -128,12 +128,6 @@
-
باز کردن وبسایت
اشتراک گذاری کلاس ها
شروع شده
- دقیقه دیگر
+ مانده تا شروع
کلاسی وجور ندارد
زبان را انتخاب کنید
بلدم
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4f2a46a..cae7345 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,6 +1,6 @@
UniTools
- 1.6.1
+ 1.7.0
"en
@@ -107,7 +107,7 @@
open website
share classes
started
- minute later
+ later
there is no class
select language
skip
diff --git a/pdfwriter/pdfwriter.iml b/pdfwriter/pdfwriter.iml
index 4c0d4ea..1678c76 100644
--- a/pdfwriter/pdfwriter.iml
+++ b/pdfwriter/pdfwriter.iml
@@ -13,7 +13,7 @@
-
+
\ No newline at end of file
diff --git a/uneversaldatetools/uneversaldatetools.iml b/uneversaldatetools/uneversaldatetools.iml
index 47007f9..bf66dc6 100644
--- a/uneversaldatetools/uneversaldatetools.iml
+++ b/uneversaldatetools/uneversaldatetools.iml
@@ -19,7 +19,7 @@
-
+
\ No newline at end of file