Compare commits

..

14 commits

Author SHA1 Message Date
Kuba Szczodrzyński
349bcc851d [3.0.2] Update build.gradle and changelog 2019-09-25 18:40:57 +02:00
Kuba Szczodrzyński
df52029a29 [API/Librus] Add Librus descriptive grades ("Bieżące oceny opisowe") support. 2019-09-24 21:45:49 +02:00
Kuba Szczodrzyński
1a2b51f3f9 [3.0.2-rc.1] Update build.gradle and changelog 2019-09-23 22:07:34 +02:00
Kuba Szczodrzyński
9500ba52fd [UI] Fix status bar icon color in light theme, color&date picker dialogs crashing the app. 2019-09-23 21:53:04 +02:00
Kuba Szczodrzyński
18d9471a94 [UI] Fix web push activity QR scanner 2019-09-23 21:32:12 +02:00
Kuba Szczodrzyński
93b4c03b87 Remove older app version check 2019-09-23 21:26:29 +02:00
Kuba Szczodrzyński
9df9f50d01 3.0.1: Update build.gradle 2019-09-20 22:55:09 +02:00
Kuba Szczodrzyński
eab5fdacee Merge branch 'develop' 2019-09-20 22:50:15 +02:00
Kuba Szczodrzyński
a4db208dfd Merge branch 'hotfix-3.0.1' into develop 2019-09-20 22:47:54 +02:00
Kuba Szczodrzyński
8d9459804f Merge branch 'hotfix-3.0.1' 2019-09-20 22:47:00 +02:00
Kuba Szczodrzyński
d7a6c222f7 [API/Iuczniowie] Fix syncing grades without color 2019-09-20 22:41:51 +02:00
Kacper Ziubryniewicz
2eee9e77e3 [UI] Fix scrolling in web push activity 2019-09-20 21:14:58 +02:00
Kuba Szczodrzyński
1bdd13bf23 Remove unnecessary files. 2019-09-20 19:38:25 +02:00
Kuba Szczodrzyński
cd3b69b136 Remove unnecessary files. 2019-09-20 19:37:45 +02:00
10 changed files with 208 additions and 202 deletions

View file

@ -31,6 +31,14 @@
</head>
<body>
<h3>Wersja 3.0.2, 2019-09-24</h3>
<ul>
<li>Librus: pobieranie Bieżących ocen opisowych.</li>
<li>Poprawki UI: kolor ikon paska statusu w jasnym motywie.</li>
<li>Poprawka braku skanera QR do przekazywania powiadomień.</li>
<li>Poprawka wyboru koloru i daty własnego wydarzenia, które crashowały aplikację.</li>
</ul>
<h3>Wersja 3.0.1, 2019-09-19</h3>
<ul>
<li>Librus: Poprawa błędu synchronizacji.</li>

View file

@ -514,7 +514,7 @@ public class App extends androidx.multidex.MultiDexApplication {
}
}
if (appConfig.lastAppVersion > BuildConfig.VERSION_CODE) {
/*if (appConfig.lastAppVersion > BuildConfig.VERSION_CODE) {
BootReceiver br = new BootReceiver();
Intent i = new Intent();
//i.putExtra("UserChecked", true);
@ -522,7 +522,7 @@ public class App extends androidx.multidex.MultiDexApplication {
Toast.makeText(mContext, R.string.warning_older_version_running, Toast.LENGTH_LONG).show();
//Toast.makeText(mContext, "Zaktualizuj aplikację.", Toast.LENGTH_LONG).show();
//System.exit(0);
}
}*/
if (appConfig == null) {
appConfig = new AppConfig(this);

View file

@ -30,6 +30,7 @@ import pl.szczodrzynski.navlib.drawer.items.DrawerPrimaryItem
import pl.szczodrzynski.navlib.drawer.items.withAppTitle
import pl.szczodrzynski.navlib.getColorFromAttr
import androidx.appcompat.widget.PopupMenu
import androidx.core.graphics.ColorUtils
import androidx.navigation.NavOptions
import com.danimahardhika.cafebar.CafeBar
import com.mikepenz.iconics.IconicsColor
@ -239,6 +240,14 @@ class MainActivity : AppCompatActivity() {
b.navView.configSystemBarsUtil(this)
// fix for setting status bar color to window color, outside of navlib
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.statusBarColor = statusBarColor
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && ColorUtils.calculateLuminance(statusBarColor) > 0.6) {
window.decorView.systemUiVisibility = window.decorView.systemUiVisibility or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
// TODO fix navlib navbar detection, orientation change issues, status bar color setting if not fullscreen
commit()

View file

@ -880,11 +880,17 @@ public class Iuczniowie implements EdziennikInterface {
boolean countToTheAverage = jGrade.get("DoSredniej").getAsBoolean();
float value = jGrade.get("WartoscDoSred").getAsFloat();
String gradeColor = jGrade.get("Kolor").getAsString();
int colorInt = 0xff2196f3;
if (!gradeColor.isEmpty()) {
colorInt = Color.parseColor("#"+gradeColor);
}
Grade gradeObject = new Grade(
profileId,
jGrade.get("idK").getAsLong(),
jGrade.get("Kategoria").getAsString(),
Color.parseColor("#"+jGrade.get("Kolor").getAsString()),
colorInt,
"",
jGrade.get("Ocena").getAsString(),
value,

View file

@ -288,6 +288,7 @@ public class Librus implements EdziennikInterface {
targetEndpoints.add("Grades");
targetEndpoints.add("PointGrades");
targetEndpoints.add("DescriptiveGrades");
targetEndpoints.add("TextGrades");
targetEndpoints.add("BehaviourGrades");
targetEndpoints.add("Events");
@ -359,6 +360,7 @@ public class Librus implements EdziennikInterface {
targetEndpoints.add("Grades");
targetEndpoints.add("PointGrades");
targetEndpoints.add("DescriptiveGrades");
targetEndpoints.add("TextGrades");
targetEndpoints.add("BehaviourGrades");
break;
case FEATURE_HOMEWORKS:
@ -498,6 +500,9 @@ public class Librus implements EdziennikInterface {
case "DescriptiveGrades":
getDescriptiveGrades();
break;
case "TextGrades":
getTextGrades();
break;
case "BehaviourGrades":
getBehaviourGrades();
break;
@ -644,7 +649,7 @@ public class Librus implements EdziennikInterface {
};
librusLoginCallback = redirectUrl -> {
fakeAuthorize = "authorize2";
fakeAuthorize = "authorize";
authorize(AUTHORIZE_URL, authorizeCallback);
};
@ -2389,6 +2394,62 @@ public class Librus implements EdziennikInterface {
});
}
private void getTextGrades() {
callback.onActionStarted(R.string.sync_action_syncing_descriptive_grades);
apiRequest("DescriptiveGrades", data -> {
if (data == null) {
r("finish", "TextGrades");
return;
}
JsonArray grades = data.get("Grades").getAsJsonArray();
//d("Got Grades: "+grades.toString());
for (JsonElement gradeEl : grades) {
JsonObject grade = gradeEl.getAsJsonObject();
long id = grade.get("Id").getAsLong();
long teacherId = grade.get("AddedBy").getAsJsonObject().get("Id").getAsLong();
int semester = grade.get("Semester").getAsInt();
long subjectId = grade.get("Subject").getAsJsonObject().get("Id").getAsLong();
String description = grade.get("Map").getAsString();
long categoryId = -1;
JsonElement skillEl = grade.get("Skill");
if (skillEl != null) {
categoryId = skillEl.getAsJsonObject().get("Id").getAsLong();
}
String str_date = grade.get("AddDate").getAsString();
long addedDate = Date.fromIso(str_date);
String category = "";
int color = -1;
GradeCategory gradeCategory = GradeCategory.search(gradeCategoryList, categoryId);
if (gradeCategory != null) {
category = gradeCategory.text;
color = gradeCategory.color;
}
Grade gradeObject = new Grade(
profileId,
id,
category,
color,
"",
description,
0.0f,
0,
semester,
teacherId,
subjectId
);
gradeObject.type = Grade.TYPE_DESCRIPTIVE;
gradeList.add(gradeObject);
metadataList.add(new Metadata(profileId, Metadata.TYPE_GRADE, gradeObject.id, profile.getEmpty(), profile.getEmpty(), addedDate));
}
r("finish", "TextGrades");
});
}
private void getBehaviourGrades() {
d(TAG, "Grades settings: "+enableStandardGrades+", "+enablePointGrades+", "+enableDescriptiveGrades);
if (!enableBehaviourGrades) {

View file

@ -115,40 +115,6 @@ public class HomeFragment extends Fragment {
return true;
});*/
b.testButton.setOnClickListener((v -> {
LoginStore loginStore = new LoginStore(1, LOGIN_TYPE_LIBRUS, new JsonObject());
loginStore.putLoginData("email", "example@example.com");
loginStore.putLoginData("password", "zaq1@WSX");
Profile profile = new Profile(1, "test", "testsubname", 1);
profile.putStudentData("accountLogin", "1234567");
new Librus(app, profile, loginStore).login(new SyncCallback() {
@Override
public void onLoginFirst(List<Profile> profileList, LoginStore loginStore) {
}
@Override
public void onSuccess(Context activityContext, ProfileFull profileFull) {
}
@Override
public void onProgress(int progressStep) {
}
@Override
public void onActionStarted(int stringResId) {
}
@Override
public void onError(Context activityContext, @NonNull AppError error) {
}
});
}));
b.composeButton.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
b.composeButton.setOnClickListener((v -> {
startActivity(new Intent(activity, MessagesComposeActivity.class));

View file

@ -1,47 +0,0 @@
package pl.szczodrzynski.edziennik.network;
import android.content.Context;
import android.util.Log;
import com.koushikdutta.async.http.Headers;
import com.koushikdutta.ion.Ion;
import java.io.IOException;
import java.net.CookieManager;
import java.net.URI;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
public class IonCookieManager {
private static final String TAG = "IonCookieManager";
private CookieManager manager;
public IonCookieManager(Context context) {
Ion ion = Ion.getDefault(context);
manager = ion.getCookieMiddleware().getCookieManager();
}
public void storeCookies(URLConnection conn) throws IOException {
List<String> cookies = conn.getHeaderFields().get("Set-Cookie");
URI uri = URI.create(conn.getURL().toString());
if(cookies != null) {
storeCookies(uri, cookies);
}
}
public void storeCookies(URI uri, List<String> cookies) throws IOException {
Headers headers = new Headers();
headers.addAll("Set-Cookie", cookies);
Log.d(TAG, "storeAllCookies: "+cookies.toString());
manager.put(uri, headers.getMultiMap());
}
public void storeCookie(URI uri, String cookieName, String cookieValue) throws IOException {
List<String> cookie = new ArrayList<String>();
cookie.add(String.format("%s=%s", cookieName, cookieValue));
Log.d(TAG, "storeCookie: "+String.format("%s=%s", cookieName, cookieValue));
storeCookies(uri, cookie);
}
}

View file

@ -17,147 +17,154 @@
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<LinearLayout
<ScrollView
android:id="@+id/webPushConfig"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textView8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="Przekazywanie powiadomień pozwala przesyłać wszystkie powiadomienia z tego urządzenia na wszystkie sparowane komputery, widoczne poniżej.\n\nPowiadomienia będą się wyświetlać w przeglądarce, w okienku pop-up, w prawym dolnym rogu ekranu.\n\nLista komputerów docelowych jest niezależna od wybranego profilu ucznia." />
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="@dimen/section_margin_top"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/web_push_configured_browsers"
android:textAllCaps="true"
android:textColor="?attr/colorSection"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/section_underline_height"
android:layout_marginTop="2dp"
android:background="?attr/colorSection" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableLayout
android:id="@+id/browserList"
android:id="@+id/textView8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:shrinkColumns="0"
android:stretchColumns="0">
android:text="Przekazywanie powiadomień pozwala przesyłać wszystkie powiadomienia z tego urządzenia na wszystkie sparowane komputery, widoczne poniżej.\n\nPowiadomienia będą się wyświetlać w przeglądarce, w okienku pop-up, w prawym dolnym rogu ekranu.\n\nLista komputerów docelowych jest niezależna od wybranego profilu ucznia." />
<!--<TableRow
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="@dimen/section_margin_top"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="end">
android:layout_height="wrap_content"
android:text="@string/web_push_configured_browsers"
android:textAllCaps="true"
android:textColor="?attr/colorSection"
android:textStyle="bold" />
<TextView
<View
android:layout_width="match_parent"
android:layout_height="@dimen/section_underline_height"
android:layout_marginTop="2dp"
android:background="?attr/colorSection" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableLayout
android:id="@+id/browserList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:shrinkColumns="0"
android:stretchColumns="0">
<!--<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="8dp"
android:gravity="center_vertical"
android:text="Chrome 70.0.3538.102 @ Windows 7 64-bit" />
android:gravity="end">
<Button
android:id="@+id/button6"
style="@style/Widget.AppCompat.Button.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="0dp"
android:minWidth="0dp"
android:text="Usuń" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="8dp"
android:gravity="center_vertical"
android:text="Chrome 70.0.3538.102 @ Windows 7 64-bit" />
</TableRow>-->
<Button
android:id="@+id/button6"
style="@style/Widget.AppCompat.Button.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="0dp"
android:minWidth="0dp"
android:text="Usuń" />
</TableLayout>
</TableRow>-->
<ProgressBar
android:id="@+id/browserListProgressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible" />
</TableLayout>
<TextView
android:id="@+id/browserListErrorText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="18sp"
android:textStyle="italic"
android:visibility="visible"
android:text="@string/web_push_no_browsers" />
<ProgressBar
android:id="@+id/browserListProgressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible" />
</FrameLayout>
<TextView
android:id="@+id/browserListErrorText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="18sp"
android:textStyle="italic"
android:visibility="visible"
android:text="@string/web_push_no_browsers" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="@dimen/section_margin_top"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:orientation="vertical">
</FrameLayout>
<TextView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/web_push_pair_browser"
android:textAllCaps="true"
android:textColor="?attr/colorSection"
android:textStyle="bold" />
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="@dimen/section_margin_top"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:orientation="vertical">
<View
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/web_push_pair_browser"
android:textAllCaps="true"
android:textColor="?attr/colorSection"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/section_underline_height"
android:layout_marginTop="2dp"
android:background="?attr/colorSection" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/section_underline_height"
android:layout_marginTop="2dp"
android:background="?attr/colorSection" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="W przeglądarce na komputerze wejdź na stronę\n\nhttp://edziennik.szczodrzynski.pl/wp\n\nUdziel zgody na wysyłanie powiadomień, następnie zeskanuj wygenerowany kod QR.\n\nPod tym samym adresem możesz zarządzać listą sparowanych z przeglądarką urządzeń.\n\nJeśli sparujesz kilka urządzeń z tą samą przeglądarką, możesz otrzymywać te same powiadomienia kilkukrotnie." />
<Button
android:id="@+id/webPushScanNewButton"
style="@style/Widget.AppCompat.Button.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Skanuj..." />
</LinearLayout>
android:layout_margin="8dp"
android:orientation="vertical">
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="W przeglądarce na komputerze wejdź na stronę\n\nhttp://edziennik.szczodrzynski.pl/wp\n\nUdziel zgody na wysyłanie powiadomień, następnie zeskanuj wygenerowany kod QR.\n\nPod tym samym adresem możesz zarządzać listą sparowanych z przeglądarką urządzeń.\n\nJeśli sparujesz kilka urządzeń z tą samą przeglądarką, możesz otrzymywać te same powiadomienia kilkukrotnie." />
<Button
android:id="@+id/webPushScanNewButton"
style="@style/Widget.AppCompat.Button.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="Skanuj..." />
</LinearLayout>
</LinearLayout>
</ScrollView>
<me.dm7.barcodescanner.zxing.ZXingScannerView
android:id="@+id/qrCodeScanner"
@ -168,4 +175,4 @@
</me.dm7.barcodescanner.zxing.ZXingScannerView>
</LinearLayout>
</layout>
</layout>

View file

@ -95,8 +95,6 @@
<item name="mal_color_secondary">?android:textColorSecondary</item>
<item name="mal_card_background">?colorSurface</item>
<item name="mal_divider_color">@color/dividerColor</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">?android:windowBackground</item>
</style>
<style name="AppTheme.Dark" parent="NavView.Dark">
<item name="colorPrimary">#64b5f6</item>
@ -121,8 +119,6 @@
<item name="mal_color_secondary">@color/secondaryTextDark</item>
<item name="mal_card_background">?colorSurface</item>
<item name="mal_divider_color">@color/dividerColor</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">?android:windowBackground</item>
</style>

View file

@ -5,8 +5,8 @@ buildscript {
kotlin_version = '1.3.50'
release = [
versionName: "3.0.1-rc.1",
versionCode: 3000110
versionName: "3.0.2",
versionCode: 3000299
]
setup = [