Browse Source

Extracted methods in CabinetActivity for driving TextViews of profile. Some lang edits.

master
Defend 8 years ago
parent
commit
aaddc9df33
  1. 48
      app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java
  2. 24
      app/src/main/res/layout/cabinet_profile.xml
  3. 4
      app/src/main/res/values-en/strings.xml
  4. 4
      app/src/main/res/values-ru/strings.xml
  5. 4
      app/src/main/res/values/strings.xml

48
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("<span id=\\\"P1_STUD\\\" class=\\\"display_only\\\" style=\\\"font-size: 120%; font-family:Verdana, Arial, Helvetica, sans-serif; color: #0000FF; font-weight:bold\\\">",
"</span>",
MainHTML);
studentName.setText(parser.cutLine(""," /",studNameGroup));
studentGroup.setText("Группа: " + parser.cutLine("/ ","",studNameGroup));
"</span>", 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("<td align=\\\"center\\\" headers=\\\"STUDRATE\\\">","</td>",RateValueHTML);
studentRate.setText("Балл: " + rate);
setStudentRate(rate);
GroupRateURL = "http://web-iais.admin.tstu.ru:7777/zion/" + parser.cutLine("><td headers=\\\"GROUP_NAME\\\"><a href=\\\"","\\\">",RateValueHTML);
FacultyRateURL = "http://web-iais.admin.tstu.ru:7777/zion/" + parser.cutLine("<td headers=\\\"INST\\\"><a href=\\\"","\\\">", 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("<font","</font>",s);
}
s2 = parser.cutLine("<td align=\\\"center\\\" headers=\\\"ROWNUM\\\">","</td>",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("<tr>","</tr>",FacultyRateHTML);
@ -466,8 +494,8 @@ public class CabinetActivity extends AppCompatActivity
s = parser.cutLine("<font","</font>",s);
}
s2 = parser.cutLine("<td align=\\\"center\\\" headers=\\\"ROWNUM\\\">","</td>",s2);
Log.i("FacultyPos",s2);
positionFaculty.setText("Место в институте: " + s2);
Log.i(getString(R.string.cabinet_faculty_position),s2);
setFacultyPosition(s2);
}
@TargetApi(19)

24
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" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Место в институте:"
android:id="@+id/positionFaculty"
android:layout_below="@+id/positionGroup"
android:layout_alignLeft="@+id/positionGroup"
android:layout_alignStart="@+id/positionGroup" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/cabinet_faculty_position"
android:id="@+id/positionFaculty"
android:layout_below="@+id/positionGroup"
android:layout_alignLeft="@+id/positionGroup"
android:layout_alignStart="@+id/positionGroup" />
</RelativeLayout>

4
app/src/main/res/values-en/strings.xml

@ -31,4 +31,8 @@
<string name="nav_add_log_out">Log Out</string>
<string name="nav_header_title">TSTU Student App</string>
<string name="dev_site">http://defend.pw/</string>
<string name="cabinet_faculty_position">"Faculty position: "</string>
<string name="cabinet_group_name">"Group: "</string>
<string name="cabinet_group_position">"Group position: "</string>
<string name="cabinet_student_rate">"Your rate: "</string>
</resources>

4
app/src/main/res/values-ru/strings.xml

@ -31,4 +31,8 @@
<string name="nav_add_log_out">Выйти из кабинета</string>
<string name="nav_header_title">TSTU Student App</string>
<string name="dev_site">http://defend.pw/</string>
<string name="cabinet_group_position">"Место в группе: "</string>
<string name="cabinet_faculty_position">"Позиция в институте: "</string>
<string name="cabinet_group_name">"Группа: "</string>
<string name="cabinet_student_rate">"Твой балл: "</string>
</resources>

4
app/src/main/res/values/strings.xml

@ -34,4 +34,8 @@
<string name="nav_add_log_out">Выйти из кабинета</string>
<string name="nav_header_title">TSTU Студенческий Кабинет</string>
<string name="dev_site">http://defend.pw/</string>
<string name="cabinet_group_position">"Место в группе: "</string>
<string name="cabinet_faculty_position">"Позиция в институте: "</string>
<string name="cabinet_group_name">"Группа: "</string>
<string name="cabinet_student_rate">"Твой балл: "</string>
</resources>

Loading…
Cancel
Save