ProfileHelperActivity -> ui

This commit is contained in:
Milos Kozak 2022-11-11 09:04:37 +01:00
parent 88899417a9
commit 18204d06b9
9 changed files with 32 additions and 32 deletions

View file

@ -86,11 +86,6 @@
android:name=".activities.HistoryBrowseActivity"
android:exported="false"
android:theme="@style/AppTheme" />
<activity
android:name=".activities.ProfileHelperActivity"
android:exported="false"
android:theme="@style/AppTheme" />
<!-- Receive new BG readings from other local apps -->
<receiver
android:name=".receivers.DataReceiver"

View file

@ -33,7 +33,7 @@ import com.joanzapata.iconify.fonts.FontAwesomeModule
import info.nightscout.androidaps.activities.HistoryBrowseActivity
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.activities.ProfileHelperActivity
import info.nightscout.ui.activities.ProfileHelperActivity
import info.nightscout.androidaps.activities.SingleFragmentActivity
import info.nightscout.androidaps.databinding.ActivityMainBinding
import info.nightscout.androidaps.events.EventPreferenceChange

View file

@ -5,7 +5,6 @@ import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.MainActivity
import info.nightscout.androidaps.activities.HistoryBrowseActivity
import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.activities.ProfileHelperActivity
import info.nightscout.androidaps.activities.SingleFragmentActivity
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity
@ -24,6 +23,5 @@ abstract class ActivitiesModule {
@ContributesAndroidInjector abstract fun contributesRequestDexcomPermissionActivity(): RequestDexcomPermissionActivity
@ContributesAndroidInjector abstract fun contributesSetupWizardActivity(): SetupWizardActivity
@ContributesAndroidInjector abstract fun contributesSingleFragmentActivity(): SingleFragmentActivity
@ContributesAndroidInjector abstract fun contributesDefaultProfileActivity(): ProfileHelperActivity
}

View file

@ -533,7 +533,6 @@
<string name="partialboluswizard">Deliver this part of bolus wizard result [%]</string>
<string name="deliverpartofboluswizard">Bolus wizard performs calculation but only this part of calculated insulin is delivered. Useful with SMB algorithm.</string>
<string name="increasingmaxbasal">Increasing max basal value because setting is lower than your max basal in profile</string>
<string name="selected_profile">Selected:</string>
<string name="unitsnosemicolon">Units</string>
<string name="key_wizard_calculation_visible" translatable="false">wizard_calculation_visible</string>
<string name="key_wizard_correction_percent" translatable="false">wizard_correction_percent</string>
@ -545,7 +544,6 @@
<string name="key_wear_showbgi" translatable="false">wear_showbgi</string>
<string name="low_mark_comment">Lower value of in range area (display only)</string>
<string name="high_mark_comment">Higher value of in range area (display only)</string>
<string name="invalidpct">Invalid % entry</string>
<string name="randombg">Random BG</string>
<string name="description_source_randombg">Generate random BG data (Demo mode only)</string>
<string name="randombg_short">BG</string>
@ -576,17 +574,6 @@
<string name="largedisplay_description">Large display</string>
<string name="key_skin" translatable="false">skin</string>
<string name="skin">Skin</string>
<string name="comapareprofile">Compare profiles</string>
<string name="nav_profilehelper">Profile helper</string>
<string name="motoldefaultprofile">Default profile</string>
<string name="currentprofile">Current profile</string>
<string name="availableprofile">Available profile</string>
<string name="profiletype">Profile type</string>
<string name="formatwithtdd">Age: %1$.0f TDD: %2$.0f U</string>
<string name="formatwittddandpct">Age: %1$.0f TDD: %2$.0f U %3$d%%</string>
<string name="formatwithweight">Age: %1$.0f Weight: %2$.0f kg</string>
<string name="basalpctfromtdd_label">% of basal</string>
<string name="dpvdefaultprofile">DPV Default profile</string>
<string name="setupwizard_pump_riley_link_status">RileyLink status:</string>
<string name="copytolocalprofile_invalid">Unable to create profile. Profile is invalid.</string>
<string name="cta_dont_kill_my_app_info">Don\'t kill my app?</string>
@ -662,8 +649,6 @@
<string name="sort_label">Sort</string>
<string name="loop_status">Loop status</string>
<string name="graph_scale">Graph scale</string>
<string name="profile1">Profile 1</string>
<string name="profile2">Profile 2</string>
<string name="a11y_open_settings">open settings</string>
<string name="a11y_set_carb_timer">set carb timer alarm</string>
<string name="device_all">All</string>

View file

@ -47,6 +47,10 @@
android:name="info.nightscout.ui.activities.TreatmentsActivity"
android:exported="false"
android:theme="@style/AppTheme" />
<activity
android:name="info.nightscout.ui.activities.ProfileHelperActivity"
android:exported="false"
android:theme="@style/AppTheme" />
</application>

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.activities
package info.nightscout.ui.activities
import android.annotation.SuppressLint
import android.os.Bundle
@ -8,9 +8,8 @@ import android.widget.ArrayAdapter
import android.widget.TextView
import com.google.android.material.tabs.TabLayout
import com.google.common.collect.Lists
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.databinding.ActivityProfilehelperBinding
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.ProfileFunction
@ -21,12 +20,13 @@ import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.database.entities.EffectiveProfileSwitch
import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.profile.PureProfile
import info.nightscout.plugins.profile.ProfilePlugin
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.events.EventLocalProfileChanged
import info.nightscout.shared.extensions.toVisibility
import info.nightscout.shared.utils.DateUtil
import info.nightscout.shared.utils.T
import info.nightscout.ui.R
import info.nightscout.ui.databinding.ActivityProfilehelperBinding
import info.nightscout.ui.defaultProfile.DefaultProfile
import info.nightscout.ui.defaultProfile.DefaultProfileDPV
import io.reactivex.rxjava3.core.Single
@ -41,7 +41,6 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
@Inject lateinit var profileFunction: ProfileFunction
@Inject lateinit var defaultProfile: DefaultProfile
@Inject lateinit var defaultProfileDPV: DefaultProfileDPV
@Inject lateinit var profilePlugin: ProfilePlugin
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var repository: AppRepository
@ -135,8 +134,8 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
else defaultProfileDPV.profile(age, tdd, pct / 100.0, profileFunction.getUnits())
profile?.let {
OKDialog.showConfirmation(this, rh.gs(R.string.careportal_profileswitch), rh.gs(R.string.copytolocalprofile), Runnable {
profilePlugin.addProfile(
profilePlugin.copyFrom(
activePlugin.activeProfileSource.addProfile(
activePlugin.activeProfileSource.copyFrom(
it, "DefaultProfile " +
dateUtil.dateAndTimeAndSecondsString(dateUtil.now())
.replace(".", "/")
@ -315,4 +314,4 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() {
super.onPause()
disposable.clear()
}
}
}

View file

@ -4,6 +4,7 @@ import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.ui.activities.BolusProgressHelperActivity
import info.nightscout.ui.activities.ErrorHelperActivity
import info.nightscout.ui.activities.ProfileHelperActivity
import info.nightscout.ui.activities.StatsActivity
import info.nightscout.ui.activities.SurveyActivity
import info.nightscout.ui.activities.TDDStatsActivity
@ -35,6 +36,7 @@ abstract class UiModule {
@ContributesAndroidInjector abstract fun contributesStatsActivity(): StatsActivity
@ContributesAndroidInjector abstract fun contributesSurveyActivity(): SurveyActivity
@ContributesAndroidInjector abstract fun contributesTreatmentsActivity(): TreatmentsActivity
@ContributesAndroidInjector abstract fun contributesProfileHelperActivityActivity(): ProfileHelperActivity
@ContributesAndroidInjector abstract fun contributesTreatmentsBolusFragment(): TreatmentsBolusCarbsFragment
@ContributesAndroidInjector abstract fun contributesTreatmentsTemporaryBasalsFragment(): TreatmentsTemporaryBasalsFragment

View file

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".activities.ProfileHelperActivity">
tools:context="info.nightscout.ui.activities.ProfileHelperActivity">
<LinearLayout
android:layout_width="match_parent"

View file

@ -80,4 +80,21 @@
<string name="show_loop_records">Show loop records</string>
<string name="show_hide_records">Hide loop records</string>
<!-- ProfileHelperActivity -->
<string name="profile1">Profile 1</string>
<string name="profile2">Profile 2</string>
<string name="profiletype">Profile type</string>
<string name="basalpctfromtdd_label">% of basal</string>
<string name="selected_profile">Selected:</string>
<string name="comapareprofile">Compare profiles</string>
<string name="nav_profilehelper">Profile helper</string>
<string name="motoldefaultprofile">Default profile</string>
<string name="currentprofile">Current profile</string>
<string name="availableprofile">Available profile</string>
<string name="formatwithtdd">Age: %1$.0f TDD: %2$.0f U</string>
<string name="formatwittddandpct">Age: %1$.0f TDD: %2$.0f U %3$d%%</string>
<string name="formatwithweight">Age: %1$.0f Weight: %2$.0f kg</string>
<string name="dpvdefaultprofile">DPV Default profile</string>
<string name="invalidpct">Invalid % entry</string>
</resources>