Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
63b4ed42ca | |||
2bb2341d0f | |||
797e233809 | |||
64b964ca18 | |||
c9bdac6a66 |
@ -126,6 +126,9 @@ jobs:
|
||||
name: Launch emulator
|
||||
command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on
|
||||
background: true
|
||||
- run:
|
||||
name: Change circle-android script file permissions
|
||||
command: sudo chmod +rx /bin/circle-android
|
||||
- run:
|
||||
name: Wait emulator
|
||||
command: |
|
||||
|
@ -28,8 +28,8 @@ android {
|
||||
testApplicationId "io.github.tests.wulkanowy"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 27
|
||||
versionCode 3
|
||||
versionName "0.2.0"
|
||||
versionCode 4
|
||||
versionName "0.2.1"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
manifestPlaceholders = [
|
||||
|
@ -16,6 +16,7 @@ import io.github.wulkanowy.data.RepositoryContract;
|
||||
import io.github.wulkanowy.di.component.ApplicationComponent;
|
||||
import io.github.wulkanowy.di.component.DaggerApplicationComponent;
|
||||
import io.github.wulkanowy.di.modules.ApplicationModule;
|
||||
import io.github.wulkanowy.utils.LogUtils;
|
||||
|
||||
public class WulkanowyApp extends Application {
|
||||
|
||||
@ -37,6 +38,17 @@ public class WulkanowyApp extends Application {
|
||||
enableDebugLog();
|
||||
}
|
||||
initializeFabric();
|
||||
initializeUserSession();
|
||||
}
|
||||
|
||||
private void initializeUserSession() {
|
||||
if (repository.getCurrentUserId() != 0) {
|
||||
try {
|
||||
repository.initLastUser();
|
||||
} catch (Exception e) {
|
||||
LogUtils.error("An error occurred when the application was started", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void enableDebugLog() {
|
||||
|
@ -1,5 +1,8 @@
|
||||
package io.github.wulkanowy.ui.main.attendance;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
@ -87,10 +90,16 @@ public class AttendanceHeaderItem
|
||||
@BindColor(R.color.free_day)
|
||||
int backgroundFreeDay;
|
||||
|
||||
@BindColor(android.R.color.black)
|
||||
int black;
|
||||
|
||||
private Context context;
|
||||
|
||||
HeaderViewHolder(View view, FlexibleAdapter adapter) {
|
||||
super(view, adapter);
|
||||
view.setOnClickListener(this);
|
||||
ButterKnife.bind(this, view);
|
||||
context = view.getContext();
|
||||
}
|
||||
|
||||
void onBind(Day item, List<AttendanceSubItem> subItems) {
|
||||
@ -103,14 +112,30 @@ public class AttendanceHeaderItem
|
||||
description.setVisibility(numberOfHours > 0 ? View.VISIBLE : View.INVISIBLE);
|
||||
alert.setVisibility(isSubItemsHasChanges(subItems) ? View.VISIBLE : View.INVISIBLE);
|
||||
freeName.setVisibility(subItems.isEmpty() ? View.VISIBLE : View.INVISIBLE);
|
||||
setInactiveHeader(item.getAttendanceLessons().isEmpty());
|
||||
}
|
||||
|
||||
if (item.getAttendanceLessons().isEmpty()) {
|
||||
((FrameLayout) getContentView()).setForeground(null);
|
||||
|
||||
private void setInactiveHeader(boolean inactive) {
|
||||
((FrameLayout) getContentView()).setForeground(inactive ? null : getSelectableDrawable());
|
||||
dayName.setTextColor(inactive ? secondaryColor : black);
|
||||
|
||||
if (inactive) {
|
||||
getContentView().setBackgroundColor(backgroundFreeDay);
|
||||
dayName.setTextColor(secondaryColor);
|
||||
} else {
|
||||
getContentView().setBackgroundDrawable(context.getResources()
|
||||
.getDrawable(R.drawable.ic_border));
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getSelectableDrawable() {
|
||||
int[] attrs = new int[]{R.attr.selectableItemBackground};
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs);
|
||||
Drawable drawable = typedArray.getDrawable(0);
|
||||
typedArray.recycle();
|
||||
return drawable;
|
||||
}
|
||||
|
||||
private int countNotPresentHours(List<AttendanceSubItem> subItems) {
|
||||
int i = 0;
|
||||
for (AttendanceSubItem subItem : subItems) {
|
||||
@ -118,17 +143,16 @@ public class AttendanceHeaderItem
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
private boolean isSubItemsHasChanges(List<AttendanceSubItem> subItems) {
|
||||
for (AttendanceSubItem subItem : subItems) {
|
||||
if (subItem.getLesson().getIsAbsenceUnexcused() || subItem.getLesson().getIsUnexcusedLateness()) {
|
||||
if (subItem.getLesson().getIsAbsenceUnexcused() || subItem.getLesson()
|
||||
.getIsUnexcusedLateness()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ public class AttendanceTabPresenter extends BasePresenter<AttendanceTabContract.
|
||||
boolean isEmptyWeek = true;
|
||||
|
||||
for (Day day : dayList) {
|
||||
day.resetAttendanceLessons();
|
||||
AttendanceHeaderItem headerItem = new AttendanceHeaderItem(day);
|
||||
|
||||
if (isEmptyWeek) {
|
||||
@ -168,7 +169,6 @@ public class AttendanceTabPresenter extends BasePresenter<AttendanceTabContract.
|
||||
loadingTask.cancel(true);
|
||||
loadingTask = null;
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ public class GradesPresenter extends BasePresenter<GradesContract.View>
|
||||
headerItems = new ArrayList<>();
|
||||
|
||||
for (Subject subject : subjectList) {
|
||||
subject.resetGradeList();
|
||||
List<Grade> gradeList = subject.getGradeList();
|
||||
|
||||
if (!gradeList.isEmpty()) {
|
||||
|
@ -37,7 +37,7 @@ public class GradesSubItem
|
||||
return grade;
|
||||
}
|
||||
|
||||
public void setSubjectAlertImage(View subjectAlertImage) {
|
||||
void setSubjectAlertImage(View subjectAlertImage) {
|
||||
this.subjectAlertImage = subjectAlertImage;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
package io.github.wulkanowy.ui.main.timetable;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
@ -84,10 +87,16 @@ public class TimetableHeaderItem
|
||||
@BindColor(R.color.free_day)
|
||||
int backgroundFreeDay;
|
||||
|
||||
@BindColor(android.R.color.black)
|
||||
int black;
|
||||
|
||||
private Context context;
|
||||
|
||||
HeaderViewHolder(View view, FlexibleAdapter adapter) {
|
||||
super(view, adapter);
|
||||
view.setOnClickListener(this);
|
||||
ButterKnife.bind(this, view);
|
||||
context = view.getContext();
|
||||
}
|
||||
|
||||
void onBind(Day item, List<TimetableSubItem> subItems) {
|
||||
@ -96,14 +105,29 @@ public class TimetableHeaderItem
|
||||
alert.setVisibility(isSubItemNewMovedInOrChanged(subItems) ? View.VISIBLE : View.INVISIBLE);
|
||||
freeName.setVisibility(item.getIsFreeDay() ? View.VISIBLE : View.INVISIBLE);
|
||||
freeName.setText(item.getFreeDayName());
|
||||
setInactiveHeader(item.getIsFreeDay());
|
||||
}
|
||||
|
||||
if (item.getIsFreeDay()) {
|
||||
((FrameLayout) getContentView()).setForeground(null);
|
||||
private void setInactiveHeader(boolean inactive) {
|
||||
((FrameLayout) getContentView()).setForeground(inactive ? null : getSelectableDrawable());
|
||||
dayName.setTextColor(inactive ? secondaryColor : black);
|
||||
|
||||
if (inactive) {
|
||||
getContentView().setBackgroundColor(backgroundFreeDay);
|
||||
dayName.setTextColor(secondaryColor);
|
||||
} else {
|
||||
getContentView().setBackgroundDrawable(context.getResources()
|
||||
.getDrawable(R.drawable.ic_border));
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getSelectableDrawable() {
|
||||
int[] attrs = new int[]{R.attr.selectableItemBackground};
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs);
|
||||
Drawable drawable = typedArray.getDrawable(0);
|
||||
typedArray.recycle();
|
||||
return drawable;
|
||||
}
|
||||
|
||||
private boolean isSubItemNewMovedInOrChanged(List<TimetableSubItem> subItems) {
|
||||
boolean isAlertActive = false;
|
||||
|
||||
|
@ -108,6 +108,7 @@ public class TimetableTabPresenter extends BasePresenter<TimetableTabContract.Vi
|
||||
boolean isFreeWeek = true;
|
||||
|
||||
for (Day day : dayList) {
|
||||
day.resetTimetableLessons();
|
||||
TimetableHeaderItem headerItem = new TimetableHeaderItem(day);
|
||||
|
||||
if (isFreeWeek) {
|
||||
|
@ -6,7 +6,6 @@ import javax.inject.Inject;
|
||||
|
||||
import io.github.wulkanowy.data.RepositoryContract;
|
||||
import io.github.wulkanowy.ui.base.BasePresenter;
|
||||
import io.github.wulkanowy.utils.LogUtils;
|
||||
|
||||
public class SplashPresenter extends BasePresenter<SplashContract.View>
|
||||
implements SplashContract.Presenter {
|
||||
@ -24,12 +23,7 @@ public class SplashPresenter extends BasePresenter<SplashContract.View>
|
||||
if (getRepository().getCurrentUserId() == 0) {
|
||||
getView().openLoginActivity();
|
||||
} else {
|
||||
try {
|
||||
getRepository().initLastUser();
|
||||
getView().openMainActivity();
|
||||
} catch (Exception e) {
|
||||
LogUtils.error("An error occurred when the application was started", e);
|
||||
}
|
||||
getView().openMainActivity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user