Skip to content

Commit

Permalink
new name
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBoot committed Jan 9, 2022
1 parent 558b3d2 commit 7a73120
Show file tree
Hide file tree
Showing 34 changed files with 140 additions and 40 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.0.0]
### Changed
- App name and package changed **(please uninstall the old version manually)**
- New icon

## [1.0.0-alpha2]
### Added
- Ability to define custom rules
- Predefined sources: Samsung Pay, Bixby, Power Menu
- Predefined targets: Google Pay, Google Assistant Go

## [1.0.0-apha1]
### Added
- Initial release of Watch 4 PaySwitch
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,29 @@ Watch 4 PaySwitch allows you to start Google Pay by long pressing the back butto
## Installation

TBD
<!-- [![Get it on Google Play](https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png)](https://play.google.com/store/apps/details?id=de.bigboot.watch4payswitch&noprocess) -->
<!-- [![Get it on Google Play](https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png)](https://play.google.com/store/apps/details?id=de.bigboot.gw4remap&noprocess) -->

## Usage

| | |
| First launch setup | |
| -------------------- | ----------------------------------------------------------- |
| ![Step 1](img/1.png) | Press the switch to start the setup |
| ![Step 2](img/2.png) | Select `Installed services` |
| ![Step 3](img/3.png) | Select `Watch 4 PaySwitch` |
| ![Step 3](img/3.png) | Select `GW4 Remap` |
| ![Step 4](img/4.png) | Enable the Service |
| ![Step 5](img/5.png) | Confirm |
| ![Step 6](img/6.png) | After going back to the app, the service should be enabled. |
| ![Step 6](img/6.png) | Go back to the app and your should see the rules screen |


That's it. Long pressing the back button should now start up Google Pay
| Creating rules | |
| --------------------- | ------------------------------------------------------------------- |
| ![Step 1](img/7.png) | Press the `+` button to create a new rule |
| ![Step 2](img/8.png) | Press the bookmark icon next to the source input to select a source |
| ![Step 3](img/9.png) | Select the source |
| ![Step 4](img/10.png) | Do the same for the target |


That's it. Your buttons should now be remapped.


## License
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
compileSdk = 31

defaultConfig {
applicationId = "de.bigboot.watch4payswitch"
applicationId = "de.bigboot.gw4remap"
minSdk = 30
targetSdk = 31
versionCode = 1
Expand Down Expand Up @@ -56,7 +56,7 @@ dependencies {
implementation("com.google.android.material:material:1.4.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.2")
implementation("com.squareup.moshi:moshi-kotlin:1.13.0") {
// exclude("org.jetbrains.kotlin", "kotlin-reflect ")
exclude("org.jetbrains.kotlin", "kotlin-reflect ")
}
ksp("com.squareup.moshi:moshi-kotlin-codegen:1.13.0")
}
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.bigboot.watch4payswitch">
package="de.bigboot.gw4remap">

<uses-permission android:name="android.permission.WAKE_LOCK" />

Expand All @@ -26,7 +26,7 @@
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light">
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand All @@ -36,7 +36,7 @@
<activity
android:name=".SelectPredefinedActivity"
android:exported="false"
android:theme="@style/Theme.AppCompat.Light" />
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />

<service
android:name=".AccessibilityService"
Expand Down
Binary file added app/src/main/ic_launcher-playstore.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.bigboot.watch4payswitch
package de.bigboot.gw4remap

import android.accessibilityservice.AccessibilityService
import android.content.Intent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.bigboot.watch4payswitch
package de.bigboot.gw4remap

import android.annotation.SuppressLint
import android.app.Activity
Expand All @@ -11,7 +11,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.activity.result.contract.ActivityResultContract
import androidx.core.widget.doOnTextChanged
import de.bigboot.watch4payswitch.databinding.FragmentActivityRuleBinding
import de.bigboot.gw4remap.databinding.FragmentActivityRuleBinding
import java.lang.IndexOutOfBoundsException
import java.util.*

Expand Down
10 changes: 8 additions & 2 deletions app/src/main/kotlin/de/bigboot/watch4payswitch/AppPreferences.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.bigboot.watch4payswitch
package de.bigboot.gw4remap

import android.content.Context
import androidx.core.content.edit
Expand Down Expand Up @@ -113,7 +113,13 @@ object PredefinedTargets {
R.string.target_google_assistant_go
)

val ALL = listOf(GOOGLE_PAY, GOOGLE_ASSISTANT_GO)
val ULTIMATE_ALEXA = ActivityTarget(
"com.com.customsolutions.android.alexa",
"com.customsolutions.android.alexa.MainActivity",
R.string.target_ultimate_alexa
)

val ALL = listOf(GOOGLE_PAY, GOOGLE_ASSISTANT_GO, ULTIMATE_ALEXA)
}

fun Context.getAppPreferences() = AppPreferences(this)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.bigboot.watch4payswitch
package de.bigboot.gw4remap

import android.os.Bundle
import de.bigboot.watch4payswitch.databinding.ActivityMainBinding
import de.bigboot.gw4remap.databinding.ActivityMainBinding
import android.content.Intent

import android.provider.Settings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package de.bigboot.watch4payswitch
package de.bigboot.gw4remap

import android.app.Activity
import android.content.Intent
import android.graphics.Rect
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.TypedValue
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import androidx.wear.widget.WearableLinearLayoutManager
import de.bigboot.watch4payswitch.databinding.ActivitySelectPredefinedBinding
import de.bigboot.gw4remap.databinding.ActivitySelectPredefinedBinding

class SelectPredefinedActivity : AppCompatActivity() {
enum class ActivityType { Source, Target }
Expand All @@ -23,6 +27,31 @@ class SelectPredefinedActivity : AppCompatActivity() {
binding = ActivitySelectPredefinedBinding.inflate(layoutInflater)

binding.recyclerView.layoutManager = WearableLinearLayoutManager(this)
binding.recyclerView.addItemDecoration(object: RecyclerView.ItemDecoration() {
override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
super.getItemOffsets(outRect, view, parent, state)

val index = parent.getChildAdapterPosition(view);
val count = parent.adapter?.itemCount?.minus(1) ?: 0

if (index == 0) {
outRect.top =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50.0f, resources.displayMetrics)
.toInt()
}

if (index == count) {
outRect.bottom =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50.0f, resources.displayMetrics)
.toInt()
}
}
})
binding.recyclerView.adapter = SelectPredefinedAdapter(when (activityType) {
ActivityType.Source -> PredefinedSources.ALL.map { source ->
SelectPredefinedAdapter.Item(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package de.bigboot.watch4payswitch
package de.bigboot.gw4remap

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import de.bigboot.watch4payswitch.databinding.ActivitySelectPredefinedItemBinding
import de.bigboot.gw4remap.databinding.ActivitySelectPredefinedItemBinding

class SelectPredefinedAdapter(private val items: List<Item>): RecyclerView.Adapter<SelectPredefinedAdapter.ViewHolder>() {
data class Item(val name: String, val value: String)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="-2dp" android:left="-2dp" android:right="-2dp">
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#BFBFBF" />
<solid android:color="#00000000" />
</shape>
</item>
</layer-list>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#2a9af3"
android:pathData="M0,0h108v108h-108z"/>
</vector>
18 changes: 18 additions & 0 deletions app/src/main/res/drawable/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:pathData="m 34.769738,35.694011 -1.450214,8.741522 C 30.482163,46.66271 28.667741,50.110068 28.667741,54 c 0,3.874677 1.814422,7.33729 4.651783,9.564466 l 1.450214,8.741523 h 12.202605 l 1.450212,-8.741523 c 1.067745,-0.838122 1.989572,-1.851995 2.725568,-2.996182 l 0.313634,0.133226 c 0.368442,0.155948 0.790507,-0.01458 0.946455,-0.383023 l 0.849311,-2.008094 c 0.155949,-0.368442 -0.01458,-0.790506 -0.383022,-0.946454 L 52.628866,57.259856 C 52.917514,56.221129 53.074338,55.129053 53.074338,54 c 0,-1.283652 -0.200743,-2.518226 -0.567595,-3.677574 l 0.202614,-0.0902 c 0.365145,-0.163519 0.527112,-0.588248 0.363594,-0.953394 L 52.182006,47.288775 C 52.018489,46.92363 51.593758,46.761662 51.228613,46.925181 l -0.324737,0.145715 c -0.692955,-0.995774 -1.526862,-1.886163 -2.481321,-2.635363 l -1.450212,-8.741522 z m 6.101996,9.1523 A 9.1527802,9.1527802 0 0 1 50.024034,54 9.1527802,9.1527802 0 0 1 40.871734,63.1523 9.1527802,9.1527802 0 0 1 31.718045,54 9.1527802,9.1527802 0 0 1 40.871734,44.846311 Z"
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:strokeWidth="1"
android:strokeColor="#00000000"/>
<path
android:pathData="m 74.75467,56.752716 4.577588,3.424925 -4.577588,3.423349 V 61.679096 H 70.2692 c -1.829776,0 -3.469016,-0.821194 -4.576801,-2.111643 -1.108574,1.290449 -2.747813,2.111643 -4.577589,2.111643 h -5.808199 v -3.149355 h 5.806625 c 1.594361,0 2.892683,-1.296748 2.892683,-2.892684 v -2.680889 c 0,-1.593574 -1.297535,-2.891109 -2.892683,-2.891109 h -5.806625 v -3.149355 h 5.806625 c 1.830562,0 3.469802,0.821194 4.577588,2.110856 1.108573,-1.289662 2.747813,-2.110856 4.577588,-2.110856 h 4.483896 v -1.626643 l 4.577588,3.424925 -4.577588,3.424924 v -2.073063 h -4.483896 c -1.594361,0 -2.892683,1.296747 -2.892683,2.891109 v 2.681676 c 0,1.593574 1.29596,2.892683 2.892683,2.892683 h 4.483896 v -1.777811 h 0.0024 z"
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:strokeWidth="1"
android:strokeColor="#00000000"/>
</vector>
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/ic_predefined.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<vector android:height="12dp"
<vector android:height="12dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="12dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#ffffff" android:pathData="M18,2H6c-1.1,0 -2,0.9 -2,2v16c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4c0,-1.1 -0.9,-2 -2,-2zM6,4h5v8l-2.5,-1.5L6,12V4z"/>
<path android:fillColor="@android:color/white" android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>
8 changes: 5 additions & 3 deletions app/src/main/res/layout/activity_select_predefined.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.wear.widget.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SelectPredefinedActivity">
tools:context=".SelectPredefinedActivity"
android:padding="@dimen/box_inset_layout_padding"
tools:deviceIds="wear">

<androidx.wear.widget.WearableRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:accessibilityHeading="false" />
</FrameLayout>
</androidx.wear.widget.BoxInsetLayout>
6 changes: 4 additions & 2 deletions app/src/main/res/layout/activity_select_predefined_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_marginVertical="2dp"
android:background="@drawable/activity_select_predefined_item_background"
android:clickable="true"
android:paddingTop="6dp"
android:paddingBottom="6dp">
android:padding="4dp">

<TextView
android:id="@+id/text"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_adaptive_back"/>
<foreground android:drawable="@mipmap/ic_launcher_adaptive_fore"/>
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
5 changes: 5 additions & 0 deletions app/src/main/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="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified app/src/main/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 modified app/src/main/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 modified app/src/main/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 modified app/src/main/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 modified app/src/main/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.
14 changes: 6 additions & 8 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
<resources>
<string name="app_name">Watch 4 PaySwitch</string>
<string name="app_name">GW4 Remap</string>

<string name="accessibility_service_label">Watch 4 PaySwitch</string>
<string name="accessibility_service_description">Watch 4 PaySwitch Service</string>
<string name="accessibility_service_enabled">Watch 4 PaySwitch enabled</string>
<string name="accessibility_service_label">GW4 Remap</string>
<string name="accessibility_service_description">GW4 Remap Service</string>
<string name="accessibility_service_enabled">GW4 Remap enabled</string>

<string name="activity_rules">Rules</string>
<string name="add_rule">Add rule</string>
<string name="predefined_sources">Predefined sources</string>
<string name="predefined_targets">Predefined targets</string>

<string name="source_package_name">com.samsung.android.samsungpay.gear</string>
<string name="target_package_name">com.google.android.apps.walletnfcrel</string>
<string name="target_activity">com.google.commerce.tapandpay.android.wearable.cardlist.WearPayActivity</string>

<string name="target_google_pay">Google Pay</string>
<string name="target_google_assistant_go">Google Assistant Go</string>
<string name="target_ultimate_alexa">Ultimate Alexa</string>

<string name="source_samsung_pay">Samsung Pay</string>
<string name="source_bixby">Bixby</string>
<string name="source_power_menu">Power Menu</string>

<string name="activity_source">Source</string>
<string name="activity_target">Target</string>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/xml/accessibility_service_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
android:accessibilityFeedbackType="feedbackGeneric"
android:notificationTimeout="0"
android:canRetrieveWindowContent="false"
android:settingsActivity="de.bigboot.watch4payswitch.MainActivity"
android:settingsActivity="de.bigboot.gw4remap.MainActivity"
/>
Binary file modified img/1.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 img/10.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 img/3.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 img/6.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 img/7.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 img/8.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 img/9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ dependencyResolutionManagement {
mavenCentral()
}
}
rootProject.name = "Watch 4 PaySwitch"
rootProject.name = "GW4 Remap"
include(":app")

0 comments on commit 7a73120

Please sign in to comment.