Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
M
magicbox
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
magicbox
Commits
df80d24e
Commit
df80d24e
authored
Mar 09, 2022
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[提交人]:王雪伟
[提交简述] :添加翻译 [实现方案] :
parent
9f96b6e2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
91 additions
and
9 deletions
+91
-9
build.gradle
cms/build.gradle
+1
-0
AndroidManifest.xml
cms/src/main/AndroidManifest.xml
+11
-1
GooglePayActivity.kt
...src/main/java/com/zxhl/cms/googlepay/GooglePayActivity.kt
+63
-1
PayActivity.kt
cms/src/main/java/com/zxhl/cms/pay/PayActivity.kt
+3
-0
activity_google_pay.xml
cms/src/main/res/layout/activity_google_pay.xml
+8
-2
strings.xml
cms/src/main/res/values/strings.xml
+4
-4
dialog_layout_props_card.xml
moduleMain/src/main/res/layout/dialog_layout_props_card.xml
+1
-1
No files found.
cms/build.gradle
View file @
df80d24e
...
@@ -89,4 +89,5 @@ dependencies {
...
@@ -89,4 +89,5 @@ dependencies {
implementation
(
name:
'alipaySdk-15.6.4-20190611174341'
,
ext:
'aar'
)
implementation
(
name:
'alipaySdk-15.6.4-20190611174341'
,
ext:
'aar'
)
implementation
'androidx.constraintlayout:constraintlayout:2.0.4'
implementation
'androidx.constraintlayout:constraintlayout:2.0.4'
//implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
//implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation
(
"com.android.billingclient:billing:4.1.0"
)
}
}
cms/src/main/AndroidManifest.xml
View file @
df80d24e
...
@@ -3,7 +3,17 @@
...
@@ -3,7 +3,17 @@
package=
"com.zxhl.cms"
>
package=
"com.zxhl.cms"
>
<application>
<application>
<activity
android:name=
".googlepay.GooglePayActivity"
></activity>
<activity
android:name=
".googlepay.GooglePayActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<data
android:host=
"google_pay"
android:scheme=
"magicbox"
/>
</intent-filter>
</activity>
<activity
android:name=
".common.WebActivity"
>
<activity
android:name=
".common.WebActivity"
>
<intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<action
android:name=
"android.intent.action.VIEW"
/>
...
...
cms/src/main/java/com/zxhl/cms/googlepay/GooglePayActivity.kt
View file @
df80d24e
package
com.zxhl.cms.googlepay
package
com.zxhl.cms.googlepay
import
android.util.Log
import
android.view.View
import
android.view.View
import
com.android.billingclient.api.*
import
com.android.billingclient.api.BillingClient.SkuType
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.R
import
com.zxhl.cms.R
import
com.zxhl.cms.common.base.BaseActivity
import
com.zxhl.cms.common.base.BaseActivity
import
kotlinx.android.synthetic.main.activity_google_pay.*
class
GooglePayActivity
:
BaseActivity
()
{
class
GooglePayActivity
:
BaseActivity
()
{
private
val
TAG
=
"GooglePayActivity"
private
val
purchasesUpdatedListener
=
PurchasesUpdatedListener
{
billingResult
,
purchases
->
// To be implemented in a later section.
Log
.
d
(
TAG
,
"purchasesUpdatedListener"
+
billingResult
.
responseCode
)
Log
.
d
(
TAG
,
"purchasesUpdatedListener"
+
purchases
?.
size
)
}
private
var
billingClient
=
BillingClient
.
newBuilder
(
AppContext
.
get
())
.
setListener
(
purchasesUpdatedListener
)
.
enablePendingPurchases
()
.
build
()
override
fun
onClick
(
v
:
View
?)
{
override
fun
onClick
(
v
:
View
?)
{
TODO
(
"Not yet implemented"
)
}
}
override
fun
layoutID
():
Int
{
override
fun
layoutID
():
Int
{
...
@@ -15,6 +33,50 @@ class GooglePayActivity : BaseActivity() {
...
@@ -15,6 +33,50 @@ class GooglePayActivity : BaseActivity() {
}
}
override
fun
init
()
{
override
fun
init
()
{
id_btn_google_pay
.
setOnClickListener
{
}
startConnection
()
}
}
fun
startConnection
()
{
billingClient
.
startConnection
(
object
:
BillingClientStateListener
{
override
fun
onBillingSetupFinished
(
billingResult
:
BillingResult
)
{
if
(
billingResult
.
responseCode
==
BillingClient
.
BillingResponseCode
.
OK
)
{
// The BillingClient is ready. You can query purchases here.
// BillingClient准备好了。你可以在这里查询购买情况。
//querySkuDetails()
querySkuDetails
()
}
Log
.
d
(
TAG
,
billingResult
.
toString
())
}
override
fun
onBillingServiceDisconnected
()
{
// Try to restart the connection on the next request to
// 尝试在下一次请求时重新启动连接
// Google Play by calling the startConnection() method.
// 谷歌通过调用startConnection()方法来播放。
startConnection
()
Log
.
d
(
TAG
,
"onBillingServiceDisconnected"
)
}
})
}
fun
querySkuDetails
()
{
val
skuList
:
MutableList
<
String
>
=
ArrayList
()
skuList
.
add
(
"premium_upgrade"
)
skuList
.
add
(
"gas"
)
val
params
=
SkuDetailsParams
.
newBuilder
()
params
.
setSkusList
(
skuList
).
setType
(
SkuType
.
INAPP
)
billingClient
.
querySkuDetailsAsync
(
params
.
build
()
)
{
billingResult
,
skuDetailsList
->
// Process the result.
Log
.
d
(
TAG
,
"billingResult ${billingResult.responseCode}"
)
Log
.
d
(
TAG
,
"skuDetailsList ${skuDetailsList?.size}"
)
}
}
}
}
\ No newline at end of file
cms/src/main/java/com/zxhl/cms/pay/PayActivity.kt
View file @
df80d24e
package
com.zxhl.cms.pay
package
com.zxhl.cms.pay
import
android.content.Intent
import
android.os.Handler
import
android.os.Handler
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.util.Log
...
@@ -10,6 +11,7 @@ import com.zxhl.cms.R
...
@@ -10,6 +11,7 @@ import com.zxhl.cms.R
import
com.zxhl.cms.common.Constant
import
com.zxhl.cms.common.Constant
import
com.zxhl.cms.common.NetConfig
import
com.zxhl.cms.common.NetConfig
import
com.zxhl.cms.common.base.BaseActivity
import
com.zxhl.cms.common.base.BaseActivity
import
com.zxhl.cms.googlepay.GooglePayActivity
import
com.zxhl.cms.net.SettingPreference
import
com.zxhl.cms.net.SettingPreference
import
com.zxhl.cms.net.model.box.AppInEntity
import
com.zxhl.cms.net.model.box.AppInEntity
import
com.zxhl.cms.net.model.video.MemberEntity
import
com.zxhl.cms.net.model.video.MemberEntity
...
@@ -71,6 +73,7 @@ class PayActivity : BaseActivity(), PayContract.View,
...
@@ -71,6 +73,7 @@ class PayActivity : BaseActivity(), PayContract.View,
)
)
id_img_back
?.
setOnClickListener
{
id_img_back
?.
setOnClickListener
{
finish
()
finish
()
startActivity
(
Intent
(
this
,
GooglePayActivity
::
class
.
java
))
}
}
id_activity_member_close
?.
setOnClickListener
{
id_activity_member_close
?.
setOnClickListener
{
finish
()
finish
()
...
...
cms/src/main/res/layout/activity_google_pay.xml
View file @
df80d24e
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<
androidx.constraintlayout.widget.Constraint
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".googlepay.GooglePayActivity"
>
tools:context=
".googlepay.GooglePayActivity"
>
</androidx.constraintlayout.widget.ConstraintLayout>
<Button
\ No newline at end of file
android:id=
"@+id/id_btn_google_pay"
android:text=
"GooglePay"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
\ No newline at end of file
cms/src/main/res/values/strings.xml
View file @
df80d24e
...
@@ -72,11 +72,11 @@
...
@@ -72,11 +72,11 @@
<string
name=
"box_detail_open_box_one_lottery_btn"
>
Open
</string>
<string
name=
"box_detail_open_box_one_lottery_btn"
>
Open
</string>
<string
name=
"box_detail_open_box_five_lottery_btn"
>
Open 5x
</string>
<string
name=
"box_detail_open_box_five_lottery_btn"
>
Open 5x
</string>
<string
name=
"box_detail_open_box_shop_pool_tips"
>
爆率按商品等级划分
</string>
<string
name=
"box_detail_open_box_shop_pool_tips"
>
爆率按商品等级划分
</string>
<string
name=
"box_detail_open_box_bottom_desc"
>
到我的底线咯
~
</string>
<string
name=
"box_detail_open_box_bottom_desc"
>
No more data
~
</string>
<string
name=
"box_detail_open_box_shop_pool_gailv"
>
概率%1$s
</string>
<string
name=
"box_detail_open_box_shop_pool_gailv"
>
概率%1$s
</string>
<string
name=
"box_detail_open_box_result_btn_happy"
>
开心收下
</string>
<string
name=
"box_detail_open_box_result_btn_happy"
>
Take it
</string>
<string
name=
"box_detail_open_box_result_btn_try"
>
试试手气
</string>
<string
name=
"box_detail_open_box_result_btn_try"
>
Try my luck
</string>
<string
name=
"box_detail_open_box_result_btn_konw"
>
我知道了
</string>
<string
name=
"box_detail_open_box_result_btn_konw"
>
Got it
</string>
<string
name=
"box_detail_open_box_result_btn_one_again"
>
Open
</string>
<string
name=
"box_detail_open_box_result_btn_one_again"
>
Open
</string>
<string
name=
"box_detail_open_box_result_btn_five_again"
>
再来五发
</string>
<string
name=
"box_detail_open_box_result_btn_five_again"
>
再来五发
</string>
<string
name=
"box_detail_open_box_result_btn_receive"
>
立即收下
</string>
<string
name=
"box_detail_open_box_result_btn_receive"
>
立即收下
</string>
...
...
moduleMain/src/main/res/layout/dialog_layout_props_card.xml
View file @
df80d24e
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<LinearLayout
<LinearLayout
android:id=
"@+id/id_props_card_bg"
android:id=
"@+id/id_props_card_bg"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
260dp
"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerHorizontal=
"true"
android:layout_centerHorizontal=
"true"
android:background=
"@drawable/props_card_bj_dialog_chongchou_weihuode"
android:background=
"@drawable/props_card_bj_dialog_chongchou_weihuode"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment