Skip to content

Commit

Permalink
fix issue #12
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethosa committed Apr 11, 2022
1 parent 8d66676 commit f40c0a9
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ethosa.ktc.ui.activities

import android.os.Bundle
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.bumptech.glide.Glide
Expand Down Expand Up @@ -32,6 +33,7 @@ class AlbumActivity(
binding = ActivityAlbumBinding.inflate(layoutInflater)
setContentView(binding.root)
setSupportActionBar(binding.toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
AppDynamicTheme(this).loadTheme()

// Setup recycler view
Expand All @@ -41,8 +43,6 @@ class AlbumActivity(
binding.albumContent.album.setHasFixedSize(true)
binding.albumContent.album.addItemDecoration(SpacingItemDecoration(8))

binding.albumBackButton.setOnClickListener { finish() }

// Fetch intent extra data
binding.toolbarLayout.title = intent.getStringExtra("title")
Glide.with(binding.root)
Expand All @@ -52,6 +52,11 @@ class AlbumActivity(
college.fetchAlbumById(intent.getStringExtra("id")!!, this)
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
finish()
return super.onOptionsItemSelected(item)
}

/**
* Fetches album content
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.ethosa.ktc.ui.activities

import android.animation.ObjectAnimator
import android.os.Bundle
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
import androidx.core.text.HtmlCompat
import com.bumptech.glide.Glide
Expand Down Expand Up @@ -32,10 +33,9 @@ class WallPostActivity : AppCompatActivity(), CollegeCallback {
binding = ActivityWallPostBinding.inflate(layoutInflater)
setContentView(binding.root)
setSupportActionBar(binding.toolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
AppDynamicTheme(this).loadTheme()

binding.albumBackButton.setOnClickListener { finish() }

// Loads intent data to toolbarLayout
setSupportActionBar(findViewById(R.id.toolbar))
binding.toolbarLayout.title = intent.getStringExtra("title")
Expand All @@ -49,6 +49,11 @@ class WallPostActivity : AppCompatActivity(), CollegeCallback {
college.fetchNewById(intent.getStringExtra("id")!!.toInt(), this)
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
finish()
return super.onOptionsItemSelected(item)
}

/**
* Fetches a news data
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class TimetableFragment : IOFragmentBackPressed() {
val json = response.body?.string()
val branches = Gson().fromJson(json, Branches::class.java)

requireActivity().runOnUiThread {
activity!!.runOnUiThread {
if (_binding == null) return@runOnUiThread
binding.back.isEnabled = true
binding.timetableToolbar.visibility = View.GONE
Expand All @@ -168,7 +168,7 @@ class TimetableFragment : IOFragmentBackPressed() {
val json = response.body?.string()
val courses = Gson().fromJson(json, Courses::class.java)

requireActivity().runOnUiThread {
activity!!.runOnUiThread {
if (_binding == null) return@runOnUiThread
binding.back.isEnabled = true
binding.timetableToolbar.visibility = View.VISIBLE
Expand Down Expand Up @@ -197,7 +197,7 @@ class TimetableFragment : IOFragmentBackPressed() {
val timetable = Gson().fromJson(json, Week::class.java)
Preferences.week = timetable.week_number

requireActivity().runOnUiThread {
activity!!.runOnUiThread {
if (_binding == null) return@runOnUiThread
binding.back.isEnabled = true
binding.next.isEnabled = true
Expand Down Expand Up @@ -230,7 +230,7 @@ class TimetableFragment : IOFragmentBackPressed() {
val timetable = Gson().fromJson(json, TeacherTimetable::class.java)
Preferences.teacherId = teacherId

requireActivity().runOnUiThread {
activity!!.runOnUiThread {
if (_binding == null) return@runOnUiThread
binding.back.isEnabled = true
binding.timetableTitle.text = timetable.title
Expand Down Expand Up @@ -258,7 +258,7 @@ class TimetableFragment : IOFragmentBackPressed() {
val teachers = Gson().fromJson(json, TeachersList::class.java)
teachers.teachers.removeAt(0)

requireActivity().runOnUiThread {
activity!!.runOnUiThread {
if (_binding == null) return@runOnUiThread
binding.back.isEnabled = true
binding.timetableToolbar.visibility = View.VISIBLE
Expand Down
11 changes: 1 addition & 10 deletions app/src/main/res/layout/activity_album.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,9 @@
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
app:layout_collapseMode="pin"
android:theme="@style/Theme.KTC.PopupOverlay"
app:popupTheme="@style/Theme.KTC.PopupOverlay" />

<ImageView
android:id="@+id/album_back_button"
android:layout_width="54dp"
android:layout_height="48dp"
app:layout_collapseMode="pin"
app:srcCompat="@drawable/ic_angle_circle_left"
app:tint="?android:textColorPrimary"
tools:tint="?android:textColorPrimary"
tools:ignore="ContentDescription" />

</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>

Expand Down
11 changes: 1 addition & 10 deletions app/src/main/res/layout/activity_wall_post.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,9 @@
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
app:layout_collapseMode="pin"
android:theme="@style/Theme.KTC.PopupOverlay"
app:popupTheme="@style/Theme.KTC.PopupOverlay" />

<ImageView
android:id="@+id/album_back_button"
android:layout_width="54dp"
android:layout_height="48dp"
app:layout_collapseMode="pin"
app:srcCompat="@drawable/ic_angle_circle_left"
app:tint="?android:textColorPrimary"
tools:tint="?android:textColorPrimary"
tools:ignore="ContentDescription" />

</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/layout_album_preview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:id="@+id/holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="@color/background"
app:cardBackgroundColor="?cardBackgroundColor"
app:cardCornerRadius="8dp"
app:cardElevation="8dp"
app:cardMaxElevation="8dp">
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<item name="tickColorInactive">@color/inactive</item>
<item name="tickColorActive">@color/active</item>
<item name="titleTextColor">@color/text</item>
</style>


Expand Down Expand Up @@ -54,5 +55,6 @@

<item name="tickColorInactive">@color/material_dynamic_neutral_variant60</item>
<item name="tickColorActive">@color/material_dynamic_tertiary90</item>
<item name="titleTextColor">@color/material_dynamic_neutral_variant80</item>
</style>
</resources>
4 changes: 3 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
<item name="background">@color/background_secondary</item>
</style>

<style name="Theme.KTC.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="Theme.KTC.PopupOverlay" parent="ThemeOverlay.AppCompat.Light">
<item name="android:textColorSecondary">?titleTextColor</item>
</style>

<style name="Theme.KTC.AppWidgetContainerParent" parent="@android:style/Theme.DeviceDefault">
<item name="appWidgetRadius">16dp</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

<item name="tickColorInactive">@color/inactive</item>
<item name="tickColorActive">@color/active</item>
<item name="titleTextColor">@color/text</item>
</style>


Expand Down Expand Up @@ -55,5 +56,6 @@

<item name="tickColorInactive">@color/material_dynamic_neutral_variant20</item>
<item name="tickColorActive">@color/material_dynamic_tertiary40</item>
<item name="titleTextColor">@color/material_dynamic_neutral_variant20</item>
</style>
</resources>

0 comments on commit f40c0a9

Please sign in to comment.