Skip to content

Commit

Permalink
Version 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bplaat committed Jun 16, 2019
1 parent f3473f4 commit a708748
Show file tree
Hide file tree
Showing 34 changed files with 111 additions and 30 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
key.keystore
key.keystore
20 changes: 16 additions & 4 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="nl.plaatsoft.warquest3" android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28" />
package="nl.plaatsoft.warquest3"
android:versionCode="2"
android:versionName="1.1">

<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="28" />

<uses-permission android:name="android.permission.INTERNET" />
<application android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:theme="@style/AppTheme">

<application android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="false"
android:theme="@style/AppTheme">

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".SettingsActivity" android:windowSoftInputMode="stateVisible" />
</application>
</manifest>
</manifest>
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Bastiaan van der Plaat
Copyright (c) 2018, 2019 Bastiaan van der Plaat

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# bplaat/warquest-android
A simple android client for the game WarQuest!

![Logo](web_hi_res_512.png)
12 changes: 6 additions & 6 deletions build.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# keytool -genkey -validity 10000 -keystore key.keystore -keyalg RSA -keysize 2048 -storepass warquest -keypass warquest
PATH=$PATH:../android-sdk/build-tools/28.0.3:../android-sdk/platform-tools
PLATFORM=../android-sdk/platforms/android-28/android.jar
if aapt p -m -J src -M AndroidManifest.xml -S res -I $PLATFORM; then
if aapt package -m -J src -M AndroidManifest.xml -S res -I $PLATFORM; then
mkdir classes
if javac -Xlint -cp $PLATFORM -d classes src/nl/plaatsoft/warquest3/*.java; then
dx.bat --dex --output=classes.dex classes
aapt p -F warquest-unaligned.apk -M AndroidManifest.xml -S res -I $PLATFORM
aapt a warquest-unaligned.apk classes.dex
dx --dex --output=classes.dex classes
aapt package -F warquest-unaligned.apk -M AndroidManifest.xml -S res -I $PLATFORM
aapt add warquest-unaligned.apk classes.dex
zipalign -f -p 4 warquest-unaligned.apk warquest.apk
rm -r classes src/nl/plaatsoft/warquest3/R.java classes.dex warquest-unaligned.apk
apksigner.bat sign --ks key.keystore --ks-pass pass:warquest --ks-pass pass:warquest warquest.apk
apksigner sign --ks key.keystore --ks-pass pass:warquest --ks-pass pass:warquest warquest.apk
adb install -r warquest.apk
adb shell am start -n nl.plaatsoft.warquest3/.MainActivity
else
rm -r classes src/nl/plaatsoft/warquest3/R.java
fi
fi
fi
Binary file added ic_launcher-web.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions res/drawable-anydpi-v21/ic_arrow_back.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#fff" android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>
9 changes: 9 additions & 0 deletions res/drawable-anydpi-v21/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp" android:height="108dp" android:viewportWidth="10085" android:viewportHeight="10085">
<group android:translateX="2673" android:translateY="2673">
<path android:fillColor="#fff" android:pathData="M1200,3730c-19,-10 -42,-22 -50,-27 -8,-4 -33,-20 -56,-35 -23,-15 -61,-37 -85,-48 -24,-11 -62,-31 -84,-45 -22,-13 -49,-29 -60,-35 -11,-6 -38,-22 -60,-35 -22,-14 -51,-31 -65,-38 -14,-7 -44,-25 -67,-40 -24,-15 -45,-27 -47,-27 -13,0 -88,-89 -105,-124 -24,-52 -44,-166 -36,-214 14,-87 29,-139 46,-161 11,-13 19,-27 19,-31 0,-17 82,-87 131,-112l54,-28 1858,0c1388,0 1869,3 1905,12 26,6 61,21 77,32 17,12 39,26 49,32 11,5 38,46 60,90 23,43 44,80 49,82 4,2 7,55 7,118 0,124 -5,143 -63,219 -34,45 -78,89 -99,99 -7,3 -31,17 -53,31 -22,13 -53,31 -70,40 -16,8 -48,27 -70,40 -22,13 -53,31 -70,40 -16,8 -48,26 -70,40 -22,13 -55,31 -74,40 -18,9 -52,28 -75,43 -105,68 29,62 -1490,62 -1328,-1 -1372,-2 -1406,-20z" />
<path android:fillColor="#fff" android:pathData="M150,2668c-120,-117 -148,-148 -149,-172 -1,-25 20,-51 142,-174 78,-79 164,-162 190,-183l49,-39 290,0 289,0 -2,-100c-2,-84 0,-104 15,-118 16,-16 121,-17 1671,-17l1653,0 26,24c23,22 26,32 28,115l3,91 93,5c87,5 95,7 118,33 23,27 24,33 24,200 0,151 -2,176 -19,203 -13,21 -30,33 -52,38 -18,3 -910,6 -1983,6l-1951,-1 -105,104c-106,105 -134,127 -166,127 -9,0 -83,-64 -164,-142z" />
<path android:fillColor="#fff" android:pathData="M1469,1695c-29,-16 -42,-49 -43,-110l-1,-40 -390,-3 -391,-2 -10,28c-7,17 -25,35 -47,46 -33,15 -66,17 -280,14 -242,-3 -243,-3 -274,-28l-32,-25 0,-112c-1,-85 2,-113 12,-113 7,0 18,-9 25,-20 12,-19 23,-20 280,-20 266,0 269,0 289,23 11,12 23,30 26,40 6,16 34,17 402,17l395,0 0,-47c0,-71 8,-86 50,-106 32,-15 63,-18 167,-17 70,0 140,-1 156,-4 15,-3 37,-7 50,-10 12,-2 82,-16 155,-30 105,-21 159,-27 250,-25l116,1 -3,-45c-1,-25 2,-48 8,-52 6,-3 11,-15 11,-25 0,-14 9,-21 33,-25 47,-9 714,-1 723,8 5,4 10,36 12,71l4,64 58,4c32,2 64,11 72,19 15,15 66,113 138,264 24,50 47,98 52,107 23,48 -6,148 -42,148 -10,0 -22,5 -25,10 -4,7 -336,10 -963,10 -811,-1 -961,-3 -983,-15z" />
</group>
</vector>
5 changes: 5 additions & 0 deletions res/drawable-anydpi-v21/ic_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#fff" android:pathData="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z"/>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@
android:textColor="@color/secondary_text_color" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
5 changes: 5 additions & 0 deletions res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/background_color"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
5 changes: 5 additions & 0 deletions res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/background_color"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified res/mipmap-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/mipmap-hdpi/ic_launcher_round.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/mipmap-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/mipmap-mdpi/ic_launcher_round.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/mipmap-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/mipmap-xhdpi/ic_launcher_round.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/mipmap-xxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/mipmap-xxhdpi/ic_launcher_round.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/mipmap-xxxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/mipmap-xxxhdpi/ic_launcher_round.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions res/values-nl/strings.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">WarQuest</string>
<string name="settings">Instellingen</string>
<string name="username_label">Login gebruikersnaam</string>
<string name="password_label">Login wachtwoord</string>
<string name="zoom_label">Zoom inschakelen</string>
<string name="save_button">Opslaan en herlogin</string>
<string name="about">Deze applicatie is gemaakt door Bastiaan van der Plaat maar WarQuest is gemaakt door Willem van der Plaat</string>
</resources>
</resources>
7 changes: 7 additions & 0 deletions res/values-v11/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.Holo.NoActionBar">
<item name="android:textColor">@color/primary_text_color</item>
<item name="android:windowBackground">@color/background_color</item>
</style>
</resources>
9 changes: 9 additions & 0 deletions res/values-v21/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.Material.NoActionBar">
<item name="android:textColor">@color/primary_text_color</item>
<item name="android:windowBackground">@color/background_color</item>
<item name="android:colorPrimary">@color/primary_color</item>
<item name="android:colorPrimaryDark">@color/primary_dark_color</item>
</style>
</resources>
3 changes: 2 additions & 1 deletion res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary_color">#222</color>
<color name="primary_dark_color">#000</color>
<color name="primary_text_color">#fff</color>
<color name="secondary_text_color">#888</color>
<color name="background_color">#111</color>
</resources>
</resources>
4 changes: 2 additions & 2 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">WarQuest</string>
<string name="app_name" translatable="false">WarQuest</string>
<string name="settings">Settings</string>
<string name="username_label">Login username</string>
<string name="password_label">Login password</string>
<string name="zoom_label">Enable zoom</string>
<string name="save_button">Save and relogin</string>
<string name="about">This application is made by Bastiaan van der Plaat but WarQuest is made by Willem van der Plaat</string>
</resources>
</resources>
4 changes: 2 additions & 2 deletions res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@android:style/Theme.DeviceDefault.NoActionBar">
<style name="AppTheme" parent="@android:style/Theme.NoTitleBar">
<item name="android:textColor">@color/primary_text_color</item>
<item name="android:windowBackground">@color/background_color</item>
</style>
</resources>
</resources>
16 changes: 12 additions & 4 deletions src/nl/plaatsoft/warquest3/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@

public class MainActivity extends Activity {
private WebView webView;
protected void onCreate(Bundle savedInstanceState) {

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
setContentView(R.layout.activity_main);

((ImageView)findViewById(R.id.settings_button)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, SettingsActivity.class));
}
});

SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
webView = (WebView)findViewById(R.id.webview);
webView.setBackgroundColor(android.R.color.transparent);

WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setLoadWithOverviewMode(true);
Expand All @@ -34,12 +38,14 @@ public void onClick(View v) {
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
}

TextView headerTitle = (TextView)findViewById(R.id.header_title);
webView.setWebChromeClient(new WebChromeClient() {
public void onReceivedTitle(WebView view, String title) {
headerTitle.setText(title);
}
});

HashMap<String, String> headers = new HashMap<String, String>();
String username = preferences.getString("username", null);
String password = preferences.getString("password", null);
Expand All @@ -59,15 +65,17 @@ public void onReceivedTitle(WebView view, String title) {
headers.put("password", password);
webView.loadUrl("https://www.warquest.nl/", headers);
}
protected void onPause() {

public void onPause() {
super.onPause();
webView.clearHistory();
}

public void onBackPressed() {
if (webView.canGoBack()) {
webView.goBack();
} else {
super.onBackPressed();
}
}
}
}
13 changes: 10 additions & 3 deletions src/nl/plaatsoft/warquest3/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,39 @@
public class SettingsActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings_activity);
setContentView(R.layout.activity_settings);

((ImageView)findViewById(R.id.back_button)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
finish();
}
});

SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);

EditText usernameInput = (EditText)findViewById(R.id.username_input);
usernameInput.setText(preferences.getString("username", null));
usernameInput.setSelection(usernameInput.getText().length());

EditText passwordInput = (EditText)findViewById(R.id.password_input);
passwordInput.setText(preferences.getString("password", null));

Switch zoomSwitch = (Switch)findViewById(R.id.zoom_switch);
zoomSwitch.setChecked(preferences.getBoolean("zoom", true));

((Button)findViewById(R.id.save_button)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
SharedPreferences.Editor editor = preferences.edit();
editor.putString("username", usernameInput.getText().toString());
editor.putString("password", passwordInput.getText().toString());
editor.putBoolean("zoom", zoomSwitch.isChecked());
editor.apply();

Intent intent = new Intent(SettingsActivity.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
});
}
}
}
Binary file modified warquest.apk
Binary file not shown.
Binary file removed web_hi_res_512.png
Binary file not shown.

0 comments on commit a708748

Please sign in to comment.