Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
supplier
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王宇航
supplier
Commits
b9711b76
Commit
b9711b76
authored
Jan 11, 2020
by
王宇航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首頁佈局
parent
01f2540c
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
195 additions
and
116 deletions
+195
-116
config.gradle
+2
-1
main/build.gradle
+2
-0
main/src/main/debug/java/debug/MyApp.java
+2
-3
main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/activity/MainActivity.java
+1
-1
main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/adapter/PersonalAdapter.java
+24
-0
main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/fragment/HomeFragment.java
+23
-2
main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/fragment/MyFragment.java
+6
-36
main/src/main/res/drawable-xhdpi/ic_normal_my.png
+0
-0
main/src/main/res/layout/main_fragment_my.xml
+7
-4
main/src/main/res/layout/main_home_title_img.xml
+12
-0
print-module/build.gradle
+1
-1
print-module/src/main/java/com/joe/print/PrintActivity.java
+37
-36
print-module/src/main/java/com/joe/print/print/SendPrint.java
+40
-31
print-module/src/main/java/com/joe/print/utils/ImageUtils.java
+26
-0
public-base/src/main/res/anim/rotate_center.xml
+10
-0
public-ui/build.gradle
+1
-0
user-login/src/main/java/com/gingersoft/gsa/cloud/user/login/mvp/ui/activity/LoginActivity.java
+1
-1
No files found.
config.gradle
View file @
b9711b76
...
@@ -114,7 +114,8 @@ ext {
...
@@ -114,7 +114,8 @@ ext {
"qmui"
:
"com.qmuiteam:qmui:2.0.0-alpha03"
,
"qmui"
:
"com.qmuiteam:qmui:2.0.0-alpha03"
,
"arms"
:
"me.jessyan:arms:2.5.2"
,
"arms"
:
"me.jessyan:arms:2.5.2"
,
"fastjson"
:
"com.alibaba:fastjson:1.2.46"
,
"fastjson"
:
"com.alibaba:fastjson:1.2.46"
,
"zxing"
:
"cn.yipianfengye.android:zxing-library:2.2"
"zxing"
:
"cn.yipianfengye.android:zxing-library:2.2"
,
"BaseRecyclerViewAdapter"
:
"com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.46"
]
]
}
}
main/build.gradle
View file @
b9711b76
...
@@ -52,4 +52,6 @@ dependencies {
...
@@ -52,4 +52,6 @@ dependencies {
// compileOnly rootProject.ext.dependencies["canary-release"]
// compileOnly rootProject.ext.dependencies["canary-release"]
// }
// }
testImplementation
rootProject
.
ext
.
dependencies
[
"junit"
]
testImplementation
rootProject
.
ext
.
dependencies
[
"junit"
]
implementation
rootProject
.
ext
.
dependencies
[
"BaseRecyclerViewAdapter"
]
}
}
main/src/main/debug/java/debug/MyApp.java
View file @
b9711b76
package
debug
;
package
debug
;
import
android.app.Application
;
import
com.billy.cc.core.component.CC
;
import
com.billy.cc.core.component.CC
;
import
com.jess.arms.base.BaseApplication
;
/**
/**
* @author billy.qi
* @author billy.qi
* @since 17/11/20 20:02
* @since 17/11/20 20:02
*/
*/
public
class
MyApp
extends
Application
{
public
class
MyApp
extends
Base
Application
{
@Override
@Override
public
void
onCreate
()
{
public
void
onCreate
()
{
super
.
onCreate
();
super
.
onCreate
();
...
...
main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/activity/MainActivity.java
View file @
b9711b76
...
@@ -127,7 +127,7 @@ public class MainActivity extends BaseFragmentActivity<MainPresenter> implements
...
@@ -127,7 +127,7 @@ public class MainActivity extends BaseFragmentActivity<MainPresenter> implements
.
setText
(
getString
(
R
.
string
.
report
))
.
setText
(
getString
(
R
.
string
.
report
))
.
build
(
mContext
);
.
build
(
mContext
);
QMUITab
my
=
builder
QMUITab
my
=
builder
.
setNormalDrawable
(
ContextCompat
.
getDrawable
(
mContext
,
R
.
drawable
.
ic_normal_m
ain
))
.
setNormalDrawable
(
ContextCompat
.
getDrawable
(
mContext
,
R
.
drawable
.
ic_normal_m
y
))
.
setSelectedDrawable
(
ContextCompat
.
getDrawable
(
mContext
,
R
.
drawable
.
ic_selected_my
))
.
setSelectedDrawable
(
ContextCompat
.
getDrawable
(
mContext
,
R
.
drawable
.
ic_selected_my
))
.
setText
(
getString
(
R
.
string
.
my
))
.
setText
(
getString
(
R
.
string
.
my
))
.
build
(
mContext
);
.
build
(
mContext
);
...
...
main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/adapter/PersonalAdapter.java
0 → 100644
View file @
b9711b76
package
com
.
gingersoft
.
gsa
.
cloud
.
main
.
mvp
.
ui
.
adapter
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.BaseViewHolder
;
import
java.util.List
;
import
java.util.Map
;
import
androidx.annotation.Nullable
;
/**
* Created by Wyh on 2020/1/11.
*/
public
class
PersonalAdapter
extends
BaseQuickAdapter
<
Map
<
String
,
Object
>,
BaseViewHolder
>
{
public
PersonalAdapter
(
int
layoutResId
,
@Nullable
List
<
Map
<
String
,
Object
>>
data
)
{
super
(
layoutResId
,
data
);
}
@Override
protected
void
convert
(
BaseViewHolder
helper
,
Map
<
String
,
Object
>
item
)
{
}
}
main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/fragment/HomeFragment.java
View file @
b9711b76
package
com
.
gingersoft
.
gsa
.
cloud
.
main
.
mvp
.
ui
.
fragment
;
package
com
.
gingersoft
.
gsa
.
cloud
.
main
.
mvp
.
ui
.
fragment
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.media.Image
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.view.animation.AnimationUtils
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
com.billy.cc.core.component.CC
;
import
com.gingersoft.gsa.cloud.base.utils.time.TimeUtils
;
import
com.gingersoft.gsa.cloud.base.utils.time.TimeUtils
;
import
com.gingersoft.gsa.cloud.main.R
;
import
com.gingersoft.gsa.cloud.main.R
;
import
com.gingersoft.gsa.cloud.main.R2
;
import
com.gingersoft.gsa.cloud.main.R2
;
...
@@ -35,6 +39,7 @@ import androidx.annotation.Nullable;
...
@@ -35,6 +39,7 @@ import androidx.annotation.Nullable;
import
androidx.recyclerview.widget.GridLayoutManager
;
import
androidx.recyclerview.widget.GridLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.recyclerview.widget.RecyclerView
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
dagger.Component
;
import
static
com
.
jess
.
arms
.
utils
.
Preconditions
.
checkNotNull
;
import
static
com
.
jess
.
arms
.
utils
.
Preconditions
.
checkNotNull
;
...
@@ -104,8 +109,19 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon
...
@@ -104,8 +109,19 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon
}
}
private
void
initTopBar
()
{
private
void
initTopBar
()
{
mTopBar
.
addLeftImageButton
(
R
.
drawable
.
ic_main_home_refresh
,
R
.
id
.
main_home_refresh
);
View
refreshView
=
View
.
inflate
(
mContext
,
R
.
layout
.
main_home_title_img
,
null
);
refreshView
.
setOnClickListener
(
this
);
ImageView
refresh
=
refreshView
.
findViewById
(
R
.
id
.
main_home_title_iv
);
refresh
.
setImageResource
(
R
.
drawable
.
ic_main_home_refresh
);
mTopBar
.
addLeftView
(
refreshView
,
R
.
id
.
main_home_refresh
);
mTopBar
.
setTitle
(
"店鋪名稱"
);
mTopBar
.
setTitle
(
"店鋪名稱"
);
View
msgView
=
View
.
inflate
(
mContext
,
R
.
layout
.
main_home_title_img
,
null
);
msgView
.
setOnClickListener
(
this
);
ImageView
msg
=
msgView
.
findViewById
(
R
.
id
.
main_home_title_iv
);
msg
.
setImageResource
(
R
.
drawable
.
selector_msg
);
mTopBar
.
addRightView
(
msgView
,
R
.
id
.
main_home_msg
);
// mTopBar.addRightImageButton(R.drawable.selector_msg, R.id.main_home_msg).setOnClickListener(this);
// mTopBar.addRightImageButton(R.drawable.selector_msg, R.id.main_home_msg).setOnClickListener(this);
}
}
...
@@ -124,7 +140,10 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon
...
@@ -124,7 +140,10 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon
@Override
@Override
public
void
onItemClick
(
QMUIStickySectionAdapter
.
ViewHolder
holder
,
int
position
)
{
public
void
onItemClick
(
QMUIStickySectionAdapter
.
ViewHolder
holder
,
int
position
)
{
CC
.
obtainBuilder
(
"Component.Table"
)
.
setActionName
(
"showTableActivity"
)
.
build
()
.
call
();
}
}
@Override
@Override
...
@@ -201,8 +220,10 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon
...
@@ -201,8 +220,10 @@ public class HomeFragment extends BaseFragment<HomePresenter> implements HomeCon
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
if
(
v
.
getId
()
==
R
.
id
.
main_home_refresh
)
{
if
(
v
.
getId
()
==
R
.
id
.
main_home_refresh
)
{
//刷新
//刷新
v
.
startAnimation
(
AnimationUtils
.
loadAnimation
(
mContext
,
R
.
anim
.
rotate_center
));
}
else
if
(
v
.
getId
()
==
R
.
id
.
main_home_msg
)
{
}
else
if
(
v
.
getId
()
==
R
.
id
.
main_home_msg
)
{
//消息
//消息
}
}
}
}
...
...
main/src/main/java/com/gingersoft/gsa/cloud/main/mvp/ui/fragment/MyFragment.java
View file @
b9711b76
...
@@ -17,6 +17,8 @@ import com.jess.arms.utils.ArmsUtils;
...
@@ -17,6 +17,8 @@ import com.jess.arms.utils.ArmsUtils;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.recyclerview.widget.RecyclerView
;
import
butterknife.BindView
;
import
static
com
.
jess
.
arms
.
utils
.
Preconditions
.
checkNotNull
;
import
static
com
.
jess
.
arms
.
utils
.
Preconditions
.
checkNotNull
;
...
@@ -34,6 +36,9 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
...
@@ -34,6 +36,9 @@ import static com.jess.arms.utils.Preconditions.checkNotNull;
* ================================================
* ================================================
*/
*/
public
class
MyFragment
extends
BaseFragment
<
MyPresenter
>
implements
MyContract
.
View
{
public
class
MyFragment
extends
BaseFragment
<
MyPresenter
>
implements
MyContract
.
View
{
@BindView
(
R
.
id
.
main_personal_center_rv
)
RecyclerView
rvMyList
;
public
static
MyFragment
newInstance
()
{
public
static
MyFragment
newInstance
()
{
MyFragment
fragment
=
new
MyFragment
();
MyFragment
fragment
=
new
MyFragment
();
...
@@ -57,45 +62,10 @@ public class MyFragment extends BaseFragment<MyPresenter> implements MyContract.
...
@@ -57,45 +62,10 @@ public class MyFragment extends BaseFragment<MyPresenter> implements MyContract.
@Override
@Override
public
void
initData
(
@Nullable
Bundle
savedInstanceState
)
{
public
void
initData
(
@Nullable
Bundle
savedInstanceState
)
{
}
}
/**
* 通过此方法可以使 Fragment 能够与外界做一些交互和通信, 比如说外部的 Activity 想让自己持有的某个 Fragment 对象执行一些方法,
* 建议在有多个需要与外界交互的方法时, 统一传 {@link Message}, 通过 what 字段来区分不同的方法, 在 {@link #setData(Object)}
* 方法中就可以 {@code switch} 做不同的操作, 这样就可以用统一的入口方法做多个不同的操作, 可以起到分发的作用
* <p>
* 调用此方法时请注意调用时 Fragment 的生命周期, 如果调用 {@link #setData(Object)} 方法时 {@link Fragment#onCreate(Bundle)} 还没执行
* 但在 {@link #setData(Object)} 里却调用了 Presenter 的方法, 是会报空的, 因为 Dagger 注入是在 {@link Fragment#onCreate(Bundle)} 方法中执行的
* 然后才创建的 Presenter, 如果要做一些初始化操作,可以不必让外部调用 {@link #setData(Object)}, 在 {@link #initData(Bundle)} 中初始化就可以了
* <p>
* Example usage:
* <pre>
* public void setData(@Nullable Object data) {
* if (data != null && data instanceof Message) {
* switch (((Message) data).what) {
* case 0:
* loadData(((Message) data).arg1);
* break;
* case 1:
* refreshUI();
* break;
* default:
* //do something
* break;
* }
* }
* }
*
* // call setData(Object):
* Message data = new Message();
* data.what = 0;
* data.arg1 = 1;
* fragment.setData(data);
* </pre>
*
* @param data 当不需要参数时 {@code data} 可以为 {@code null}
*/
@Override
@Override
public
void
setData
(
@Nullable
Object
data
)
{
public
void
setData
(
@Nullable
Object
data
)
{
...
...
main/src/main/res/drawable-xhdpi/ic_normal_my.png
0 → 100644
View file @
b9711b76
4.32 KB
main/src/main/res/layout/main_fragment_my.xml
View file @
b9711b76
...
@@ -5,8 +5,10 @@
...
@@ -5,8 +5,10 @@
android:gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<TextView
<androidx.recyclerview.widget.RecyclerView
android:layout_width=
"wrap_content"
android:id=
"@+id/main_personal_center_rv"
android:layout_height=
"wrap_content"
android:layout_width=
"match_parent"
android:text=
"我的"
/>
android:layout_height=
"match_parent"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
main/src/main/res/layout/main_home_title_img.xml
0 → 100644
View file @
b9711b76
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/main_home_title_iv"
android:layout_width=
"@dimen/head_height"
android:layout_height=
"@dimen/head_height"
android:layout_centerInParent=
"true"
android:padding=
"@dimen/dp_12"
/>
</RelativeLayout>
print-module/build.gradle
View file @
b9711b76
...
@@ -43,6 +43,6 @@ dependencies {
...
@@ -43,6 +43,6 @@ dependencies {
androidTestImplementation
'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.2.0'
implementation
rootProject
.
ext
.
dependencies
[
"zxing"
]
implementation
rootProject
.
ext
.
dependencies
[
"zxing"
]
implementation
'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.46'
implementation
'am.util:printer:2.1.0'
implementation
'am.util:printer:2.1.0'
implementation
rootProject
.
ext
.
dependencies
[
"BaseRecyclerViewAdapter"
]
}
}
print-module/src/main/java/com/joe/print/PrintActivity.java
View file @
b9711b76
...
@@ -16,6 +16,7 @@ import java.util.List;
...
@@ -16,6 +16,7 @@ import java.util.List;
import
am.util.printer.PrintExecutor
;
import
am.util.printer.PrintExecutor
;
import
am.util.printer.PrintSocketHolder
;
import
am.util.printer.PrintSocketHolder
;
import
am.util.printer.PrinterWriter58mm
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.recyclerview.widget.RecyclerView
;
...
@@ -35,42 +36,42 @@ public class PrintActivity extends Activity implements PrintSocketHolder.OnState
...
@@ -35,42 +36,42 @@ public class PrintActivity extends Activity implements PrintSocketHolder.OnState
@Override
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
//
setContentView(R.layout.activity_print);
setContentView
(
R
.
layout
.
activity_print
);
setContentView
(
R
.
layout
.
print_layout_print
);
//
setContentView(R.layout.print_layout_print);
rvFood
=
findViewById
(
R
.
id
.
rv_food
);
//
rvFood = findViewById(R.id.rv_food);
rvBill
=
findViewById
(
R
.
id
.
rv_bill_amount
);
//
rvBill = findViewById(R.id.rv_bill_amount);
//
List
<
FoodBean
>
data
=
new
ArrayList
<>();
//
List<FoodBean> data = new ArrayList<>();
data
.
add
(
new
FoodBean
(
"包子(主項)"
,
1
,
13.54
));
//
data.add(new FoodBean("包子(主項)",1,13.54));
data
.
add
(
new
FoodBean
(
"番薯爸爸"
,
2
,
8.0
));
//
data.add(new FoodBean("番薯爸爸",2,8.0));
data
.
add
(
new
FoodBean
(
"包子(主項)"
,
3
,
37.34
));
//
data.add(new FoodBean("包子(主項)",3,37.34));
data
.
add
(
new
FoodBean
(
"測卡很快就酸辣粉十大減肥和思考"
,
33
,
1334.2254
));
//
data.add(new FoodBean("測卡很快就酸辣粉十大減肥和思考",33,1334.2254));
//
FoodAdapter
foodAdapter
=
new
FoodAdapter
(
data
);
//
FoodAdapter foodAdapter = new FoodAdapter(data);
rvFood
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
//
rvFood.setLayoutManager(new LinearLayoutManager(this));
rvFood
.
setAdapter
(
foodAdapter
);
//
rvFood.setAdapter(foodAdapter);
//
//
List
<
BillingBean
>
billingBeans
=
new
ArrayList
<>();
//
List<BillingBean> billingBeans = new ArrayList<>();
billingBeans
.
add
(
new
BillingBean
(
"合計"
,
58.88
));
//
billingBeans.add(new BillingBean("合計", 58.88));
billingBeans
.
add
(
new
BillingBean
(
"10%服務費"
,
5.08
));
//
billingBeans.add(new BillingBean("10%服務費", 5.08));
billingBeans
.
add
(
new
BillingBean
(
"賬單小數"
,
-
0.06
));
//
billingBeans.add(new BillingBean("賬單小數", -0.06));
billingBeans
.
add
(
new
BillingBean
(
"上課交電話費扣水電費可接受的咖啡機"
,
837248.8829372
));
//
billingBeans.add(new BillingBean("上課交電話費扣水電費可接受的咖啡機", 837248.8829372));
//
BillAdapter
billAdapter
=
new
BillAdapter
(
billingBeans
);
//
BillAdapter billAdapter = new BillAdapter(billingBeans);
rvBill
.
setLayoutManager
(
new
LinearLayoutManager
(
this
));
//
rvBill.setLayoutManager(new LinearLayoutManager(this));
rvBill
.
setAdapter
(
billAdapter
);
//
rvBill.setAdapter(billAdapter);
maker
=
new
SendPrint
(
this
,
255
,
560
);
//
findViewById(R.id.btn_print).setOnClickListener(v -> {
findViewById
(
R
.
id
.
btn_print
).
setOnClickListener
(
v
->
{
//
if (executor == null) {
if
(
executor
==
null
)
{
//
executor = new PrintExecutor("192.168.1.217", 9100, PrinterWriter58mm.TYPE_58);
executor
=
new
PrintExecutor
(
"192.168.1.217"
,
9100
,
PrinterWriter58mm
.
TYPE_58
);
//
executor.setOnStateChangedListener(PrintActivity.this::onResult);
executor
.
setOnStateChangedListener
(
PrintActivity
.
this
::
onResult
);
//
executor.setOnPrintResultListener(PrintActivity.this);
executor
.
setOnPrintResultListener
(
PrintActivity
.
this
);
//
}
}
//
executor.setIp("192.168.1.217", 9100);
executor
.
setIp
(
"192.168.1.217"
,
9100
);
//
executor.doPrinterRequestAsync(maker);
executor
.
doPrinterRequestAsync
(
maker
);
//
});
});
// view = findViewById(R.id.iv_print);
// view = findViewById(R.id.iv_print);
}
}
...
...
print-module/src/main/java/com/joe/print/print/SendPrint.java
View file @
b9711b76
...
@@ -13,6 +13,9 @@ import com.joe.print.adapter.FoodAdapter;
...
@@ -13,6 +13,9 @@ import com.joe.print.adapter.FoodAdapter;
import
com.joe.print.bean.BillingBean
;
import
com.joe.print.bean.BillingBean
;
import
com.joe.print.bean.FoodBean
;
import
com.joe.print.bean.FoodBean
;
import
com.joe.print.utils.BitmapUtil
;
import
com.joe.print.utils.BitmapUtil
;
import
com.joe.print.utils.ImageUtils
;
import
org.jetbrains.annotations.NotNull
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -48,38 +51,15 @@ public class SendPrint implements PrintDataMaker {
...
@@ -48,38 +51,15 @@ public class SendPrint implements PrintDataMaker {
PrinterWriter
printer
;
PrinterWriter
printer
;
printer
=
type
==
PrinterWriter58mm
.
TYPE_58
?
new
PrinterWriter58mm
(
parting
,
width
)
:
new
PrinterWriter80mm
(
parting
,
width
);
printer
=
type
==
PrinterWriter58mm
.
TYPE_58
?
new
PrinterWriter58mm
(
parting
,
width
)
:
new
PrinterWriter80mm
(
parting
,
width
);
printer
.
setAlignCenter
();
printer
.
setAlignCenter
();
data
.
add
(
printer
.
getDataAndReset
());
View
view
=
LinearLayout
.
inflate
(
context
,
R
.
layout
.
print_layout_print
,
null
);
RecyclerView
rvFood
=
view
.
findViewById
(
R
.
id
.
rv_food
);
RecyclerView
rvBill
=
view
.
findViewById
(
R
.
id
.
rv_bill_amount
);
List
<
FoodBean
>
foodBeans
=
new
ArrayList
<>();
foodBeans
.
add
(
new
FoodBean
(
"包子(主項)"
,
1
,
13.54
));
foodBeans
.
add
(
new
FoodBean
(
"番薯爸爸"
,
2
,
8.0
));
foodBeans
.
add
(
new
FoodBean
(
"包子(主項)"
,
3
,
37.34
));
foodBeans
.
add
(
new
FoodBean
(
"測卡很快就酸辣粉十大減肥和思考"
,
33
,
1334.2254
));
FoodAdapter
foodAdapter
=
new
FoodAdapter
(
foodBeans
);
rvFood
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvFood
.
setAdapter
(
foodAdapter
);
List
<
BillingBean
>
billingBeans
=
new
ArrayList
<>();
billingBeans
.
add
(
new
BillingBean
(
"合計"
,
58.88
));
billingBeans
.
add
(
new
BillingBean
(
"10%服務費"
,
5.08
));
billingBeans
.
add
(
new
BillingBean
(
"賬單小數"
,
-
0.06
));
billingBeans
.
add
(
new
BillingBean
(
"上課交電話費扣水電費可接受的咖啡機"
,
837248.8829372
));
BillAdapter
billAdapter
=
new
BillAdapter
(
billingBeans
);
data
.
add
(
printer
.
getDataAndReset
());
rvBill
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvBill
.
setAdapter
(
billAdapter
);
//加载条形码
ImageView
ivBarCode
=
view
.
findViewById
(
R
.
id
.
iv_bar_code
);
ivBarCode
.
setImageBitmap
(
BitmapUtil
.
generateBitmap
(
"12312112131"
,
2
,
450
,
150
));
View
view
=
initView
();
LayoutToBitmapUtils
.
layoutView
(
context
,
view
);
//先测量view
LayoutToBitmapUtils
.
layoutView
(
context
,
view
);
//先测量view
Bitmap
bitmap
=
LayoutToBitmapUtils
.
loadBitmapFromView
(
view
);
//将view轉bitmap
Bitmap
bitmap
=
LayoutToBitmapUtils
.
loadBitmapFromView
(
view
);
//将view轉bitmap
//壓縮bitmap到指定大小
bitmap
=
ImageUtils
.
scalingBitmap
(
bitmap
,
width
);
ArrayList
<
byte
[]>
image1
=
PrinterUtils
.
decodeBitmapToDataList
(
bitmap
,
parting
);
//bitmap转字节码
ArrayList
<
byte
[]>
image1
=
PrinterUtils
.
decodeBitmapToDataList
(
bitmap
,
parting
);
//bitmap转字节码
data
.
addAll
(
image1
);
data
.
addAll
(
image1
);
...
@@ -92,9 +72,6 @@ public class SendPrint implements PrintDataMaker {
...
@@ -92,9 +72,6 @@ public class SendPrint implements PrintDataMaker {
// .getImageByte(context.getResources(), R.drawable.ic_printer_qr);
// .getImageByte(context.getResources(), R.drawable.ic_printer_qr);
// data.addAll(image2);
// data.addAll(image2);
// }
// }
printer
.
printLineFeed
();
printer
.
printLineFeed
();
printer
.
printLineFeed
();
printer
.
printLineFeed
();
printer
.
printLineFeed
();
printer
.
printLineFeed
();
...
@@ -107,4 +84,36 @@ public class SendPrint implements PrintDataMaker {
...
@@ -107,4 +84,36 @@ public class SendPrint implements PrintDataMaker {
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
}
}
@NotNull
private
View
initView
()
{
View
view
=
LinearLayout
.
inflate
(
context
,
R
.
layout
.
print_layout_print
,
null
);
RecyclerView
rvFood
=
view
.
findViewById
(
R
.
id
.
rv_food
);
RecyclerView
rvBill
=
view
.
findViewById
(
R
.
id
.
rv_bill_amount
);
List
<
FoodBean
>
foodBeans
=
new
ArrayList
<>();
foodBeans
.
add
(
new
FoodBean
(
"包子(主項)"
,
1
,
13.54
));
foodBeans
.
add
(
new
FoodBean
(
"番薯爸爸"
,
2
,
8.0
));
foodBeans
.
add
(
new
FoodBean
(
"包子(主項)"
,
3
,
37.34
));
foodBeans
.
add
(
new
FoodBean
(
"測卡很快就酸辣粉十大減肥和思考"
,
33
,
1334.2254
));
FoodAdapter
foodAdapter
=
new
FoodAdapter
(
foodBeans
);
rvFood
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvFood
.
setAdapter
(
foodAdapter
);
List
<
BillingBean
>
billingBeans
=
new
ArrayList
<>();
billingBeans
.
add
(
new
BillingBean
(
"合計"
,
58.88
));
billingBeans
.
add
(
new
BillingBean
(
"10%服務費"
,
5.08
));
billingBeans
.
add
(
new
BillingBean
(
"賬單小數"
,
-
0.06
));
billingBeans
.
add
(
new
BillingBean
(
"上課交電話費扣水電費可接受的咖啡機"
,
837248.8829372
));
BillAdapter
billAdapter
=
new
BillAdapter
(
billingBeans
);
rvBill
.
setLayoutManager
(
new
LinearLayoutManager
(
context
));
rvBill
.
setAdapter
(
billAdapter
);
//加载条形码
ImageView
ivBarCode
=
view
.
findViewById
(
R
.
id
.
iv_bar_code
);
ivBarCode
.
setImageBitmap
(
BitmapUtil
.
generateBitmap
(
"12312112131"
,
2
,
450
,
150
));
return
view
;
}
}
}
print-module/src/main/java/com/joe/print/utils/ImageUtils.java
View file @
b9711b76
...
@@ -160,4 +160,30 @@ public class ImageUtils {
...
@@ -160,4 +160,30 @@ public class ImageUtils {
return
Bitmap
.
createBitmap
(
oldbmp
,
0
,
0
,
width
,
height
,
return
Bitmap
.
createBitmap
(
oldbmp
,
0
,
0
,
width
,
height
,
matrix
,
true
);
matrix
,
true
);
}
}
/**
* 缩放图片
*
* @param image 图片
* @param maxWidth 最大宽
* @return 缩放后的图片
*/
public
static
Bitmap
scalingBitmap
(
Bitmap
image
,
int
maxWidth
)
{
if
(
image
==
null
||
image
.
getWidth
()
<=
0
||
image
.
getHeight
()
<=
0
)
return
null
;
try
{
final
int
width
=
image
.
getWidth
();
final
int
height
=
image
.
getHeight
();
// 精确缩放
float
scale
=
1
;
if
(
maxWidth
<=
0
||
width
<=
maxWidth
)
{
scale
=
maxWidth
/
(
float
)
width
;
}
Matrix
matrix
=
new
Matrix
();
matrix
.
postScale
(
scale
,
scale
);
return
Bitmap
.
createBitmap
(
image
,
0
,
0
,
width
,
height
,
matrix
,
true
);
}
catch
(
OutOfMemoryError
e
)
{
return
null
;
}
}
}
}
public-base/src/main/res/anim/rotate_center.xml
0 → 100644
View file @
b9711b76
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:interpolator=
"@android:anim/linear_interpolator"
android:duration=
"1500"
android:fromDegrees=
"0"
android:pivotX=
"50%"
android:pivotY=
"50%"
android:repeatCount=
"3"
android:toDegrees=
"360"
/>
\ No newline at end of file
public-ui/build.gradle
View file @
b9711b76
...
@@ -37,4 +37,5 @@ android {
...
@@ -37,4 +37,5 @@ android {
dependencies
{
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
implementation
'com.github.hackware1993:MagicIndicator:1.5.0'
implementation
'com.github.hackware1993:MagicIndicator:1.5.0'
}
}
user-login/src/main/java/com/gingersoft/gsa/cloud/user/login/mvp/ui/activity/LoginActivity.java
View file @
b9711b76
...
@@ -77,8 +77,8 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login
...
@@ -77,8 +77,8 @@ public class LoginActivity extends BaseActivity<LoginPresenter> implements Login
edAccount
=
findViewById
(
R
.
id
.
ed_login_user_account
);
edAccount
=
findViewById
(
R
.
id
.
ed_login_user_account
);
edPwd
=
findViewById
(
R
.
id
.
ed_login_user_pwd
);
edPwd
=
findViewById
(
R
.
id
.
ed_login_user_pwd
);
if
(
GsaCloudApplication
.
getLoginToken
(
mContext
).
length
()
>
0
){
if
(
GsaCloudApplication
.
getLoginToken
(
mContext
).
length
()
>
0
){
finish
();
jumpActivity
();
jumpActivity
();
finish
();
}
}
}
}
...
...
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