interfaces -> kt

This commit is contained in:
Milos Kozak 2021-03-07 14:37:05 +01:00
parent fcb4d00ba2
commit 54ad6caf83
7 changed files with 60 additions and 139 deletions

View file

@ -129,7 +129,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
holder.binding.clone.tag = profileSwitch
holder.binding.name.tag = profileSwitch
holder.binding.date.tag = profileSwitch
holder.binding.invalid.visibility = if (profileSwitch.isValid()) View.GONE else View.VISIBLE
holder.binding.invalid.visibility = if (profileSwitch.isValid) View.GONE else View.VISIBLE
}
override fun getItemCount(): Int {

View file

@ -1,28 +0,0 @@
package info.nightscout.androidaps.interfaces;
import dagger.android.HasAndroidInjector;
/**
* Created by mike on 21.05.2017.
*/
public interface Interval {
long durationInMsec();
long start();
// planned end time at time of creation
long originalEnd();
// end time after cut
long end();
void cutEndTo(long end);
boolean match(long time);
boolean before(long time);
boolean after(long time);
boolean isInProgress();
boolean isEndingEvent();
boolean isValid();
}

View file

@ -0,0 +1,20 @@
package info.nightscout.androidaps.interfaces
interface Interval {
fun durationInMsec(): Long
fun start(): Long
// planned end time at time of creation
fun originalEnd(): Long
// end time after cut
fun end(): Long
fun cutEndTo(end: Long)
fun match(time: Long): Boolean
fun before(time: Long): Boolean
fun after(time: Long): Boolean
val isInProgress: Boolean
val isEndingEvent: Boolean
val isValid: Boolean
}

View file

@ -1,96 +0,0 @@
package info.nightscout.androidaps.interfaces;
public class PluginDescription {
PluginType mainType = PluginType.GENERAL;
String fragmentClass = null;
public boolean alwaysVisible = false;
public boolean neverVisible = false;
public boolean alwaysEnabled = false;
boolean showInList = true;
int pluginName = -1;
int shortName = -1;
int description = -1;
int preferencesId = -1;
public boolean enableByDefault = false;
public boolean visibleByDefault = false;
boolean defaultPlugin = false;
int pluginIcon = -1;
public PluginDescription mainType(PluginType mainType) {
this.mainType = mainType;
return this;
}
public PluginDescription fragmentClass(String fragmentClass) {
this.fragmentClass = fragmentClass;
return this;
}
public PluginDescription alwaysEnabled(boolean alwaysEnabled) {
this.alwaysEnabled = alwaysEnabled;
return this;
}
public PluginDescription alwaysVisible(boolean alwaysVisible) {
this.alwaysVisible = alwaysVisible;
return this;
}
public PluginDescription neverVisible(boolean neverVisible) {
this.neverVisible = neverVisible;
return this;
}
public PluginDescription showInList(boolean showInList) {
this.showInList = showInList;
return this;
}
public PluginDescription pluginIcon(int pluginIcon) {
this.pluginIcon = pluginIcon;
return this;
}
public PluginDescription pluginName(int pluginName) {
this.pluginName = pluginName;
return this;
}
public PluginDescription shortName(int shortName) {
this.shortName = shortName;
return this;
}
public PluginDescription preferencesId(int preferencesId) {
this.preferencesId = preferencesId;
return this;
}
public PluginDescription enableByDefault(boolean enableByDefault) {
this.enableByDefault = enableByDefault;
return this;
}
public PluginDescription visibleByDefault(boolean visibleByDefault) {
this.visibleByDefault = visibleByDefault;
return this;
}
public PluginDescription description(int description) {
this.description = description;
return this;
}
public PluginDescription setDefault() {
defaultPlugin = true;
return this;
}
public String getFragmentClass() {
return fragmentClass;
}
public PluginType getType() {
return mainType;
}
}

View file

@ -0,0 +1,34 @@
package info.nightscout.androidaps.interfaces
class PluginDescription {
var mainType = PluginType.GENERAL
var fragmentClass: String? = null
var alwaysVisible = false
var neverVisible = false
var alwaysEnabled = false
var showInList = true
var pluginName = -1
var shortName = -1
var description = -1
var preferencesId = -1
var enableByDefault = false
var visibleByDefault = false
var defaultPlugin = false
var pluginIcon = -1
fun mainType(mainType: PluginType): PluginDescription = this.also { it.mainType = mainType }
fun fragmentClass(fragmentClass: String?): PluginDescription = this.also { it.fragmentClass = fragmentClass }
fun alwaysEnabled(alwaysEnabled: Boolean): PluginDescription = this.also { it.alwaysEnabled = alwaysEnabled }
fun alwaysVisible(alwaysVisible: Boolean): PluginDescription = this.also { it.alwaysVisible = alwaysVisible }
fun neverVisible(neverVisible: Boolean): PluginDescription = this.also { it.neverVisible = neverVisible }
fun showInList(showInList: Boolean): PluginDescription = this.also { it.showInList = showInList }
fun pluginIcon(pluginIcon: Int): PluginDescription = this.also { it.pluginIcon = pluginIcon }
fun pluginName(pluginName: Int): PluginDescription = this.also { it.pluginName = pluginName }
fun shortName(shortName: Int): PluginDescription = this.also { it.shortName = shortName }
fun preferencesId(preferencesId: Int): PluginDescription = this.also { it.preferencesId = preferencesId }
fun enableByDefault(enableByDefault: Boolean): PluginDescription = this.also { it.enableByDefault = enableByDefault }
fun visibleByDefault(visibleByDefault: Boolean): PluginDescription = this.also { it.visibleByDefault = visibleByDefault }
fun description(description: Int): PluginDescription = this.also { it.description = description }
fun setDefault(): PluginDescription = this.also { it.defaultPlugin = true }
}

View file

@ -1,14 +0,0 @@
package info.nightscout.androidaps.interfaces;
public enum PluginType {
GENERAL,
TREATMENT,
SENSITIVITY,
PROFILE,
APS,
PUMP,
CONSTRAINTS,
LOOP,
BGSOURCE,
INSULIN
}

View file

@ -0,0 +1,5 @@
package info.nightscout.androidaps.interfaces
enum class PluginType {
GENERAL, TREATMENT, SENSITIVITY, PROFILE, APS, PUMP, CONSTRAINTS, LOOP, BGSOURCE, INSULIN
}