Skip to content
This repository was archived by the owner on May 16, 2025. It is now read-only.

Commit 0b6f2cb

Browse files
committed
[WIP] v1.1.0
1 parent 0f6fac4 commit 0b6f2cb

File tree

9 files changed

+234
-7
lines changed

9 files changed

+234
-7
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
- [**PayPay**](https://play.google.com/store/apps/details?id=jp.ne.paypay.android.app&hl=ja)
1818
- [**楽天ペイ**](https://play.google.com/store/apps/details?id=jp.co.rakuten.pay&hl=ja)
1919
- [**d払い**](https://play.google.com/store/apps/details?id=com.nttdocomo.keitai.payment&hl=ja)
20+
- [**ファミペイ**](https://play.google.com/store/apps/details?id=jp.co.family.familymart_app&hl=ja)
2021
- [**VポイントPay**](https://play.google.com/store/apps/details?id=com.smbc_card.vpoint&hl=ja)
22+
- [**QUICK RIDE**](https://play.google.com/store/apps/details?id=com.lecipapp&hl=ja)
2123
- [**WESTER**](https://play.google.com/store/apps/details?id=jp.co.westjr.wester&hl=ja)
2224
- [**住信SBIネット銀行**](https://play.google.com/store/apps/details?id=jp.co.netbk&hl=ja)
2325
- [**みんなの銀行**](https://play.google.com/store/apps/details?id=com.MinnaNoGinko.bankapp&hl=ja)
2426

25-
## リクエスト
27+
## アプリ一覧の設定
2628

27-
アプリの追加、順番の並び替えを行いたい場合は、[**Issue**](https://github.com/s1204IT/PaymentSelector/issues/new) よりご連絡ください。
28-
基本はクローンして自分で修正してください。
29+
<!-- TODO -->

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ android {
99
defaultConfig {
1010
minSdk = 28
1111
targetSdk = 35
12-
versionCode = 1
13-
versionName = "1.0.0"
12+
versionCode = 2
13+
versionName = "1.1.0-rc1"
1414
proguardFiles += 'proguard-rules.pro'
1515
multiDexEnabled = false
1616
}

app/src/main/AndroidManifest.xml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,52 @@
44
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
55

66
<application
7+
android:appCategory="productivity"
78
android:icon="@android:drawable/ic_menu_set_as"
89
android:label="決済アプリ一覧"
10+
android:manageSpaceActivity=".ClearActivity"
911
android:theme="@android:style/Theme.Material.Light.Dialog.NoActionBar">
1012

1113
<activity
1214
android:name=".PaymentSelector"
1315
android:excludeFromRecents="true"
1416
android:exported="true"
15-
android:label="決済">
17+
android:label="決済"
18+
android:launchMode="singleInstance"
19+
android:noHistory="true">
1620
<intent-filter>
1721
<action android:name="android.intent.action.MAIN" />
1822
<category android:name="android.intent.category.DEFAULT" />
1923
<category android:name="android.intent.category.LAUNCHER" />
2024
</intent-filter>
2125
</activity>
2226

27+
<activity
28+
android:name=".SettingsActivity"
29+
android:exported="true"
30+
android:icon="@android:drawable/ic_input_add"
31+
android:label="アプリ一覧の設定"
32+
android:launchMode="singleInstance">
33+
<intent-filter>
34+
<action android:name="android.intent.action.VIEW" />
35+
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
36+
<category android:name="android.intent.category.INFO" />
37+
</intent-filter>
38+
</activity>
39+
40+
<activity
41+
android:name=".ClearActivity"
42+
android:excludeFromRecents="true"
43+
android:exported="true"
44+
android:icon="@android:drawable/ic_dialog_alert"
45+
android:label="アプリ一覧のリセット"
46+
android:launchMode="singleInstance">
47+
<intent-filter>
48+
<action android:name="android.intent.action.VIEW" />
49+
<category android:name="android.intent.category.PREFERENCE" />
50+
</intent-filter>
51+
</activity>
52+
2353
</application>
2454

2555
</manifest>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package me.s1204.payment.selector;
2+
3+
import android.app.Activity;
4+
import android.app.AlertDialog;
5+
import android.os.Bundle;
6+
7+
public class ClearActivity extends Activity {
8+
9+
/**
10+
* 構成のクリア
11+
* @since v1.1.0
12+
* @see #clearList()
13+
* @author Syuugo
14+
*/
15+
private void checkUserAcception() {
16+
new AlertDialog.Builder(this)
17+
.setTitle("アプリ一覧のリセット")
18+
.setIcon(android.R.drawable.ic_dialog_alert)
19+
.setMessage("設定したアプリ一覧をリセットしますか?")
20+
.setPositiveButton(android.R.string.yes, (d, s) -> clearList())
21+
.setNegativeButton(android.R.string.no, (d, s) -> finish())
22+
.show();
23+
}
24+
25+
/**
26+
* @since v1.1.0
27+
* @see #checkUserAcception()
28+
* @author Syuugo
29+
*/
30+
private void clearList() {
31+
//TODO: リストをクリア
32+
finishAndRemoveTask();
33+
}
34+
35+
/// @see #checkUserAcception()
36+
@Override
37+
protected void onCreate(Bundle savedInstanceState) {
38+
super.onCreate(savedInstanceState);
39+
checkUserAcception();
40+
}
41+
42+
@Override
43+
protected void onDestroy() {
44+
super.onDestroy();
45+
finishAndRemoveTask();
46+
}
47+
48+
}

app/src/main/java/me/s1204/payment/selector/PaymentSelector.java

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,39 @@
55
import android.content.Intent;
66
import android.content.pm.PackageManager;
77
import android.os.Bundle;
8+
import android.provider.Settings;
89
import android.view.View;
910
import android.widget.Button;
11+
import android.widget.Toast;
1012

1113
public class PaymentSelector extends Activity {
1214

15+
private static final String DOUBLE_PRESS = "function_key_config_doublepress";
16+
private static final String DOUBLE_PRESS_TYPE = DOUBLE_PRESS + "_type";
17+
private static final String DOUBLE_PRESS_VALUE = DOUBLE_PRESS + "_value";
18+
1319
/**
1420
* アプリ起動時の処理
1521
* @since v1.0.0
22+
* @see #checkDoublePress()
1623
* @see #setPackage(int, String, String)
1724
* @author Syuugo
1825
* @noinspection SpellCheckingInspection*/
1926
private void refresh() {
27+
28+
// アプリ一覧にアプリが1つも無かったら設定アクティビティを立ち上げ終了
29+
if (!checkItemCount()) {
30+
startActivity(
31+
new Intent(Intent.ACTION_VIEW)
32+
.setClassName(getPackageName(), SettingsActivity.class.getName())
33+
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
34+
);
35+
finish();
36+
return;
37+
}
38+
39+
// [2回押し]が有効でかつ選択されているかどうかの処理
40+
checkDoublePress();
2041
// レイアウトを表示
2142
setContentView(R.layout.applist);
2243

@@ -44,12 +65,24 @@ private void refresh() {
4465
"com.nttdocomo.keitai.payment",
4566
".presentation.scenes.splash.view.SplashActivity"
4667
);
68+
// ファミペイ
69+
setPackage(
70+
R.id.famipay,
71+
"jp.co.family.familymart_app",
72+
"jp.co.family.familymart.presentation.splash.SplashActivity"
73+
);
4774
// VポイントPay
4875
setPackage(
4976
R.id.v_point_pay,
5077
"com.smbc_card.vpoint",
5178
".ui.splash.SplashActivity"
5279
);
80+
// QUICK RIDE
81+
setPackage(
82+
R.id.quick_ride,
83+
"com.lecipapp",
84+
".SplashActivity"
85+
);
5386
// WESTER
5487
setPackage(
5588
R.id.wester,
@@ -113,6 +146,63 @@ private void setPackage(final int resId, final String packageName, String classN
113146
});
114147
}
115148

149+
/**
150+
* アプリ一覧にアプリが1つ以上選択されているか
151+
* @since v1.1.0
152+
* @see SettingsActivity#countSelectedItem()
153+
* @author Syuugo
154+
*/
155+
private boolean checkItemCount() {
156+
return SettingsActivity.countSelectedItem() > 0;
157+
}
158+
159+
/**
160+
* Galaxy において、ダブルクリックが有効かどうかを確認
161+
* @since v1.1.0
162+
* @author Syuugo
163+
*/
164+
private void checkDoublePress() {
165+
if (
166+
// Samsung 製の端末かどうか
167+
Settings.System.getString(getContentResolver(), "preload_fingerprint").startsWith("samsung/")
168+
// [2回押し]が有効かどうか
169+
&& (!checkInt(DOUBLE_PRESS, 1)
170+
// [アプリを起動]が選択されているかどうか
171+
|| !checkInt(DOUBLE_PRESS_TYPE, 2)
172+
// このアプリが対象に選ばれているかどうか
173+
|| !checkString(DOUBLE_PRESS_VALUE, getPackageName() + "/" + getClass().getName()))
174+
) {
175+
// トーストメッセージを表示
176+
Toast.makeText(this, "ダブルクリックの対象に選択されていません", Toast.LENGTH_SHORT).show();
177+
}
178+
}
179+
180+
/**
181+
* Global ネームスペースの整数型の値が一致するかどうかを返す
182+
* @param name 変数名
183+
* @param value 検証する値
184+
* @since v1.1.0
185+
* @author Syuugo
186+
* @noinspection BooleanMethodIsAlwaysInverted*/
187+
private boolean checkInt(String name, int value) {
188+
try {
189+
return Settings.Global.getInt(getContentResolver(), name) == value;
190+
} catch (Settings.SettingNotFoundException ignored) {
191+
return false;
192+
}
193+
}
194+
195+
/**
196+
* Global ネームスペースの文字列型の値が一致するかどうかを返す
197+
* @param name 変数名
198+
* @param value 検証する値
199+
* @since v1.1.0
200+
* @author Syuugo
201+
* @noinspection SameParameterValue*/
202+
private boolean checkString(String name, String value) {
203+
return Settings.Global.getString(getContentResolver(), name).equals(value);
204+
}
205+
116206
/// @see #refresh()
117207
@Override
118208
protected void onCreate(Bundle savedInstanceState) {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package me.s1204.payment.selector;
2+
3+
import android.app.Activity;
4+
import android.os.Bundle;
5+
6+
public class SettingsActivity extends Activity {
7+
8+
/**
9+
* アプリ一覧に設定されているアプリの合計数を返す
10+
* @return 設定されているアプリの合計数
11+
* @since v1.1.0
12+
* @author Syuugo
13+
*/
14+
protected static int countSelectedItem() {
15+
//TODO: showAppList() の実装後にこちらも修正
16+
return 1;
17+
}
18+
19+
/**
20+
* アプリ一覧に表示するアプリの設定
21+
* @since v1.1.0
22+
* @author Syuugo
23+
*/
24+
private void showAppList() {
25+
//TODO: AlertDialog で既存アプリをリスト化し、チェックボックスで選択後、閉じるボタンで finish()
26+
finishAndRemoveTask();
27+
}
28+
29+
/// @see #showAppList()
30+
@Override
31+
protected void onCreate(Bundle savedInstanceState) {
32+
super.onCreate(savedInstanceState);
33+
showAppList();
34+
}
35+
36+
@Override
37+
protected void onDestroy() {
38+
super.onDestroy();
39+
finishAndRemoveTask();
40+
}
41+
42+
}
870 Bytes
Loading
2.39 KB
Loading

app/src/main/res/layout/applist.xml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@
3737
android:text=" d払い"
3838
android:textAllCaps="false" />
3939

40+
<Button
41+
android:id="@+id/famipay"
42+
android:layout_width="wrap_content"
43+
android:layout_height="wrap_content"
44+
android:drawableStart="@drawable/famipay"
45+
android:text=" ファミペイ"
46+
android:textAllCaps="false" />
47+
4048
<Button
4149
android:id="@+id/v_point_pay"
4250
android:layout_width="wrap_content"
@@ -45,6 +53,14 @@
4553
android:text="VポイントPay"
4654
android:textAllCaps="false" />
4755

56+
<Button
57+
android:id="@+id/quick_ride"
58+
android:layout_width="wrap_content"
59+
android:layout_height="wrap_content"
60+
android:drawableStart="@drawable/quick_ride"
61+
android:text=" QUICK RIDE"
62+
android:textAllCaps="false" />
63+
4864
<Button
4965
android:id="@+id/wester"
5066
android:layout_width="wrap_content"
@@ -58,7 +74,7 @@
5874
android:layout_width="wrap_content"
5975
android:layout_height="wrap_content"
6076
android:drawableStart="@drawable/neobank"
61-
android:text=" NeoBank"
77+
android:text=" 住信SBI"
6278
android:textAllCaps="false" />
6379

6480
<Button

0 commit comments

Comments
 (0)