mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-14 21:18:51 -06:00
Implement show sub habits
This commit is contained in:
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.isoron.uhabits.activities.habits.show
|
package org.isoron.uhabits.activities.habits.show
|
||||||
|
|
||||||
import android.content.ContentUris
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.HapticFeedbackConstants
|
import android.view.HapticFeedbackConstants
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
@@ -74,8 +73,15 @@ class ShowHabitActivity : AppCompatActivity(), CommandRunner.Listener {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
val appComponent = (applicationContext as HabitsApplication).component
|
val appComponent = (applicationContext as HabitsApplication).component
|
||||||
val habitList = appComponent.habitList
|
val habitGroupList = appComponent.habitGroupList
|
||||||
habit = habitList.getById(ContentUris.parseId(intent.data!!))!!
|
val parentUUID = intent.getStringExtra("parentUUID")
|
||||||
|
val habitList = if (parentUUID == null) {
|
||||||
|
appComponent.habitList
|
||||||
|
} else {
|
||||||
|
habitGroupList.getByUUID(parentUUID)!!.habitList
|
||||||
|
}
|
||||||
|
val uuid = intent.getStringExtra("habitUUID")!!
|
||||||
|
habit = habitList.getByUUID(uuid)!!
|
||||||
preferences = appComponent.preferences
|
preferences = appComponent.preferences
|
||||||
commandRunner = appComponent.commandRunner
|
commandRunner = appComponent.commandRunner
|
||||||
widgetUpdater = appComponent.widgetUpdater
|
widgetUpdater = appComponent.widgetUpdater
|
||||||
|
|||||||
@@ -63,9 +63,11 @@ class IntentFactory
|
|||||||
fun startSettingsActivity(context: Context) =
|
fun startSettingsActivity(context: Context) =
|
||||||
Intent(context, SettingsActivity::class.java)
|
Intent(context, SettingsActivity::class.java)
|
||||||
|
|
||||||
fun startShowHabitActivity(context: Context, habit: Habit) =
|
fun startShowHabitActivity(context: Context, habit: Habit): Intent {
|
||||||
Intent(context, ShowHabitActivity::class.java).apply {
|
val intent = Intent(context, ShowHabitActivity::class.java)
|
||||||
data = Uri.parse(habit.uriString)
|
intent.putExtra("habitUUID", habit.uuid)
|
||||||
|
intent.putExtra("parentUUID", habit.parentUUID)
|
||||||
|
return intent
|
||||||
}
|
}
|
||||||
|
|
||||||
fun startShowHabitGroupActivity(context: Context, habitGroup: HabitGroup) =
|
fun startShowHabitGroupActivity(context: Context, habitGroup: HabitGroup) =
|
||||||
|
|||||||
Reference in New Issue
Block a user