Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
c0742cef5d | |||
6f4320b074 | |||
000f2ee655 |
28
.idea/deploymentTargetDropDown.xml
generated
28
.idea/deploymentTargetDropDown.xml
generated
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<runningDeviceTargetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="RUNNING_DEVICE_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_5_API_26.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</runningDeviceTargetSelectedWithDropDown>
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.android/avd/Pixel_5_API_26.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2023-01-18T19:46:02.696157Z" />
|
||||
</component>
|
||||
</project>
|
@ -5,7 +5,4 @@ It can also open links to userpages of Bookwyrm users and it can scan ISBN codes
|
||||
|
||||
This application works on: Android 6 and above.
|
||||
|
||||
And if you want to know, I am [`@StoryDragon@wyrms.de`](https://wyrms.de/user/storydragon) on BookWyrm.
|
||||
|
||||
For the ISBN-scanning I use the library zxing-android-embedded.
|
||||
The barcode icon that is added for instances that do not have ISBN-scanning by default comes from the Remix Icon project.
|
||||
And if you want to know, I am `@StoryDragon@wyrms.de` on BookWyrm.
|
||||
|
@ -3,14 +3,14 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 33
|
||||
compileSdk 31
|
||||
|
||||
defaultConfig {
|
||||
applicationId "nl.privacydragon.bookwyrm"
|
||||
minSdk 23
|
||||
targetSdk 31
|
||||
versionCode 10
|
||||
versionName "1.3.3"
|
||||
versionCode 7
|
||||
versionName "1.3.0"
|
||||
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
}
|
||||
@ -29,12 +29,12 @@ android {
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.6.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
implementation 'com.google.zxing:core:3.5.1'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
implementation 'com.google.zxing:core:3.3.0'
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0@aar'
|
||||
//implementation 'com.github.yuriy-budiyev:code-scanner:2.1.2'
|
||||
|
||||
|
BIN
app/release/Bookwyrm-v1.3.0.apk
Normal file
BIN
app/release/Bookwyrm-v1.3.0.apk
Normal file
Binary file not shown.
Binary file not shown.
@ -11,8 +11,8 @@
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 10,
|
||||
"versionName": "1.3.3",
|
||||
"versionCode": 7,
|
||||
"versionName": "1.3.0",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
|
@ -5,11 +5,13 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
|
||||
<meta-data
|
||||
android:name="android.webkit.WebView.MetricsOptOut"
|
||||
android:value="true" />
|
||||
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:icon="@mipmap/ic_launcher_wyrm"
|
||||
@ -17,9 +19,6 @@
|
||||
android:roundIcon="@mipmap/ic_launcher_wyrm_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Bookwyrm">
|
||||
<meta-data
|
||||
android:name="android.webkit.WebView.MetricsOptOut"
|
||||
android:value="true" />
|
||||
<activity
|
||||
android:name=".HandlerActivity"
|
||||
android:exported="true">
|
||||
@ -243,270 +242,6 @@
|
||||
android:pathPrefix="/user/"
|
||||
android:scheme="https" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="bookwyrm.lond.com.br"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="good.franv.site"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="books.solarpunkanarchism.org"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="shoko.one"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="bookwyrm.mennisch.net"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="library.southfox.me"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="bookrastinating.com"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="library.cybre.city"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="books.storydragon.nl"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="reading.unbl.ink"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="velhaestante.com.br"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="bookwyrm.gatti.ninja"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="books.theunseen.city"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="lore.livellosegreto.it"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="books.jascha.wtf"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="bw.diaspodon.fr"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="bookwyrm.tilde.zone"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="ramblingreaders.org"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="libros.mistli.net"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="lectura.social"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="orreadi.com"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="bookishbook.club"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="bookwyrm.tech"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:scheme="https"
|
||||
android:host="comelibros.club"
|
||||
android:pathPrefix="/user/" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".StartActivity"
|
||||
|
@ -70,17 +70,14 @@ public class HandlerActivity extends AppCompatActivity {
|
||||
// End of auto-generated stuff
|
||||
LoadIndicator = (ProgressBar) findViewById(R.id.progressBar3);
|
||||
myWebView = (WebView) findViewById(R.id.webview);
|
||||
myWebView.setVisibility(View.GONE);
|
||||
myWebView.getSettings().setJavaScriptEnabled(true);
|
||||
myWebView.getSettings().setDomStorageEnabled(true);
|
||||
myWebView.addJavascriptInterface(new Object()
|
||||
{
|
||||
@JavascriptInterface // For API 17+
|
||||
public void performClick(String what)
|
||||
public void performClick()
|
||||
{
|
||||
if (!what.contains("[object Window]")) { //For some reason the function has to be called when the event listener is attached to the button. So, by adding in 'this', it is possible to make sure to only act when the thing that called the function is NOT the window, but the button.
|
||||
ScanBarCode();
|
||||
}
|
||||
|
||||
}
|
||||
}, "scan");
|
||||
@ -177,40 +174,25 @@ public class HandlerActivity extends AppCompatActivity {
|
||||
myWebView.setWebViewClient(new HandlerActivity.MyWebViewClient() {
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
LoadIndicator.setVisibility(View.GONE);
|
||||
myWebView.setVisibility(View.VISIBLE);
|
||||
|
||||
view.loadUrl("javascript:(function() { document.getElementById('id_password').value = '" + passw + "'; ;})()");
|
||||
view.loadUrl("javascript:(function() { document.getElementById('id_localname').value = '" + name + "'; ;})()");
|
||||
view.loadUrl("javascript:(function() { if (window.location.href == '" + finalToGoServer + "' && !/(review|generatednote|quotation|comment)/i.test(window.location.href)) { document.getElementsByName(\"login\")[0].submit();} ;})()");
|
||||
view.loadUrl("javascript:(function() { if (window.location.href == 'https://" + server + "') { document.getElementsByName(\"login\")[0].submit();} ;})()");
|
||||
view.loadUrl("javascript:(function() { if (/(review|generatednote|quotation|comment)/i.test(window.location.href)) {" +
|
||||
"blocks = document.getElementsByClassName('block');" +
|
||||
"for (let element of blocks){" +
|
||||
"if (element.localName == 'header') { " +
|
||||
"element.innerHTML = ` <a href=\"https://"+ server +"\" class=\"button\" data-back=\"\">\n" +
|
||||
view.loadUrl("javascript:(function() { if (/(review|generatednote|quotation|comment)/i.test(window.location.href)) { document.getElementsByClassName(\"block\")[0].innerHTML = ` <a href=\"https://"+ server +"\" class=\"button\" data-back=\"\">\n" +
|
||||
" <span class=\"icon icon-arrow-left\" aria-hidden=\"true\"></span>\n" +
|
||||
" <span><b>Back to homeserver</b></span>\n" +
|
||||
"</a>`;" +
|
||||
"break;" +
|
||||
"}" +
|
||||
"}" +
|
||||
"} ;})()");
|
||||
" </a>`;} ;})()");
|
||||
view.loadUrl("javascript:(function() { " +
|
||||
"if (document.querySelectorAll(\"[data-modal-open]\")[0]) {" +
|
||||
"let ISBN_Button = document.querySelectorAll(\"[data-modal-open]\")[0];" +
|
||||
"ISBN_Button.replaceWith(ISBN_Button.cloneNode(true));" +
|
||||
"document.querySelectorAll(\"[data-modal-open]\")[0].addEventListener('click', () => {" +
|
||||
"scan.performClick(this);" +
|
||||
"const ISBN = document.createElement(\"p\");" +
|
||||
"ISBN.innerHTML = '<br/>Click to scan ISBN';" +
|
||||
"ISBN.addEventListener('click', () => {" +
|
||||
" scan.performClick();" +
|
||||
"});" +
|
||||
"} else {" +
|
||||
"let ISBN = document.createElement(\"div\");" +
|
||||
"ISBN.class = 'control';" +
|
||||
//"ISBN.class = 'button';" +
|
||||
//"ISBN.type = 'button';" +
|
||||
"ISBN.innerHTML = '<button class=\"button\" type=\"button\" onclick=\"scan.performClick(this)\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" aria-hidden=\"true\"><path fill=\"none\" d=\"M0 0h24v24H0z\"/><path d=\"M4 5v14h16V5H4zM3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm3 4h3v10H6V7zm4 0h2v10h-2V7zm3 0h1v10h-1V7zm2 0h3v10h-3V7z\"/></svg><span class=\"is-sr-only\">Search</span></button>';" +
|
||||
"nav = document.getElementsByClassName(\"field has-addons\")[0];" +
|
||||
"nav.appendChild(ISBN);" +
|
||||
"}" +
|
||||
"const NewCenter = document.createElement(\"center\");" +
|
||||
"NewCenter.append(ISBN);" +
|
||||
"nav = document.body;" +
|
||||
"nav.insertBefore(NewCenter, nav.children[0]);" +
|
||||
";})()");
|
||||
}
|
||||
});
|
||||
@ -218,7 +200,7 @@ public class HandlerActivity extends AppCompatActivity {
|
||||
// Need to accept permissions to use the camera
|
||||
@Override
|
||||
public void onPermissionRequest(PermissionRequest request) {
|
||||
String permission = Manifest.permission.WRITE_EXTERNAL_STORAGE;
|
||||
String permission = Manifest.permission.CAMERA;
|
||||
int grant = ContextCompat.checkSelfPermission(HandlerActivity.this, permission);
|
||||
if (grant != PackageManager.PERMISSION_GRANTED) {
|
||||
String[] permission_list = new String[1];
|
||||
@ -228,7 +210,7 @@ public class HandlerActivity extends AppCompatActivity {
|
||||
request.grant(request.getResources());
|
||||
final String[] requestedResources = request.getResources();
|
||||
for (String r : requestedResources) {
|
||||
if (r.equals(PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID)) {
|
||||
if (r.equals(PermissionRequest.RESOURCE_VIDEO_CAPTURE)) {
|
||||
request.grant(new String[]{PermissionRequest.RESOURCE_VIDEO_CAPTURE});
|
||||
break;
|
||||
}
|
||||
@ -250,7 +232,7 @@ public class HandlerActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
IntentIntegrator intentIntegrator = new IntentIntegrator(HandlerActivity.this);
|
||||
intentIntegrator.setDesiredBarcodeFormats(intentIntegrator.EAN_13);
|
||||
intentIntegrator.setDesiredBarcodeFormats(intentIntegrator.ALL_CODE_TYPES);
|
||||
intentIntegrator.setBeepEnabled(true);
|
||||
intentIntegrator.setCameraId(0);
|
||||
intentIntegrator.setPrompt("SCAN");
|
||||
@ -269,7 +251,7 @@ public class HandlerActivity extends AppCompatActivity {
|
||||
Toast.makeText(this, "cancelled", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Log.d("MainActivity", "Scanned");
|
||||
myWebView.loadUrl("Javascript:(function() {document.getElementById('tour-search').value = " + Result.getContents() + ";" + "document.getElementById('search_input').value = " + Result.getContents() + ";" +
|
||||
myWebView.loadUrl("Javascript:(function() {document.getElementById('search_input').value = " + Result.getContents() + ";" +
|
||||
"document.getElementsByTagName('form')[0].submit(); ;})()");
|
||||
LoadIndicator.setVisibility(View.VISIBLE);
|
||||
|
||||
|
@ -54,16 +54,13 @@ public class StartActivity extends AppCompatActivity {
|
||||
setContentView(R.layout.activity_start);
|
||||
LoadIndicator = (ProgressBar) findViewById(R.id.progressBar3);
|
||||
myWebView = (WebView) findViewById(R.id.webview);
|
||||
myWebView.setVisibility(View.GONE);
|
||||
myWebView.getSettings().setJavaScriptEnabled(true);
|
||||
myWebView.addJavascriptInterface(new Object()
|
||||
{
|
||||
@JavascriptInterface // For API 17+
|
||||
public void performClick(String what)
|
||||
public void performClick()
|
||||
{
|
||||
if (!what.contains("[object Window]")) { //For some reason the function has to be called when the event listener is attached to the button. So, by adding in 'this', it is possible to make sure to only act when the thing that called the function is NOT the window, but the button.
|
||||
ScanBarCode();
|
||||
}
|
||||
|
||||
}
|
||||
}, "scan");
|
||||
@ -139,28 +136,21 @@ public class StartActivity extends AppCompatActivity {
|
||||
myWebView.setWebViewClient(new MyWebViewClient(){
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
LoadIndicator.setVisibility(View.GONE);
|
||||
myWebView.setVisibility(View.VISIBLE);
|
||||
|
||||
view.loadUrl("javascript:(function() { document.getElementById('id_password_confirm').value = '" + passw + "'; ;})()");
|
||||
view.loadUrl("javascript:(function() { document.getElementById('id_localname_confirm').value = '" + name + "'; ;})()");
|
||||
view.loadUrl("javascript:(function() { if (window.location.href == 'https://" + server + "/login') { document.getElementsByName(\"login-confirm\")[0].submit();} ;})()");
|
||||
view.loadUrl("javascript:(function() { " +
|
||||
"if (document.querySelectorAll(\"[data-modal-open]\")[0]) {" +
|
||||
"let ISBN_Button = document.querySelectorAll(\"[data-modal-open]\")[0];" +
|
||||
"ISBN_Button.replaceWith(ISBN_Button.cloneNode(true));" +
|
||||
"document.querySelectorAll(\"[data-modal-open]\")[0].addEventListener('click', () => {" +
|
||||
"scan.performClick(this);" +
|
||||
"const ISBN = document.createElement(\"p\");" +
|
||||
"ISBN.innerHTML = '<br/>Click to scan ISBN';" +
|
||||
"ISBN.addEventListener('click', () => {" +
|
||||
" scan.performClick();" +
|
||||
"});" +
|
||||
"} else {" +
|
||||
"let ISBN = document.createElement(\"div\");" +
|
||||
"ISBN.class = 'control';" +
|
||||
//"ISBN.class = 'button';" +
|
||||
//"ISBN.type = 'button';" +
|
||||
"ISBN.innerHTML = '<button class=\"button\" type=\"button\" onclick=\"scan.performClick(this)\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" aria-hidden=\"true\"><path fill=\"none\" d=\"M0 0h24v24H0z\"/><path d=\"M4 5v14h16V5H4zM3 3h18a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm3 4h3v10H6V7zm4 0h2v10h-2V7zm3 0h1v10h-1V7zm2 0h3v10h-3V7z\"/></svg><span class=\"is-sr-only\">Search</span></button>';" +
|
||||
"nav = document.getElementsByClassName(\"field has-addons\")[0];" +
|
||||
"nav.appendChild(ISBN);" +
|
||||
"}" +
|
||||
";})()"); //This lines replace the ISBN-scan button event listener with one that points to the on-device scanning implementation, if it is available on the instance. If not, the button is added.
|
||||
"const NewCenter = document.createElement(\"center\");" +
|
||||
"NewCenter.append(ISBN);" +
|
||||
"nav = document.body;" +
|
||||
"nav.insertBefore(NewCenter, nav.children[0]);" +
|
||||
";})()");
|
||||
|
||||
}
|
||||
});
|
||||
@ -177,7 +167,7 @@ public class StartActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
IntentIntegrator intentIntegrator = new IntentIntegrator(StartActivity.this);
|
||||
intentIntegrator.setDesiredBarcodeFormats(intentIntegrator.EAN_13);
|
||||
intentIntegrator.setDesiredBarcodeFormats(intentIntegrator.ALL_CODE_TYPES);
|
||||
intentIntegrator.setBeepEnabled(false);
|
||||
intentIntegrator.setCameraId(0);
|
||||
intentIntegrator.setPrompt("SCAN ISBN");
|
||||
@ -196,7 +186,7 @@ public class StartActivity extends AppCompatActivity {
|
||||
Toast.makeText(this, "cancelled", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Log.d("MainActivity", "Scanned");
|
||||
myWebView.loadUrl("Javascript:(function() {document.getElementById('tour-search').value = " + Result.getContents() + ";" + "document.getElementById('search_input').value = " + Result.getContents() + ";" +
|
||||
myWebView.loadUrl("Javascript:(function() {document.getElementById('search_input').value = " + Result.getContents() + ";" +
|
||||
"document.getElementsByTagName('form')[0].submit(); ;})()");
|
||||
LoadIndicator.setVisibility(View.VISIBLE);
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
android:id="@+id/Instance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="1dp"
|
||||
android:layout_marginBottom="262dp"
|
||||
android:hint="bookwyrm.social"
|
||||
@ -41,7 +41,7 @@
|
||||
android:id="@+id/Username"
|
||||
android:layout_width="409dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginStart="1dp"
|
||||
android:layout_marginEnd="1dp"
|
||||
android:layout_marginBottom="284dp"
|
||||
android:hint="Username"
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
<EditText
|
||||
android:id="@+id/Password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="409dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="1dp"
|
||||
@ -89,10 +89,10 @@
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="76dp"
|
||||
android:layout_marginEnd="185dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:text="Instance. WITHOUT the https part"
|
||||
app:layout_constraintBottom_toTopOf="@+id/Instance"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@ -107,7 +107,7 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginEnd="41dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginBottom="35dp"
|
||||
android:text="Username"
|
||||
app:layout_constraintBottom_toTopOf="@+id/Username"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@ -115,21 +115,6 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/Instance" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginEnd="340dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="Password"
|
||||
app:layout_constraintBottom_toTopOf="@+id/Password"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/Username" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -14,7 +14,6 @@
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar3"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:indeterminate="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="715dp"
|
||||
|
@ -1,6 +1,6 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Bookwyrm" parent="Theme.AppCompat">
|
||||
<style name="Theme.Bookwyrm" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">#3298DC</item>
|
||||
<item name="colorPrimaryDark">#1B557C</item>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Bookwyrm" parent="Theme.AppCompat">
|
||||
<style name="Theme.Bookwyrm" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">#3298DC</item>
|
||||
<item name="colorPrimaryDark">#1B557C</item>
|
||||
|
@ -1,3 +0,0 @@
|
||||
* Fixed a bug with the barcode scanning. Now you can scan barcodes again.
|
||||
* Dependencies have been updated to newest versions.
|
||||
* More Bookwyrm instances have been added.
|
@ -1,6 +0,0 @@
|
||||
* Improved the loading bar.
|
||||
* The ISBN-scanning feature now works by simply clicking the ISBN button that is used by the instances that have scanning already available.
|
||||
* For instances that do not support the scanning server-side, there is now instead of the text a button for ISBN-scanning, similar to the standard one.
|
||||
* More bookwyrm instances added to the ones that can be opened in the app.
|
||||
* Small bug-fix, so now only ISBN-codes (And other EAN-13 codes) will be scanned.
|
||||
* Another bug-fix. The modified back button works again.
|
@ -1,2 +0,0 @@
|
||||
* Changed the initial screen to dark mode.
|
||||
* The login screen things are now better aligned.
|
Binary file not shown.
Before Width: | Height: | Size: 318 KiB After Width: | Height: | Size: 329 KiB |
Binary file not shown.
Before Width: | Height: | Size: 203 KiB After Width: | Height: | Size: 205 KiB |
Binary file not shown.
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 46 KiB |
Reference in New Issue
Block a user