more README info; pictures; DB closure for ShareActivity
This commit is contained in:
parent
6efc014ce5
commit
acdfe4c306
4 changed files with 26 additions and 2 deletions
20
README.md
20
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.
|
## 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:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
BIN
Screenshot_app.png
Executable file
BIN
Screenshot_app.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 82 KiB |
BIN
Screenshot_share.png
Executable file
BIN
Screenshot_share.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 201 KiB |
|
@ -35,6 +35,7 @@ class ShareActivity : AppCompatActivity() {
|
||||||
// Get the shared text
|
// Get the shared text
|
||||||
val sharedText = intent.getStringExtra(Intent.EXTRA_TEXT)
|
val sharedText = intent.getStringExtra(Intent.EXTRA_TEXT)
|
||||||
|
|
||||||
|
// pull variables from our app's SQLite DB
|
||||||
val url = dbHelper.getUrl()
|
val url = dbHelper.getUrl()
|
||||||
val token = dbHelper.getToken()
|
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) {
|
private fun sendPostRequest(url: String, token: String, sharedText: String) {
|
||||||
isRequestRunning = true
|
isRequestRunning = true
|
||||||
val fullUrl = "$url/api/recipes/create/url"
|
val fullUrl = "$url/api/recipes/create/url"
|
||||||
|
@ -84,6 +91,7 @@ class ShareActivity : AppCompatActivity() {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
isRequestRunning = false
|
isRequestRunning = false
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
|
// Send a Toast notification to the running UI (if successfully POSTed)
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
Toast.makeText(this@ShareActivity, "URL sent to your Mealie API", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this@ShareActivity, "URL sent to your Mealie API", Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue