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
1567df13
Commit
1567df13
authored
Jan 22, 2018
by
陈前
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UI
parent
1688455d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
10 deletions
+40
-10
app/src/main/java/com/xingdata/zzdpos/ui/main/fragment/MyselfFragment.java
.../com/xingdata/zzdpos/ui/main/fragment/MyselfFragment.java
+1
-1
app/src/main/java/com/xingdata/zzdpos/util/DensityUtil.java
app/src/main/java/com/xingdata/zzdpos/util/DensityUtil.java
+27
-0
app/src/main/java/com/xingdata/zzdpos/util/RecyclerViewUtil.java
.../main/java/com/xingdata/zzdpos/util/RecyclerViewUtil.java
+4
-2
app/src/main/res/layout/item_myself_string.xml
app/src/main/res/layout/item_myself_string.xml
+8
-7
No files found.
app/src/main/java/com/xingdata/zzdpos/ui/main/fragment/MyselfFragment.java
View file @
1567df13
...
...
@@ -48,7 +48,7 @@ public class MyselfFragment extends BaseFragment<MainPresenter, FragmentMyselfBi
integers
.
add
(
110
);
integers
.
add
(
111
);
mMySelfRecyclerAdapter
=
new
MySelfRecyclerAdapter
(
getActivity
(),
integers
);
mViewBinding
.
fragmentMyselfRecycler
.
addItemDecoration
(
new
RecyclerViewUtil
.
ListCardItemDecoration
(
getActivity
(),
1
,
getResources
().
getColor
(
R
.
color
.
gray_kongming
)));
mMySelfRecyclerAdapter
.
bindToRecyclerView
(
mViewBinding
.
fragmentMyselfRecycler
);
mMySelfRecyclerAdapter
.
setOnItemClickListener
(
new
BaseQuickAdapter
.
OnItemClickListener
()
{
@Override
...
...
app/src/main/java/com/xingdata/zzdpos/util/DensityUtil.java
0 → 100644
View file @
1567df13
package
com
.
xingdata
.
zzdpos
.
util
;
import
android.content.Context
;
/**
* Created by Administrator on 2018/1/22.
*/
public
class
DensityUtil
{
/**
* 根据手机的分辨率从 dp 的单位 转成为 px(像素)
*/
public
static
int
dip2px
(
Context
context
,
float
dpValue
)
{
final
float
scale
=
context
.
getResources
().
getDisplayMetrics
().
density
;
return
(
int
)
(
dpValue
*
scale
+
0.5f
);
}
/**
* 根据手机的分辨率从 px(像素) 的单位 转成为 dp
*/
public
static
int
px2dip
(
Context
context
,
float
pxValue
)
{
final
float
scale
=
context
.
getResources
().
getDisplayMetrics
().
density
;
return
(
int
)
(
pxValue
/
scale
+
0.5f
);
}
}
app/src/main/java/com/xingdata/zzdpos/util/RecyclerViewUtil.java
View file @
1567df13
...
...
@@ -140,6 +140,7 @@ public class RecyclerViewUtil {
private
StatisticsCallback
mStatisticsCallback
;
private
int
mDividerHight
=
1
;
private
Paint
mColorPaint
;
private
Context
mContext
;
public
final
int
[]
ATRRS
=
new
int
[]{
android
.
R
.
attr
.
listDivider
};
...
...
@@ -147,6 +148,7 @@ public class RecyclerViewUtil {
public
StatisticsItemDecoration
(
Context
context
)
{
final
TypedArray
ta
=
context
.
obtainStyledAttributes
(
ATRRS
);
this
.
mDividerDarwable
=
ta
.
getDrawable
(
0
);
mContext
=
context
;
ta
.
recycle
();
}
...
...
@@ -189,13 +191,13 @@ public class RecyclerViewUtil {
SectionEntity
sectionEntity
=
mStatisticsCallback
.
getItem
(
position
);
if
(
sectionEntity
!=
null
)
{
if
(!
sectionEntity
.
isHeader
)
{
final
int
left
=
child
.
getLeft
()
-
params
.
leftMargin
-
mDividerHight
+
200
;
final
int
left
=
child
.
getLeft
()
-
params
.
leftMargin
-
mDividerHight
+
DensityUtil
.
dip2px
(
mContext
,
65
)
;
final
int
right
=
child
.
getRight
()
+
params
.
rightMargin
;
int
top
=
0
;
int
bottom
=
0
;
top
=
child
.
getBottom
()
+
params
.
bottomMargin
+
1
;
top
=
child
.
getBottom
()
+
params
.
bottomMargin
+
1
;
bottom
=
top
+
mDividerHight
;
//画分割线
mDividerDarwable
.
setBounds
(
left
,
top
,
right
,
bottom
);
...
...
app/src/main/res/layout/item_myself_string.xml
View file @
1567df13
...
...
@@ -32,19 +32,20 @@
app:layout_constraintStart_toStartOf=
"@id/item_tv"
app:layout_constraintTop_toTopOf=
"@id/item_tv"
/>
<View
android:layout_width=
"0dp"
android:layout_height=
"@dimen/view_line_L050"
android:background=
"@color/gray_kongming"
app:layout_constraintBottom_toBottomOf=
"@id/item_tv"
android:layout_height=
"@dimen/all_padding"
android:background=
"@color/gray_zhouyu"
app:layout_constraintEnd_toEndOf=
"@id/item_tv"
app:layout_constraintStart_toStartOf=
"@id/item_tv"
/>
app:layout_constraintStart_toStartOf=
"@id/item_tv"
app:layout_constraintTop_toBottomOf=
"@id/item_tv"
/>
<View
android:layout_width=
"0dp"
android:layout_height=
"@dimen/
all_padding
"
android:background=
"@color/gray_
zhouyu
"
app:layout_constraint
Top
_toBottomOf=
"@id/item_tv"
android:layout_height=
"@dimen/
view_line_L050
"
android:background=
"@color/gray_
kongming
"
app:layout_constraint
Bottom
_toBottomOf=
"@id/item_tv"
app:layout_constraintEnd_toEndOf=
"@id/item_tv"
app:layout_constraintStart_toStartOf=
"@id/item_tv"
/>
...
...
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