4 Commits

13 changed files with 83 additions and 9 deletions

View File

@ -1,7 +1,8 @@
# Bookwyrm-android
A crappy attempt at creating an Android application for Bookwyrm. Basically, it is just bookwyrm put into a 'webview' element.
An Android application for Bookwyrm. Basically, it is just bookwyrm put into a 'webview' element.
What it does? It enables you to use BookWyrm on your Android phone without having to use a browser to go to it every time.
It can also open links to userpages of Bookwyrm users.
This application works on: Android 6 and above.
And if you want to know, I am `@StoryDragon@wyrms.de` on BookWyrm.

View File

@ -9,8 +9,8 @@ android {
applicationId "nl.privacydragon.bookwyrm"
minSdk 23
targetSdk 31
versionCode 4
versionName "1.2.1"
versionCode 6
versionName "1.2.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

View File

@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 4,
"versionName": "1.2.1",
"versionCode": 6,
"versionName": "1.2.3",
"outputFile": "app-release.apk"
}
],

View File

@ -192,6 +192,50 @@
android:host="bookwyrm.tardis.pw"
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="tankie.ml"
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="masstoc.io"
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.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="bookwyrm.pt"
android:pathPrefix="/user/" />
</intent-filter>
</activity>
<activity
android:name=".StartActivity"

View File

@ -8,6 +8,7 @@ import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Base64;
import android.view.KeyEvent;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@ -31,6 +32,7 @@ import javax.crypto.spec.GCMParameterSpec;
public class HandlerActivity extends AppCompatActivity {
WebView myWebView;
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -41,7 +43,7 @@ public class HandlerActivity extends AppCompatActivity {
String appLinkAction = appLinkIntent.getAction();
Uri appLinkData = appLinkIntent.getData();
// End of auto-generated stuff
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView = (WebView) findViewById(R.id.webview);
myWebView.getSettings().setJavaScriptEnabled(true);
//The user credentials are stored in the shared preferences, so first they have to be read from there.
String defaultValue = "none";
@ -149,6 +151,17 @@ public class HandlerActivity extends AppCompatActivity {
//Here, load the login page of the server. That actually does all that is needed.
myWebView.loadUrl(toGoServer);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Check if the key event was the Back button and if there's history
if ((keyCode == KeyEvent.KEYCODE_BACK) && myWebView.canGoBack()) {
myWebView.goBack();
return true;
}
// If it wasn't the Back key or there's no web page history, bubble up to the default
// system behavior (probably exit the activity)
return super.onKeyDown(keyCode, event);
}
//Here is code to make sure that links of the bookwyrm server are handled withing the webview client, instead of having it open in the default browser.
//Yes, I used the web for this too.
private class MyWebViewClient extends WebViewClient {

View File

@ -7,6 +7,7 @@ import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Base64;
import android.view.KeyEvent;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@ -29,13 +30,13 @@ import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.GCMParameterSpec;
public class StartActivity extends AppCompatActivity {
WebView myWebView;
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_start);
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView = (WebView) findViewById(R.id.webview);
myWebView.getSettings().setJavaScriptEnabled(true);
//The user credentials are stored in the shared preferences, so first they have to be read from there.
String defaultValue = "none";
@ -118,6 +119,17 @@ public class StartActivity extends AppCompatActivity {
//Here, load the login page of the server. That actually does all that is needed.
myWebView.loadUrl("https://" + server + "/login");
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Check if the key event was the Back button and if there's history
if ((keyCode == KeyEvent.KEYCODE_BACK) && myWebView.canGoBack()) {
myWebView.goBack();
return true;
}
// If it wasn't the Back key or there's no web page history, bubble up to the default
// system behavior (probably exit the activity)
return super.onKeyDown(keyCode, event);
}
//Here is code to make sure that links of the bookwyrm server are handled withing the webview client, instead of having it open in the default browser.
//Yes, I used the web for this too.
private class MyWebViewClient extends WebViewClient {

View File

@ -0,0 +1,3 @@
Initial release for F-Droid.
* Added support for four more BookWyrm instances.

View File

@ -1,2 +1,3 @@
This is a, probably crappy, Android client for BookWyrm.
This is an Android client for BookWyrm.
It is just BookWyrm put into a webview element, nothing special.
<b>This application is <u>not</u> an official client!</b> (An official client does not exist yet, as far as I know)

View File

Before

Width:  |  Height:  |  Size: 302 KiB

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB