Browse Source

little refactoring

Ethosa 3 years ago
parent
commit
1b9516e8db

+ 1 - 1
.idea/deploymentTargetDropDown.xml

@@ -12,6 +12,6 @@
         </deviceKey>
       </Target>
     </targetSelectedWithDropDown>
-    <timeTargetWasSelectedWithDropDown value="2022-04-15T14:14:36.172074500Z" />
+    <timeTargetWasSelectedWithDropDown value="2022-04-16T10:11:01.647505700Z" />
   </component>
 </project>

+ 2 - 6
app/src/main/java/com/ethosa/ktc/ui/adapters/TimetableAdapter.kt

@@ -35,8 +35,6 @@ class TimetableAdapter(
     @SuppressLint("SimpleDateFormat")
     override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
         dateFormat = SimpleDateFormat("mm:ss")
-        dateFormat.isLenient = false
-        dateFormat.timeZone = TimeZone.getTimeZone("Europe/Krasnoyarsk")
 
         val calendar = Calendar.getInstance()
         val day = calendar.get(Calendar.DAY_OF_WEEK)
@@ -56,10 +54,8 @@ class TimetableAdapter(
      * Binds every lesson in day.
      */
     override fun onBindViewHolder(holder: ViewHolder, position: Int) {
-        val binding = holder.binding
         val day = week.days[position]
-
-        binding.dayHeader.text = day.title
+        holder.binding.dayHeader.text = day.title
 
         var lesson: LayoutLessonBinding
         for (l in day.lessons) {
@@ -81,7 +77,7 @@ class TimetableAdapter(
                 if (current in from..to && weekday.title == day.title)
                     lesson.root.setBackgroundResource(R.color.foreground_alpha)
 
-                binding.root.addView(root)
+                holder.binding.root.addView(root)
             }
         }
     }

+ 0 - 2
app/src/main/java/com/ethosa/ktc/ui/widgets/TimetableWidget.kt

@@ -106,8 +106,6 @@ class TimetableWidget : AppWidgetProvider() {
         val now = "${calendar.get(Calendar.HOUR_OF_DAY)}:${Calendar.MINUTE}"
 
         val dateFormat = SimpleDateFormat("mm:ss")
-        dateFormat.isLenient = false
-        dateFormat.timeZone = TimeZone.getTimeZone("Europe/Krasnoyarsk")
 
         CollegeApi.fetchTimetable(groupId, object : CollegeCallback {
             @SuppressLint("SetTextI18n")

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -64,4 +64,5 @@
 
     <string name="placeholder">Placeholder</string>
     <string name="app_version_string">v0.0.1</string>
+    <string name="title_activity_main">MainActivity</string>
 </resources>