Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #110 from readium/develop
Browse files Browse the repository at this point in the history
1.1.5
  • Loading branch information
aferditamuriqi authored Jan 11, 2020
2 parents 5f1e39f + 7766cab commit 7e07395
Show file tree
Hide file tree
Showing 72 changed files with 12,070 additions and 1,150 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @aferditamuriqi
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.31'
ext.r2branch = 'develop'
ext.kotlin_version = '1.3.61'

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
// NOTE: Do not place your application dependencies here; they belong
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
46 changes: 15 additions & 31 deletions r2-navigator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,23 @@ apply plugin: 'com.github.dcendents.android-maven'
group='com.github.readium'

android {
flavorDimensions "testapp"

compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
minSdkVersion 21
targetSdkVersion 28

targetSdkVersion 29
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
intTestapp {
dimension "testapp"
}
intTestappWithLcp {
dimension "testapp"
}
devTestapp {
dimension "testapp"
}
devTestappWithLcp {
dimension "testapp"
}
}

// default build flavour
defaultPublishConfig "intTestappDebug"
}

dependencies {
Expand All @@ -56,28 +40,28 @@ dependencies {
if (findProject(':r2-shared')) {
implementation project(':r2-shared')
} else {
implementation "com.github.readium:r2-shared-kotlin:1.0.10"
implementation "com.github.readium:r2-shared-kotlin:1.1.6"
}
implementation "androidx.appcompat:appcompat:1.1.0-beta01"
implementation "androidx.appcompat:appcompat:1.2.0-alpha01"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.webkit:webkit:1.0.0'
implementation 'androidx.webkit:webkit:1.1.0'
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "com.google.android.material:material:1.1.0-alpha07"
implementation "androidx.recyclerview:recyclerview:1.1.0-alpha06"
implementation "com.google.android.material:material:1.2.0-alpha03"
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation 'joda-time:joda-time:2.9.9'
implementation "androidx.legacy:legacy-support-core-ui:1.0.0"

implementation 'com.duolingo.open:rtl-viewpager:1.0.3'
implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha05'
implementation 'androidx.viewpager2:viewpager2:1.0.0'

implementation 'com.jakewharton.timber:timber:4.7.1'

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'

implementation 'org.zeroturnaround:zt-zip:1.12'
implementation 'org.zeroturnaround:zt-zip:1.13'

implementation 'org.jsoup:jsoup:1.11.2'
implementation 'org.jsoup:jsoup:1.10.3'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
Expand Down
267 changes: 0 additions & 267 deletions r2-navigator/r2-navigator.iml

This file was deleted.

10 changes: 8 additions & 2 deletions r2-navigator/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@
tools:replace="android:allowBackup">

<activity
android:name=".R2EpubActivity"
android:name=".epub.R2EpubActivity"
android:theme="@style/AppTheme" />
<activity
android:name=".R2CbzActivity"
android:name=".cbz.R2CbzActivity"
android:theme="@style/AppTheme" />
<activity
android:name=".audiobook.R2AudiobookActivity"
android:theme="@style/AppTheme" />
<activity
android:name=".divina.R2DiViNaActivity"
android:theme="@style/AppTheme" />

</application>
Expand Down
27 changes: 27 additions & 0 deletions r2-navigator/src/main/assets/divina/divinaPlayer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>DiViNa Player</title>
<style type="text/css">
body, html {
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgb(0, 0, 0);
}
</style>
<script type="text/javascript" src="./divinaTouchHandling.js"></script>
<script type="text/javascript" src="./divinaPlayer.js"></script>
</head>
<body>
<script type="text/javascript">
var player = null
window.onload = function() {
const Player = window.divinaPlayer
player = new Player(window.document.body)
}
</script>
</body>
</html>
271 changes: 271 additions & 0 deletions r2-navigator/src/main/assets/divina/divinaPlayer.js

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions r2-navigator/src/main/assets/divina/divinaTouchHandling.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
var singleTouchGesture = false;
var startX = 0;
var startY = 0;
var availWidth = window.screen.availWidth;
var availHeight = window.screen.availHeight;


window.addEventListener("load", function(){ // on page load
// Get screen X and Y sizes.
// Events listeners for the touches.
window.document.addEventListener("touchstart", handleTouchStart, false);
window.document.addEventListener("touchend", handleTouchEnd, false);
// When device orientation changes, screen X and Y sizes are recalculated.
}, false);



// When a touch is detected records its starting coordinates and if it's a singleTouchGesture.
var handleTouchStart = function(event) {
if (event.target.nodeName.toUpperCase() === 'A') {
console.log("Touched a link.");
// singleTouchGesture = false;
return;
}
console.log("Touch sent to native code.");
singleTouchGesture = event.touches.length == 1;

var touch = event.changedTouches[0];

startX = touch.screenX % availWidth;
startY = touch.screenY % availHeight;

};

// When a touch ends, check if any action has to be made, and contact native code.
var handleTouchEnd = function(event) {
if(!singleTouchGesture) {
return;
}

var touch = event.changedTouches[0];

var relativeDistanceX = Math.abs(((touch.screenX % availWidth) - startX) / availWidth);
var relativeDistanceY = Math.abs(((touch.screenY % availHeight) - startY) / availHeight);
var touchDistance = Math.max(relativeDistanceX, relativeDistanceY);

var scrollWidth = document.scrollWidth;
var screenWidth = availWidth;
var tapAreaWidth = availWidth * 0.2;

if(touchDistance < 0.01) {
var position = (touch.screenX % availWidth) / availWidth;
if (position <= 0.2) {
console.log("LeftTapped");
} else if(position >= 0.8) {
console.log("RightTapped");
} else {
console.log("CenterTapped");
Android.centerTapped();
}
event.stopPropagation();
event.preventDefault();
return;
}
};
Loading

0 comments on commit 7e07395

Please sign in to comment.