Skip to content

Commit

Permalink
Fix #230 (personal note text window does not scroll downward when key…
Browse files Browse the repository at this point in the history
…board is active.)
  • Loading branch information
tuomas2 committed Jan 31, 2019
1 parent 1a97667 commit 63713a7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<activity
android:name="net.bible.android.view.activity.page.MainBibleActivity"
android:configChanges="keyboardHidden|orientation|screenSize|locale"
android:windowSoftInputMode="stateHidden|adjustResize"
android:launchMode="singleTask"
android:label="@string/app_name" />
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class DocumentControl @Inject constructor(
val commentariesForVerse: List<Book>
get () = swordDocumentFacade.getBooks(BookCategory.COMMENTARY).filter { it -> commentaryFilter.test(it) }

val isMyNotes: Boolean
get () = currentPage.isMyNoteShown

val isBibleBook: Boolean
get () = currentDocument.bookCategory == BookCategory.BIBLE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,13 @@ class MainBibleActivity : CustomTitlebarActivityBase(), VerseActionModeMediator.
private val leftNavBarVisible get() = false
private var transportBarVisible = false

val isMyNotes get() =
if(::documentControl.isInitialized) {
documentControl.isMyNotes
} else false

// Top offset with only statusbar
val topOffset1 get() = if(!isFullScreen) statusBarHeight else 0.0F
val topOffset1 get() = if(!isFullScreen && !isMyNotes) statusBarHeight else 0.0F
// Top offset with only statusbar and toolbar
val topOffset2 get() = topOffset1 + if(!isFullScreen) actionBarHeight else 0.0F
// Bottom offset with only navigation bar
Expand All @@ -132,7 +137,7 @@ class MainBibleActivity : CustomTitlebarActivityBase(), VerseActionModeMediator.
} else {
false
}
return if (isPortrait && bottomNavBarVisible && !isFullScreen && !multiWinMode) navigationBarHeight -2 else 0.0F
return if (isPortrait && bottomNavBarVisible && !isFullScreen && !isMyNotes && !multiWinMode) navigationBarHeight -2 else 0.0F
}
// Bottom offset with navigation bar and transport bar
val bottomOffset2 get() = bottomOffset1 + if(transportBarVisible) transportBarHeight else 0.0F
Expand Down Expand Up @@ -369,7 +374,6 @@ class MainBibleActivity : CustomTitlebarActivityBase(), VerseActionModeMediator.
val approximateSize = 53 * resources.displayMetrics.density
val maxWidth = (screenWidth * 0.5).roundToInt()
val maxButtons: Int = (maxWidth / approximateSize).toInt()
val isMyNotes = documentControl.currentPage.isMyNoteShown
val showSearch = documentControl.isBibleBook || documentControl.isCommentary


Expand Down Expand Up @@ -511,6 +515,10 @@ class MainBibleActivity : CustomTitlebarActivityBase(), VerseActionModeMediator.
fun resetSystemUi() {
if(isFullScreen)
hideSystemUI()
else
showSystemUI()

updateToolbar()
}

private val sharedActivityState = SharedActivityState.getInstance()
Expand All @@ -530,12 +538,15 @@ class MainBibleActivity : CustomTitlebarActivityBase(), VerseActionModeMediator.
}

private fun showSystemUI() {
var uiFlags = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
var uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE

// only need to un-hide navigation bar in portrait mode
if (isPortrait)
uiFlags = (uiFlags or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION)
if(!isMyNotes) {
uiFlags = uiFlags or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN

// only need to un-hide navigation bar in portrait mode
if (isPortrait)
uiFlags = uiFlags or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
}

window.decorView.systemUiVisibility = uiFlags
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void onEvent(NumberOfWindowsChangedEvent event) {

public synchronized void buildView() {
if (myNoteViewBuilder.isMyNoteViewType()) {
mainBibleActivity.resetSystemUi();
documentWebViewBuilder.removeWebView(parent);
myNoteViewBuilder.addMyNoteView(parent);
} else {
Expand Down

0 comments on commit 63713a7

Please sign in to comment.