diff --git a/README.md b/README.md index 37a08b8..c1077dd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,19 @@ -# mealie-android-share +# Mealie Android Share -Simple Android App to easily share recipe URLs to a locally owned Mealie server. \ No newline at end of file +## Simple Android App to easily share recipe URLs to a locally owned Mealie server. + +The app is *very* basic. + +The main activity stores your server URL and API token in a SQLite DB. + +Then you can click your Android's "Share" button and select "Mealie URL Share" and it will send the URL to your server for parsing. + +Will work with any shared URL. + +NOTE: This doesn't verify URLs or check for duplicates. + +Screenshots: + +![sharing_url](Screenshot_share.png) + +![app_screen](Screenshot_app.png) \ No newline at end of file diff --git a/Screenshot_app.png b/Screenshot_app.png new file mode 100755 index 0000000..2d5959c Binary files /dev/null and b/Screenshot_app.png differ diff --git a/Screenshot_share.png b/Screenshot_share.png new file mode 100755 index 0000000..a7e6b9c Binary files /dev/null and b/Screenshot_share.png differ diff --git a/app/src/main/java/org/seanandroid/mealieurlshare/ShareActivity.kt b/app/src/main/java/org/seanandroid/mealieurlshare/ShareActivity.kt index c0becc6..d192499 100644 --- a/app/src/main/java/org/seanandroid/mealieurlshare/ShareActivity.kt +++ b/app/src/main/java/org/seanandroid/mealieurlshare/ShareActivity.kt @@ -35,6 +35,7 @@ class ShareActivity : AppCompatActivity() { // Get the shared text val sharedText = intent.getStringExtra(Intent.EXTRA_TEXT) + // pull variables from our app's SQLite DB val url = dbHelper.getUrl() val token = dbHelper.getToken() @@ -46,6 +47,12 @@ class ShareActivity : AppCompatActivity() { } } + // Closes DB when process closes + override fun onDestroy() { + super.onDestroy() + dbHelper.close() + } + private fun sendPostRequest(url: String, token: String, sharedText: String) { isRequestRunning = true val fullUrl = "$url/api/recipes/create/url" @@ -84,6 +91,7 @@ class ShareActivity : AppCompatActivity() { override fun onResponse(call: Call, response: Response) { isRequestRunning = false if (response.isSuccessful) { + // Send a Toast notification to the running UI (if successfully POSTed) runOnUiThread { Toast.makeText(this@ShareActivity, "URL sent to your Mealie API", Toast.LENGTH_SHORT).show() }