diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index b6bb60dee8..bc9cf30a15 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -134,6 +134,7 @@ public class MainApp extends DaggerApplication { @Inject DanaRv2Plugin danaRv2Plugin; @Inject DanaRKoreanPlugin danaRKoreanPlugin; @Inject DstHelperPlugin dstHelperPlugin; + @Inject FoodPlugin foodPlugin; @Inject InsulinOrefFreePeakPlugin insulinOrefFreePeakPlugin; @Inject InsulinOrefRapidActingPlugin insulinOrefRapidActingPlugin; @Inject InsulinOrefUltraRapidActingPlugin insulinOrefUltraRapidActingPlugin; @@ -260,7 +261,7 @@ public class MainApp extends DaggerApplication { pluginsList.add(eversensePlugin); pluginsList.add(randomBgPlugin); if (!Config.NSCLIENT) pluginsList.add(smsCommunicatorPlugin); - pluginsList.add(FoodPlugin.getPlugin()); + pluginsList.add(foodPlugin); pluginsList.add(wearPlugin); pluginsList.add(statusLinePlugin); diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt index a97dea3c4f..1922eed5a0 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt @@ -33,6 +33,7 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsFragment import info.nightscout.androidaps.dialogs.WizardInfoDialog import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog +import info.nightscout.androidaps.plugins.general.food.FoodFragment import info.nightscout.androidaps.plugins.general.maintenance.MaintenanceFragment import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsBolusFragment import info.nightscout.androidaps.plugins.treatments.fragments.TreatmentsCareportalFragment @@ -50,6 +51,7 @@ abstract class FragmentsModule { @ContributesAndroidInjector abstract fun contributesCareportalFragment(): CareportalFragment @ContributesAndroidInjector abstract fun contributesConfigBuilderFragment(): ConfigBuilderFragment @ContributesAndroidInjector abstract fun contributesDanaRFragment(): DanaRFragment + @ContributesAndroidInjector abstract fun contributesFoodFragment(): FoodFragment @ContributesAndroidInjector abstract fun contributesLocalProfileFragment(): LocalProfileFragment @ContributesAndroidInjector abstract fun contributesObjectivesFragment(): ObjectivesFragment @ContributesAndroidInjector abstract fun contributesOpenAPSAMAFragment(): OpenAPSAMAFragment diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.java deleted file mode 100644 index 402bac8a6b..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.java +++ /dev/null @@ -1,285 +0,0 @@ -package info.nightscout.androidaps.plugins.general.food; - -import android.graphics.Paint; -import android.os.Bundle; -import android.text.Editable; -import android.text.TextWatcher; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; -import android.widget.EditText; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import info.nightscout.androidaps.MainApp; -import info.nightscout.androidaps.R; -import info.nightscout.androidaps.events.EventFoodDatabaseChanged; -import info.nightscout.androidaps.plugins.bus.RxBus; -import info.nightscout.androidaps.plugins.general.nsclient.NSUpload; -import info.nightscout.androidaps.utils.FabricPrivacy; -import info.nightscout.androidaps.utils.OKDialog; -import info.nightscout.androidaps.utils.SpinnerHelper; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.disposables.CompositeDisposable; - -/** - * Created by mike on 16.10.2017. - */ - -public class FoodFragment extends Fragment { - private CompositeDisposable disposable = new CompositeDisposable(); - - private EditText filter; - private SpinnerHelper category; - private SpinnerHelper subcategory; - private RecyclerView recyclerView; - - private List unfiltered; - private List filtered; - - private final String EMPTY = MainApp.gs(R.string.none); - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.food_fragment, container, false); - filter = view.findViewById(R.id.food_filter); - ImageView clearFilter = view.findViewById(R.id.food_clearfilter); - category = new SpinnerHelper(view.findViewById(R.id.food_category)); - subcategory = new SpinnerHelper(view.findViewById(R.id.food_subcategory)); - recyclerView = view.findViewById(R.id.food_recyclerview); - recyclerView.setHasFixedSize(true); - LinearLayoutManager llm = new LinearLayoutManager(view.getContext()); - recyclerView.setLayoutManager(llm); - - clearFilter.setOnClickListener(v -> { - filter.setText(""); - category.setSelection(0); - subcategory.setSelection(0); - filterData(); - }); - - category.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView parent, View view, int position, long id) { - fillSubcategories(); - filterData(); - } - - @Override - public void onNothingSelected(AdapterView parent) { - fillSubcategories(); - filterData(); - } - }); - - subcategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView parent, View view, int position, long id) { - filterData(); - } - - @Override - public void onNothingSelected(AdapterView parent) { - filterData(); - } - }); - - filter.addTextChangedListener(new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - filterData(); - } - - @Override - public void afterTextChanged(Editable s) { - } - }); - - RecyclerViewAdapter adapter = new RecyclerViewAdapter(FoodPlugin.getPlugin().getService().getFoodData()); - recyclerView.setAdapter(adapter); - - loadData(); - fillCategories(); - fillSubcategories(); - filterData(); - return view; - } - - @Override - public synchronized void onResume() { - super.onResume(); - disposable.add(RxBus.Companion.getINSTANCE() - .toObservable(EventFoodDatabaseChanged.class) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(event -> updateGui(), FabricPrivacy::logException) - ); - updateGui(); - } - - @Override - public synchronized void onPause() { - super.onPause(); - disposable.clear(); - } - - private void loadData() { - unfiltered = FoodPlugin.getPlugin().getService().getFoodData(); - } - - private void fillCategories() { - Set catSet = new HashSet<>(); - - for (Food f : unfiltered) { - if (f.category != null && !f.category.equals("")) - catSet.add(f.category); - } - - // make it unique - ArrayList categories = new ArrayList<>(catSet); - categories.add(0, MainApp.gs(R.string.none)); - - ArrayAdapter adapterCategories = new ArrayAdapter<>(getContext(), - R.layout.spinner_centered, categories); - category.setAdapter(adapterCategories); - } - - private void fillSubcategories() { - String categoryFilter = category.getSelectedItem().toString(); - - Set subCatSet = new HashSet<>(); - - if (!categoryFilter.equals(EMPTY)) { - for (Food f : unfiltered) { - if (f.category != null && f.category.equals(categoryFilter)) - if (f.subcategory != null && !f.subcategory.equals("")) - subCatSet.add(f.subcategory); - } - } - - // make it unique - ArrayList subcategories = new ArrayList<>(subCatSet); - subcategories.add(0, MainApp.gs(R.string.none)); - - ArrayAdapter adapterSubcategories = new ArrayAdapter<>(getContext(), - R.layout.spinner_centered, subcategories); - subcategory.setAdapter(adapterSubcategories); - } - - private void filterData() { - String textFilter = filter.getText().toString(); - String categoryFilter = category.getSelectedItem().toString(); - String subcategoryFilter = subcategory.getSelectedItem().toString(); - - filtered = new ArrayList<>(); - - for (Food f : unfiltered) { - if (f.name == null || f.category == null || f.subcategory == null) - continue; - - if (!subcategoryFilter.equals(EMPTY) && !f.subcategory.equals(subcategoryFilter)) - continue; - if (!categoryFilter.equals(EMPTY) && !f.category.equals(categoryFilter)) - continue; - if (!textFilter.equals("") && !f.name.toLowerCase().contains(textFilter.toLowerCase())) - continue; - filtered.add(f); - } - - updateGui(); - } - - protected void updateGui() { - recyclerView.swapAdapter(new FoodFragment.RecyclerViewAdapter(filtered), true); - } - - public class RecyclerViewAdapter extends RecyclerView.Adapter { - - List foodList; - - RecyclerViewAdapter(List foodList) { - this.foodList = foodList; - } - - @NonNull - @Override - public FoodsViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) { - View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.food_item, viewGroup, false); - return new FoodsViewHolder(v); - } - - @Override - public void onBindViewHolder(FoodsViewHolder holder, int position) { - Food food = foodList.get(position); - holder.ns.setVisibility(food._id != null ? View.VISIBLE : View.GONE); - holder.name.setText(food.name); - holder.portion.setText(food.portion + food.units); - holder.carbs.setText(food.carbs + MainApp.gs(R.string.shortgramm)); - holder.fat.setText(MainApp.gs(R.string.shortfat) + ": " + food.fat + MainApp.gs(R.string.shortgramm)); - if (food.fat == 0) - holder.fat.setVisibility(View.INVISIBLE); - holder.protein.setText(MainApp.gs(R.string.shortprotein) + ": " + food.protein + MainApp.gs(R.string.shortgramm)); - if (food.protein == 0) - holder.protein.setVisibility(View.INVISIBLE); - holder.energy.setText(MainApp.gs(R.string.shortenergy) + ": " + food.energy + MainApp.gs(R.string.shortkilojoul)); - if (food.energy == 0) - holder.energy.setVisibility(View.INVISIBLE); - holder.remove.setTag(food); - } - - @Override - public int getItemCount() { - return foodList.size(); - } - - class FoodsViewHolder extends RecyclerView.ViewHolder { - TextView name; - TextView portion; - TextView carbs; - TextView fat; - TextView protein; - TextView energy; - TextView ns; - TextView remove; - - FoodsViewHolder(View itemView) { - super(itemView); - name = itemView.findViewById(R.id.food_name); - portion = itemView.findViewById(R.id.food_portion); - carbs = itemView.findViewById(R.id.food_carbs); - fat = itemView.findViewById(R.id.food_fat); - protein = itemView.findViewById(R.id.food_protein); - energy = itemView.findViewById(R.id.food_energy); - ns = itemView.findViewById(R.id.ns_sign); - remove = itemView.findViewById(R.id.food_remove); - remove.setOnClickListener(v -> { - final Food food = (Food) v.getTag(); - OKDialog.showConfirmation(getContext(), MainApp.gs(R.string.confirmation), MainApp.gs(R.string.removerecord) + "\n" + food.name, (dialog, id) -> { - final String _id = food._id; - if (_id != null && !_id.equals("")) { - NSUpload.removeFoodFromNS(_id); - } - FoodPlugin.getPlugin().getService().delete(food); - }, null); - }); - remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); - } - } - } -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.kt new file mode 100644 index 0000000000..f5c6721498 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodFragment.kt @@ -0,0 +1,211 @@ +package info.nightscout.androidaps.plugins.general.food + +import android.content.DialogInterface +import android.graphics.Paint +import android.os.Bundle +import android.text.Editable +import android.text.TextWatcher +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.AdapterView +import android.widget.ArrayAdapter +import android.widget.TextView +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import dagger.android.support.DaggerFragment +import info.nightscout.androidaps.R +import info.nightscout.androidaps.events.EventFoodDatabaseChanged +import info.nightscout.androidaps.plugins.bus.RxBusWrapper +import info.nightscout.androidaps.plugins.general.food.FoodFragment.RecyclerViewAdapter.FoodsViewHolder +import info.nightscout.androidaps.plugins.general.nsclient.NSUpload +import info.nightscout.androidaps.utils.FabricPrivacy +import info.nightscout.androidaps.utils.OKDialog.showConfirmation +import info.nightscout.androidaps.utils.resources.ResourceHelper +import io.reactivex.android.schedulers.AndroidSchedulers +import io.reactivex.disposables.CompositeDisposable +import kotlinx.android.synthetic.main.food_fragment.* +import java.util.* +import javax.inject.Inject + +class FoodFragment : DaggerFragment() { + + @Inject lateinit var rxBus: RxBusWrapper + @Inject lateinit var resourceHelper: ResourceHelper + @Inject lateinit var foodPlugin: FoodPlugin + + private val disposable = CompositeDisposable() + private lateinit var unfiltered: List + private lateinit var filtered: MutableList + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + return inflater.inflate(R.layout.food_fragment, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + food_recyclerview.setHasFixedSize(true) + food_recyclerview.setLayoutManager(LinearLayoutManager(view.context)) + food_recyclerview.adapter = RecyclerViewAdapter(foodPlugin.service.foodData) + + food_clearfilter.setOnClickListener { + food_filter.setText("") + food_category.setSelection(0) + food_subcategory.setSelection(0) + filterData() + } + food_category.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { + override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) { + fillSubcategories() + filterData() + } + + override fun onNothingSelected(parent: AdapterView<*>?) { + fillSubcategories() + filterData() + } + } + food_subcategory.setOnItemSelectedListener(object : AdapterView.OnItemSelectedListener { + override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) { + filterData() + } + + override fun onNothingSelected(parent: AdapterView<*>?) { + filterData() + } + }) + food_filter.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {} + override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { + filterData() + } + + override fun afterTextChanged(s: Editable) {} + }) + loadData() + fillCategories() + fillSubcategories() + filterData() + } + + @Synchronized override fun onResume() { + super.onResume() + disposable.add(rxBus + .toObservable(EventFoodDatabaseChanged::class.java) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe({ updateGui() }) { FabricPrivacy.logException(it) } + ) + updateGui() + } + + @Synchronized override fun onPause() { + super.onPause() + disposable.clear() + } + + private fun loadData() { + unfiltered = foodPlugin.service.foodData + } + + private fun fillCategories() { + val catSet: MutableSet = HashSet() + for (f in unfiltered) { + if (f.category != null && f.category != "") catSet.add(f.category) + } + // make it unique + val categories = ArrayList(catSet) + categories.add(0, resourceHelper.gs(R.string.none)) + context?.let { context -> + val adapterCategories = ArrayAdapter(context, R.layout.spinner_centered, categories) + food_category.adapter = adapterCategories + } + } + + private fun fillSubcategories() { + val categoryFilter = food_category.selectedItem.toString() + val subCatSet: MutableSet = HashSet() + if (categoryFilter != resourceHelper.gs(R.string.none)) { + for (f in unfiltered) { + if (f.category != null && f.category == categoryFilter) if (f.subcategory != null && f.subcategory != "") subCatSet.add(f.subcategory) + } + } + // make it unique + val subcategories = ArrayList(subCatSet) + subcategories.add(0, resourceHelper.gs(R.string.none)) + context?.let { context -> + val adapterSubcategories = ArrayAdapter(context, R.layout.spinner_centered, subcategories) + food_subcategory.adapter = adapterSubcategories + } + } + + private fun filterData() { + val textFilter = food_filter.text.toString() + val categoryFilter = food_category.selectedItem.toString() + val subcategoryFilter = food_subcategory.selectedItem.toString() + val newfiltered = ArrayList() + for (f in unfiltered) { + if (f.name == null || f.category == null || f.subcategory == null) continue + if (subcategoryFilter != resourceHelper.gs(R.string.none) && f.subcategory != subcategoryFilter) continue + if (categoryFilter != resourceHelper.gs(R.string.none) && f.category != categoryFilter) continue + if (textFilter != "" && !f.name.toLowerCase(Locale.getDefault()).contains(textFilter.toLowerCase(Locale.getDefault()))) continue + newfiltered.add(f) + } + filtered = newfiltered + updateGui() + } + + protected fun updateGui() { + food_recyclerview?.swapAdapter(RecyclerViewAdapter(filtered), true) + } + + inner class RecyclerViewAdapter internal constructor(var foodList: List) : RecyclerView.Adapter() { + override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): FoodsViewHolder { + val v = LayoutInflater.from(viewGroup.context).inflate(R.layout.food_item, viewGroup, false) + return FoodsViewHolder(v) + } + + override fun onBindViewHolder(holder: FoodsViewHolder, position: Int) { + val food = foodList[position] + holder.ns.visibility = if (food._id != null) View.VISIBLE else View.GONE + holder.name.text = food.name + holder.portion.text = food.portion.toString() + food.units + holder.carbs.text = food.carbs.toString() + resourceHelper.gs(R.string.shortgramm) + holder.fat.text = resourceHelper.gs(R.string.shortfat) + ": " + food.fat + resourceHelper.gs(R.string.shortgramm) + if (food.fat == 0) holder.fat.visibility = View.INVISIBLE + holder.protein.text = resourceHelper.gs(R.string.shortprotein) + ": " + food.protein + resourceHelper.gs(R.string.shortgramm) + if (food.protein == 0) holder.protein.visibility = View.INVISIBLE + holder.energy.text = resourceHelper.gs(R.string.shortenergy) + ": " + food.energy + resourceHelper.gs(R.string.shortkilojoul) + if (food.energy == 0) holder.energy.visibility = View.INVISIBLE + holder.remove.tag = food + } + + override fun getItemCount(): Int = foodList.size + + inner class FoodsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + var name: TextView = itemView.findViewById(R.id.food_name) + var portion: TextView = itemView.findViewById(R.id.food_portion) + var carbs: TextView = itemView.findViewById(R.id.food_carbs) + var fat: TextView = itemView.findViewById(R.id.food_fat) + var protein: TextView = itemView.findViewById(R.id.food_protein) + var energy: TextView = itemView.findViewById(R.id.food_energy) + var ns: TextView = itemView.findViewById(R.id.ns_sign) + var remove: TextView = itemView.findViewById(R.id.food_remove) + + init { + remove.setOnClickListener { v: View -> + val food = v.tag as Food + activity?.let { activity -> + showConfirmation(activity, resourceHelper.gs(R.string.confirmation), resourceHelper.gs(R.string.removerecord) + "\n" + food.name, DialogInterface.OnClickListener { _: DialogInterface?, _: Int -> + if (food._id != null && food._id != "") { + NSUpload.removeFoodFromNS(food._id) + } + foodPlugin.service.delete(food) + }, null) + } + } + remove.paintFlags = remove.paintFlags or Paint.UNDERLINE_TEXT_FLAG + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodPlugin.java deleted file mode 100644 index 2b9ba5af2d..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodPlugin.java +++ /dev/null @@ -1,39 +0,0 @@ -package info.nightscout.androidaps.plugins.general.food; - -import info.nightscout.androidaps.R; -import info.nightscout.androidaps.interfaces.PluginBase; -import info.nightscout.androidaps.interfaces.PluginDescription; -import info.nightscout.androidaps.interfaces.PluginType; - -/** - * Created by mike on 05.08.2016. - */ -public class FoodPlugin extends PluginBase { - - private static FoodPlugin plugin = null; - - @Deprecated - public static FoodPlugin getPlugin() { - if (plugin == null) - plugin = new FoodPlugin(); - return plugin; - } - - private FoodService service; - - private FoodPlugin() { - super(new PluginDescription() - .mainType(PluginType.GENERAL) - .fragmentClass(FoodFragment.class.getName()) - .pluginName(R.string.food) - .shortName(R.string.food_short) - .description(R.string.description_food) - ); - this.service = new FoodService(); - } - - public FoodService getService() { - return this.service; - } - -} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodPlugin.kt new file mode 100644 index 0000000000..7a52d74d16 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/food/FoodPlugin.kt @@ -0,0 +1,20 @@ +package info.nightscout.androidaps.plugins.general.food + +import info.nightscout.androidaps.R +import info.nightscout.androidaps.interfaces.PluginBase +import info.nightscout.androidaps.interfaces.PluginDescription +import info.nightscout.androidaps.interfaces.PluginType +import javax.inject.Inject +import javax.inject.Singleton + +@Singleton +class FoodPlugin @Inject constructor() : PluginBase(PluginDescription() + .mainType(PluginType.GENERAL) + .fragmentClass(FoodFragment::class.java.name) + .pluginName(R.string.food) + .shortName(R.string.food_short) + .description(R.string.description_food) +) { + + val service: FoodService = FoodService() +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt index 2dcbafd113..34b4210222 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/MaintenanceFragment.kt @@ -22,6 +22,7 @@ class MaintenanceFragment : DaggerFragment() { @Inject lateinit var mainApp: MainApp @Inject lateinit var resourceHelper: ResourceHelper @Inject lateinit var treatmentsPlugin: TreatmentsPlugin + @Inject lateinit var foodPlugin: FoodPlugin override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.maintenance_fragment, container, false) @@ -37,7 +38,7 @@ class MaintenanceFragment : DaggerFragment() { MainApp.getDbHelper().resetDatabases() // should be handled by Plugin-Interface and // additional service interface and plugin registry - FoodPlugin.getPlugin().service.resetFood() + foodPlugin.service.resetFood() treatmentsPlugin.service.resetTreatments() }) }