forked from github/wulkanowy-mirror
Add grades interface and change app appearance (#14)
* Change style and remake activity_main layout * Change to a brighter navigation background color * Add expandable recyclerView (thoughtbot) * Add indicator to expandableRecyclerView and empty subject not shown * Add Dialog Fragment with grade details
This commit is contained in:
parent
ba7c8f0b1e
commit
cd687a6108
@ -37,9 +37,10 @@ dependencies {
|
||||
compile 'com.android.support:support-vector-drawable:25.3.1'
|
||||
compile 'com.android.support:support-v4:25.3.1'
|
||||
compile 'com.android.support:recyclerview-v7:25.3.1'
|
||||
compile 'com.squareup.picasso:picasso:2.5.2'
|
||||
compile 'org.apache.commons:commons-lang3:3.6'
|
||||
compile 'org.apache.commons:commons-collections4:4.1'
|
||||
compile 'com.thoughtbot:expandablerecyclerview:1.3'
|
||||
compile 'com.android.support:cardview-v7:25.3.1'
|
||||
|
||||
testCompile 'junit:junit:4.12'
|
||||
testCompile 'org.mockito:mockito-core:2.8.47'
|
||||
|
@ -1,22 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="io.github.wulkanowy"
|
||||
android:installLocation="internalOnly">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<uses-sdk tools:overrideLibrary="com.thoughtbot.expandablerecyclerview, com.thoughtbot.expandablecheckrecyclerview" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AppCompat">
|
||||
android:theme="@style/WulkanowyTheme">
|
||||
<activity
|
||||
android:name=".activity.started.StartedActivity"
|
||||
android:noHistory="true"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar"
|
||||
android:theme="@style/WulkanowyTheme.noActionBar"
|
||||
android:configChanges="orientation|screenSize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
@ -26,12 +29,12 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.main.MainActivity"
|
||||
android:label="@string/login_title"
|
||||
android:label="@string/login_text"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity
|
||||
android:name=".activity.dashboard.DashboardActivity"
|
||||
android:label="@string/title_activity_dashboard"
|
||||
android:label="@string/activity_dashboard_text"
|
||||
android:configChanges="orientation|screenSize"/>
|
||||
</application>
|
||||
|
||||
|
@ -10,12 +10,12 @@ import android.view.MenuItem;
|
||||
import io.github.wulkanowy.R;
|
||||
import io.github.wulkanowy.activity.dashboard.attendance.AttendanceFragment;
|
||||
import io.github.wulkanowy.activity.dashboard.board.BoardFragment;
|
||||
import io.github.wulkanowy.activity.dashboard.grades.GradesFragment;
|
||||
import io.github.wulkanowy.activity.dashboard.lessonplan.LessonPlanFragment;
|
||||
import io.github.wulkanowy.activity.dashboard.marks.MarksFragment;
|
||||
|
||||
public class DashboardActivity extends AppCompatActivity {
|
||||
|
||||
private MarksFragment marksFragment = new MarksFragment();
|
||||
private GradesFragment gradesFragment = new GradesFragment();
|
||||
private AttendanceFragment attendanceFragment = new AttendanceFragment();
|
||||
private BoardFragment boardFragment = new BoardFragment();
|
||||
private LessonPlanFragment lessonPlanFragment = new LessonPlanFragment();
|
||||
@ -30,26 +30,26 @@ public class DashboardActivity extends AppCompatActivity {
|
||||
|
||||
switch (item.getItemId()) {
|
||||
case R.id.navigation_marks:
|
||||
setTitle(R.string.title_marks);
|
||||
transaction.replace(R.id.fragment_container, marksFragment);
|
||||
setTitle(R.string.grades_text);
|
||||
transaction.replace(R.id.fragment_container, gradesFragment);
|
||||
transaction.commit();
|
||||
return true;
|
||||
|
||||
case R.id.navigation_attendance:
|
||||
setTitle(R.string.title_attendance);
|
||||
setTitle(R.string.attendance_text);
|
||||
transaction.replace(R.id.fragment_container, attendanceFragment);
|
||||
transaction.commit();
|
||||
return true;
|
||||
|
||||
case R.id.navigation_lessonplan:
|
||||
setTitle(R.string.title_lessonplan);
|
||||
setTitle(R.string.lessonplan_text);
|
||||
transaction.replace(R.id.fragment_container, lessonPlanFragment);
|
||||
transaction.commit();
|
||||
return true;
|
||||
|
||||
case R.id.navigation_dashboard:
|
||||
default:
|
||||
setTitle(R.string.title_dashboard);
|
||||
setTitle(R.string.dashboard_text);
|
||||
transaction.replace(R.id.fragment_container, boardFragment);
|
||||
transaction.commit();
|
||||
return true;
|
||||
@ -62,7 +62,7 @@ public class DashboardActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_dashboard);
|
||||
|
||||
setTitle(R.string.title_dashboard);
|
||||
setTitle(R.string.dashboard_text);
|
||||
|
||||
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
|
||||
navigation.setSelectedItemId(R.id.navigation_dashboard);
|
||||
|
@ -10,12 +10,9 @@ import io.github.wulkanowy.R;
|
||||
|
||||
public class AttendanceFragment extends Fragment {
|
||||
|
||||
public AttendanceFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_attendance, container, false);
|
||||
}
|
||||
}
|
||||
|
@ -10,12 +10,9 @@ import io.github.wulkanowy.R;
|
||||
|
||||
public class BoardFragment extends Fragment {
|
||||
|
||||
public BoardFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_board, container, false);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
package io.github.wulkanowy.activity.dashboard.grades;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import io.github.wulkanowy.R;
|
||||
import io.github.wulkanowy.api.grades.Grade;
|
||||
|
||||
|
||||
public class GradeItem extends Grade implements Parcelable {
|
||||
|
||||
protected GradeItem(Parcel source) {
|
||||
value = source.readString();
|
||||
}
|
||||
|
||||
public GradeItem() {
|
||||
// empty constructor
|
||||
}
|
||||
|
||||
public int getValueColor() {
|
||||
if ("6".equals(value) || "6-".equals(value) || "6+".equals(value)) {
|
||||
return R.color.six_grade;
|
||||
} else if ("5".equals(value) || "5-".equals(value) || "5+".equals(value)) {
|
||||
return R.color.five_grade;
|
||||
} else if ("4".equals(value) || "4-".equals(value) || "4+".equals(value)) {
|
||||
return R.color.four_grade;
|
||||
} else if ("3".equals(value) || "3-".equals(value) || "3+".equals(value)) {
|
||||
return R.color.three_grade;
|
||||
} else if ("2".equals(value) || "2-".equals(value) || "2+".equals(value)) {
|
||||
return R.color.two_grade;
|
||||
} else if ("1".equals(value) || "1-".equals(value) || "1+".equals(value)) {
|
||||
return R.color.one_grade;
|
||||
} else {
|
||||
return R.color.default_grade;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(value);
|
||||
}
|
||||
|
||||
public static final Creator<GradeItem> CREATOR = new Creator<GradeItem>() {
|
||||
@Override
|
||||
public GradeItem createFromParcel(Parcel source) {
|
||||
return new GradeItem(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GradeItem[] newArray(int size) {
|
||||
return new GradeItem[size];
|
||||
}
|
||||
};
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
package io.github.wulkanowy.activity.dashboard.grades;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.RotateAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.thoughtbot.expandablerecyclerview.ExpandableRecyclerViewAdapter;
|
||||
import com.thoughtbot.expandablerecyclerview.models.ExpandableGroup;
|
||||
import com.thoughtbot.expandablerecyclerview.viewholders.ChildViewHolder;
|
||||
import com.thoughtbot.expandablerecyclerview.viewholders.GroupViewHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.github.wulkanowy.R;
|
||||
|
||||
import static android.view.animation.Animation.RELATIVE_TO_SELF;
|
||||
|
||||
public class GradesAdapter extends ExpandableRecyclerViewAdapter<GradesAdapter.SubjectViewHolder, GradesAdapter.GradeViewHolder> {
|
||||
|
||||
private Activity activity;
|
||||
|
||||
public GradesAdapter(List<? extends ExpandableGroup> groups, Context context) {
|
||||
super(groups);
|
||||
activity = (Activity) context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubjectViewHolder onCreateGroupViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.subject_item, parent, false);
|
||||
return new SubjectViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GradeViewHolder onCreateChildViewHolder(ViewGroup child, int viewType) {
|
||||
View view = LayoutInflater.from(child.getContext()).inflate(R.layout.grade_item, child, false);
|
||||
return new GradeViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindGroupViewHolder(SubjectViewHolder holder, int flatPosition, ExpandableGroup group) {
|
||||
holder.bind(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindChildViewHolder(GradeViewHolder holder, int flatPosition, ExpandableGroup group, int childIndex) {
|
||||
holder.bind((GradeItem) group.getItems().get(childIndex));
|
||||
}
|
||||
|
||||
public class SubjectViewHolder extends GroupViewHolder {
|
||||
|
||||
private TextView subjectName;
|
||||
|
||||
private ImageView indicatorDown;
|
||||
|
||||
private ImageView indicatorUp;
|
||||
|
||||
public SubjectViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
subjectName = (TextView) itemView.findViewById(R.id.subject_text);
|
||||
indicatorDown = (ImageView) itemView.findViewById(R.id.group_indicator_down);
|
||||
indicatorUp = (ImageView) itemView.findViewById(R.id.group_indicator_up);
|
||||
|
||||
}
|
||||
|
||||
public void bind(ExpandableGroup group) {
|
||||
subjectName.setText(group.getTitle());
|
||||
|
||||
if (isGroupExpanded(group)) {
|
||||
indicatorDown.setVisibility(View.INVISIBLE);
|
||||
indicatorUp.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
indicatorDown.setVisibility(View.VISIBLE);
|
||||
indicatorUp.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expand() {
|
||||
RotateAnimation rotate =
|
||||
new RotateAnimation(-360, -180, RELATIVE_TO_SELF, 0.5f, RELATIVE_TO_SELF, 0.5f);
|
||||
rotate.setDuration(300);
|
||||
rotate.setFillAfter(false);
|
||||
rotate.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
//Empty method definition
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
indicatorDown.setVisibility(View.INVISIBLE);
|
||||
indicatorUp.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
//Empty method definition
|
||||
}
|
||||
});
|
||||
indicatorDown.setAnimation(rotate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collapse() {
|
||||
RotateAnimation rotate =
|
||||
new RotateAnimation(360, 180, RELATIVE_TO_SELF, 0.5f, RELATIVE_TO_SELF, 0.5f);
|
||||
rotate.setDuration(300);
|
||||
rotate.setFillAfter(false);
|
||||
rotate.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
//Empty method definition
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
indicatorDown.setVisibility(View.VISIBLE);
|
||||
indicatorUp.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
//Empty method definition
|
||||
}
|
||||
});
|
||||
indicatorUp.setAnimation(rotate);
|
||||
}
|
||||
}
|
||||
|
||||
public class GradeViewHolder extends ChildViewHolder {
|
||||
|
||||
private TextView gradeValue;
|
||||
|
||||
private TextView descriptionGrade;
|
||||
|
||||
private TextView dateGrade;
|
||||
|
||||
private GradeItem grade;
|
||||
|
||||
public GradeViewHolder(final View itemView) {
|
||||
super(itemView);
|
||||
gradeValue = (TextView) itemView.findViewById(R.id.grade_text);
|
||||
descriptionGrade = (TextView) itemView.findViewById(R.id.description_grade_text);
|
||||
dateGrade = (TextView) itemView.findViewById(R.id.grade_date_text);
|
||||
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
GradesDialogFragment gradesDialogFragment = GradesDialogFragment.newInstance(grade);
|
||||
gradesDialogFragment.setStyle(DialogFragment.STYLE_NO_TITLE, 0);
|
||||
gradesDialogFragment.show(activity.getFragmentManager(), grade.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void bind(GradeItem grade) {
|
||||
this.grade = grade;
|
||||
gradeValue.setText(grade.getValue());
|
||||
gradeValue.setBackgroundResource(grade.getValueColor());
|
||||
dateGrade.setText(grade.getDate());
|
||||
|
||||
if (grade.getDescription().equals("") || grade.getDescription() == null) {
|
||||
if (!grade.getSymbol().equals("")) {
|
||||
descriptionGrade.setText(grade.getSymbol());
|
||||
} else {
|
||||
descriptionGrade.setText(R.string.noDescription_text);
|
||||
}
|
||||
} else {
|
||||
descriptionGrade.setText(grade.getDescription());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package io.github.wulkanowy.activity.dashboard.grades;
|
||||
|
||||
|
||||
import android.app.DialogFragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import io.github.wulkanowy.R;
|
||||
|
||||
public class GradesDialogFragment extends DialogFragment {
|
||||
|
||||
private GradeItem grade;
|
||||
|
||||
public static final GradesDialogFragment newInstance(GradeItem grade) {
|
||||
return new GradesDialogFragment().setGrade(grade);
|
||||
}
|
||||
|
||||
public GradesDialogFragment setGrade(GradeItem grade) {
|
||||
this.grade = grade;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.grades_dialog, container, false);
|
||||
|
||||
TextView gradeText = (TextView) view.findViewById(R.id.dialog_grade_text);
|
||||
TextView subjectText = (TextView) view.findViewById(R.id.subject_dialog_text_value);
|
||||
TextView descriptionText = (TextView) view.findViewById(R.id.description_dialog_text_value);
|
||||
TextView weightText = (TextView) view.findViewById(R.id.weight_dialog_text_value);
|
||||
TextView teacherText = (TextView) view.findViewById(R.id.teacher_dialog_text_value);
|
||||
TextView dateText = (TextView) view.findViewById(R.id.date_dialog_text_value);
|
||||
TextView colorText = (TextView) view.findViewById(R.id.color_dialog_text_value);
|
||||
TextView okTextClick = (TextView) view.findViewById(R.id.OK_dialog);
|
||||
|
||||
gradeText.setText(grade.getValue());
|
||||
gradeText.setBackgroundResource(grade.getValueColor());
|
||||
subjectText.setText(grade.getSubject());
|
||||
weightText.setText(grade.getWeight());
|
||||
dateText.setText(grade.getDate());
|
||||
colorText.setText(colorHexToColorName(grade.getColor()));
|
||||
|
||||
if (grade.getDescription().equals("")) {
|
||||
if (!grade.getSymbol().equals("")) {
|
||||
descriptionText.setText(grade.getSymbol());
|
||||
}
|
||||
} else if (!grade.getSymbol().equals("")) {
|
||||
descriptionText.setText(grade.getSymbol() + " - " + grade.getDescription());
|
||||
} else {
|
||||
descriptionText.setText(grade.getDescription());
|
||||
}
|
||||
|
||||
if (!grade.getTeacher().equals("")) {
|
||||
teacherText.setText(grade.getTeacher());
|
||||
}
|
||||
|
||||
okTextClick.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public int colorHexToColorName(String hexColor) {
|
||||
switch (hexColor) {
|
||||
case "000000": {
|
||||
return R.string.color_black_text;
|
||||
}
|
||||
case "F04C4C": {
|
||||
return R.string.color_red_text;
|
||||
}
|
||||
case "20A4F7": {
|
||||
return R.string.color_blue_text;
|
||||
}
|
||||
case "6ECD07": {
|
||||
return R.string.color_green_text;
|
||||
}
|
||||
default: {
|
||||
return R.string.noColor_text;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
package io.github.wulkanowy.activity.dashboard.marks;
|
||||
package io.github.wulkanowy.activity.dashboard.grades;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -27,40 +27,35 @@ import io.github.wulkanowy.database.accounts.AccountsDatabase;
|
||||
import io.github.wulkanowy.database.grades.GradesDatabase;
|
||||
import io.github.wulkanowy.database.subjects.SubjectsDatabase;
|
||||
|
||||
public class MarksFragment extends Fragment {
|
||||
public class GradesFragment extends Fragment {
|
||||
|
||||
private ArrayList<String> subjectsName = new ArrayList<>();
|
||||
private List<SubjectWithGrades> subjectWithGradesList = new ArrayList<>();
|
||||
|
||||
private View view;
|
||||
|
||||
public MarksFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
view = inflater.inflate(R.layout.fragment_marks, container, false);
|
||||
view = inflater.inflate(R.layout.fragment_grades, container, false);
|
||||
|
||||
if (subjectsName.size() == 0) {
|
||||
if (subjectWithGradesList.size() == 0) {
|
||||
new MarksTask(container.getContext()).execute();
|
||||
} else if (subjectsName.size() > 1) {
|
||||
createGrid();
|
||||
} else if (subjectWithGradesList.size() > 1) {
|
||||
createExpListView();
|
||||
view.findViewById(R.id.loadingPanel).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
public void createGrid() {
|
||||
public void createExpListView() {
|
||||
|
||||
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.card_recycler_view);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(view.getContext(), 2);
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.subject_grade_recycler);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext()));
|
||||
GradesAdapter gradesAdapter = new GradesAdapter(subjectWithGradesList, view.getContext());
|
||||
recyclerView.setAdapter(gradesAdapter);
|
||||
|
||||
ImageAdapter adapter = new ImageAdapter(view.getContext(), subjectsName);
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
public class MarksTask extends AsyncTask<Void, Void, Void> {
|
||||
@ -75,6 +70,7 @@ public class MarksFragment extends Fragment {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
String cookiesPath = mContext.getFilesDir().getPath() + "/cookies.txt";
|
||||
long userId = mContext.getSharedPreferences("LoginData", mContext.MODE_PRIVATE).getLong("isLogin", 0);
|
||||
|
||||
try {
|
||||
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(cookiesPath));
|
||||
@ -89,7 +85,7 @@ public class MarksFragment extends Fragment {
|
||||
|
||||
AccountsDatabase accountsDatabase = new AccountsDatabase(mContext);
|
||||
accountsDatabase.open();
|
||||
Account account = accountsDatabase.getAccount(mContext.getSharedPreferences("LoginData", mContext.MODE_PRIVATE).getLong("isLogin", 0));
|
||||
Account account = accountsDatabase.getAccount(userId);
|
||||
accountsDatabase.close();
|
||||
|
||||
StudentAndParent snp = new StudentAndParent(cookies, account.getCounty());
|
||||
@ -98,19 +94,24 @@ public class MarksFragment extends Fragment {
|
||||
SubjectsDatabase subjectsDatabase = new SubjectsDatabase(mContext);
|
||||
subjectsDatabase.open();
|
||||
subjectsDatabase.put(subjectsList.getAll());
|
||||
List<Subject> subjects = subjectsDatabase.getAllSubjectsNames();
|
||||
subjectsDatabase.close();
|
||||
|
||||
for (Subject subject : subjects) {
|
||||
subjectsName.add(subject.getName());
|
||||
}
|
||||
|
||||
GradesList gradesList = new GradesList(snp);
|
||||
GradesDatabase gradesDatabase = new GradesDatabase(mContext);
|
||||
gradesDatabase.open();
|
||||
gradesDatabase.put(gradesList.getAll());
|
||||
|
||||
for (Subject subject : subjectsList.getAll()) {
|
||||
List<GradeItem> gradeItems = gradesDatabase.getSubjectGrades(userId, SubjectsDatabase.getSubjectId(subject.getName()));
|
||||
if (gradeItems.size() > 0) {
|
||||
subjectWithGradesList.add(new SubjectWithGrades(subject.getName(), gradeItems));
|
||||
}
|
||||
}
|
||||
|
||||
gradesDatabase.close();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -119,7 +120,7 @@ public class MarksFragment extends Fragment {
|
||||
}
|
||||
|
||||
protected void onPostExecute(Void result) {
|
||||
createGrid();
|
||||
createExpListView();
|
||||
|
||||
view.findViewById(R.id.loadingPanel).setVisibility(View.GONE);
|
||||
|
@ -0,0 +1,13 @@
|
||||
package io.github.wulkanowy.activity.dashboard.grades;
|
||||
|
||||
|
||||
import com.thoughtbot.expandablerecyclerview.models.ExpandableGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SubjectWithGrades extends ExpandableGroup<GradeItem> {
|
||||
|
||||
public SubjectWithGrades(String title, List<GradeItem> items) {
|
||||
super(title, items);
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
package io.github.wulkanowy.activity.dashboard.marks;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import io.github.wulkanowy.R;
|
||||
|
||||
public class ImageAdapter extends RecyclerView.Adapter<ImageAdapter.ViewHolder> {
|
||||
|
||||
private Context context;
|
||||
private ArrayList<String> list;
|
||||
|
||||
public ImageAdapter(Context context, ArrayList<String> list) {
|
||||
this.list = list;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImageAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||||
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.row_layout,
|
||||
viewGroup, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ImageAdapter.ViewHolder viewHolder, int i) {
|
||||
|
||||
viewHolder.tv_android.setText(list.get(i));
|
||||
Picasso.with(context)
|
||||
.load(R.drawable.sample_0)
|
||||
.resize(240, 120)
|
||||
.noFade()
|
||||
.into(viewHolder.img_android);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView tv_android;
|
||||
private ImageView img_android;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
super(view);
|
||||
|
||||
tv_android = (TextView) view.findViewById(R.id.tv_android);
|
||||
img_android = (ImageView) view.findViewById(R.id.img_android);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -46,8 +46,8 @@ public class LoginTask extends AsyncTask<String, Integer, Integer> {
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
|
||||
progress.setTitle(activity.getText(R.string.login_title));
|
||||
progress.setMessage(activity.getText(R.string.please_wait));
|
||||
progress.setTitle(activity.getText(R.string.login_text));
|
||||
progress.setMessage(activity.getText(R.string.please_wait_text));
|
||||
progress.setCancelable(false);
|
||||
progress.show();
|
||||
}
|
||||
@ -60,11 +60,11 @@ public class LoginTask extends AsyncTask<String, Integer, Integer> {
|
||||
try {
|
||||
login.login(credentials[0], credentials[1], credentials[2]);
|
||||
} catch (BadCredentialsException e) {
|
||||
return R.string.login_bad_credentials;
|
||||
return R.string.login_bad_credentials_text;
|
||||
} catch (AccountPermissionException e) {
|
||||
return R.string.login_bad_account_permission;
|
||||
return R.string.login_bad_account_permission_text;
|
||||
} catch (LoginErrorException e) {
|
||||
return R.string.login_denied;
|
||||
return R.string.login_denied_text;
|
||||
}
|
||||
try {
|
||||
String cookiesPath = activity.getFilesDir().getPath() + "/cookies.txt";
|
||||
@ -73,7 +73,7 @@ public class LoginTask extends AsyncTask<String, Integer, Integer> {
|
||||
outputStream.writeObject(login.getCookies());
|
||||
outputStream.flush();
|
||||
} catch (IOException e) {
|
||||
return R.string.login_cookies_save_failed;
|
||||
return R.string.login_cookies_save_failed_text;
|
||||
}
|
||||
|
||||
if (save) {
|
||||
@ -106,16 +106,16 @@ public class LoginTask extends AsyncTask<String, Integer, Integer> {
|
||||
} catch (SQLException e) {
|
||||
return R.string.SQLite_ioError_text;
|
||||
} catch (IOException | LoginErrorException e) {
|
||||
return R.string.login_denied;
|
||||
return R.string.login_denied_text;
|
||||
} catch (CryptoException e) {
|
||||
return R.string.encrypt_failed;
|
||||
return R.string.encrypt_failed_text;
|
||||
} catch (UnsupportedOperationException e) {
|
||||
return R.string.root_failed;
|
||||
return R.string.root_failed_text;
|
||||
}
|
||||
}
|
||||
//Map<String, String> cookiesList = login.getJar();
|
||||
|
||||
return R.string.login_accepted;
|
||||
return R.string.login_accepted_text;
|
||||
}
|
||||
|
||||
protected void onPostExecute(Integer messageID) {
|
||||
@ -125,8 +125,8 @@ public class LoginTask extends AsyncTask<String, Integer, Integer> {
|
||||
|
||||
Toast.makeText(activity, activity.getString(messageID), Toast.LENGTH_LONG).show();
|
||||
|
||||
if (messageID == R.string.login_accepted || messageID == R.string.root_failed
|
||||
|| messageID == R.string.encrypt_failed) {
|
||||
if (messageID == R.string.login_accepted_text || messageID == R.string.root_failed_text
|
||||
|| messageID == R.string.encrypt_failed_text) {
|
||||
Intent intent = new Intent(activity, DashboardActivity.class);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.warning_label)
|
||||
.setTitle(R.string.warning_label_text)
|
||||
.setMessage(R.string.warning_text)
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
@ -97,7 +97,7 @@ public class LoadingTask extends AsyncTask<Void, Void, Void> {
|
||||
Toast.makeText(activity, R.string.SQLite_ioError_text,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} catch (CryptoException e) {
|
||||
Toast.makeText(activity, R.string.decrypt_failed, Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(activity, R.string.decrypt_failed_text, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
accountsDatabase.close();
|
||||
|
@ -2,7 +2,9 @@ package io.github.wulkanowy.activity.started;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.widget.TextView;
|
||||
|
||||
import io.github.wulkanowy.BuildConfig;
|
||||
import io.github.wulkanowy.R;
|
||||
|
||||
public class StartedActivity extends AppCompatActivity {
|
||||
@ -12,6 +14,9 @@ public class StartedActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_started);
|
||||
|
||||
TextView versionName = (TextView) findViewById(R.id.rawText);
|
||||
versionName.setText(getText(R.string.version_text) + BuildConfig.VERSION_NAME);
|
||||
|
||||
new LoadingTask(this).execute();
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
||||
public class Grade {
|
||||
private int id;
|
||||
protected int id;
|
||||
|
||||
private int userID;
|
||||
|
||||
@ -12,7 +12,7 @@ public class Grade {
|
||||
|
||||
private String subject = "";
|
||||
|
||||
private String value = "";
|
||||
protected String value = "";
|
||||
|
||||
private String color = "";
|
||||
|
||||
|
@ -18,8 +18,6 @@ public class SubjectsList extends Vulcan {
|
||||
|
||||
private String subjectsPageUrl = "Oceny/Wszystkie?details=1";
|
||||
|
||||
private List<Subject> subjects = new ArrayList<>();
|
||||
|
||||
public SubjectsList(StudentAndParent snp) {
|
||||
this.snp = snp;
|
||||
}
|
||||
@ -29,6 +27,8 @@ public class SubjectsList extends Vulcan {
|
||||
|
||||
Elements rows = subjectPage.select(".ocenyZwykle-table > tbody > tr");
|
||||
|
||||
List<Subject> subjects = new ArrayList<>();
|
||||
|
||||
for (Element subjectRow : rows) {
|
||||
subjects.add(new Subject()
|
||||
.setName(subjectRow.select("td:nth-child(1)").text())
|
||||
|
@ -11,6 +11,7 @@ import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.github.wulkanowy.activity.dashboard.grades.GradeItem;
|
||||
import io.github.wulkanowy.api.grades.Grade;
|
||||
import io.github.wulkanowy.database.DatabaseAdapter;
|
||||
import io.github.wulkanowy.database.DatabaseComparer;
|
||||
@ -152,16 +153,16 @@ public class GradesDatabase extends DatabaseAdapter {
|
||||
return grade;
|
||||
}
|
||||
|
||||
public List<Grade> getSubjectGrades(long userId, long subjectId) throws SQLException {
|
||||
public List<GradeItem> getSubjectGrades(long userId, long subjectId) throws SQLException {
|
||||
|
||||
String whereExec = "SELECT * FROM " + grades + " WHERE " + userIdText + "=? AND " + subjectIdText + "=?";
|
||||
|
||||
List<Grade> gradesList = new ArrayList<>();
|
||||
List<GradeItem> gradesList = new ArrayList<>();
|
||||
|
||||
Cursor cursor = database.rawQuery(whereExec, new String[]{String.valueOf(userId), String.valueOf(subjectId)});
|
||||
|
||||
while (cursor.moveToNext()) {
|
||||
Grade grade = new Grade();
|
||||
GradeItem grade = new GradeItem();
|
||||
grade.setId(cursor.getInt(0));
|
||||
grade.setUserID(cursor.getInt(1));
|
||||
grade.setSubjectID(cursor.getInt(2));
|
||||
|
@ -22,7 +22,7 @@ public class Safety extends Scrambler {
|
||||
return encryptString(email, plainText);
|
||||
} else {
|
||||
|
||||
if (!RootUtilities.isRooted()) {
|
||||
if (RootUtilities.isRooted()) {
|
||||
return new String(Base64.encode(plainText.getBytes(), Base64.DEFAULT));
|
||||
} else {
|
||||
Log.e(Scrambler.DEBUG_TAG, "Password store in this devices isn't safe because is rooted");
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="#cfd5dd" android:state_checked="true" />
|
||||
<item android:color="#ffffff" />
|
||||
<item android:color="@color/colorPrimary" android:state_checked="true" />
|
||||
<item android:color="#000000" />
|
||||
</selector>
|
9
app/src/main/res/drawable/border.xml
Normal file
9
app/src/main/res/drawable/border.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:centerColor="@android:color/transparent"
|
||||
android:centerX="0.01"
|
||||
android:startColor="#60606060" />
|
||||
</shape>
|
12
app/src/main/res/drawable/ic_arrow_down.xml
Normal file
12
app/src/main/res/drawable/ic_arrow_down.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="35dp"
|
||||
android:height="35dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z" />
|
||||
<path android:pathData="M0-.75h24v24H0z" />
|
||||
</vector>
|
@ -23,7 +23,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="?android:attr/windowBackground"
|
||||
android:background="@color/colorBackgroundBottomNavi"
|
||||
app:itemIconTint="@color/bottomnavi_color"
|
||||
app:itemTextColor="@color/bottomnavi_color"
|
||||
app:menu="@menu/navigation" />
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
@ -26,7 +27,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:ems="10"
|
||||
android:hint="@string/email_hint"
|
||||
android:hint="@string/email_hint_text"
|
||||
android:inputType="textEmailAddress" />
|
||||
|
||||
<EditText
|
||||
@ -37,8 +38,9 @@
|
||||
android:layout_marginTop="10dp"
|
||||
android:ems="10"
|
||||
android:fontFamily="sans-serif"
|
||||
android:hint="@string/pass_hint"
|
||||
android:inputType="textPassword" />
|
||||
android:hint="@string/pass_hint_text"
|
||||
android:inputType="textPassword"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/countyText"
|
||||
@ -46,7 +48,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:hint="@string/county_hint"
|
||||
android:hint="@string/county_hint_text"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="text" />
|
||||
|
||||
@ -57,7 +59,7 @@
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="20dp"
|
||||
android:onClick="login"
|
||||
android:text="@string/login_button" />
|
||||
android:text="@string/login_button_text" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -1,54 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="io.github.wulkanowy.activity.started.StartedActivity"
|
||||
tools:layout_editor_absoluteX="0dp"
|
||||
tools:layout_editor_absoluteY="0dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logoImage"
|
||||
android:layout_width="250dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="70dp"
|
||||
android:src="@drawable/logo_image"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameApp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="228dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="40sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.503"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
tools:layout_constraintBottom_creator="1"
|
||||
tools:layout_constraintLeft_creator="1"
|
||||
tools:layout_constraintRight_creator="1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logoImage"
|
||||
android:layout_width="201dp"
|
||||
android:layout_height="176dp"
|
||||
android:layout_marginBottom="53dp"
|
||||
android:src="@drawable/logo_image"
|
||||
app:layout_constraintBottom_toTopOf="@+id/nameApp"
|
||||
app:layout_constraintHorizontal_bias="0.503"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
tools:layout_constraintBottom_creator="1"
|
||||
tools:layout_constraintLeft_creator="1"
|
||||
tools:layout_constraintRight_creator="1" />
|
||||
android:textSize="40sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rawText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="57dp"
|
||||
android:text="@string/under_logo"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/nameApp"
|
||||
tools:layout_constraintLeft_creator="1"
|
||||
tools:layout_constraintRight_creator="1"
|
||||
tools:layout_constraintTop_creator="1" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="@string/version_text"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
@ -2,13 +2,12 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="io.github.wulkanowy.activity.dashboard.marks.MarksFragment">
|
||||
tools:context="io.github.wulkanowy.activity.dashboard.grades.GradesFragment">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/card_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="vertical" />
|
||||
android:id="@+id/subject_grade_recycler" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/loadingPanel"
|
59
app/src/main/res/layout/grade_item.xml
Normal file
59
app/src/main/res/layout/grade_item.xml
Normal file
@ -0,0 +1,59 @@
|
||||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/grade_cardview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:foreground="?attr/selectableItemBackgroundBorderless"
|
||||
card_view:cardElevation="0dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:layout_marginEnd="7dp"
|
||||
android:layout_marginLeft="7dp"
|
||||
android:layout_marginRight="7dp"
|
||||
android:layout_marginStart="7dp"
|
||||
android:layout_marginTop="7dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/grade_text"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center"
|
||||
android:textSize="19sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_grade_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_toEndOf="@+id/grade_text"
|
||||
android:layout_toRightOf="@+id/grade_text"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="19sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/grade_date_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/grade_text"
|
||||
android:layout_alignLeft="@+id/description_grade_text"
|
||||
android:layout_alignStart="@+id/description_grade_text"
|
||||
android:text="@string/grades_text"
|
||||
android:textSize="13sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
</android.support.v7.widget.CardView>
|
180
app/src/main/res/layout/grades_dialog.xml
Normal file
180
app/src/main/res/layout/grades_dialog.xml
Normal file
@ -0,0 +1,180 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:minHeight="350dp"
|
||||
android:minWidth="300dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dialog_grade_text"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="70dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="30sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject_dialog_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginEnd="80dp"
|
||||
android:layout_marginRight="80dp"
|
||||
android:text="@string/dialog_subject_text"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject_dialog_text_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/subject_dialog_text"
|
||||
android:layout_marginEnd="80dp"
|
||||
android:layout_marginRight="80dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="@string/grades_text"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_dialog_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_description_text"
|
||||
android:textSize="17sp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_below="@+id/subject_dialog_text_value"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_dialog_text_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/description_dialog_text"
|
||||
android:layout_marginEnd="80dp"
|
||||
android:layout_marginRight="80dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:maxLines="3"
|
||||
android:text="@string/noDescription_text"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/weight_dialog_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/description_dialog_text_value"
|
||||
android:layout_marginEnd="80dp"
|
||||
android:layout_marginRight="80dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/dialog_weight_text"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/weight_dialog_text_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/weight_dialog_text"
|
||||
android:layout_marginEnd="80dp"
|
||||
android:layout_marginRight="80dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="@string/grades_text"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/teacher_dialog_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/dialog_teacher_text"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/teacher_dialog_text_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="@string/grades_text"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/color_dialog_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/dialog_color_text"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/color_dialog_text_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="@string/grades_text"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date_dialog_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/dialog_date_text"
|
||||
android:textSize="17sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date_dialog_text_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="@string/grades_text"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="19dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/OK_dialog"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/ok_text"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:layout_marginRight="1dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#FFFFFF"
|
||||
android:gravity="center"
|
||||
android:lines="2"
|
||||
android:textColor="#000000"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
35
app/src/main/res/layout/subject_item.xml
Normal file
35
app/src/main/res/layout/subject_item.xml
Normal file
@ -0,0 +1,35 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/border"
|
||||
android:foreground="?attr/selectableItemBackgroundBorderless">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="19sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/group_indicator_down"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
app:srcCompat="@drawable/ic_arrow_down" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/group_indicator_up"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:rotation="180"
|
||||
app:srcCompat="@drawable/ic_arrow_down" />
|
||||
|
||||
</RelativeLayout>
|
@ -4,26 +4,26 @@
|
||||
<item
|
||||
android:id="@+id/navigation_marks"
|
||||
android:icon="@drawable/icon_marks_26dp"
|
||||
android:title="@string/title_marks" />
|
||||
android:title="@string/grades_text" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_attendance"
|
||||
android:icon="@drawable/icon_attendance_24dp"
|
||||
android:title="@string/title_attendance" />
|
||||
android:title="@string/attendance_text" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_dashboard"
|
||||
android:icon="@drawable/ic_dashboard_black_24dp"
|
||||
android:title="@string/title_dashboard" />
|
||||
android:title="@string/dashboard_text" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_lessonplan"
|
||||
android:icon="@drawable/icon_lessonplan_24dp"
|
||||
android:title="@string/title_lessonplan" />
|
||||
android:title="@string/lessonplan_text" />
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_settings"
|
||||
android:icon="@drawable/icon_other_24dp"
|
||||
android:title="@string/title_settings" />
|
||||
android:title="@string/settings_text" />
|
||||
|
||||
</menu>
|
||||
|
@ -1,29 +1,42 @@
|
||||
<resources>
|
||||
<string name="app_name">Wulkanowy</string>
|
||||
<string name="under_logo">Surowa wersja</string>
|
||||
<string name="login_title">Logowanie</string>
|
||||
<string name="pass_hint">Hasło</string>
|
||||
<string name="email_hint">E-mail</string>
|
||||
<string name="login_button">Zaloguj</string>
|
||||
<string name="county_hint">Powiat</string>
|
||||
<string name="login_text">Logowanie</string>
|
||||
<string name="pass_hint_text">Hasło</string>
|
||||
<string name="email_hint_text">E-mail</string>
|
||||
<string name="login_button_text">Zaloguj</string>
|
||||
<string name="county_hint_text">Powiat</string>
|
||||
<string name="warning_text">Aplikacja ta nie jest ukończona, więc mogą występować różnego rodzaju błędy lub dane funkcje nie bedą działać. Prosimy o cierpliwość i wyrozumiałość.</string>
|
||||
<string name="warning_label">Ostrzeżenie</string>
|
||||
<string name="warning_label_text">Ostrzeżenie</string>
|
||||
<string name="data_text">Brak danych logowania</string>
|
||||
<string name="login_accepted">Pomyślnie zalogowano</string>
|
||||
<string name="login_bad_credentials">Niepoprawny e-mail lub hasło</string>
|
||||
<string name="login_bad_account_permission">Brak uprawnień do otwarcia dziennika. Sprawdź wprowadzoną nazwę powiatu</string>
|
||||
<string name="login_denied">Logowanie nie powiodło się</string>
|
||||
<string name="please_wait">Proszę czekać…</string>
|
||||
<string name="title_activity_dashboard">Aktywność dashboard</string>
|
||||
<string name="title_dashboard">Dashboard</string>
|
||||
<string name="title_marks">Oceny</string>
|
||||
<string name="title_attendance">Frekwencja</string>
|
||||
<string name="title_lessonplan">Plan lekcji</string>
|
||||
<string name="title_settings">Ustawienia</string>
|
||||
<string name="login_accepted_text">Pomyślnie zalogowano</string>
|
||||
<string name="login_bad_credentials_text">Niepoprawny e-mail lub hasło</string>
|
||||
<string name="login_bad_account_permission_text">Brak uprawnień do otwarcia dziennika. Sprawdź wprowadzoną nazwę powiatu</string>
|
||||
<string name="login_denied_text">Logowanie nie powiodło się</string>
|
||||
<string name="please_wait_text">Proszę czekać…</string>
|
||||
<string name="activity_dashboard_text">Aktywność dashboard</string>
|
||||
<string name="dashboard_text">Dashboard</string>
|
||||
<string name="grades_text">Oceny</string>
|
||||
<string name="attendance_text">Frekwencja</string>
|
||||
<string name="lessonplan_text">Plan lekcji</string>
|
||||
<string name="settings_text">Ustawienia</string>
|
||||
<string name="noInternet_text">Brak połączenia z internetem</string>
|
||||
<string name="login_cookies_save_failed">Nie udało się zapisać sesji</string>
|
||||
<string name="login_cookies_save_failed_text">Nie udało się zapisać sesji</string>
|
||||
<string name="SQLite_ioError_text">W bazie danych wystąpił błąd. Zrestartuj aplikacje a także sprawdź iość wolnego miejsca w pamięci wewnętrznej</string>
|
||||
<string name="root_failed">To urządzenie posiada posiada podwyższone uprawnienia (root). Automatyczne logowanie zosatło wyłączone.</string>
|
||||
<string name="encrypt_failed">Szyfrowanie nie powiodło się. Automatyczne logowanie zostało wyłączone</string>
|
||||
<string name="decrypt_failed">Deszyfrowanie nie powiodło się. Automatyczne logowanie zostało wyłączone</string>
|
||||
<string name="root_failed_text">To urządzenie posiada posiada podwyższone uprawnienia (root). Automatyczne logowanie zosatło wyłączone.</string>
|
||||
<string name="encrypt_failed_text">Szyfrowanie nie powiodło się. Automatyczne logowanie zostało wyłączone</string>
|
||||
<string name="decrypt_failed_text">Deszyfrowanie nie powiodło się. Automatyczne logowanie zostało wyłączone</string>
|
||||
<string name="version_text">Wersja\u0020</string>
|
||||
<string name="dialog_description_text">Opis</string>
|
||||
<string name="dialog_weight_text">Waga</string>
|
||||
<string name="noDescription_text">Brak opisu</string>
|
||||
<string name="dialog_teacher_text">Nauczyciel</string>
|
||||
<string name="dialog_date_text">Data</string>
|
||||
<string name="dialog_color_text">Kolor</string>
|
||||
<string name="color_black_text">Czarny</string>
|
||||
<string name="color_red_text">Czerwony</string>
|
||||
<string name="color_blue_text">Niebieski</string>
|
||||
<string name="color_green_text">Zielony</string>
|
||||
<string name="noColor_text">Brak koloru</string>
|
||||
<string name="ok_text">OK</string>
|
||||
<string name="dialog_subject_text">Przedmiot</string>
|
||||
</resources>
|
||||
|
@ -1,6 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="colorPrimary">#d32f2f</color>
|
||||
<color name="colorPrimaryDark">#9a0007</color>
|
||||
<color name="colorPrimaryLight">#ff6659</color>
|
||||
<color name="colorBackgroundBottomNavi">#f0f0f0</color>
|
||||
<color name="white">#ffffff</color>
|
||||
<color name="six_grade">#92b53d</color>
|
||||
<color name="five_grade">#66B266</color>
|
||||
<color name="four_grade">#55BBDB</color>
|
||||
<color name="three_grade">#FFE68C</color>
|
||||
<color name="two_grade">#CE9AD2</color>
|
||||
<color name="one_grade">#d32f2f</color>
|
||||
<color name="default_grade">#cdcdcd</color>
|
||||
</resources>
|
||||
|
@ -1,29 +1,42 @@
|
||||
<resources>
|
||||
<string name="app_name">Wulkanowy</string>
|
||||
<string name="under_logo">Raw version</string>
|
||||
<string name="login_title">Login</string>
|
||||
<string name="pass_hint">Password</string>
|
||||
<string name="email_hint">E-mail</string>
|
||||
<string name="login_button">Log in</string>
|
||||
<string name="county_hint">County</string>
|
||||
<string name="login_text">Login</string>
|
||||
<string name="pass_hint_text">Password</string>
|
||||
<string name="email_hint_text">E-mail</string>
|
||||
<string name="login_button_text">Log in</string>
|
||||
<string name="county_hint_text">County</string>
|
||||
<string name="warning_text">This application is not complete, so there may be a variety of errors or features that will not work. Please be patient and understanding.</string>
|
||||
<string name="warning_label">Warning</string>
|
||||
<string name="warning_label_text">Warning</string>
|
||||
<string name="data_text">No login data</string>
|
||||
<string name="login_accepted">Login is successful</string>
|
||||
<string name="login_bad_credentials">Bad e-mail or password</string>
|
||||
<string name="login_bad_account_permission">No permission to open log. Check entered county name</string>
|
||||
<string name="login_denied">Login is failed</string>
|
||||
<string name="please_wait">Please wait…</string>
|
||||
<string name="title_activity_dashboard">Dashboard Activity</string>
|
||||
<string name="title_dashboard">Dashboard</string>
|
||||
<string name="title_marks">Marks</string>
|
||||
<string name="title_attendance">Attendance</string>
|
||||
<string name="title_lessonplan">Lesson Plan</string>
|
||||
<string name="title_settings">Settings</string>
|
||||
<string name="login_accepted_text">Login is successful</string>
|
||||
<string name="login_bad_credentials_text">Bad e-mail or password</string>
|
||||
<string name="login_bad_account_permission_text">No permission to open log. Check entered county name</string>
|
||||
<string name="login_denied_text">Login is failed</string>
|
||||
<string name="please_wait_text">Please wait…</string>
|
||||
<string name="activity_dashboard_text">Dashboard Activity</string>
|
||||
<string name="dashboard_text">Dashboard</string>
|
||||
<string name="grades_text">Grades</string>
|
||||
<string name="attendance_text">Attendance</string>
|
||||
<string name="lessonplan_text">Lesson Plan</string>
|
||||
<string name="settings_text">Settings</string>
|
||||
<string name="noInternet_text">No internet connection</string>
|
||||
<string name="login_cookies_save_failed">Failed to save session</string>
|
||||
<string name="login_cookies_save_failed_text">Failed to save session</string>
|
||||
<string name="SQLite_ioError_text">An error occurred in the database. Restart the applications and check the free space in the internal memory</string>
|
||||
<string name="root_failed">This device is rooted. Automatic login has been disabled</string>
|
||||
<string name="encrypt_failed">Encryption failed. Automatic login has been disabled</string>
|
||||
<string name="decrypt_failed">Decrypt is failed. Automatic login has been disable</string>
|
||||
<string name="root_failed_text">This device is rooted. Automatic login has been disabled</string>
|
||||
<string name="encrypt_failed_text">Encryption failed. Automatic login has been disabled</string>
|
||||
<string name="decrypt_failed_text">Decrypt is failed. Automatic login has been disable</string>
|
||||
<string name="version_text">Version\u0020</string>
|
||||
<string name="dialog_description_text">Description</string>
|
||||
<string name="dialog_weight_text">Weight</string>
|
||||
<string name="noDescription_text">No description</string>
|
||||
<string name="dialog_teacher_text">Teacher</string>
|
||||
<string name="dialog_date_text">Date</string>
|
||||
<string name="dialog_color_text">Color</string>
|
||||
<string name="color_black_text">Black</string>
|
||||
<string name="color_red_text">Red</string>
|
||||
<string name="color_blue_text">Blue</string>
|
||||
<string name="color_green_text">Green</string>
|
||||
<string name="noColor_text">No color</string>
|
||||
<string name="ok_text">OK</string>
|
||||
<string name="dialog_subject_text">Subject</string>
|
||||
</resources>
|
||||
|
@ -1,9 +1,23 @@
|
||||
<resources>
|
||||
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<style name="WulkanowyTheme" parent="Theme.AppCompat.Light">
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="colorAccent">@color/colorPrimary</item>
|
||||
<item name="actionMenuTextColor">@android:color/primary_text_dark</item>
|
||||
<item name="android:textColorPrimary">@android:color/primary_text_light</item>
|
||||
<item name="android:textColorSecondary">@android:color/primary_text_light</item>
|
||||
<item name="android:textColorSecondaryInverse">@android:color/primary_text_dark</item>
|
||||
<item name="android:textColorTertiary">@android:color/primary_text_light</item>
|
||||
<item name="android:textColorTertiaryInverse">@android:color/primary_text_dark</item>
|
||||
<item name="titleTextColor">@android:color/primary_text_dark</item>
|
||||
<item name="subtitleTextColor">@android:color/primary_text_dark</item>
|
||||
<item name="android:colorBackground">@color/white</item>
|
||||
</style>
|
||||
|
||||
<style name="WulkanowyTheme.noActionBar" parent="WulkanowyTheme">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user