Skip to content

Commit 7c38ba0

Browse files
author
alllexey
committed
Add settings button
1 parent 905738a commit 7c38ba0

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

app/src/main/java/me/alllexey123/itmowidgets/ui/schedule/ScheduleActivity.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ import androidx.appcompat.app.AppCompatActivity
1212
import androidx.recyclerview.widget.LinearLayoutManager
1313
import androidx.recyclerview.widget.PagerSnapHelper
1414
import androidx.recyclerview.widget.RecyclerView
15+
import com.google.android.material.floatingactionbutton.FloatingActionButton
1516
import me.alllexey123.itmowidgets.ItmoWidgetsApp
1617
import me.alllexey123.itmowidgets.R
18+
import me.alllexey123.itmowidgets.ui.settings.SettingsActivity
1719
import java.time.LocalDate
1820

1921
class ScheduleActivity : AppCompatActivity() {
2022
private lateinit var outerRecyclerView: RecyclerView
2123
private lateinit var dayScheduleAdapter: DayScheduleAdapter
2224
private lateinit var progressBar: ProgressBar
2325

26+
private lateinit var fabSettings: FloatingActionButton
27+
2428
private val snapHelper = PagerSnapHelper()
2529

2630
private val scheduleViewModel: ScheduleViewModel by viewModels {
@@ -33,13 +37,21 @@ class ScheduleActivity : AppCompatActivity() {
3337
setContentView(R.layout.activity_schedule)
3438

3539
setupRecyclerView()
40+
setupButtons()
3641
progressBar = findViewById(R.id.loadingProgressBar)
37-
3842
observeUiState()
3943

4044
scheduleViewModel.fetchScheduleData()
4145
}
4246

47+
private fun setupButtons() {
48+
fabSettings = findViewById(R.id.fab_settings)
49+
fabSettings.setOnClickListener { view ->
50+
val intent = Intent(this, SettingsActivity::class.java)
51+
startActivity(intent)
52+
}
53+
}
54+
4355
private fun setupRecyclerView() {
4456
outerRecyclerView = findViewById(R.id.outerRecyclerView)
4557
outerRecyclerView.layoutManager =

app/src/main/res/layout/activity_schedule.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,15 @@
2727
app:layout_constraintStart_toStartOf="parent"
2828
app:layout_constraintEnd_toEndOf="parent"
2929
android:visibility="visible" />
30+
31+
32+
<com.google.android.material.floatingactionbutton.FloatingActionButton
33+
android:id="@+id/fab_settings"
34+
android:layout_width="wrap_content"
35+
android:layout_height="wrap_content"
36+
android:layout_margin="16dp"
37+
app:srcCompat="@drawable/ic_settings"
38+
app:layout_constraintBottom_toBottomOf="parent"
39+
app:layout_constraintEnd_toEndOf="parent" />
40+
3041
</androidx.constraintlayout.widget.ConstraintLayout>

0 commit comments

Comments
 (0)