Skip to content

Commit

Permalink
finalize for release version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ali77gh committed Feb 2, 2019
1 parent 07ba24e commit 4fd88cb
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 34 deletions.
24 changes: 14 additions & 10 deletions app/src/main/java/com/github/ali77gh/unitools/core/Translator.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ public static String getEventReadable(Event event) {
int currentDayOfWeek = DateTimeTools.getCurrentDayOfWeek();
int currentWeek = UserInfoRepo.getWeekNumber();

String day;
if (currentDayOfWeek == event.time.dayOfWeek) {
day = context.getString(R.string.today);
} else if (currentDayOfWeek + 1 == event.time.dayOfWeek |
(currentDayOfWeek == 6 & 0 == event.time.dayOfWeek)) {
day = context.getString(R.string.tomorrow);
} else {
day = getDayString(event.time.dayOfWeek);
}

String week;
if (currentWeek == event.WeekNumber) {
week = context.getString(R.string.this_week);
Expand All @@ -71,6 +61,20 @@ public static String getEventReadable(Event event) {
throw new RuntimeException("un excepted week number");
}

String day;
if (currentWeek == event.WeekNumber){
if (currentDayOfWeek == event.time.dayOfWeek) {
day = context.getString(R.string.today);
} else if (currentDayOfWeek + 1 == event.time.dayOfWeek |
(currentDayOfWeek == 6 & 0 == event.time.dayOfWeek)) {
day = context.getString(R.string.tomorrow);
} else {
day = getDayString(event.time.dayOfWeek);
}
} else {
day = getDayString(event.time.dayOfWeek);
}

return week + " " + day + " " + event.time.toString() + " " + event.what;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class CloseToClassNotify {
static void on15Min(Context context){
ContextHolder.initStatics(context);
List<UClass> classes = UserInfoRepo.getUserInfo().Classes;
if(classes.size()==0) return;
Sort.SortClass(classes);
PushNotify(context,classes.get(0));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Silent {
static void on15Min(Context context) {
ContextHolder.initStatics(context);
List<UClass> classes = UserInfoRepo.getUserInfo().Classes;
if (classes.size() == 0) return;
Sort.SortClass(classes);
silent(context, classes.get(0));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public int getMins() {

public static boolean Validator(int hour, int min) {
if (hour > 24) return false;
if (min > 60) return false;
if (min > 59) return false;
if (hour < 0) return false;
if (min < 0) return false;
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
Expand Down Expand Up @@ -34,6 +36,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Method;
import java.util.Locale;

/**
Expand Down Expand Up @@ -122,6 +125,16 @@ private void SetupFabs() {

private void OpenCamera() {

//to fix android 7+ crash
if(Build.VERSION.SDK_INT>=24){
try{
Method m = StrictMode.class.getMethod("disableDeathOnFileUriExposure");
m.invoke(null);
}catch(Exception e){
e.printStackTrace();
}
}

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File photo = new File(Path + File.separator + FilePackProvider.IMAGE_PATH_NAME + File.separator + FilePackProvider.getMaxPicCode(Path) + ".bmp");
Uri imageUri = Uri.fromFile(photo);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.github.ali77gh.unitools.uI.fragments;

import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -16,15 +14,14 @@
import android.widget.Spinner;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;

import com.github.ali77gh.unitools.R;
import com.github.ali77gh.unitools.data.model.UserInfo;
import com.github.ali77gh.unitools.data.repo.UserInfoRepo;
import com.github.ali77gh.unitools.uI.activities.GuideActivity;
import com.github.ali77gh.unitools.uI.dialogs.SettingsAlarmConfigDialog;

import java.util.Locale;

/**
* Created by ali on 10/3/18.
*/
Expand Down Expand Up @@ -167,14 +164,8 @@ private void SetLang(String lang) {
ui.LangId = lang;
UserInfoRepo.setUserInfo(ui);

Resources res = getResources();
// Change locale settings in the app.
DisplayMetrics dm = res.getDisplayMetrics();
android.content.res.Configuration conf = res.getConfiguration();
conf.setLocale(new Locale(lang)); // API 17+ only.
// Use conf.locale = new Locale(...) if targeting lower versions
res.updateConfiguration(conf, dm);
getActivity().recreate();
Toast.makeText(getActivity(),getString(R.string.open_app_again_reverse),Toast.LENGTH_LONG).show();
getActivity().finishAndRemoveTask();
}

private void OpenGithub() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/dialog_class_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/apcents"
android:text="@string/absents"
android:textColor="@color/black"
android:layout_marginStart="10dp"/>

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<string name="note">یادداشت</string>
<string name="write_here">این جا بنویسید</string>
<string name="there_is_nothing_to_show">چیزی برای نمایش وجود ندارد</string>
<string name="apcents">غیبت ها</string>
<string name="absents">غیبت ها</string>
<string name="pay">پرداخت</string>
<string name="how_match_to_pay">مبلغ (تومن)</string>
<string name="donate_programmer_of_this_app_to_improve_app_and_add_more_features">به برنامه نویس این اپ کمک کنید تا شاهد ویژگی های جدید در نسخه های بعدی باشید</string>
Expand All @@ -116,6 +116,8 @@
<string name="confirm_delete">تایید حذف</string>
<string name="are_you_sure_this_will_never_undo">مطمعنی؟ این عملیات بازگشت پذیر نیست.</string>
<string name="rename">تغییر نام</string>
<string name="edit_doc">ویرایش جزوه</string>
<string name="open_app_again_reverse">open app again</string> <!--this should be english-->

<string-array name="nums">
<item>۰</item>
Expand Down
17 changes: 9 additions & 8 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<string name="note">note</string>
<string name="write_here">write here</string>
<string name="there_is_nothing_to_show">there is nothing to show</string>
<string name="apcents">apcents</string>
<string name="absents">absents</string>
<string name="pay">pay</string>
<string name="how_match_to_pay">how match to pay</string>
<string name="donate_programmer_of_this_app_to_improve_app_and_add_more_features">donate programmer of this app to improve app and add more features</string>
Expand All @@ -115,6 +115,7 @@
<string name="are_you_sure_this_will_never_undo">are you sure? this will never undo</string>
<string name="edit_doc">edit doc</string>
<string name="rename">rename</string>
<string name="open_app_again_reverse">اپلیکیشن را دوباره باز کنید</string> <!--this should be persian-->

<string-array name="nums">
<item>0</item>
Expand Down Expand Up @@ -151,13 +152,13 @@
</string-array>

<string-array name="guide">
<item>this part is for ...............</item>
<item>this part is for ...........................</item>
<item>this part is for ....................</item>
<item>this part is for ........................</item>
<item>this part is for ...........................</item>
<item>this part is for ......................</item>
<item>this part is for .................................</item>
<item>in this part you can manage your classes and events.</item>
<item>you can share your classes list via qr code.</item>
<item>in this part you can get your friend classes via scanning qr code. (this part do not need internet connection)</item>
<item>you can use widget to see your next class.</item>
<item>this part designed for manage your pictures that you take from whiteboard and your friends pamphlets.</item>
<item>this part designed for manage your voices that you record in class.</item>
<item>in this part you can write note about your class</item>
</string-array>

</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/xml/show_next_class_widget_info.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="@layout/widget_show_next_class"
android:minHeight="70dp"
android:minHeight="50dp"
android:minWidth="220dp"
android:previewImage="@drawable/widget_preview"
android:resizeMode="horizontal|vertical"
Expand Down

0 comments on commit 4fd88cb

Please sign in to comment.