Skip to content
Permalink
Browse files

Attempt an experimental view-based tab controller

  • Loading branch information...
io7m committed Apr 21, 2019
1 parent 4f0e658 commit a9e4b617488355df836545a3b4523c084cbe2ce1
Showing with 457 additions and 1,277 deletions.
  1. +37 −73 build.gradle
  2. +6 −8 one.irradia.neutrino.feeds.api/build.gradle
  3. +1 −5 one.irradia.neutrino.feeds.model/build.gradle
  4. +8 −12 one.irradia.neutrino.feeds.opds12/build.gradle
  5. +3 −5 one.irradia.neutrino.feeds.spi/build.gradle
  6. +10 −9 one.irradia.neutrino.sandbox/build.gradle
  7. +15 −0 one.irradia.neutrino.sandbox/src/main/assets/logback.xml
  8. +61 −26 one.irradia.neutrino.sandbox/src/main/java/one/irradia/neutrino/sandbox/BasicReader.kt
  9. +41 −0 one.irradia.neutrino.sandbox/src/main/java/one/irradia/neutrino/sandbox/NControllerA.kt
  10. +41 −0 one.irradia.neutrino.sandbox/src/main/java/one/irradia/neutrino/sandbox/NControllerB.kt
  11. +41 −0 one.irradia.neutrino.sandbox/src/main/java/one/irradia/neutrino/sandbox/NControllerC.kt
  12. +3 −7 one.irradia.neutrino.services.api/build.gradle
  13. +9 −11 one.irradia.neutrino.tests/build.gradle
  14. +4 −6 one.irradia.neutrino.tests/gradle.properties
  15. +5 −8 one.irradia.neutrino.views/build.gradle
  16. +0 −49 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NCatalogPageCollectionSelect.kt
  17. +0 −113 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NPageFeed.kt
  18. +0 −13 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NPageFeedArguments.kt
  19. +0 −92 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NSettingsPageMain.kt
  20. +0 −27 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NTabBooks.kt
  21. +0 −28 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NTabCatalog.kt
  22. +111 −0 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NTabController.kt
  23. +8 −0 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NTabControllerItem.kt
  24. +0 −27 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NTabReservations.kt
  25. +0 −17 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NTabSettings.kt
  26. +23 −0 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NViewControllerType.kt
  27. +12 −0 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/NViewType.kt
  28. +0 −165 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/api/NeutrinoActivityHelper.kt
  29. +0 −10 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/api/NeutrinoEventType.kt
  30. +0 −10 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/api/NeutrinoFragment.kt
  31. +0 −20 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/api/NeutrinoListenerType.kt
  32. +0 −243 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/api/NeutrinoMain.kt
  33. +0 −39 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/pages/NPageAbstract.kt
  34. +0 −11 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/pages/NPageConstructor.kt
  35. +0 −19 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/pages/NeutrinoPageEvent.kt
  36. +0 −28 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/pages/NeutrinoPageType.kt
  37. +0 −79 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/tabs/NTabWithPageStack.kt
  38. +0 −11 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/tabs/NeutrinoTabEvent.kt
  39. +0 −68 one.irradia.neutrino.views/src/main/java/one/irradia/neutrino/views/tabs/NeutrinoTabType.kt
  40. +16 −6 one.irradia.neutrino.views/src/main/res/layout/neutrino_activity.xml
  41. +1 −31 one.irradia.neutrino.views/src/main/res/layout/neutrino_tabs.xml
  42. +1 −1 one.irradia.neutrino.views/src/main/res/values/neutrino_theme.xml
@@ -60,6 +60,43 @@ ext {
}
}

def irradiaOPDS12Version = "0.0.4"
def irradiaMIMEVersion = "0.0.6"
def irradiaHTTPVersion = "0.0.1"
def irradiaServiceDirectoryVersion = "0.0.1"

ext.libraries = [
androidMaterial: "com.google.android.material:material:1.0.0",
androidSupportTestRules: "com.android.support.test:rules:1.0.2",
androidSupportTestRunner: "com.android.support.test:runner:1.0.2",
androidTestOrchestrator: "com.android.support.test:orchestrator:1.0.2",
androidXActivity: "androidx.activity:activity-ktx:1.0.0-alpha06",
androidXAppCompat: "androidx.appcompat:appcompat:1.1.0-alpha04",
androidXCore: "androidx.core:core-ktx:1.0.1",
googleGuava: "com.google.guava:guava:27.1-android",
irradiaHTTPAPI: "one.irradia.http:one.irradia.http.api:${irradiaHTTPVersion}",
irradiaHTTPVanilla: "one.irradia.http:one.irradia.http.vanilla:${irradiaHTTPVersion}",
irradiaMimeAPI: "one.irradia.mime:one.irradia.mime.api:${irradiaMIMEVersion}",
irradiaMimeVanilla: "one.irradia.mime:one.irradia.mime.vanilla:${irradiaMIMEVersion}",
irradiaOPDS12API: "one.irradia.opds1_2:one.irradia.opds1_2.api:${irradiaOPDS12Version}",
irradiaOPDS12Dublin: "one.irradia.opds1_2:one.irradia.opds1_2.dublin:${irradiaOPDS12Version}",
irradiaOPDS12NYPL: "one.irradia.opds1_2:one.irradia.opds1_2.nypl:${irradiaOPDS12Version}",
irradiaOPDS12ParserAPI: "one.irradia.opds1_2:one.irradia.opds1_2.parser.api:${irradiaOPDS12Version}",
irradiaOPDS12ParserVanilla: "one.irradia.opds1_2:one.irradia.opds1_2.vanilla:${irradiaOPDS12Version}",
irradiaServiceDirectoryAPI: "one.irradia.servicedirectory:one.irradia.servicedirectory.api:${irradiaServiceDirectoryVersion}",
irradiaServiceDirectoryVanilla: "one.irradia.servicedirectory:one.irradia.servicedirectory.vanilla:${irradiaServiceDirectoryVersion}",
jackson: "com.fasterxml.jackson.core:jackson-core:2.9.8",
jodaTime: "joda-time:joda-time:2.10.1",
junit: "junit:junit:4.12",
kotlinReflect: "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version",
kotlinStdlib: "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version",
logbackAndroid: "com.github.tony19:logback-android:2.0.0",
logbackClassic: "ch.qos.logback:logback-classic:1.3.0-alpha4",
okhttp: "com.squareup.okhttp3:okhttp:3.14.1",
rxjava: "io.reactivex.rxjava2:rxjava:2.2.8",
slf4j: "org.slf4j:slf4j-api:1.7.25"
]

apply plugin: "io.codearte.nexus-staging"
apply plugin: "com.vanniktech.android.junit.jacoco"

@@ -123,16 +160,11 @@ Automatic-Module-Name: ${POM_AUTOMATIC_MODULE_NAME}
defaultConfig {
minSdkVersion androidMinimumSDKVersion
targetSdkVersion androidTargetSDKVersion
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
testOptions {
execution "ANDROID_TEST_ORCHESTRATOR"
animationsDisabled = true
}
}
break

@@ -256,73 +288,5 @@ Automatic-Module-Name: ${POM_AUTOMATIC_MODULE_NAME}
jcenter()
google()
}

configurations {
dependencyAndroidMaterial
dependencyAndroidSupportTestRules
dependencyAndroidSupportTestRunner
dependencyAndroidTestOrchestrator
dependencyAndroidXActivity
dependencyAndroidXAppCompat
dependencyAndroidXCore
dependencyGoogleGuava
dependencyIrradiaHTTPAPI
dependencyIrradiaHTTPImpl
dependencyIrradiaMimeAPI
dependencyIrradiaMimeImpl
dependencyIrradiaOPDS12API
dependencyIrradiaOPDS12Dublin
dependencyIrradiaOPDS12NYPL
dependencyIrradiaOPDS12ParserAPI
dependencyIrradiaOPDS12ParserImpl
dependencyIrradiaServiceDirectoryAPI
dependencyIrradiaServiceDirectoryImpl
dependencyJUnit
dependencyJackson
dependencyJodaTime
dependencyKotlinReflect
dependencyKotlinStdlib
dependencyLogback
dependencyOkHttp
dependencyRXJava
dependencySLF4J
}

dependencies {

def irradiaOPDS12Version = "0.0.4"
def irradiaMIMEVersion = "0.0.6"
def irradiaHTTPVersion = "0.0.1"
def irradiaServiceDirectoryVersion = "0.0.1"

dependencyAndroidMaterial "com.google.android.material:material:1.0.0"
dependencyAndroidSupportTestRules "com.android.support.test:rules:1.0.2"
dependencyAndroidSupportTestRunner "com.android.support.test:runner:1.0.2"
dependencyAndroidTestOrchestrator "com.android.support.test:orchestrator:1.0.2"
dependencyAndroidXActivity "androidx.activity:activity-ktx:1.0.0-alpha06"
dependencyAndroidXAppCompat "androidx.appcompat:appcompat:1.1.0-alpha04"
dependencyAndroidXCore "androidx.core:core-ktx:1.0.1"
dependencyGoogleGuava "com.google.guava:guava:27.1-android"
dependencyIrradiaHTTPAPI "one.irradia.http:one.irradia.http.api:${irradiaHTTPVersion}"
dependencyIrradiaHTTPImpl "one.irradia.http:one.irradia.http.vanilla:${irradiaHTTPVersion}"
dependencyIrradiaMimeAPI "one.irradia.mime:one.irradia.mime.api:${irradiaMIMEVersion}"
dependencyIrradiaMimeImpl "one.irradia.mime:one.irradia.mime.vanilla:${irradiaMIMEVersion}"
dependencyIrradiaOPDS12API "one.irradia.opds1_2:one.irradia.opds1_2.api:${irradiaOPDS12Version}"
dependencyIrradiaOPDS12Dublin "one.irradia.opds1_2:one.irradia.opds1_2.dublin:${irradiaOPDS12Version}"
dependencyIrradiaOPDS12NYPL "one.irradia.opds1_2:one.irradia.opds1_2.nypl:${irradiaOPDS12Version}"
dependencyIrradiaOPDS12ParserAPI "one.irradia.opds1_2:one.irradia.opds1_2.parser.api:${irradiaOPDS12Version}"
dependencyIrradiaOPDS12ParserImpl "one.irradia.opds1_2:one.irradia.opds1_2.vanilla:${irradiaOPDS12Version}"
dependencyIrradiaServiceDirectoryAPI "one.irradia.servicedirectory:one.irradia.servicedirectory.api:${irradiaServiceDirectoryVersion}"
dependencyIrradiaServiceDirectoryImpl "one.irradia.servicedirectory:one.irradia.servicedirectory.vanilla:${irradiaServiceDirectoryVersion}"
dependencyJUnit "junit:junit:4.12"
dependencyJackson "com.fasterxml.jackson.core:jackson-core:2.9.8"
dependencyJodaTime "joda-time:joda-time:2.10.1"
dependencyKotlinReflect "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
dependencyKotlinStdlib "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
dependencyLogback "ch.qos.logback:logback-classic:1.3.0-alpha4"
dependencyOkHttp "com.squareup.okhttp3:okhttp:3.14.1"
dependencyRXJava "io.reactivex.rxjava2:rxjava:2.2.8"
dependencySLF4J "org.slf4j:slf4j-api:1.8.0-beta4"
}
}

@@ -14,16 +14,14 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

configurations {
api.extendsFrom dependencyIrradiaHTTPAPI
api.extendsFrom dependencyGoogleGuava

implementation.extendsFrom dependencyKotlinStdlib
implementation.extendsFrom dependencySLF4J
}

dependencies {
api project(":one.irradia.neutrino.feeds.model")

implementation project(":one.irradia.neutrino.feeds.spi")

api libraries.irradiaHTTPAPI
api libraries.googleGuava

implementation libraries.kotlinStdlib
implementation libraries.slf4j
}
@@ -14,10 +14,6 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

configurations {
implementation.extendsFrom dependencyKotlinStdlib
}

dependencies {

implementation libraries.kotlinStdlib
}
@@ -14,22 +14,18 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

configurations {
implementation.extendsFrom dependencyKotlinStdlib

implementation.extendsFrom dependencySLF4J

implementation.extendsFrom dependencyIrradiaOPDS12API
implementation.extendsFrom dependencyIrradiaOPDS12Dublin
implementation.extendsFrom dependencyIrradiaOPDS12NYPL
implementation.extendsFrom dependencyIrradiaOPDS12ParserAPI
implementation.extendsFrom dependencyIrradiaOPDS12ParserImpl
}

dependencies {
api project(":one.irradia.neutrino.feeds.model")

implementation project(":one.irradia.neutrino.feeds.spi")

implementation libraries.kotlinStdlib
implementation libraries.slf4j
implementation libraries.irradiaOPDS12API
implementation libraries.irradiaOPDS12Dublin
implementation libraries.irradiaOPDS12NYPL
implementation libraries.irradiaOPDS12ParserAPI
implementation libraries.irradiaOPDS12ParserVanilla
}

def opds12ResourcesDir = file("$buildDir/generated-resources/")
@@ -14,11 +14,9 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

configurations {
implementation.extendsFrom dependencyKotlinStdlib
implementation.extendsFrom dependencyIrradiaMimeAPI
}

dependencies {
implementation project(":one.irradia.neutrino.feeds.model")

implementation libraries.kotlinStdlib
implementation libraries.irradiaMimeAPI
}
@@ -14,15 +14,16 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

configurations {
implementation.extendsFrom dependencyKotlinStdlib
implementation.extendsFrom dependencyRXJava
implementation.extendsFrom dependencyAndroidXAppCompat
implementation.extendsFrom dependencyAndroidXActivity
implementation.extendsFrom dependencyAndroidXCore
implementation.extendsFrom dependencyAndroidMaterial
}

dependencies {
implementation project(":one.irradia.neutrino.services.api")
implementation project(":one.irradia.neutrino.views")

implementation libraries.slf4j
implementation libraries.logbackAndroid
implementation libraries.kotlinStdlib
implementation libraries.rxjava
implementation libraries.androidXAppCompat
implementation libraries.androidXActivity
implementation libraries.androidXCore
implementation libraries.androidMaterial
}
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="logcat" class="ch.qos.logback.classic.android.LogcatAppender">
<tagEncoder>
<pattern>%logger{12}</pattern>
</tagEncoder>
<encoder>
<pattern>[%-20thread] %msg</pattern>
</encoder>
</appender>

<root level="DEBUG">
<appender-ref ref="logcat" />
</root>
</configuration>
@@ -1,41 +1,76 @@
package one.irradia.neutrino.sandbox

import android.os.Bundle
import android.view.MenuItem
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import io.reactivex.subjects.Subject
import one.irradia.neutrino.views.api.NeutrinoActivityHelper
import one.irradia.neutrino.views.api.NeutrinoEventType
import one.irradia.neutrino.views.api.NeutrinoListenerType
import one.irradia.neutrino.views.api.NeutrinoMain
import one.irradia.neutrino.views.pages.NeutrinoPageType
import one.irradia.neutrino.views.tabs.NeutrinoTabType
import androidx.appcompat.widget.Toolbar
import one.irradia.neutrino.views.NTabController
import one.irradia.neutrino.views.NTabControllerItem
import org.slf4j.LoggerFactory

class BasicReader : AppCompatActivity(), NeutrinoListenerType {
class BasicReader : AppCompatActivity() {

override val neutrinoEventBus: Subject<NeutrinoEventType>
get() = this.neutrinoMain.eventBus
private val logger = LoggerFactory.getLogger(BasicReader::class.java)

private lateinit var neutrinoMain: NeutrinoMain
private lateinit var content: ViewGroup
private lateinit var toolbar: Toolbar

override fun onNeutrinoPageMenuUpdated(page: NeutrinoPageType) =
NeutrinoActivityHelper.onNeutrinoPageMenuUpdated(this, page)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

override fun onNeutrinoTabUpdated(tab: NeutrinoTabType) =
NeutrinoActivityHelper.onNeutrinoTabUpdated(this, tab)
this.logger.debug("onCreate: {}", savedInstanceState)

override fun onNeutrinoTabSelected(tab: NeutrinoTabType) =
NeutrinoActivityHelper.onNeutrinoTabSelected(this, tab)
this.setContentView(R.layout.neutrino_activity)

override fun onBackPressed() {
NeutrinoActivityHelper.onNeutrinoBackPressed(this)
}
this.content =
this.findViewById(R.id.neutrinoContent)
this.toolbar =
this.findViewById(R.id.neutrinoToolbar)

override fun onOptionsItemSelected(item: MenuItem): Boolean =
NeutrinoActivityHelper.onNeutrinoOptionsItemSelected(this, item)
this.toolbar.title = "Neutrino Toolbar"
this.toolbar.inflateMenu(R.menu.neutrino_page_feed_external_menu)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
this.neutrinoMain = NeutrinoActivityHelper.onNeutrinoCreate(this, savedInstanceState)
val controller =
NTabController(
controllers = listOf(
NTabControllerItem(
title = "Controller A",
icon = this.resources.getDrawable(R.drawable.neutrino_icon_books, this.theme),
controller = NControllerA()
),
NTabControllerItem(
title = "Controller B",
icon = this.resources.getDrawable(R.drawable.neutrino_icon_books, this.theme),
controller = NControllerB()
),

NTabControllerItem(
title = "Controller B",
icon = this.resources.getDrawable(R.drawable.neutrino_icon_books, this.theme),
controller = NTabController(
controllers = listOf(
NTabControllerItem(
title = "Controller A",
icon = this.resources.getDrawable(R.drawable.neutrino_icon_books, this.theme),
controller = NControllerA()
),
NTabControllerItem(
title = "Controller B",
icon = this.resources.getDrawable(R.drawable.neutrino_icon_books, this.theme),
controller = NControllerB()
)
))
),

NTabControllerItem(
title = "Controller C",
icon = this.resources.getDrawable(R.drawable.neutrino_icon_books, this.theme),
controller = NControllerC())))

val controllerView =
controller.onCreateView(this, this.layoutInflater, this.content)

this.content.addView(controllerView)
controller.onAttach()
}
}

0 comments on commit a9e4b61

Please sign in to comment.
You can’t perform that action at this time.