Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
android
/
dayu
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1fcdc19a
authored
6 years ago
by
罗翻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recyerview增加动画
parent
c660e10d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
baseSDK/src/main/java/com/dayu/base/ui/adapter/CoreAdapter.java
baseSDK/src/main/java/com/dayu/utils/UIUtils.java
orderCenter/src/main/java/com/dayu/order/ui/activity/MultiProcessOrderActivity.java
baseSDK/src/main/java/com/dayu/base/ui/adapter/CoreAdapter.java
View file @
1fcdc19a
package
com
.
dayu
.
base
.
ui
.
adapter
;
import
android.animation.ObjectAnimator
;
import
android.content.Context
;
import
android.databinding.DataBindingUtil
;
import
android.support.annotation.LayoutRes
;
import
android.support.annotation.NonNull
;
import
android.support.v7.widget.RecyclerView
;
import
android.view.LayoutInflater
;
import
android.view.View
;
...
...
@@ -45,6 +47,7 @@ public class CoreAdapter<M, B> extends RecyclerView.Adapter<BaseViewHolder> {
private
boolean
isNeedFoot
=
false
;
private
View
mFootView
;
private
int
mFootViewType
;
private
int
oldPosition
=
-
1
;
@Override
public
BaseViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
...
...
@@ -86,10 +89,6 @@ public class CoreAdapter<M, B> extends RecyclerView.Adapter<BaseViewHolder> {
}
}
public
void
setViewType
(
@LayoutRes
int
type
)
{
this
.
viewType
=
type
;
}
public
void
setTypeSelector
(
TypeSelector
mTypeSelector
)
{
this
.
mTypeSelector
=
mTypeSelector
;
this
.
viewType
=
Constants
.
FLAG_MULTI_VH
;
...
...
@@ -106,6 +105,7 @@ public class CoreAdapter<M, B> extends RecyclerView.Adapter<BaseViewHolder> {
/**
* 目前只支持添加一个脚布局.
*
* @param view
* @param type
*/
...
...
@@ -232,6 +232,18 @@ public class CoreAdapter<M, B> extends RecyclerView.Adapter<BaseViewHolder> {
}
}
@Override
public
void
onViewAttachedToWindow
(
@NonNull
BaseViewHolder
holder
)
{
if
(
holder
.
getLayoutPosition
()
>
oldPosition
)
{
addItemAnimation
(
holder
.
itemView
);
oldPosition
=
holder
.
getLayoutPosition
();
}
}
private
void
addItemAnimation
(
View
itemView
)
{
ObjectAnimator
.
ofFloat
(
itemView
,
"translationY"
,
500
f
,
0
f
).
setDuration
(
500
).
start
();
}
/**
* 继承coreadapter需要重写此方法.
*
...
...
This diff is collapsed.
Click to expand it.
baseSDK/src/main/java/com/dayu/utils/UIUtils.java
View file @
1fcdc19a
...
...
@@ -74,7 +74,7 @@ public class UIUtils {
* @param dp
* @return
*/
public
int
dp2px
(
int
dp
)
{
public
static
int
dp2px
(
int
dp
)
{
// 获取手机屏幕的密度
float
density
=
getResources
().
getDisplayMetrics
().
density
;
return
(
int
)
(
dp
*
density
+
0.5f
);
// 加0.5是为了四舍五入
...
...
This diff is collapsed.
Click to expand it.
orderCenter/src/main/java/com/dayu/order/ui/activity/MultiProcessOrderActivity.java
View file @
1fcdc19a
...
...
@@ -71,9 +71,9 @@ public class MultiProcessOrderActivity extends BaseActivity<MultiProcessOrderPre
mBind
.
ivDelete
.
setVisibility
(
View
.
GONE
);
mSnImages
.
clear
();
});
mBind
.
scan
.
setOnClickListener
(
v
->
{
new
IntentIntegrator
(
this
).
setOrientationLocked
(
false
).
setCaptureActivity
(
CustomScannerActivity
.
class
).
initiateScan
();
});
//
mBind.scan.setOnClickListener(v -> {
//
new IntentIntegrator(this).setOrientationLocked(false).setCaptureActivity(CustomScannerActivity.class).initiateScan();
//
});
}
@Override
...
...
This diff is collapsed.
Click to expand it.
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