From aaddc9df335ef04b7ecfe6b70909cb93de5e3f17 Mon Sep 17 00:00:00 2001 From: Defend Date: Sat, 11 Feb 2017 00:53:14 +0300 Subject: [PATCH] Extracted methods in CabinetActivity for driving TextViews of profile. Some lang edits. --- .../defdevteam/tstu/CabinetActivity.java | 48 +++++++++++++++---- app/src/main/res/layout/cabinet_profile.xml | 24 +++++----- app/src/main/res/values-en/strings.xml | 4 ++ app/src/main/res/values-ru/strings.xml | 4 ++ app/src/main/res/values/strings.xml | 4 ++ 5 files changed, 62 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java b/app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java index 1167678..a25a6d6 100644 --- a/app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java +++ b/app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java @@ -337,6 +337,33 @@ public class CabinetActivity extends AppCompatActivity return 0; } + public void setStudentName(String string){ + studentGroup.setText(string); + } + + public void setStudentGroup(String string) { + studentGroup.setText(getString(R.string.cabinet_group_name) + string); + } + + public void setStudentRate(String string) { + studentRate.setText(getString(R.string.cabinet_student_rate) + string); + } + + public void setProgressVisibility(Boolean visible) { + if(visible){ + progressLayout.setVisibility(View.VISIBLE); + } else { + progressLayout.setVisibility(View.INVISIBLE); + } + } + + public void setGroupPosition(String position) { + positionGroup.setText(getString(R.string.cabinet_group_position) + position); + } + + public void setFacultyPosition(String position) { + positionFaculty.setText(getString(R.string.cabinet_faculty_position) + position); + } // Контент генератор public void taskGenerator(int state){ @@ -346,10 +373,9 @@ public class CabinetActivity extends AppCompatActivity case 2: MainHTML = siteBuf; String studNameGroup = parser.cutLine("", - "", - MainHTML); - studentName.setText(parser.cutLine(""," /",studNameGroup)); - studentGroup.setText("Группа: " + parser.cutLine("/ ","",studNameGroup)); + "", MainHTML); + setStudentName(parser.cutLine(""," /",studNameGroup)); + setStudentGroup(parser.cutLine("/ ","",studNameGroup)); loadSite("javascript:apex.submit('T_ЗАНЯТИЯ/ОЦЕНКИ');"); break; case 3: @@ -367,7 +393,7 @@ public class CabinetActivity extends AppCompatActivity case 5: RateValueHTML = siteBuf; String rate = parser.cutLine("","",RateValueHTML); - studentRate.setText("Балл: " + rate); + setStudentRate(rate); GroupRateURL = "http://web-iais.admin.tstu.ru:7777/zion/" + parser.cutLine(">",RateValueHTML); FacultyRateURL = "http://web-iais.admin.tstu.ru:7777/zion/" + parser.cutLine("", RateValueHTML); loadSite(GroupRateURL); @@ -382,7 +408,7 @@ public class CabinetActivity extends AppCompatActivity fillFaculty(); fillAll(); taskFinished = true; - progressLayout.setVisibility(View.INVISIBLE); + setProgressVisibility(false); break; } @@ -454,8 +480,10 @@ public class CabinetActivity extends AppCompatActivity s = parser.cutLine("",s); } s2 = parser.cutLine("","",s2); - Log.i("GroupPos",s2); - positionGroup.setText("Место в группе: " + s2); + //***// + Log.i(getString(R.string.cabinet_group_position), s2); + //***// + setGroupPosition(s2); s = ""; s2 = FacultyRateHTML; s = parser.cutLine("","",FacultyRateHTML); @@ -466,8 +494,8 @@ public class CabinetActivity extends AppCompatActivity s = parser.cutLine("",s); } s2 = parser.cutLine("","",s2); - Log.i("FacultyPos",s2); - positionFaculty.setText("Место в институте: " + s2); + Log.i(getString(R.string.cabinet_faculty_position),s2); + setFacultyPosition(s2); } @TargetApi(19) diff --git a/app/src/main/res/layout/cabinet_profile.xml b/app/src/main/res/layout/cabinet_profile.xml index d392595..b50d0d8 100644 --- a/app/src/main/res/layout/cabinet_profile.xml +++ b/app/src/main/res/layout/cabinet_profile.xml @@ -30,7 +30,7 @@ android:layout_height="fill_parent"> android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" - android:text="Группа: " + android:text="@string/cabinet_group_name" android:id="@+id/studentGroup" android:layout_below="@+id/studentName" android:layout_alignLeft="@+id/studentName" @@ -40,7 +40,7 @@ android:layout_height="fill_parent"> android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" - android:text="Балл:" + android:text="@string/cabinet_student_rate" android:id="@+id/studentRate" android:layout_below="@+id/studentGroup" android:layout_alignLeft="@+id/studentGroup" @@ -50,20 +50,20 @@ android:layout_height="fill_parent"> android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" - android:text="Место в группе:" + android:text="@string/cabinet_group_position" android:id="@+id/positionGroup" android:layout_below="@+id/studentRate" android:layout_alignLeft="@+id/studentRate" android:layout_alignStart="@+id/studentRate" /> - + \ No newline at end of file diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index 70e1b2c..0581d2c 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -31,4 +31,8 @@ Log Out TSTU Student App http://defend.pw/ + "Faculty position: " + "Group: " + "Group position: " + "Your rate: " \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 661fca7..b044071 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -31,4 +31,8 @@ Выйти из кабинета TSTU Student App http://defend.pw/ + "Место в группе: " + "Позиция в институте: " + "Группа: " + "Твой балл: " \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a678296..2397fe7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -34,4 +34,8 @@ Выйти из кабинета TSTU Студенческий Кабинет http://defend.pw/ + "Место в группе: " + "Позиция в институте: " + "Группа: " + "Твой балл: "