Skip to content

Instantly share code, notes, and snippets.

@NsAveek
Last active March 2, 2019 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NsAveek/aabd73f11c633cee2245d3775b94e3df to your computer and use it in GitHub Desktop.
Save NsAveek/aabd73f11c633cee2245d3775b94e3df to your computer and use it in GitHub Desktop.
State Classes that extends from Base interface
class State1 : IState1 {
var featureAvailable = false
private set
get() = field
var totalFeature = ""
private set
get() = field
var consumedFeature = ""
private set
get() = field
var defaultMarginBottom = 0
private set
get() = field
var leftIcon: Int = 0
private set
get() = field
var packageExpiry = false
private set
get() = field
var videoPackageExpiry = ""
private set
get() = field
override fun setPackageExpiryVisibility() {
packageExpiry = true
}
override fun setParams(icon: Int, hasLimitedPackage: Boolean, totalFeature: Int, consumedFeature: Int, expiry : String) {
if (hasLimitedPackage) {
featureAvailable = true
defaultMarginBottom = 10
}
totalFeature = " $totalFreeFeature " + context.getString(R.string.free_counter)
consumedFeature = " $consumedFreeFeature " + context.getString(R.string.free_balance)
leftIcon = icon
packageExpiry = expiry
}
}
class State2 : IState2 {
var featureAvailable = false
private set
get() = field
var totalFeature = ""
private set
get() = field
var totalConsumed = ""
private set
get() = field
var defaultMarginBottom = 0
private set
get() = field
var leftIcon: Int = 0
private set
get() = field
var packageExpiry = false
private set
get() = field
override fun setPackageExpiryVisibility() {
packageExpiry = false
}
override fun setParams(icon: Int, hasLimitedPackage: Boolean, totalFeature: Int, consumedFeature: Int) {
if (hasLimitedPackage) {
featureAvailable = true
defaultMarginBottom = 10
}
totalFeature = " $totalFreeFeature " + context.getString(R.string.free_counter)
totalConsumed = " $consumedFreeFeature " + context.getString(R.string.free_balance)
leftIcon = icon
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment