Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TangKuPos
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王海
TangKuPos
Commits
7be3a603
Commit
7be3a603
authored
Dec 21, 2017
by
zhang_z
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交新颜色;
修改PaymentFragment;
parent
b4f7f4dc
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
129 additions
and
68 deletions
+129
-68
.idea/dictionaries/Eurus.xml
.idea/dictionaries/Eurus.xml
+1
-0
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+7
-5
app/src/main/java/com/xingdata/zzdpos/App.java
app/src/main/java/com/xingdata/zzdpos/App.java
+4
-6
app/src/main/java/com/xingdata/zzdpos/ui/payment/PaymentActivity.java
.../java/com/xingdata/zzdpos/ui/payment/PaymentActivity.java
+4
-0
app/src/main/java/com/xingdata/zzdpos/ui/payment/fragment/CalculatorFragment.java
...ngdata/zzdpos/ui/payment/fragment/CalculatorFragment.java
+0
-11
app/src/main/java/com/xingdata/zzdpos/ui/payment/fragment/PaymentFragment.java
.../xingdata/zzdpos/ui/payment/fragment/PaymentFragment.java
+31
-0
app/src/main/java/com/xingdata/zzdpos/ui/payment/view/CalculatorView.java
...a/com/xingdata/zzdpos/ui/payment/view/CalculatorView.java
+33
-13
app/src/main/res/layout/activity_payment.xml
app/src/main/res/layout/activity_payment.xml
+2
-33
app/src/main/res/layout/fragment_payment.xml
app/src/main/res/layout/fragment_payment.xml
+46
-0
app/src/main/res/values/colors.xml
app/src/main/res/values/colors.xml
+1
-0
No files found.
.idea/dictionaries/Eurus.xml
View file @
7be3a603
...
...
@@ -4,6 +4,7 @@
<w>
baozheng
</w>
<w>
caocao
</w>
<w>
guanyu
</w>
<w>
huanggai
</w>
<w>
inputer
</w>
<w>
likui
</w>
<w>
mawu
</w>
...
...
app/src/main/AndroidManifest.xml
View file @
7be3a603
...
...
@@ -24,11 +24,7 @@
android:name=
".ui.splash.SplashActivity"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
android:theme=
"@style/AppTheme"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".ui.login.LoginActivity"
...
...
@@ -45,7 +41,13 @@
<activity
android:name=
".ui.payment.PaymentActivity"
android:configChanges=
"keyboard|orientation|screenSize|keyboardHidden"
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
/>
android:windowSoftInputMode=
"adjustUnspecified|stateHidden"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/com/xingdata/zzdpos/App.java
View file @
7be3a603
...
...
@@ -69,8 +69,8 @@ public class App extends Application {
.
callback
(
this
)
.
start
();
//
初始化异常处理
initEx
();
//
初始化异常处理
//
initEx();
//初始化Fragment框架
initFragment
();
...
...
@@ -147,16 +147,14 @@ public class App extends Application {
}
public
static
void
reStartApp
()
{
// 重启
Intent
intent
=
new
Intent
(
instance
.
getApplicationContext
(),
SplashActivity
.
class
);
@SuppressLint
(
"WrongConstant"
)
PendingIntent
restartIntent
=
PendingIntent
.
getActivity
(
instance
.
getApplicationContext
(),
0
,
intent
,
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
.
getApplicationContext
(),
0
,
intent
,
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
AlarmManager
mgr
=
(
AlarmManager
)
instance
.
getSystemService
(
Context
.
ALARM_SERVICE
);
mgr
.
set
(
AlarmManager
.
RTC
,
System
.
currentTimeMillis
()
+
1
,
restartIntent
);
//
...
...
app/src/main/java/com/xingdata/zzdpos/ui/payment/PaymentActivity.java
View file @
7be3a603
...
...
@@ -3,9 +3,12 @@ package com.xingdata.zzdpos.ui.payment;
import
com.xingdata.zzdpos.R
;
import
com.xingdata.zzdpos.base.BaseActivity
;
import
com.xingdata.zzdpos.databinding.ActivityPaymentBinding
;
import
com.xingdata.zzdpos.ui.payment.fragment.PaymentFragment
;
public
class
PaymentActivity
extends
BaseActivity
<
PaymentPresenter
,
ActivityPaymentBinding
>
implements
PaymentContract
.
View
{
private
PaymentFragment
mPaymentFragment
=
new
PaymentFragment
();
@Override
public
int
getLayoutId
()
{
return
R
.
layout
.
activity_payment
;
...
...
@@ -13,6 +16,7 @@ public class PaymentActivity extends BaseActivity<PaymentPresenter, ActivityPaym
@Override
public
void
initView
()
{
loadRootFragment
(
R
.
id
.
f_payment
,
mPaymentFragment
);
}
}
app/src/main/java/com/xingdata/zzdpos/ui/payment/fragment/CalculatorFragment.java
deleted
100644 → 0
View file @
b4f7f4dc
//package com.xingdata.zzdpos.ui.payment.fragment;
//
//import com.xingdata.zzdpos.base.BaseFragment;
//import com.xingdata.zzdpos.ui.payment.PaymentPresenter;
//
///**
// * Created by Eurus on 2017/12/21.
// */
//
//public class CalculatorFragment extends BaseFragment<PaymentPresenter,> {
//}
app/src/main/java/com/xingdata/zzdpos/ui/payment/fragment/PaymentFragment.java
0 → 100644
View file @
7be3a603
package
com
.
xingdata
.
zzdpos
.
ui
.
payment
.
fragment
;
import
com.blankj.utilcode.util.LogUtils
;
import
com.xingdata.zzdpos.R
;
import
com.xingdata.zzdpos.base.BaseFragment
;
import
com.xingdata.zzdpos.databinding.FragmentPaymentBinding
;
import
com.xingdata.zzdpos.ui.payment.PaymentPresenter
;
import
com.xingdata.zzdpos.ui.payment.view.CalculatorView
;
import
com.xingdata.zzdpos.util.ConvertUtil
;
public
class
PaymentFragment
extends
BaseFragment
<
PaymentPresenter
,
FragmentPaymentBinding
>
{
private
CalculatorView
mCalculatorView
=
new
CalculatorView
();
@Override
public
int
getLayoutId
()
{
return
R
.
layout
.
fragment_payment
;
}
@Override
public
void
initView
()
{
loadRootFragment
(
R
.
id
.
f_inputer
,
mCalculatorView
);
mCalculatorView
.
setmOnResultChangeListener
((
exp
,
result
)
->
{
LogUtils
.
e
(
exp
+
"\n"
+
result
);
});
mCalculatorView
.
setmOnSettleClickListener
(
result
->
{
LogUtils
.
e
(
ConvertUtil
.
fenToYuan
(
result
));
});
}
}
app/src/main/java/com/xingdata/zzdpos/ui/payment/view/CalculatorView.java
View file @
7be3a603
...
...
@@ -2,6 +2,7 @@ package com.xingdata.zzdpos.ui.payment.view;
import
android.view.View
;
import
android.widget.TextView
;
import
com.xingdata.zzdpos.R
;
import
com.xingdata.zzdpos.base.BaseFragment
;
...
...
@@ -16,9 +17,17 @@ import java.util.regex.Pattern;
public
class
CalculatorView
extends
BaseFragment
<
PaymentPresenter
,
ViewCalculatorBinding
>
{
private
String
mExp
;
private
String
mValue
;
private
OnResultChangeListener
mOnResultChangeListener
;
private
onSettleClickListener
mOnSettleClickListener
;
public
CalculatorView
()
{
mExp
=
""
;
mValue
=
""
;
}
public
interface
OnResultChangeListener
{
void
onResultChange
(
String
exp
,
Long
result
);
}
...
...
@@ -36,16 +45,6 @@ public class CalculatorView extends BaseFragment<PaymentPresenter, ViewCalculato
public
void
initView
()
{
View
.
OnClickListener
mOnClickListener
=
view
->
{
switch
(
view
.
getId
())
{
case
R
.
id
.
btn_add
:
break
;
case
R
.
id
.
btn_sub
:
break
;
case
R
.
id
.
btn_mul
:
break
;
case
R
.
id
.
btn_div
:
break
;
case
R
.
id
.
btn_point
:
break
;
case
R
.
id
.
btn_del
:
delete
();
break
;
...
...
@@ -55,13 +54,34 @@ public class CalculatorView extends BaseFragment<PaymentPresenter, ViewCalculato
case
R
.
id
.
btn_settle
:
settle
();
break
;
default
:
if
(
view
instanceof
TextView
)
{
String
str
=
((
TextView
)
view
).
getText
().
toString
();
if
(
mExp
.
length
()
==
0
&&
str
.
matches
(
"[+\\-*/]"
))
return
;
if
(
mExp
.
length
()
==
0
&&
str
.
equals
(
"."
))
mExp
+=
"0"
;
if
(
mValue
.
length
()
>
0
&&
str
.
matches
(
"[+\\-*/]"
))
{
mValue
=
""
;
}
else
{
if
(
mValue
.
contains
(
"."
)
&&
str
.
matches
(
"[.]"
))
return
;
mValue
+=
str
;
String
[]
_values
=
mValue
.
split
(
"[.]"
);
if
(
_values
.
length
>
1
)
{
if
(
_values
[
1
].
length
()
>
2
)
return
;
}
}
mExp
+=
str
;
}
break
;
}
if
(
mOnResultChangeListener
!=
null
)
{
mOnResultChangeListener
.
onResultChange
(
mExp
,
ConvertUtil
.
yuanToFen
(
parseExp
(
mExp
)));
}
};
mViewBinding
.
setOnClick
(
mOnClickListener
);
}
/**
...
...
@@ -106,7 +126,7 @@ public class CalculatorView extends BaseFragment<PaymentPresenter, ViewCalculato
if
(
exp
.
matches
(
minExp
))
{
String
result
=
calculate
(
exp
);
return
Double
.
parseDouble
(
result
)
>=
0
?
result
:
"["
+
result
+
"]"
;
}
else
if
(
exp
.
matches
(
"[0-9]+"
))
{
}
else
if
(
exp
.
matches
(
"[0-9
.
]+"
))
{
return
exp
;
}
else
if
(
exp
.
length
()
==
0
)
{
return
"0"
;
...
...
@@ -131,7 +151,7 @@ public class CalculatorView extends BaseFragment<PaymentPresenter, ViewCalculato
}
return
parseExp
(
exp
);
}
String
minParentheses
=
"\\([^
\\(\\
)]+\\)"
;
String
minParentheses
=
"\\([^
(
)]+\\)"
;
Pattern
patt
=
Pattern
.
compile
(
minParentheses
);
Matcher
mat
=
patt
.
matcher
(
exp
);
if
(
mat
.
find
())
{
...
...
app/src/main/res/layout/activity_payment.xml
View file @
7be3a603
...
...
@@ -13,40 +13,9 @@
android:title=
"收款"
android:titleTextColor=
"@color/white"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"3"
android:background=
"@color/store_product_bg"
android:orientation=
"vertical"
>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:background=
"@color/white"
android:gravity=
"end|center_vertical"
android:orientation=
"horizontal"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"小计:"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"40.00"
android:textColor=
"@color/deep_red"
/>
</LinearLayout>
<FrameLayout
android:id=
"@+id/f_payment"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"7"
/>
android:layout_height=
"match_parent"
/>
</LinearLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/fragment_payment.xml
0 → 100644
View file @
7be3a603
<?xml version="1.0" encoding="utf-8"?>
<layout>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"3"
android:background=
"@color/store_product_bg"
android:orientation=
"vertical"
>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:background=
"@color/white"
android:gravity=
"end|center_vertical"
android:orientation=
"horizontal"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"小计:"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"40.00"
android:textColor=
"@color/deep_red"
/>
</LinearLayout>
<FrameLayout
android:id=
"@+id/f_inputer"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"7"
/>
</LinearLayout>
</layout>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
7be3a603
...
...
@@ -119,6 +119,7 @@
<color
name=
"red_guanyu"
>
#b4282d
</color>
<color
name=
"red_xishi"
>
#e57b7b
</color>
<color
name=
"gray_zhouyu"
>
#f1f3f7
</color>
<color
name=
"gray_huanggai"
>
#afb9c3
</color>
<color
name=
"white_caocao"
>
#ffffff
</color>
<color
name=
"black_zhangfei"
>
#233142
</color>
<color
name=
"black_baozheng"
>
#121212
</color>
...
...
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