feat: added companion app for WearOS, and setted up icons
This commit is contained in:
@@ -7,11 +7,13 @@ import android.widget.Button
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.PopupMenu
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.w3c.dom.Text
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
@@ -32,9 +34,23 @@ class MainActivity : AppCompatActivity() {
|
||||
cardsList = findViewById(R.id.cardsList)
|
||||
|
||||
val addCardButton: Button = findViewById(R.id.addCardButton)
|
||||
val syncWithWearOSButton: Button = findViewById(R.id.syncWithWearOSButton)
|
||||
|
||||
addCardButton.setOnClickListener {
|
||||
startActivity(Intent(this, AddCardActivity::class.java))
|
||||
}
|
||||
|
||||
syncWithWearOSButton.setOnClickListener {
|
||||
Toast.makeText(this, "Sync in progress...", Toast.LENGTH_SHORT).show()
|
||||
|
||||
val isSuccess = sendToWatch(this, "/updateCards", Json.encodeToString(db.getCards()))
|
||||
|
||||
if (isSuccess) {
|
||||
Toast.makeText(this, "Synced!", Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
Toast.makeText(this, "Sync failed! Please, check your connection", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
||||
Reference in New Issue
Block a user