Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt an experimental view-based tab controller
- Loading branch information
Showing
42 changed files
with
457 additions
and
1,277 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 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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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> |
87 changes: 61 additions & 26 deletions
87
one.irradia.neutrino.sandbox/src/main/java/one/irradia/neutrino/sandbox/BasicReader.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,41 +1,76 @@ | |||
package one.irradia.neutrino.sandbox | package one.irradia.neutrino.sandbox | ||
|
|
||
import android.os.Bundle | import android.os.Bundle | ||
import android.view.MenuItem | import android.view.ViewGroup | ||
import androidx.appcompat.app.AppCompatActivity | import androidx.appcompat.app.AppCompatActivity | ||
import io.reactivex.subjects.Subject | import androidx.appcompat.widget.Toolbar | ||
import one.irradia.neutrino.views.api.NeutrinoActivityHelper | import one.irradia.neutrino.views.NTabController | ||
import one.irradia.neutrino.views.api.NeutrinoEventType | import one.irradia.neutrino.views.NTabControllerItem | ||
import one.irradia.neutrino.views.api.NeutrinoListenerType | import org.slf4j.LoggerFactory | ||
import one.irradia.neutrino.views.api.NeutrinoMain | |||
import one.irradia.neutrino.views.pages.NeutrinoPageType | |||
import one.irradia.neutrino.views.tabs.NeutrinoTabType | |||
|
|
||
class BasicReader : AppCompatActivity(), NeutrinoListenerType { | class BasicReader : AppCompatActivity() { | ||
|
|
||
override val neutrinoEventBus: Subject<NeutrinoEventType> | private val logger = LoggerFactory.getLogger(BasicReader::class.java) | ||
get() = this.neutrinoMain.eventBus | |||
|
|
||
private lateinit var neutrinoMain: NeutrinoMain | private lateinit var content: ViewGroup | ||
private lateinit var toolbar: Toolbar | |||
|
|
||
override fun onNeutrinoPageMenuUpdated(page: NeutrinoPageType) = | override fun onCreate(savedInstanceState: Bundle?) { | ||
NeutrinoActivityHelper.onNeutrinoPageMenuUpdated(this, page) | super.onCreate(savedInstanceState) | ||
|
|
||
override fun onNeutrinoTabUpdated(tab: NeutrinoTabType) = | this.logger.debug("onCreate: {}", savedInstanceState) | ||
NeutrinoActivityHelper.onNeutrinoTabUpdated(this, tab) | |||
|
|
||
override fun onNeutrinoTabSelected(tab: NeutrinoTabType) = | this.setContentView(R.layout.neutrino_activity) | ||
NeutrinoActivityHelper.onNeutrinoTabSelected(this, tab) | |||
|
|
||
override fun onBackPressed() { | this.content = | ||
NeutrinoActivityHelper.onNeutrinoBackPressed(this) | this.findViewById(R.id.neutrinoContent) | ||
} | this.toolbar = | ||
this.findViewById(R.id.neutrinoToolbar) | |||
|
|
||
override fun onOptionsItemSelected(item: MenuItem): Boolean = | this.toolbar.title = "Neutrino Toolbar" | ||
NeutrinoActivityHelper.onNeutrinoOptionsItemSelected(this, item) | this.toolbar.inflateMenu(R.menu.neutrino_page_feed_external_menu) | ||
|
|
||
override fun onCreate(savedInstanceState: Bundle?) { | val controller = | ||
super.onCreate(savedInstanceState) | NTabController( | ||
this.neutrinoMain = NeutrinoActivityHelper.onNeutrinoCreate(this, savedInstanceState) | 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() | |||
} | } | ||
} | } |
Oops, something went wrong.