mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-22 07:58:20 -05:00
Now able to infinitely scroll bibles!
Tons of issues outstanding, but this is a huge accomplishment.
This commit is contained in:
parent
ef7b8f82fa
commit
918f7688ba
@ -1,14 +1,18 @@
|
|||||||
<html lang="en" ng-app="bookApp">
|
<html lang="en" ng-app="bookApp">
|
||||||
<head>
|
<head>
|
||||||
<script type="text/javascript" src="file:///android_asset/dist/book-bundle.js"></script>
|
<script type="text/javascript" src="file:///android_asset/dist/book-bundle.js"></script>
|
||||||
|
<script type="text/javascript" src="file:///android_asset/dist/scroll.js"></script>
|
||||||
|
<script type="text/javascript" src="file:///android_asset/dist/scroll-jqlite.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body ng-controller="BookCtrl" id="bookController">
|
<body ng-controller="BookCtrl" id="bookController">
|
||||||
<div ng-repeat="verse in verses">
|
<div u-scroll-viewport style="height:200px;">
|
||||||
<h3 style="display: inline;" ng-show="verse.verseNum === 1">
|
<div ui-scroll="verse in verseSource" style="display: inline;">
|
||||||
{{ verse.chapter }}
|
<h3 style="display: inline;" ng-show="verse.verseNum === 1">
|
||||||
</h3>
|
{{ verse.chapter }}
|
||||||
<sup ng-show="verse.verseNum !== 1">{{ verse.verseNum }}</sup>
|
</h3>
|
||||||
{{ verse.content }}
|
<sup ng-show="verse.verseNum !== 1 && verse.verseNum !== 0">{{ verse.verseNum }}</sup>
|
||||||
|
{{ verse.content }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
9217
app/src/main/assets/dist/book-bundle.js
vendored
9217
app/src/main/assets/dist/book-bundle.js
vendored
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,12 @@
|
|||||||
$ = require 'jquery' # For using selectors to access scope
|
|
||||||
require 'angular'
|
require 'angular'
|
||||||
|
|
||||||
app = angular.module('bookApp', [])
|
app = angular.module('bookApp', ['ui.scroll', 'ui.scroll.jqlite'])
|
||||||
|
|
||||||
app.controller 'BookCtrl', ['$scope', '$filter', ($scope, $filter) ->
|
app.controller 'BookCtrl', ['$scope', '$filter', ($scope, $filter) ->
|
||||||
$scope.verses = []
|
$scope.verseSource =
|
||||||
|
get: (index, count, success) ->
|
||||||
|
console.log "Calling me with " + index
|
||||||
|
success angular.fromJson Android.getVerses(index, count)
|
||||||
|
|
||||||
$scope.order_verses = ->
|
$scope.order_verses = ->
|
||||||
$scope.verses = $filter('orderBy')($scope.verses, 'id', false)
|
$scope.verses = $filter('orderBy')($scope.verses, 'id', false)
|
||||||
@ -12,8 +14,6 @@ app.controller 'BookCtrl', ['$scope', '$filter', ($scope, $filter) ->
|
|||||||
$scope.appendVerse = (jsonVerseString) ->
|
$scope.appendVerse = (jsonVerseString) ->
|
||||||
$scope.verses.push angular.fromJson jsonVerseString
|
$scope.verses.push angular.fromJson jsonVerseString
|
||||||
$scope.order_verses()
|
$scope.order_verses()
|
||||||
|
|
||||||
$scope.appendVerse Android.getVerse(5)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# Due to page initialization, we can only store the controller string.
|
# Due to page initialization, we can only store the controller string.
|
||||||
@ -21,11 +21,11 @@ app.controller 'BookCtrl', ['$scope', '$filter', ($scope, $filter) ->
|
|||||||
# etc. to grab the scope ahead of time and re-use it.
|
# etc. to grab the scope ahead of time and re-use it.
|
||||||
controller = "#bookController"
|
controller = "#bookController"
|
||||||
|
|
||||||
window.appendVerse = (jsonVerseString) ->
|
#window.appendVerse = (jsonVerseString) ->
|
||||||
scope = angular.element($("#bookController")).scope()
|
#scope = angular.element($("#bookController")).scope()
|
||||||
scope.appendVerse jsonVerseString
|
#scope.appendVerse jsonVerseString
|
||||||
# Since we're calling outside of angular, we need to manually apply
|
## Since we're calling outside of angular, we need to manually apply
|
||||||
scope.$apply()
|
#scope.$apply()
|
||||||
|
|
||||||
###
|
###
|
||||||
Future reference: Get the controller scope like so:
|
Future reference: Get the controller scope like so:
|
||||||
|
@ -6,6 +6,8 @@ import android.webkit.WebViewClient
|
|||||||
import android.webkit.JavascriptInterface
|
import android.webkit.JavascriptInterface
|
||||||
import org.crosswire.jsword.book.Book
|
import org.crosswire.jsword.book.Book
|
||||||
import org.crosswire.jsword.versification.getVersification
|
import org.crosswire.jsword.versification.getVersification
|
||||||
|
import java.util.ArrayList
|
||||||
|
import android.util.Log
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by bspeice on 9/14/14.
|
* Created by bspeice on 9/14/14.
|
||||||
@ -20,4 +22,13 @@ class BibleViewClient(b: Book, lookup: VerseLookupService) : WebViewClient() {
|
|||||||
val v = Verse(b.getVersification(), ordinal)
|
val v = Verse(b.getVersification(), ordinal)
|
||||||
return lookup.getJsonVerse(v) as String
|
return lookup.getJsonVerse(v) as String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JavascriptInterface fun getVerses(first: Int, count: Int): String {
|
||||||
|
Log.e("getVerses", "First: " + first + " count: " + count)
|
||||||
|
val verses: MutableList<String> = ArrayList<String>()
|
||||||
|
for (i in first..first + count - 1) {
|
||||||
|
verses.add(getVerse(i))
|
||||||
|
}
|
||||||
|
return verses.toString()
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user