Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
WalletDemo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林封赶
WalletDemo
Commits
e3073aa1
Commit
e3073aa1
authored
Oct 27, 2021
by
linfenggan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改钱包等关键字
parent
4ed7dc1a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
166 additions
and
981 deletions
+166
-981
.gitignore
.gitignore
+1
-0
encodings.xml
.idea/encodings.xml
+10
-0
jarRepositories.xml
.idea/jarRepositories.xml
+21
-0
build.gradle
WalletModule/build.gradle
+3
-2
nexus-push.gradle
WalletModule/nexus-push.gradle
+58
-0
WalletAdapter.kt
...c/main/java/com/fzm/walletmodule/adapter/WalletAdapter.kt
+1
-16
WalletModuleApp.kt
...rc/main/java/com/fzm/walletmodule/base/WalletModuleApp.kt
+2
-1
PWallet.java
...src/main/java/com/fzm/walletmodule/db/entity/PWallet.java
+1
-2
BackUpWalletActivity.kt
.../com/fzm/walletmodule/ui/activity/BackUpWalletActivity.kt
+1
-5
ImportWalletActivity.kt
.../com/fzm/walletmodule/ui/activity/ImportWalletActivity.kt
+3
-1
WalletFragment.kt
...n/java/com/fzm/walletmodule/ui/fragment/WalletFragment.kt
+1
-54
WalletIndexFragment.kt
...a/com/fzm/walletmodule/ui/fragment/WalletIndexFragment.kt
+5
-19
CommonDialogFragment.java
.../com/fzm/walletmodule/ui/widget/CommonDialogFragment.java
+1
-1
EditDialogFragment.java
...va/com/fzm/walletmodule/ui/widget/EditDialogFragment.java
+2
-2
FlowTagLayout.java
...in/java/com/fzm/walletmodule/ui/widget/FlowTagLayout.java
+2
-2
MenuItemType.java
...ava/com/fzm/walletmodule/ui/widget/swip/MenuItemType.java
+0
-14
SwapRecyclerView.java
...com/fzm/walletmodule/ui/widget/swip/SwapRecyclerView.java
+0
-193
SwipeMenu.java
...n/java/com/fzm/walletmodule/ui/widget/swip/SwipeMenu.java
+0
-41
SwipeMenuBuilder.java
...com/fzm/walletmodule/ui/widget/swip/SwipeMenuBuilder.java
+0
-10
SwipeMenuItem.java
...va/com/fzm/walletmodule/ui/widget/swip/SwipeMenuItem.java
+0
-120
SwipeMenuLayout.java
.../com/fzm/walletmodule/ui/widget/swip/SwipeMenuLayout.java
+0
-0
SwipeMenuView.java
...va/com/fzm/walletmodule/ui/widget/swip/SwipeMenuView.java
+0
-119
activity_import_wallet.xml
WalletModule/src/main/res/layout/activity_import_wallet.xml
+1
-1
activity_my_wallets.xml
WalletModule/src/main/res/layout/activity_my_wallets.xml
+0
-30
fragment_wallet.xml
WalletModule/src/main/res/layout/fragment_wallet.xml
+1
-1
fragment_wallet_index.xml
WalletModule/src/main/res/layout/fragment_wallet_index.xml
+0
-34
view_header_wallet.xml
WalletModule/src/main/res/layout/view_header_wallet.xml
+1
-1
view_item_coin_info.xml
WalletModule/src/main/res/layout/view_item_coin_info.xml
+1
-0
strings.xml
WalletModule/src/main/res/values/strings.xml
+20
-20
build.gradle
app/build.gradle
+15
-9
walletdemo.jks
app/sign/walletdemo.jks
+0
-0
CommonFragment.kt
app/src/main/java/com/fzm/walletdemo/CommonFragment.kt
+0
-62
MainActivity.kt
app/src/main/java/com/fzm/walletdemo/MainActivity.kt
+13
-119
activity_main.xml
app/src/main/res/layout/activity_main.xml
+0
-100
strings.xml
app/src/main/res/values/strings.xml
+1
-1
build.gradle
build.gradle
+1
-1
No files found.
.gitignore
View file @
e3073aa1
...
...
@@ -13,3 +13,4 @@
.externalNativeBuild
.cxx
local.properties
/build/
.idea/encodings.xml
0 → 100644
View file @
e3073aa1
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"Encoding"
native2AsciiForPropertiesFiles=
"true"
defaultCharsetForPropertiesFiles=
"UTF-8"
>
<file
url=
"file://$PROJECT_DIR$/WalletModule/src/main/java/com/fzm/walletmodule/db/entity/Coin.java"
charset=
"UTF-8"
/>
<file
url=
"file://$PROJECT_DIR$/WalletModule/src/main/java/com/fzm/walletmodule/db/entity/PWallet.java"
charset=
"GBK"
/>
<file
url=
"file://$PROJECT_DIR$/WalletModule/src/main/java/com/fzm/walletmodule/listener/SoftKeyBoardListener.java"
charset=
"UTF-8"
/>
<file
url=
"PROJECT"
charset=
"UTF-8"
/>
</component>
</project>
\ No newline at end of file
.idea/jarRepositories.xml
View file @
e3073aa1
...
...
@@ -26,5 +26,25 @@
<option
name=
"name"
value=
"maven"
/>
<option
name=
"url"
value=
"https://jitpack.io"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"MavenLocal"
/>
<option
name=
"name"
value=
"MavenLocal"
/>
<option
name=
"url"
value=
"file:/$USER_HOME$/.m2/repository"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"maven2"
/>
<option
name=
"name"
value=
"maven2"
/>
<option
name=
"url"
value=
"http://localhost:8081/repository/release/"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"MavenLocal"
/>
<option
name=
"name"
value=
"MavenLocal"
/>
<option
name=
"url"
value=
"file:/$USER_HOME$/.m2/repository/"
/>
</remote-repository>
<remote-repository>
<option
name=
"id"
value=
"MavenRepo"
/>
<option
name=
"name"
value=
"MavenRepo"
/>
<option
name=
"url"
value=
"https://repo.maven.apache.org/maven2/"
/>
</remote-repository>
</component>
</project>
\ No newline at end of file
WalletModule/build.gradle
View file @
e3073aa1
...
...
@@ -78,4 +78,5 @@ dependencies {
api
"com.alibaba:fastjson:1.2.48"
api
"cn.finalteam.loadingviewfinal:ultra-pull-to-refresh:1.0.1"
}
\ No newline at end of file
}
apply
from:
'./nexus-push.gradle'
\ No newline at end of file
WalletModule/nexus-push.gradle
0 → 100644
View file @
e3073aa1
apply
plugin:
'maven'
task
androidJavadocs
(
type:
Javadoc
)
{
source
=
android
.
sourceSets
.
main
.
java
.
srcDirs
classpath
+=
project
.
files
(
android
.
getBootClasspath
().
join
(
File
.
pathSeparator
))
failOnError
false
// 忽略错误配置
}
task
androidJavadocsJar
(
type:
Jar
,
dependsOn:
androidJavadocs
)
{
classifier
=
'javadoc'
from
androidJavadocs
.
destinationDir
}
task
androidSourcesJar
(
type:
Jar
)
{
classifier
=
'sources'
from
android
.
sourceSets
.
main
.
java
.
srcDirs
}
artifacts
{
archives
androidSourcesJar
archives
androidJavadocsJar
}
task
javadoc
(
type:
Javadoc
)
{
options
.
encoding
"UTF-8"
options
.
charSet
'UTF-8'
}
allprojects
{
repositories
{
mavenLocal
()
jcenter
()
}
}
uploadArchives
{
repositories
{
mavenDeployer
{
repository
(
url:
"http://localhost:8081/repository/release/"
)
{
authentication
(
userName:
"admin"
,
password:
"123456"
)
}
pom
.
groupId
=
'com.fzm.walletmodule'
pom
.
artifactId
=
'wallet'
pom
.
version
=
'0.0.1'
pom
.
project
{
licenses
{
license
{
name
'The Apache Software License, Version 2.0'
url
'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
}
}
}
}
\ No newline at end of file
WalletModule/src/main/java/com/fzm/walletmodule/adapter/WalletAdapter.kt
View file @
e3073aa1
...
...
@@ -5,27 +5,17 @@ import android.text.TextUtils
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.view.animation.BounceInterpolator
import
android.view.animation.LinearInterpolator
import
android.widget.ImageView
import
androidx.fragment.app.Fragment
import
com.bumptech.glide.Glide
import
com.fzm.walletmodule.R
import
com.fzm.walletmodule.db.entity.Coin
import
com.fzm.walletmodule.ui.widget.swip.SwipeMenuBuilder
import
com.fzm.walletmodule.ui.widget.swip.SwipeMenuLayout
import
com.fzm.walletmodule.ui.widget.swip.SwipeMenuView
import
com.fzm.walletmodule.utils.DecimalUtils
import
com.zhy.adapter.recyclerview.CommonAdapter
import
com.zhy.adapter.recyclerview.base.ViewHolder
class
WalletAdapter
(
context
:
Context
,
layoutId
:
Int
,
datas
:
List
<
Coin
>,
fragment
:
Fragment
)
:
CommonAdapter
<
Coin
>(
context
,
layoutId
,
datas
)
{
private
var
swipeMenuBuilder
:
SwipeMenuBuilder
?
=
null
init
{
swipeMenuBuilder
=
fragment
as
SwipeMenuBuilder
}
override
fun
convert
(
holder
:
ViewHolder
?,
baseCoin
:
Coin
?,
position
:
Int
)
{
holder
!!
.
setText
(
R
.
id
.
name
,
baseCoin
!!
.
uiName
)
...
...
@@ -54,12 +44,7 @@ class WalletAdapter(context: Context, layoutId: Int, datas: List<Coin>, fragment
layoutId
,
parent
,
false
)
val
left
:
SwipeMenuView
=
swipeMenuBuilder
!!
.
createLeft
()
val
right
:
SwipeMenuView
=
swipeMenuBuilder
!!
.
createRight
()
val
swipeMenuLayout
=
SwipeMenuLayout
(
itemView
,
right
,
left
,
BounceInterpolator
(),
LinearInterpolator
())
val
holder
=
ViewHolder
(
mContext
,
swipeMenuLayout
)
val
holder
=
ViewHolder
(
mContext
,
itemView
)
onViewHolderCreated
(
holder
,
holder
.
convertView
)
holder
.
setOnClickListener
(
R
.
id
.
middle
)
{
view
->
if
(
mItemClickListener
!=
null
)
{
...
...
WalletModule/src/main/java/com/fzm/walletmodule/base/WalletModuleApp.kt
View file @
e3073aa1
package
com.fzm.walletmodule.base
import
android.content.Context
import
com.bumptech.glide.Glide
import
com.tencent.mmkv.MMKV
import
org.jetbrains.anko.doAsync
import
org.litepal.LitePal
...
...
@@ -12,7 +14,6 @@ class WalletModuleApp {
this
.
context
=
context
MMKV
.
initialize
(
context
)
LitePal
.
initialize
(
context
)
}
}
...
...
WalletModule/src/main/java/com/fzm/walletmodule/db/entity/PWallet.java
View file @
e3073aa1
...
...
@@ -23,10 +23,9 @@ public class PWallet extends BaseBean {
private
String
name
;
private
String
password
;
private
String
mnem
;
//0
:英文 1:
中文
//0
:英文 1:
中文
private
int
mnemType
;
private
List
<
Coin
>
coinList
=
new
ArrayList
<>();
//小钱包是否设置过密码,临时使用字段
private
boolean
putpassword
;
public
boolean
isPutpassword
()
{
...
...
WalletModule/src/main/java/com/fzm/walletmodule/ui/activity/BackUpWalletActivity.kt
View file @
e3073aa1
...
...
@@ -136,7 +136,7 @@ class BackUpWalletActivity : BaseActivity() {
var
isHave
=
false
for
(
i
in
mMnemResultList
.
indices
)
{
for
(
j
in
mMnemList
.
indices
)
{
if
(
mMnemResultList
[
i
].
mnem
.
equals
(
backUp
.
mnem
)
&&
backUp
.
select
==
=
1
)
{
if
(
mMnemResultList
[
i
].
mnem
.
equals
(
backUp
.
mnem
)
&&
backUp
.
select
==
1
)
{
isHave
=
true
break
}
...
...
@@ -188,15 +188,12 @@ class BackUpWalletActivity : BaseActivity() {
}
// 设置适配器
// 设置适配器
mMnemResultAdapter
=
BackUpWalletAdapter
(
R
.
layout
.
activity_back_up_wallet_item
,
mMnemResultList
,
mPWallet
.
mnemType
)
//给RecyclerView设置适配器
//给RecyclerView设置适配器
ftl_mnem_result
.
adapter
=
mMnemResultAdapter
mMnemResultAdapter
?.
notifyDataSetChanged
()
val
itemDragAndSwipeCallback
=
ItemDragAndSwipeCallback
(
mMnemResultAdapter
)
...
...
@@ -263,7 +260,6 @@ class BackUpWalletActivity : BaseActivity() {
EventBus
.
getDefault
().
postSticky
(
MyWalletEvent
(
mPWallet
))
closeSomeActivitys
()
}
})
}
...
...
WalletModule/src/main/java/com/fzm/walletmodule/ui/activity/ImportWalletActivity.kt
View file @
e3073aa1
...
...
@@ -18,6 +18,8 @@ import com.fzm.walletmodule.utils.*
import
com.qmuiteam.qmui.util.QMUIKeyboardHelper
import
com.snail.antifake.jni.EmulatorDetectUtil
import
kotlinx.android.synthetic.main.activity_import_wallet.*
import
kotlinx.android.synthetic.main.activity_import_wallet.et_mnem
import
kotlinx.android.synthetic.main.view_import0.*
import
org.greenrobot.eventbus.EventBus
import
org.greenrobot.eventbus.Subscribe
import
org.greenrobot.eventbus.ThreadMode
...
...
@@ -42,7 +44,6 @@ class ImportWalletActivity : BaseActivity() {
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_import_wallet
)
initIntent
()
initData
()
initListener
()
initObserver
()
...
...
@@ -53,6 +54,7 @@ class ImportWalletActivity : BaseActivity() {
val
count
=
LitePal
.
count
<
PWallet
>()
val
name
=
getString
(
R
.
string
.
import_wallet_wallet_name
)
+
(
count
+
1
)
walletName
.
setText
(
name
)
et_mnem
.
setRegex
(
LimitEditText
.
REGEX_CHINESE_ENGLISH
)
}
override
fun
initListener
()
{
...
...
WalletModule/src/main/java/com/fzm/walletmodule/ui/fragment/WalletFragment.kt
View file @
e3073aa1
...
...
@@ -17,7 +17,6 @@ import com.fzm.walletmodule.db.entity.PWallet
import
com.fzm.walletmodule.event.*
import
com.fzm.walletmodule.ui.activity.*
import
com.fzm.walletmodule.ui.base.BaseFragment
import
com.fzm.walletmodule.ui.widget.swip.*
import
com.fzm.walletmodule.utils.*
import
kotlinx.android.synthetic.main.fragment_wallet.*
import
org.greenrobot.eventbus.EventBus
...
...
@@ -29,7 +28,7 @@ import org.litepal.LitePal.where
import
java.lang.String
import
java.util.*
class
WalletFragment
:
BaseFragment
()
,
SwipeMenuBuilder
{
class
WalletFragment
:
BaseFragment
()
{
private
var
mWalletAdapter
:
WalletAdapter
?
=
null
private
var
mHeaderView
:
View
?
=
null
private
var
mPWallet
:
PWallet
?
=
null
...
...
@@ -181,58 +180,6 @@ class WalletFragment : BaseFragment(), SwipeMenuBuilder {
const
val
UPDATE_WALLET
=
1000
}
override
fun
createRight
():
SwipeMenuView
{
val
menu
=
SwipeMenu
(
activity
)
val
item
=
SwipeMenuItem
(
activity
)
item
.
setTitle
(
"转账"
)
.
setTitleColor
(
Color
.
WHITE
)
.
setIcon
(
R
.
mipmap
.
menu_right_icon
)
.
setTitleSize
(
16
)
.
setType
(
MenuItemType
.
LEFT
)
.
setWidth
(
ScreenUtils
.
dp2px
(
activity
,
88f
))
.
setBackground
(
resources
.
getDrawable
(
R
.
drawable
.
menu_right_bg
))
menu
.
addMenuItem
(
item
)
val
menuView
=
SwipeMenuView
(
menu
)
menuView
.
setOnMenuItemClickListener
{
position
,
menu
,
index
->
val
coinPosition
=
position
-
1
//减去header
val
coin
=
mCoinList
[
coinPosition
]
as
Coin
val
intent
=
Intent
(
activity
,
OutActivity
::
class
.
java
)
intent
.
putExtra
(
Coin
::
class
.
java
.
simpleName
,
coin
)
startActivity
(
intent
)
}
return
menuView
}
override
fun
createLeft
():
SwipeMenuView
{
val
menu
=
SwipeMenu
(
activity
)
val
item
=
SwipeMenuItem
(
activity
)
item
.
setTitle
(
"收款"
)
.
setTitleColor
(
Color
.
WHITE
)
.
setTitleSize
(
16
)
.
setWidth
(
ScreenUtils
.
dp2px
(
activity
,
88f
))
.
setType
(
MenuItemType
.
LEFT
)
.
setIcon
(
R
.
mipmap
.
menu_left_icon
)
.
setBackground
(
resources
.
getDrawable
(
R
.
drawable
.
menu_left_bg
))
menu
.
addMenuItem
(
item
)
val
menuView
=
SwipeMenuView
(
menu
)
menuView
.
setOnMenuItemClickListener
{
position
,
menu
,
index
->
val
coinPosition
=
position
-
1
//减去header
val
coin
=
mCoinList
[
coinPosition
]
as
Coin
val
intent
=
Intent
(
activity
,
InActivity
::
class
.
java
)
intent
.
putExtra
(
Coin
::
class
.
java
.
simpleName
,
coin
)
startActivity
(
intent
)
}
return
menuView
}
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
public
fun
onUpdateWalletNameEvent
(
event
:
UpdateWalletNameEvent
)
{
if
(
event
!=
null
&&
event
.
needUpdate
)
{
...
...
WalletModule/src/main/java/com/fzm/walletmodule/ui/fragment/WalletIndexFragment.kt
View file @
e3073aa1
...
...
@@ -16,7 +16,7 @@ import kotlinx.android.synthetic.main.fragment_wallet_index.*
* 钱包入口fragment
*/
class
WalletIndexFragment
:
BaseFragment
()
{
private
var
agree
=
true
override
fun
getLayout
():
Int
{
return
R
.
layout
.
fragment_wallet_index
}
...
...
@@ -28,29 +28,14 @@ class WalletIndexFragment : BaseFragment() {
override
fun
initListener
()
{
walletCreate
.
setOnClickListener
{
if
(!
agree
)
{
ToastUtils
.
show
(
activity
,
getString
(
R
.
string
.
my_wallet_read_toast
))
return
@setOnClickListener
}
startActivity
(
Intent
(
activity
,
CreateWalletActivity
::
class
.
java
))
}
walletImport
.
setOnClickListener
{
if
(!
agree
)
{
ToastUtils
.
show
(
activity
,
getString
(
R
.
string
.
my_wallet_read_toast
))
return
@setOnClickListener
}
val
intent
=
Intent
(
activity
,
ImportWalletActivity
::
class
.
java
)
startActivity
(
intent
)
}
agreementChoice
.
setOnClickListener
{
activity
?.
let
{
if
(
agree
)
{
agreementChoice
.
setImageDrawable
(
ContextCompat
.
getDrawable
(
it
,
R
.
mipmap
.
agreement_un_choice
))
}
else
{
agreementChoice
.
setImageDrawable
(
ContextCompat
.
getDrawable
(
it
,
R
.
mipmap
.
agreement_choice
))
}
}
agree
=
!
agree
}
}
}
\ No newline at end of file
WalletModule/src/main/java/com/fzm/walletmodule/ui/widget/CommonDialogFragment.java
View file @
e3073aa1
...
...
@@ -29,7 +29,7 @@ public class CommonDialogFragment extends DialogFragment {
private
String
mResultDetails
;
private
String
mLeftButtonStr
;
private
String
mRightButtonStr
;
private
int
type
=
2
;
// 1=1个按钮,2=
2个按钮
private
int
type
=
2
;
// 1= 1个按钮 2=
2个按钮
private
int
resultColor
=
-
1
;
private
View
mVMiddleLine
;
private
AlertDialog
mAlertDialog
;
...
...
WalletModule/src/main/java/com/fzm/walletmodule/ui/widget/EditDialogFragment.java
View file @
e3073aa1
...
...
@@ -32,11 +32,11 @@ public class EditDialogFragment extends DialogFragment {
private
String
mTitle
;
private
String
mHint
;
private
String
mInput
;
//要一起写才能
起
作用
//要一起写才能
气
作用
private
int
mInputType
=
InputType
.
TYPE_CLASS_TEXT
|
InputType
.
TYPE_TEXT_VARIATION_PASSWORD
;
private
int
maxlength
=
0
;
private
String
mRightButtonStr
;
private
int
type
=
2
;
// 1=1个按钮,2=
2个按钮
private
int
type
=
2
;
// 1= 1个按钮 2=
2个按钮
private
EditText
mEtInput
;
private
TextView
mTvTitle
;
private
boolean
isAutoDismiss
=
true
;
...
...
WalletModule/src/main/java/com/fzm/walletmodule/ui/widget/FlowTagLayout.java
View file @
e3073aa1
...
...
@@ -57,7 +57,7 @@ public class FlowTagLayout extends ViewGroup {
OnTagSelectListener
mOnTagSelectListener
;
/**
* 标签流式布局选中模式
,
默认是不支持选中的
* 标签流式布局选中模式
,
默认是不支持选中的
*/
private
int
mTagCheckMode
=
FLOW_TAG_CHECKED_NONE
;
private
int
mGroupMode
=
-
1
;
...
...
@@ -96,7 +96,7 @@ public class FlowTagLayout extends ViewGroup {
//测量时每一行的宽度
int
lineWidth
=
0
;
//测量时每一行的高度
,
加起来就是FlowLayout的高度
//测量时每一行的高度
,
加起来就是FlowLayout的高度
int
lineHeight
=
0
;
//遍历每个子元素
...
...
WalletModule/src/main/java/com/fzm/walletmodule/ui/widget/swip/MenuItemType.java
deleted
100644 → 0
View file @
4ed7dc1a
package
com
.
fzm
.
walletmodule
.
ui
.
widget
.
swip
;
import
androidx.annotation.IntDef
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
@IntDef
({
MenuItemType
.
LEFT
,
MenuItemType
.
RIGHT
})
@Retention
(
RetentionPolicy
.
SOURCE
)
public
@interface
MenuItemType
{
public
static
final
int
LEFT
=
0
;
public
static
final
int
RIGHT
=
1
;
}
WalletModule/src/main/java/com/fzm/walletmodule/ui/widget/swip/SwapRecyclerView.java
deleted
100644 → 0
View file @
4ed7dc1a
package
com
.
fzm
.
walletmodule
.
ui
.
widget
.
swip
;
import
android.content.Context
;
import
android.graphics.Rect
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.ViewConfiguration
;
import
androidx.annotation.Nullable
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
cn.finalteam.loadingviewfinal.RecyclerViewFinal
;
/**
*
* 自定义SwapRecyclerView实现左右滑显示菜单Menu
*/
public
class
SwapRecyclerView
extends
RecyclerViewFinal
{
private
static
final
int
TOUCH_STATE_NONE
=
0
;
//没有滑动
private
static
final
int
TOUCH_STATE_X
=
1
;
//是否处于左右滑动
private
static
final
int
TOUCH_STATE_Y
=
2
;
//是否处于上下滑动
private
int
mTouchState
=
TOUCH_STATE_NONE
;
//当前状态
private
float
mDownX
;
//按下去的X坐标
private
float
mDownY
;
//按下去的Y坐标
private
Rect
mTouchFrame
=
new
Rect
();
//点击后坐标产生的矩形Rect
private
int
mTouchPosition
=
-
1
;
//当前按下去的位置
private
int
oldPos
=
-
1
;
//上一次按下去的位置
private
SwipeMenuLayout
mTouchView
;
//当前按下去的位置的那个view
private
int
mTouchSlop
;
//是否达到了滑动的距离
public
SwapRecyclerView
(
Context
context
)
{
super
(
context
);
init
();
}
public
SwapRecyclerView
(
Context
context
,
@Nullable
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
init
();
}
public
SwapRecyclerView
(
Context
context
,
@Nullable
AttributeSet
attrs
,
int
defStyle
)
{
super
(
context
,
attrs
,
defStyle
);
init
();
}
private
void
init
()
{
mTouchSlop
=
ViewConfiguration
.
get
(
getContext
()).
getScaledTouchSlop
();
}
@Override
public
boolean
onInterceptTouchEvent
(
MotionEvent
event
)
{
int
x
=
(
int
)
event
.
getX
();
int
y
=
(
int
)
event
.
getY
();
switch
(
event
.
getAction
())
{
case
MotionEvent
.
ACTION_DOWN
:
mDownX
=
event
.
getX
();
mDownY
=
event
.
getY
();
//是否拦截的返回值
boolean
handled
=
super
.
onInterceptTouchEvent
(
event
);
mTouchState
=
TOUCH_STATE_NONE
;
oldPos
=
mTouchPosition
;
//找到当前点击坐标下的所处于SwapRecyclerView的位置
int
mFirstPosition
=
((
LinearLayoutManager
)
getLayoutManager
()).
findFirstVisibleItemPosition
();
int
count
=
getChildCount
();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
final
View
child
=
getChildAt
(
i
);
if
(
child
.
getVisibility
()
==
View
.
VISIBLE
)
{
child
.
getHitRect
(
mTouchFrame
);
//判断是否点击到该控件上
if
(
mTouchFrame
.
contains
(
x
,
y
))
{
mTouchPosition
=
mFirstPosition
+
i
;
Log
.
e
(
"swap"
,
"mTouchPosition = "
+
mTouchPosition
);
break
;
}
}
}
//找到了
if
(
mTouchPosition
!=
-
1
)
{
//通过position得到item的viewHolder,并判断合法性
View
view
=
getChildAt
(
mTouchPosition
-
mFirstPosition
);
if
(
view
!=
null
){
ViewHolder
viewHolder
=
getChildViewHolder
(
view
);
if
(
viewHolder
.
itemView
instanceof
SwipeMenuLayout
)
{
//menuView处于打开且点击的不在menu区域
if
(
mTouchView
!=
null
&&
mTouchView
.
isOpen
()
&&
!
inRangeOfView
(
mTouchView
.
getmRightMenuView
(),
event
)
&&!
inRangeOfView
(
mTouchView
.
getmLeftMenuView
(),
event
))
{
//拦截事件,交给自己的onTouch方法处理.
return
true
;
}
mTouchView
=
(
SwipeMenuLayout
)
view
;
//将事件交给SwipeMenuLayout处理down事件
mTouchView
.
onSwipe
(
event
);
}
}
}
//down事件,如果没有打开menu,则不拦截,仍然交给系统
return
handled
;
case
MotionEvent
.
ACTION_MOVE
:
float
dy
=
Math
.
abs
((
event
.
getY
()
-
mDownY
));
float
dx
=
Math
.
abs
((
event
.
getX
()
-
mDownX
));
//达到了滑动的临界值
if
(
Math
.
abs
(
dy
)
>
mTouchSlop
||
Math
.
abs
(
dx
)
>
mTouchSlop
)
{
if
(
mTouchState
==
TOUCH_STATE_NONE
)
{
if
(
Math
.
abs
(
dy
)
>
mTouchSlop
)
{
//上下滑动的
mTouchState
=
TOUCH_STATE_Y
;
}
else
if
(
dx
>
mTouchSlop
)
{
//左右滑动的
mTouchState
=
TOUCH_STATE_X
;
}
}
return
true
;
//拦截事件,交给自己的onTouch方法处理.
}
}
return
super
.
onInterceptTouchEvent
(
event
);
}
@Override
public
boolean
onTouchEvent
(
MotionEvent
event
)
{
if
(
event
.
getAction
()
!=
MotionEvent
.
ACTION_DOWN
&&
mTouchView
==
null
)
return
super
.
onTouchEvent
(
event
);
switch
(
event
.
getAction
())
{
case
MotionEvent
.
ACTION_DOWN
:
//如果当前是处于打开的且用户按下去正好是打开menu的那行
if
(
mTouchPosition
==
oldPos
&&
mTouchView
!=
null
&&
mTouchView
.
isOpen
())
{
mTouchState
=
TOUCH_STATE_X
;
mTouchView
.
onSwipe
(
event
);
return
true
;
}
else
{
//如果不是直接关闭
if
(
mTouchView
!=
null
&&
mTouchView
.
isOpen
())
{
mTouchView
.
smoothCloseMenu
();
mTouchView
=
null
;
return
super
.
onTouchEvent
(
event
);
}
}
break
;
case
MotionEvent
.
ACTION_MOVE
:
//左右滑动交给mTouchView处理,事件消费了
if
(
mTouchState
==
TOUCH_STATE_X
)
{
if
(
mTouchView
!=
null
)
{
mTouchView
.
onSwipe
(
event
);
}
event
.
setAction
(
MotionEvent
.
ACTION_CANCEL
);
super
.
onTouchEvent
(
event
);
return
true
;
}
break
;
case
MotionEvent
.
ACTION_UP
:
//处于左右滑动
if
(
mTouchState
==
TOUCH_STATE_X
)
{
if
(
mTouchView
!=
null
)
{
mTouchView
.
onSwipe
(
event
);
//打开活着关闭
if
(!
mTouchView
.
isOpen
())
{
//关闭后复原变量
mTouchPosition
=
-
1
;
mTouchView
=
null
;
}
else
{
mTouchView
.
getmRightMenuView
().
setPosition
(
mTouchPosition
);
mTouchView
.
getmLeftMenuView
().
setPosition
(
mTouchPosition
);
}
}
event
.
setAction
(
MotionEvent
.
ACTION_CANCEL
);
super
.
onTouchEvent
(
event
);
return
true
;
}
break
;
default
:
break
;
}
return
super
.
onTouchEvent
(
event
);
}
/**
* 判断点击事件是否在某个view内
*
* @param view view
* @param ev ev
* @return true 是 false 不是
*/
public
static
boolean
inRangeOfView
(
View
view
,
MotionEvent
ev
)
{
int
[]
location
=
new
int
[
2
];
view
.
getLocationOnScreen
(
location
);
int
x
=
location
[
0
];
int
y
=
location
[
1
];
if
(
ev
.
getRawX
()
<
x
||
ev
.
getRawX
()
>
(
x
+
view
.
getWidth
())
||
ev
.
getRawY
()
<
y
||
ev
.
getRawY
()
>
(
y
+
view
.
getHeight
()))
{
return
false
;
}
return
true
;
}
}
WalletModule/src/main/java/com/fzm/walletmodule/ui/widget/swip/SwipeMenu.java
deleted
100644 → 0
View file @
4ed7dc1a
package
com
.
fzm
.
walletmodule
.
ui
.
widget
.
swip
;
import
android.content.Context
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 包含SwipeMenuItem对象的辅助类
*/
public
class
SwipeMenu
{
private
Context
mContext
;
private
List
<
SwipeMenuItem
>
mItems
;
public
SwipeMenu
(
Context
context
)
{
mContext
=
context
;
mItems
=
new
ArrayList
<>();
}
public
Context
getContext
()
{
return
mContext
;
}
public
void
addMenuItem
(
SwipeMenuItem
item
)
{
mItems
.
add
(
item
);
}
public
void
removeMenuItem
(
SwipeMenuItem
item
)
{
mItems
.
remove
(
item
);
}
public
List
<
SwipeMenuItem
>
getMenuItems
()
{
return
mItems
;
}
public
SwipeMenuItem
getMenuItem
(
int
index
)
{
return
mItems
.
get
(
index
);
}
}
WalletModule/src/main/java/com/fzm/walletmodule/ui/widget/swip/SwipeMenuBuilder.java
deleted
100644 → 0
View file @
4ed7dc1a
package
com
.
fzm
.
walletmodule
.
ui
.
widget
.
swip
;
/**
* SwipeMenuView 接口生成类
*/
public
interface
SwipeMenuBuilder
{
SwipeMenuView
createRight
();
SwipeMenuView
createLeft
();
}
WalletModule/src/main/java/com/fzm/walletmodule/ui/widget/swip/SwipeMenuItem.java
deleted
100644 → 0
View file @
4ed7dc1a
package
com
.
fzm
.
walletmodule
.
ui
.
widget
.
swip
;
import
android.content.Context
;
import
android.graphics.Color
;
import
android.graphics.drawable.Drawable
;
import
android.util.DisplayMetrics
;
import
android.util.TypedValue
;
/**
* menu的数据对象
*/
public
class
SwipeMenuItem
{
private
static
final
int
TITLE_SIZE
=
20
;
//sp
private
static
final
int
WIDTH
=
80
;
//dp
private
int
id
;
private
Context
mContext
;
private
String
title
;
private
Drawable
icon
;
private
Drawable
background
;
private
int
titleColor
;
private
int
titleSize
;
private
int
width
;
private
int
type
;
//设置类型 0代表是左边 1代表右边
public
SwipeMenuItem
(
Context
context
)
{
mContext
=
context
;
//设置默认值
DisplayMetrics
dm
=
mContext
.
getResources
().
getDisplayMetrics
();
titleColor
=
Color
.
WHITE
;
titleSize
=
TITLE_SIZE
;
width
=
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
WIDTH
,
dm
);
}
public
int
getId
()
{
return
id
;
}
public
SwipeMenuItem
setId
(
int
id
)
{
this
.
id
=
id
;
return
this
;
}
public
Context
getmContext
()
{
return
mContext
;
}
public
SwipeMenuItem
setmContext
(
Context
mContext
)
{
this
.
mContext
=
mContext
;
return
this
;
}
public
String
getTitle
()
{
return
title
;
}
public
SwipeMenuItem
setTitle
(
String
title
)
{
this
.
title
=
title
;
return
this
;
}
public
Drawable
getIcon
()
{
return
icon
;
}
public
SwipeMenuItem
setIcon
(
Drawable
icon
)
{
this
.
icon
=
icon
;
return
this
;
}
public
SwipeMenuItem
setType
(
@MenuItemType
int
type
)
{
this
.
type
=
type
;
return
this
;
}
public
int
getType
()
{
return
type
;
}
public
SwipeMenuItem
setIcon
(
int
resId
)
{
this
.
icon
=
mContext
.
getResources
().
getDrawable
(
resId
);
return
this
;
}
public
Drawable
getBackground
()
{
return
background
;
}
public
SwipeMenuItem
setBackground
(
Drawable
background
)
{
this
.
background
=
background
;
return
this
;
}
public
int
getTitleColor
()
{
return
titleColor
;
}
public
SwipeMenuItem
setTitleColor
(
int
titleColor
)
{
this
.
titleColor
=
titleColor
;
return
this
;
}
public
int
getTitleSize
()
{
return
titleSize
;
}
public
SwipeMenuItem
setTitleSize
(
int
titleSize
)
{
this
.
titleSize
=
titleSize
;
return
this
;
}
public
int
getWidth
()
{
return
width
;
}
public
SwipeMenuItem
setWidth
(
int
width
)
{
this
.
width
=
width
;
return
this
;
}
}
WalletModule/src/main/java/com/fzm/walletmodule/ui/widget/swip/SwipeMenuLayout.java
deleted
100644 → 0
View file @
4ed7dc1a
This diff is collapsed.
Click to expand it.
WalletModule/src/main/java/com/fzm/walletmodule/ui/widget/swip/SwipeMenuView.java
deleted
100644 → 0
View file @
4ed7dc1a
package
com
.
fzm
.
walletmodule
.
ui
.
widget
.
swip
;
import
android.text.TextUtils
;
import
android.util.TypedValue
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
java.util.List
;
/**
* 左右滑动显示的控件
*/
public
class
SwipeMenuView
extends
LinearLayout
implements
View
.
OnClickListener
{
private
SwipeMenuLayout
mLayout
;
private
SwipeMenu
mMenu
;
private
OnMenuItemClickListener
mOnMenuItemClickListener
;
private
int
position
;
public
int
getPosition
()
{
return
position
;
}
public
void
setPosition
(
int
position
)
{
this
.
position
=
position
;
}
public
SwipeMenuView
(
SwipeMenu
menu
)
{
super
(
menu
.
getContext
());
setOrientation
(
LinearLayout
.
HORIZONTAL
);
mMenu
=
menu
;
List
<
SwipeMenuItem
>
items
=
mMenu
.
getMenuItems
();
int
id
=
0
;
for
(
SwipeMenuItem
item
:
items
)
{
addItem
(
item
,
id
++);
}
setPadding
(
0
,
dp2px
(
6
),
0
,
dp2px
(
6
));
}
private
void
addItem
(
SwipeMenuItem
item
,
int
id
)
{
LayoutParams
params
=
new
LayoutParams
(
item
.
getWidth
(),
LayoutParams
.
MATCH_PARENT
);
LinearLayout
parent
=
new
LinearLayout
(
getContext
());
parent
.
setId
(
id
);
parent
.
setGravity
(
Gravity
.
CENTER
);
parent
.
setOrientation
(
LinearLayout
.
HORIZONTAL
);
parent
.
setLayoutParams
(
params
);
parent
.
setBackgroundDrawable
(
item
.
getBackground
());
parent
.
setOnClickListener
(
this
);
addView
(
parent
);
if
(
item
.
getType
()
==
MenuItemType
.
LEFT
)
{
if
(!
TextUtils
.
isEmpty
(
item
.
getTitle
()))
{
parent
.
addView
(
createTitle
(
item
,
item
.
getType
()));
}
if
(
item
.
getIcon
()
!=
null
)
{
parent
.
addView
(
createIcon
(
item
));
}
}
else
if
(
item
.
getType
()
==
MenuItemType
.
RIGHT
)
{
if
(
item
.
getIcon
()
!=
null
)
{
parent
.
addView
(
createIcon
(
item
));
}
if
(!
TextUtils
.
isEmpty
(
item
.
getTitle
()))
{
parent
.
addView
(
createTitle
(
item
,
item
.
getType
()));
}
}
}
private
ImageView
createIcon
(
SwipeMenuItem
item
)
{
ImageView
iv
=
new
ImageView
(
getContext
());
iv
.
setImageDrawable
(
item
.
getIcon
());
return
iv
;
}
private
TextView
createTitle
(
SwipeMenuItem
item
,
int
type
)
{
TextView
tv
=
new
TextView
(
getContext
());
tv
.
setText
(
item
.
getTitle
());
tv
.
setGravity
(
Gravity
.
CENTER
);
if
(
type
==
MenuItemType
.
LEFT
)
{
tv
.
setPadding
(
0
,
0
,
dp2px
(
5
),
0
);
}
else
if
(
type
==
MenuItemType
.
RIGHT
)
{
tv
.
setPadding
(
dp2px
(
5
),
0
,
0
,
0
);
}
tv
.
setTextSize
(
item
.
getTitleSize
());
tv
.
setTextColor
(
item
.
getTitleColor
());
return
tv
;
}
@Override
public
void
onClick
(
View
v
)
{
if
(
mOnMenuItemClickListener
!=
null
&&
mLayout
.
isOpen
())
{
mOnMenuItemClickListener
.
onMenuItemClick
(
position
,
mMenu
,
v
.
getId
());
}
}
public
interface
OnMenuItemClickListener
{
void
onMenuItemClick
(
int
position
,
SwipeMenu
menu
,
int
index
);
}
public
void
setOnMenuItemClickListener
(
OnMenuItemClickListener
mOnMenuItemClickListener
)
{
this
.
mOnMenuItemClickListener
=
mOnMenuItemClickListener
;
}
public
void
setLayout
(
SwipeMenuLayout
mLayout
)
{
this
.
mLayout
=
mLayout
;
}
private
int
dp2px
(
int
dp
)
{
return
(
int
)
TypedValue
.
applyDimension
(
TypedValue
.
COMPLEX_UNIT_DIP
,
dp
,
getResources
().
getDisplayMetrics
());
}
}
WalletModule/src/main/res/layout/activity_import_wallet.xml
View file @
e3073aa1
...
...
@@ -71,7 +71,7 @@
android:maxLength=
"16"
android:textColor=
"#ff333649"
android:textSize=
"16sp"
tools:text=
"
钱包
1"
/>
tools:text=
"
账户
1"
/>
<View
android:layout_width=
"match_parent"
...
...
WalletModule/src/main/res/layout/activity_my_wallets.xml
View file @
e3073aa1
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:id=
"@+id/baseTitleLayout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/white"
android:orientation=
"vertical"
>
<!-- <RelativeLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<ImageView
android:id="@+id/backButton"
android:layout_width="52dp"
android:layout_height="match_parent"
android:scaleType="center"
app:srcCompat="@drawable/ic_back"
tools:ignore="VectorDrawableCompat" />
<TextView
android:id="@+id/baseTitle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:text="@string/my_wallets_chose1"
android:singleLine="true"
android:textColor="#ff333649"
android:textSize="17sp"
android:visibility="visible" />
</RelativeLayout>
-->
<View
android:layout_width=
"match_parent"
android:layout_height=
"2px"
...
...
WalletModule/src/main/res/layout/fragment_wallet.xml
View file @
e3073aa1
...
...
@@ -75,7 +75,7 @@
app:ptr_ratio_of_header_height_to_refresh=
"1.2"
app:ptr_resistance=
"1.7"
>
<c
om.fzm.walletmodule.ui.widget.swip.SwapRecyclerView
<c
n.finalteam.loadingviewfinal.RecyclerViewFinal
android:id=
"@+id/recyclerView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
WalletModule/src/main/res/layout/fragment_wallet_index.xml
View file @
e3073aa1
...
...
@@ -30,40 +30,6 @@
tools:ignore=
"VectorDrawableCompat"
/>
</FrameLayout>
<LinearLayout
android:id=
"@+id/agreementLayout"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:layout_alignParentBottom=
"true"
android:gravity=
"center"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/agreementChoice"
android:layout_width=
"40dp"
android:layout_height=
"match_parent"
android:scaleType=
"center"
android:src=
"@mipmap/agreement_choice"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:text=
"@string/agree_read"
android:textColor=
"@color/color_333649"
android:textSize=
"13sp"
/>
<TextView
android:id=
"@+id/agreement"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:text=
"@string/user_agreement"
android:textColor=
"@color/color_7190ff"
android:textSize=
"13sp"
/>
</LinearLayout>
<RelativeLayout
android:id=
"@+id/fatherLayout"
android:layout_width=
"match_parent"
...
...
WalletModule/src/main/res/layout/view_header_wallet.xml
View file @
e3073aa1
...
...
@@ -37,7 +37,7 @@
android:layout_height=
"wrap_content"
android:textColor=
"#ffd9dce9"
android:textSize=
"@dimen/sp_20"
tools:text=
"
百岁的钱包
(¥)"
/>
tools:text=
"
某某的账户
(¥)"
/>
</LinearLayout>
<TextView
...
...
WalletModule/src/main/res/layout/view_item_coin_info.xml
View file @
e3073aa1
...
...
@@ -47,6 +47,7 @@
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"4dp"
android:layout_weight=
"1"
android:visibility=
"invisible"
android:textColor=
"#ff8e92a3"
android:textSize=
"12sp"
tools:text=
"以太坊"
/>
...
...
WalletModule/src/main/res/values/strings.xml
View file @
e3073aa1
...
...
@@ -3,28 +3,28 @@
<string
name=
"hello_blank_fragment"
>
Hello blank fragment
</string>
<string
name=
"agree_read"
>
我已阅读并同意
</string>
<string
name=
"user_agreement"
>
《隐私服务协议》
</string>
<string
name=
"block_chain_wallet"
>
区块链
钱包
</string>
<string
name=
"my_create_wallet"
>
创建
钱包
</string>
<string
name=
"my_import_wallet"
>
导入
钱包
</string>
<string
name=
"block_chain_wallet"
>
区块链
账户
</string>
<string
name=
"my_create_wallet"
>
创建
账户
</string>
<string
name=
"my_import_wallet"
>
导入
账户
</string>
<string
name=
"my_wallet_read_toast"
>
请先勾选协议
</string>
<string
name=
"wallet_name"
>
钱包
名称
</string>
<string
name=
"wallet_name"
>
账户
名称
</string>
<string
name=
"my_set_password_toast"
>
请输入8–16位数字、字母组合
</string>
<string
name=
"set_wallet_password"
>
请设置
钱包
密码
</string>
<string
name=
"set_wallet_password"
>
请设置
账户
密码
</string>
<string
name=
"my_set_password_different"
>
两次密码不相同!
</string>
<string
name=
"confirm_wallet_password"
>
确认
钱包
密码
</string>
<string
name=
"confirm_wallet_password"
>
确认
账户
密码
</string>
<string
name=
"my_import_start"
>
开始导入
</string>
<string
name=
"import_wallet_hint0"
>
请输入助记词,用空格分隔
</string>
<string
name=
"import_wallet_tips"
>
钱包
支持导入所有遵循BIP标准生成的助记词
</string>
<string
name=
"import_wallet_tips"
>
账户
支持导入所有遵循BIP标准生成的助记词
</string>
<string
name=
"import_wallet_chain_name"
>
主链:
</string>
<string
name=
"my_wallet_detail_choose_chain"
>
选择主链
</string>
<string
name=
"import_wallet_hint1"
>
请输入私钥或扫描私钥生成的二维码录入
</string>
<string
name=
"import_wallet_hint2"
>
请输入地址或扫描地址生成的二维码录入
</string>
<string
name=
"import_wallet_wallet_name"
>
钱包
</string>
<string
name=
"import_wallet_wallet_name"
>
账户
</string>
<string
name=
"my_scan"
>
扫一扫
</string>
<string
name=
"my_import_backup_null"
>
助记词不能为空
</string>
<string
name=
"my_wallet_detail_name"
>
请输入
钱包
名称
</string>
<string
name=
"my_wallet_detail_name_exist"
>
钱包
名称重复
</string>
<string
name=
"my_wallet_detail_password"
>
请输入
钱包
密码
</string>
<string
name=
"my_wallet_detail_name"
>
请输入
账户
名称
</string>
<string
name=
"my_wallet_detail_name_exist"
>
账户
名称重复
</string>
<string
name=
"my_wallet_detail_password"
>
请输入
账户
密码
</string>
<string
name=
"my_wallet_set_password"
>
请输入密码
</string>
<string
name=
"my_change_password_again"
>
请再次输入新密码
</string>
<string
name=
"my_create_letter"
>
请输入8–16位字符
</string>
...
...
@@ -32,7 +32,7 @@
<string
name=
"my_import_success"
>
导入成功
</string>
<string
name=
"my_import_backup_none"
>
助记词不存在!
</string>
<string
name=
"import_wallet_mnem_repeat"
>
助记词重复!
</string>
<string
name=
"my_create_name"
>
设置
钱包
名称
</string>
<string
name=
"my_create_name"
>
设置
账户
名称
</string>
<string
name=
"my_wallet_password_tips"
>
请输入密码
</string>
<string
name=
"my_wallet_confirm_password_tips"
>
请重新输入密码
</string>
<string
name=
"backup_mnemonic"
>
备份助记词
</string>
...
...
@@ -51,19 +51,19 @@
<string
name=
"backup_success"
>
助记词备份成功
</string>
<string
name=
"downloading"
>
加载中…
</string>
<string
name=
"state_reloading"
>
重新加载
</string>
<string
name=
"my_wallet_detail_delete"
>
删除
钱包
</string>
<string
name=
"my_wallet_detail_delete"
>
删除
账户
</string>
<string
name=
"my_wallet_detail_export"
>
导出私钥
</string>
<string
name=
"my_wallet_detail_out_mnem"
>
导出助记词
</string>
<string
name=
"my_wallet_detail_update_name"
>
修改
钱包
名称
</string>
<string
name=
"my_wallet_detail_update_name"
>
修改
账户
名称
</string>
<string
name=
"change_password"
>
修改密码
</string>
<string
name=
"my_wallet_forget_password"
>
忘记密码
</string>
<string
name=
"title_wallet_details"
>
钱包
设置
</string>
<string
name=
"title_wallet_details"
>
账户
设置
</string>
<string
name=
"my_wallet_modified_success"
>
修改成功
</string>
<string
name=
"my_wallet_detail_modify_name"
>
修改名称
</string>
<string
name=
"my_version_toast_title"
>
更新提示
</string>
<string
name=
"my_version_toast"
>
检测到新版本,是否更新
</string>
<string
name=
"my_wallet_detail_safe"
>
安全警告
</string>
<string
name=
"my_wallet_detail_delete_message"
>
删除
钱包仅能通过助记词和私钥找回,是否确定删除该钱包
</string>
<string
name=
"my_wallet_detail_delete_message"
>
删除
账户仅能通过助记词和私钥找回,是否确定删除该账户
</string>
<string
name=
"home_choose_chain"
>
选择币种
</string>
<string
name=
"my_wallet_detail_wrong_password"
>
密码输入错误
</string>
<string
name=
"my_wallet_detail_mnem"
>
查看助记词
</string>
...
...
@@ -84,8 +84,8 @@
<string
name=
"qrcode_error"
>
二维码识别失败,请端正相机重新扫描!
</string>
<string
name=
"qrcode_success_sign"
>
扫码完成,请去签名
</string>
<string
name=
"my_wallets_chose1"
>
创建/导入
</string>
<string
name=
"my_wallets_current_wallet"
>
当前
钱包
</string>
<string
name=
"my_wallets_mnem_walllet"
>
助记词
钱包
</string>
<string
name=
"my_wallets_current_wallet"
>
当前
账户
</string>
<string
name=
"my_wallets_mnem_walllet"
>
助记词
账户
</string>
<string
name=
"home_empty"
>
暂无资产,快去添加吧
</string>
<string
name=
"equal"
>
≈
</string>
<string
name=
"cny"
>
¥
</string>
...
...
@@ -96,12 +96,12 @@
<string
name=
"home_receipt_address"
>
收款地址
</string>
<string
name=
"in_universal"
>
通用
</string>
<string
name=
"in_exclusive"
>
专属
</string>
<string
name=
"in_common_tip"
>
适用于所有
钱包
收款
</string>
<string
name=
"in_common_tip"
>
适用于所有
账户
收款
</string>
<string
name=
"in_bi_tip"
>
仅适用于%1$s收款
</string>
<string
name=
"in_set_money"
>
指定金额
</string>
<string
name=
"home_label_balance"
>
余额:
</string>
<string
name=
"home_btc_transfer"
>
BTC转账
</string>
<string
name=
"in_share_address_tip"
>
钱包
地址
</string>
<string
name=
"in_share_address_tip"
>
账户
地址
</string>
<string
name=
"home_receipt_currency_address"
>
收币地址
</string>
<string
name=
"home_send_number"
>
发送数量
</string>
<string
name=
"home_hint_please_input_count"
>
请输入数量
</string>
...
...
app/build.gradle
View file @
e3073aa1
...
...
@@ -24,6 +24,10 @@ android {
arguments
=
[
moduleName:
project
.
getName
()]
}
}
ndk
{
// 设置支持的SO库架构
abiFilters
"armeabi-v7a"
}
}
buildTypes
{
...
...
@@ -48,16 +52,17 @@ repositories {
}
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
,
'*.aar'
])
implementation
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation
'androidx.core:core-ktx:1.
2.0
'
implementation
'androidx.appcompat:appcompat:1.
1
.0'
implementation
'com.google.android.material:material:1.
1
.0'
implementation
'androidx.constraintlayout:constraintlayout:
1.1.3
'
implementation
'androidx.core:core-ktx:1.
3.2
'
implementation
'androidx.appcompat:appcompat:1.
2
.0'
implementation
'com.google.android.material:material:1.
3
.0'
implementation
'androidx.constraintlayout:constraintlayout:
2.0.4
'
implementation
project
(
path:
':WalletModule'
)
implementation
'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation
'junit:junit:4.+'
androidTestImplementation
'androidx.test.ext:junit:1.1.1'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.2.0'
implementation
'androidx.multidex:multidex:2.0.0'
testImplementation
'junit:junit:4.13.2'
androidTestImplementation
'androidx.test.ext:junit:1.1.2'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.3.0'
implementation
'androidx.multidex:multidex:2.0.1'
// implementation "com.fzm.walletmodule:wallet:0.0.1"
}
\ No newline at end of file
app/sign/walletdemo.jks
0 → 100644
View file @
e3073aa1
File added
app/src/main/java/com/fzm/walletdemo/CommonFragment.kt
deleted
100644 → 0
View file @
4ed7dc1a
package
com.fzm.walletdemo
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
kotlinx.android.synthetic.main.fragment_common.*
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private
const
val
ARG_PARAM1
=
"param1"
private
const
val
ARG_PARAM2
=
"param2"
/**
* A simple [Fragment] subclass.
* Use the [CommonFragment.newInstance] factory method to
* create an instance of this fragment.
*/
class
CommonFragment
:
Fragment
()
{
// TODO: Rename and change types of parameters
private
var
param1
:
String
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
arguments
?.
let
{
param1
=
it
.
getString
(
ARG_PARAM1
)
}
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
):
View
?
{
// Inflate the layout for this fragment
return
inflater
.
inflate
(
R
.
layout
.
fragment_common
,
container
,
false
)
}
override
fun
onViewCreated
(
view
:
View
,
savedInstanceState
:
Bundle
?)
{
super
.
onViewCreated
(
view
,
savedInstanceState
)
text
.
text
=
param1
}
companion
object
{
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @return A new instance of fragment CommonFragment.
*/
// TODO: Rename and change types and number of parameters
@JvmStatic
fun
newInstance
(
param1
:
String
)
=
CommonFragment
().
apply
{
arguments
=
Bundle
().
apply
{
putString
(
ARG_PARAM1
,
param1
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/fzm/walletdemo/MainActivity.kt
View file @
e3073aa1
...
...
@@ -19,67 +19,26 @@ import org.greenrobot.eventbus.ThreadMode
import
org.litepal.LitePal.count
class
MainActivity
:
AppCompatActivity
()
{
var
mIndex
=
0
private
var
homeFragment
:
WalletFragment
?
=
null
private
var
marketFragment
:
CommonFragment
?
=
null
private
var
exploreFragment
:
CommonFragment
?
=
null
private
var
myFragment
:
CommonFragment
?
=
null
private
var
mWalletIndexFragment
:
WalletIndexFragment
?
=
null
private
var
mCurrentTab
:
ViewGroup
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_main
)
EventBus
.
getDefault
().
register
(
this
)
initView
()
initListener
()
setTabSelection
()
}
private
fun
initView
()
{
setTabSelection
(
0
)
}
private
fun
initListener
()
{
ly_home
.
setOnClickListener
{
setTabSelection
(
0
)
}
ly_market
.
setOnClickListener
{
setTabSelection
(
1
)
}
ly_explore
.
setOnClickListener
{
setTabSelection
(
2
)
}
ly_my
.
setOnClickListener
{
setTabSelection
(
3
)
}
}
private
fun
setTabSelection
(
index
:
Int
)
{
mIndex
=
index
private
fun
setTabSelection
()
{
// 开启一个Fragment事务
val
fragmentTransaction
=
supportFragmentManager
.
beginTransaction
()
// 先隐藏掉所有的Fragment,以防止有多个Fragment显示在界面上的情况
hideFragments
(
fragmentTransaction
)
when
(
index
)
{
0
->
{
val
count
:
Int
=
count
(
PWallet
::
class
.
java
)
if
(
count
>
0
)
{
showWalletFragment
(
fragmentTransaction
)
}
else
{
showWalletIndexFragment
(
fragmentTransaction
)
}
}
1
->
{
showMarketFragment
(
fragmentTransaction
)
}
2
->
{
showExploreFragment
(
fragmentTransaction
)
}
3
->
{
showMyFragment
(
fragmentTransaction
)
}
val
count
:
Int
=
count
(
PWallet
::
class
.
java
)
if
(
count
>
0
)
{
showWalletFragment
(
fragmentTransaction
)
}
else
{
showWalletIndexFragment
(
fragmentTransaction
)
}
}
...
...
@@ -90,26 +49,14 @@ class MainActivity : AppCompatActivity() {
if
(
mWalletIndexFragment
!=
null
)
{
transaction
.
hide
(
mWalletIndexFragment
!!
)
}
if
(
marketFragment
!=
null
)
{
transaction
.
hide
(
marketFragment
!!
)
}
if
(
exploreFragment
!=
null
)
{
transaction
.
hide
(
exploreFragment
!!
)
}
if
(
myFragment
!=
null
)
{
transaction
.
hide
(
myFragment
!!
)
}
}
private
fun
showWalletFragment
(
fragmentTransaction
:
FragmentTransaction
)
{
if
(
mCurrentTab
===
ly_home
&&
homeFragment
!=
null
)
{
if
(
homeFragment
!=
null
)
{
fragmentTransaction
.
show
(
homeFragment
!!
)
}
else
{
if
(
mCurrentTab
!=
null
)
mCurrentTab
?.
isSelected
=
false
ly_home
.
isSelected
=
true
mCurrentTab
=
ly_home
if
(
homeFragment
==
null
)
{
homeFragment
=
WalletFragment
()
fragmentTransaction
.
add
(
R
.
id
.
fl_tabcontent
,
homeFragment
!!
,
"homeFragment"
)
...
...
@@ -120,64 +67,11 @@ class MainActivity : AppCompatActivity() {
fragmentTransaction
.
commitAllowingStateLoss
()
}
private
fun
showMarketFragment
(
fragmentTransaction
:
FragmentTransaction
)
{
if
(
mCurrentTab
===
ly_market
&&
marketFragment
!=
null
)
{
fragmentTransaction
.
show
(
marketFragment
!!
)
}
else
{
if
(
mCurrentTab
!=
null
)
mCurrentTab
!!
.
isSelected
=
false
ly_market
.
isSelected
=
true
mCurrentTab
=
ly_market
if
(
marketFragment
==
null
)
{
marketFragment
=
CommonFragment
.
newInstance
(
"行情"
)
fragmentTransaction
.
add
(
R
.
id
.
fl_tabcontent
,
marketFragment
!!
,
"marketFragment"
)
}
else
{
fragmentTransaction
.
show
(
marketFragment
!!
)
}
}
fragmentTransaction
.
commitAllowingStateLoss
()
}
private
fun
showExploreFragment
(
fragmentTransaction
:
FragmentTransaction
)
{
if
(
mCurrentTab
===
ly_explore
&&
exploreFragment
!=
null
)
{
fragmentTransaction
.
show
(
exploreFragment
!!
)
}
else
{
if
(
mCurrentTab
!=
null
)
mCurrentTab
?.
isSelected
=
false
ly_explore
.
isSelected
=
true
mCurrentTab
=
ly_explore
if
(
exploreFragment
==
null
)
{
exploreFragment
=
CommonFragment
.
newInstance
(
"探索"
)
fragmentTransaction
.
add
(
R
.
id
.
fl_tabcontent
,
exploreFragment
!!
)
}
else
{
fragmentTransaction
.
show
(
exploreFragment
!!
)
}
}
fragmentTransaction
.
commitAllowingStateLoss
()
}
private
fun
showMyFragment
(
fragmentTransaction
:
FragmentTransaction
)
{
if
(
mCurrentTab
===
ly_my
&&
myFragment
!=
null
)
{
fragmentTransaction
.
show
(
myFragment
!!
)
}
else
{
if
(
mCurrentTab
!=
null
)
mCurrentTab
?.
isSelected
=
false
ly_my
.
isSelected
=
true
mCurrentTab
=
ly_my
if
(
myFragment
==
null
)
{
myFragment
=
CommonFragment
.
newInstance
(
"我的"
)
fragmentTransaction
.
add
(
R
.
id
.
fl_tabcontent
,
myFragment
!!
,
"homeFragment"
)
}
else
{
fragmentTransaction
.
show
(
myFragment
!!
)
}
}
fragmentTransaction
.
commitAllowingStateLoss
()
}
private
fun
showWalletIndexFragment
(
fragmentTransaction
:
FragmentTransaction
)
{
if
(
m
CurrentTab
===
ly_home
&&
m
WalletIndexFragment
!=
null
)
{
if
(
mWalletIndexFragment
!=
null
)
{
fragmentTransaction
.
show
(
mWalletIndexFragment
!!
)
}
else
{
if
(
mCurrentTab
!=
null
)
mCurrentTab
!!
.
isSelected
=
false
ly_home
.
isSelected
=
true
mCurrentTab
=
ly_home
if
(
mWalletIndexFragment
==
null
)
{
mWalletIndexFragment
=
WalletIndexFragment
()
fragmentTransaction
.
add
(
...
...
@@ -194,7 +88,7 @@ class MainActivity : AppCompatActivity() {
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
setTabSelection
(
0
)
setTabSelection
()
}
private
var
mPWallet
:
PWallet
?
=
null
...
...
@@ -205,7 +99,7 @@ class MainActivity : AppCompatActivity() {
if
(
null
==
event
.
mPWallet
)
{
return
}
else
{
setTabSelection
(
0
)
setTabSelection
()
mPWallet
=
event
.
mPWallet
PWallet
.
setUsingWallet
(
mPWallet
)
}
...
...
@@ -214,7 +108,7 @@ class MainActivity : AppCompatActivity() {
@Subscribe
(
threadMode
=
ThreadMode
.
MAIN
)
fun
onMessageEvent
(
event
:
MainCloseEvent
)
{
setTabSelection
(
0
);
setTabSelection
(
)
}
...
...
app/src/main/res/layout/activity_main.xml
View file @
e3073aa1
...
...
@@ -12,104 +12,5 @@
android:layout_width=
"match_parent"
android:layout_height=
"0dip"
android:layout_weight=
"1"
/>
<LinearLayout
android:id=
"@+id/ll_main_bottom"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"@color/white"
android:orientation=
"horizontal"
>
<LinearLayout
android:id=
"@+id/ly_home"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:gravity=
"center"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:background=
"@drawable/selector_home"
android:focusable=
"false"
/>
<TextView
android:id=
"@+id/tv_home"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/main_home"
android:textColor=
"@color/selector_bottom_tab_text"
android:textSize=
"12sp"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ly_market"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:gravity=
"center"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:background=
"@drawable/selector_market"
android:focusable=
"false"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/main_market"
android:textColor=
"@color/selector_bottom_tab_text"
android:textSize=
"12sp"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ly_explore"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:gravity=
"center"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:background=
"@drawable/selector_explore"
android:focusable=
"false"
/>
<TextView
android:id=
"@+id/tv_explore_bottom"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/main_explore"
android:textColor=
"@color/selector_bottom_tab_text"
android:textSize=
"12sp"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ly_my"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:gravity=
"center"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:background=
"@drawable/selector_my"
android:focusable=
"false"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"@string/main_my"
android:textColor=
"@color/selector_bottom_tab_text"
android:textSize=
"12sp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
e3073aa1
<resources>
<string
name=
"app_name"
>
WalletDemo
</string>
<string
name=
"app_name"
>
开源钱包
</string>
<string
name=
"main_home"
>
首页
</string>
<string
name=
"main_market"
>
行情
</string>
<string
name=
"main_explore"
>
探索
</string>
...
...
build.gradle
View file @
e3073aa1
...
...
@@ -9,7 +9,6 @@ buildscript {
dependencies
{
classpath
"com.android.tools.build:gradle:4.1.3"
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
...
...
@@ -19,6 +18,7 @@ allprojects {
repositories
{
google
()
jcenter
()
maven
{
url
"http://localhost:8081/repository/release/"
}
maven
{
url
"https://jitpack.io"
}
}
}
...
...
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