-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added functionality for favorites (not yet connected to backend). Als…
…o updated UI for the fitness room list items.
- Loading branch information
Showing
17 changed files
with
735 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
PennMobile/src/main/java/com/pennapps/labs/pennmobile/FitnessPreferencesFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package com.pennapps.labs.pennmobile | ||
|
||
import android.os.Bundle | ||
import android.util.Log | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.TextView | ||
import androidx.fragment.app.DialogFragment | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.pennapps.labs.pennmobile.adapters.FitnessPreferenceAdapter | ||
import com.pennapps.labs.pennmobile.classes.FitnessPreferenceViewModel | ||
|
||
interface CloseListener { | ||
fun updateAdapters() | ||
} | ||
|
||
class FitnessPreferencesFragment(private val dataModel: FitnessPreferenceViewModel, | ||
private val listener: CloseListener) : DialogFragment() { | ||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
return inflater.inflate(R.layout.fragment_fitness_preferences, container, false) | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
val prefAdapter = FitnessPreferenceAdapter(dataModel) | ||
|
||
val recyclerView: RecyclerView = view.findViewById(R.id.fitness_preference_recycler_view) | ||
recyclerView.adapter = prefAdapter | ||
|
||
val cancelText : TextView = view.findViewById(R.id.fitness_fragment_pref_cancel) | ||
cancelText.setOnClickListener { | ||
dataModel.restorePreferences() | ||
dialog?.dismiss() | ||
} | ||
|
||
val saveText : TextView = view.findViewById(R.id.fitness_fragment_pref_save) | ||
saveText.setOnClickListener { | ||
dataModel.updatePositionMap() | ||
dataModel.updateRemotePreferences() | ||
listener.updateAdapters() | ||
|
||
dialog?.dismiss() | ||
} | ||
} | ||
|
||
override fun onStart() { | ||
super.onStart() | ||
val dialog = dialog | ||
|
||
if (dialog != null) { | ||
val width = ViewGroup.LayoutParams.MATCH_PARENT | ||
val height = ViewGroup.LayoutParams.MATCH_PARENT | ||
dialog.window!!.setLayout(width, height) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.