Skip to content

Commit

Permalink
Merge branch
Browse files Browse the repository at this point in the history
  • Loading branch information
terrabyte25 committed Jun 2, 2019
1 parent e3857ea commit e3ca655
Show file tree
Hide file tree
Showing 34 changed files with 245 additions and 119 deletions.
24 changes: 24 additions & 0 deletions 3rdparty-licenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@ Font Awesome Free

This software includes graphical resources based on Font Awesome icons. Font Awesome is licensed under the Creative Commons Attribution 4.0 International license. See https://fontawesome.com/license/free for more details.

journal.png: https://fontawesome.com/icons/book-open?style=solid
jump.png: https://fontawesome.com/icons/reply?style=solid
keyboard.png: https://fontawesome.com/icons/keyboard?style=solid
pause.png: https://fontawesome.com/icons/pause?style=solid
save.png: https://fontawesome.com/icons/file-download?style=solid
sneak.png: https://fontawesome.com/icons/eye-slash?style=solid
third_person.png: https://fontawesome.com/icons/video?style=solid
toggle.png: https://fontawesome.com/icons/bars?style=solid
toggle_magic.png: https://fontawesome.com/icons/bolt?style=solid
use.png: https://fontawesome.com/icons/hand-point-up?style=solid
wait.png: https://fontawesome.com/icons/hourglass?style=solid
mouse.png - https://github.com/FortAwesome/Font-Awesome/issues/2376#issuecomment-215401368 - Based on an icon by t1k3 https://github.com/t1k3


============
Noun Project
============

This software includes graphical resources based on Noun Project icons.

inventory.png: https://thenounproject.com/term/backpack/2551/ - CC-0 - By Rémy Médard, FR
weapon.png: https://thenounproject.com/term/sword/1161/ - CC-BY-3 - By Christopher T. Howlett, CA
attack.png: Based on the weapon.png by Christopher T. Howlett and modified by treio


=============
libjpeg-turbo
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ The second method is used to connect to servers which are not displayed on the b

If you want to go back to Singleplayer, simply untoggle the Multiplayer setting in the settings menu, and you can just start the game into Singleplayer by pressing the play icon.

[Google Play](https://play.google.com/store/apps/details?id=is.xyz.omw) | [Google Play (Nightly)](https://play.google.com/store/apps/details?id=is.xyz.omw_nightly) | [FAQ & Info](https://omw.xyz.is/)

## Building

There are two steps for building tes3mp for Android. The first step is building C/C++ libraries. The second step is building the Java launcher.
Expand Down Expand Up @@ -69,9 +71,3 @@ adb logcat | ./tool/asan_symbolize.py --demangle -s ./symbols/armeabi-v7a/
### Source code

Original Java code written by sandstranger. Build scripts originally written by sandstranger and bwhaines.

### Icons

Some of the icons used in this project (keyboard.xml, load.xml, pause.xml, save.xml) are Font Awesome icons, distributed under the terms of the CC-BY 4.0 license. See https://fontawesome.com/license/free for more details.

mouse.png - https://github.com/FortAwesome/Font-Awesome/issues/2376#issuecomment-215401368
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {

defaultConfig {
applicationId "is.terrabyte.omw"
versionCode 14
versionCode 17
versionName calculateVersion()

minSdkVersion 21
Expand Down Expand Up @@ -74,7 +74,7 @@ android {

applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "omw_${variant.buildType.name}_${defaultConfig.versionName}.apk"
outputFileName = "app-debug.apk"
}
}
}
Expand All @@ -97,5 +97,7 @@ dependencies {

implementation 'com.bugsnag:bugsnag-android-ndk:4.+'

implementation 'com.github.javiersantos:AppUpdater:2.7'

testImplementation 'junit:junit:4.12'
}
2 changes: 1 addition & 1 deletion app/settings-default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ terrain specular map pattern = _diffusespec
grab cursor = true

# Key controlling sneak toggles setting instead of being held down.
toggle sneak = false
toggle sneak = true

# Player is running by default.
always run = false
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
android:screenOrientation="fullUser"
android:theme="@style/MyTheme"
android:exported="true"
android:label="browser"
android:label="Server Browser"
/>

</application>
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/ui/activity/BrowserActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
import android.view.MenuItem;

import android.view.ViewGroup;
import android.widget.AdapterView;
Expand Down Expand Up @@ -41,6 +42,12 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.browser);

setSupportActionBar(findViewById(R.id.browser_toolbar));

// Enable the "back" icon in the action bar
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

listView = (ListView) findViewById(R.id.list);

pullToRefresh = (SwipeRefreshLayout) findViewById(R.id.pullToRefresh);
Expand Down Expand Up @@ -131,6 +138,17 @@ public int compare(Server m1, Server m2) {
sortPlayersFilter = false;
sortAlphabetFilter = true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
} else {
return super.onOptionsItemSelected(item);
}
}

}


44 changes: 44 additions & 0 deletions app/src/main/java/ui/activity/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ package ui.activity
import android.annotation.SuppressLint
import android.app.AlarmManager
import android.app.AlertDialog
import android.app.DownloadManager
import android.app.PendingIntent
import android.app.ProgressDialog
import android.content.*
import android.net.Uri
import android.os.Bundle
import android.os.Environment
import android.preference.PreferenceManager
import android.util.DisplayMetrics
import com.google.android.material.floatingactionbutton.FloatingActionButton
Expand All @@ -40,6 +42,10 @@ import com.bugsnag.android.Bugsnag

import com.libopenmw.openmw.BuildConfig
import com.libopenmw.openmw.R
import com.github.javiersantos.appupdater.AppUpdater;
import com.github.javiersantos.appupdater.enums.Display;
import com.github.javiersantos.appupdater.enums.UpdateFrom;

import constants.Constants
import file.GameInstaller

Expand Down Expand Up @@ -83,6 +89,14 @@ class MainActivity : AppCompatActivity() {
if (prefs.getString("bugsnag_consent", "")!! == "") {
askBugsnagConsent()
}

/**
AppUpdater(this)
.setUpdateFrom(UpdateFrom.GITHUB)
.setButtonUpdateClickListener{ _, _ -> update() }
.setGitHubUserAndRepo("terabyte25", "tes3mp-android")
.start();
*/
}

/**
Expand Down Expand Up @@ -347,6 +361,36 @@ class MainActivity : AppCompatActivity() {
deleteRecursive(File(Constants.USER_CONFIG))
}

private fun update() {
var destination: String = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + "/OpenMW-tes3mp-update.apk"
val uri = Uri.parse("file://" + destination)
val file = File(destination)
if (file.exists())
file.delete()
val url = "https://github.com/terabyte25/tes3mp-android/releases/latest/download/app-debug.apk"
val request = DownloadManager.Request(Uri.parse(url))
request.setDescription("Downloading the latest version of OpenMW")
request.setTitle("OpenMW update")
request.allowScanningByMediaScanner()
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
request.setDestinationUri(uri)
val manager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
val downloadId = manager.enqueue(request)
val onComplete = object:BroadcastReceiver() {

override fun onReceive(ctxt:Context, intent:Intent) {
val install = Intent(Intent.ACTION_VIEW)
install.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
install.setDataAndType(uri,
"application/vnd.android.package-‌​archive")
startActivity(install)
unregisterReceiver(this)
finish()
}
}
registerReceiver(onComplete, IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE))
}

public fun startGame() {
// Get scaling factor from config; if invalid or not provided, generate one
var scaling = 0f
Expand Down
Loading

0 comments on commit e3ca655

Please sign in to comment.