-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update sample app implementation
- Loading branch information
Showing
76 changed files
with
984 additions
and
1,138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 21 additions & 18 deletions
39
app/src/main/kotlin/co/anitrend/retrofit/graphql/core/settings/Settings.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
package co.anitrend.retrofit.graphql.core.settings | ||
|
||
import android.content.Context | ||
import co.anitrend.arch.extension.preference.BooleanPreference | ||
import co.anitrend.arch.extension.preference.IntPreference | ||
import co.anitrend.arch.extension.preference.StringPreference | ||
import co.anitrend.arch.extension.preference.SupportSettings | ||
import co.anitrend.arch.extension.preference.SupportPreference | ||
import co.anitrend.arch.extension.settings.BooleanSetting | ||
import co.anitrend.arch.extension.settings.IntSetting | ||
import co.anitrend.arch.extension.settings.StringSetting | ||
import co.anitrend.retrofit.graphql.data.authentication.settings.IAuthenticationSettings | ||
import co.anitrend.retrofit.graphql.sample.R | ||
|
||
class Settings(context: Context) : SupportSettings(context), IAuthenticationSettings { | ||
class Settings(context: Context) : SupportPreference(context), IAuthenticationSettings { | ||
|
||
override var authenticatedUserId by StringPreference( | ||
R.string.setting_authenticated_user_id, | ||
IAuthenticationSettings.INVALID_USER_ID, | ||
context.resources | ||
override val authenticatedUserId = StringSetting( | ||
key = R.string.setting_authenticated_user_id, | ||
default = IAuthenticationSettings.INVALID_USER_ID, | ||
resources = context.resources, | ||
preference = this, | ||
) | ||
|
||
override var isNewInstallation by BooleanPreference( | ||
R.string.setting_is_new_installation, | ||
true, | ||
context.resources | ||
override val isNewInstallation = BooleanSetting( | ||
key = R.string.setting_is_new_installation, | ||
default = true, | ||
resources = context.resources, | ||
preference = this, | ||
) | ||
|
||
override var versionCode by IntPreference( | ||
R.string.setting_version_code, | ||
1, | ||
context.resources | ||
override val versionCode = IntSetting( | ||
key = R.string.setting_version_code, | ||
default = 1, | ||
resources = context.resources, | ||
preference = this, | ||
) | ||
|
||
companion object { | ||
val BINDINGS = arrayOf( | ||
Settings::class, SupportSettings::class, IAuthenticationSettings::class | ||
Settings::class, SupportPreference::class, IAuthenticationSettings::class | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 13 additions & 6 deletions
19
app/src/main/kotlin/co/anitrend/retrofit/graphql/core/view/SampleListFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
package co.anitrend.retrofit.graphql.core.view | ||
|
||
import androidx.lifecycle.Observer | ||
import co.anitrend.arch.domain.entities.NetworkState | ||
import co.anitrend.arch.core.model.ISupportViewModelState | ||
import co.anitrend.arch.ui.fragment.list.SupportFragmentList | ||
import org.koin.android.scope.AndroidScopeComponent | ||
import org.koin.androidx.scope.fragmentScope | ||
import org.koin.core.component.KoinScopeComponent | ||
|
||
abstract class SampleListFragment<M : Any> : SupportFragmentList<M>() { | ||
override val onRefreshObserver = Observer<NetworkState> { | ||
// workaround for support-arch:ui on refresh overrides network state | ||
} | ||
abstract class SampleListFragment<M : Any> : SupportFragmentList<M>(), | ||
AndroidScopeComponent, KoinScopeComponent { | ||
|
||
override val scope by fragmentScope() | ||
|
||
/** | ||
* Proxy for a view model state if one exists | ||
*/ | ||
override fun viewModelState(): ISupportViewModelState<*>? = null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
app/src/main/kotlin/co/anitrend/retrofit/graphql/data/arch/common/SampleMapper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package co.anitrend.retrofit.graphql.data.arch.common | ||
|
||
import co.anitrend.arch.data.mapper.contract.ISupportMapperHelper | ||
import co.anitrend.arch.data.mapper.SupportResponseMapper | ||
import co.anitrend.retrofit.graphql.domain.common.EntityId | ||
|
||
/** | ||
* @param E entity | ||
* @param M model | ||
*/ | ||
internal abstract class SampleMapper<E: EntityId, M: Any> { | ||
protected abstract fun from(): ISupportMapperHelper<E, M> | ||
protected abstract fun to(): ISupportMapperHelper<M, E> | ||
protected abstract fun from(): SupportResponseMapper<E, M> | ||
protected abstract fun to(): SupportResponseMapper<M, E> | ||
} |
Oops, something went wrong.