去除无用资源
This commit is contained in:
@ -1,105 +0,0 @@
|
||||
package com.gh.common.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.gh.common.util.DisplayUtils;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.eventbus.EBShowDone;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
public class Gh_LinearLayout extends LinearLayout {
|
||||
|
||||
private LinearLayout dm_item, dm_item_ll_delete;
|
||||
|
||||
private int height;
|
||||
private int total;
|
||||
private int distance;
|
||||
|
||||
private boolean isSliding;
|
||||
|
||||
public boolean isSliding() {
|
||||
return isSliding;
|
||||
}
|
||||
|
||||
private int position;
|
||||
|
||||
Runnable show = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
LayoutParams lparams = new LayoutParams(
|
||||
LayoutParams.MATCH_PARENT, height);
|
||||
lparams.height = dm_item.getHeight() + distance;
|
||||
if (lparams.height > total) {
|
||||
lparams.height = total;
|
||||
}
|
||||
dm_item.setLayoutParams(lparams);
|
||||
invalidate();
|
||||
if (dm_item.getHeight() < total) {
|
||||
postDelayed(show, 10);
|
||||
} else {
|
||||
isSliding = false;
|
||||
EventBus.getDefault().post(new EBShowDone("下载管理", position));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Runnable hide = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
LayoutParams lparams = new LayoutParams(
|
||||
LayoutParams.MATCH_PARENT, height);
|
||||
lparams.height = dm_item.getHeight() - distance;
|
||||
if (lparams.height < height) {
|
||||
lparams.height = height;
|
||||
}
|
||||
dm_item.setLayoutParams(lparams);
|
||||
invalidate();
|
||||
if (dm_item.getHeight() > height) {
|
||||
postDelayed(hide, 10);
|
||||
} else {
|
||||
dm_item_ll_delete.setVisibility(View.GONE);
|
||||
isSliding = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public Gh_LinearLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
|
||||
height = DisplayUtils.dip2px(getContext(), 66);
|
||||
total = DisplayUtils.dip2px(getContext(), 96);
|
||||
distance = DisplayUtils.dip2px(getContext(), 3);
|
||||
|
||||
isSliding = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
|
||||
super.onAttachedToWindow();
|
||||
dm_item = (LinearLayout) findViewById(R.id.dm_item);
|
||||
dm_item_ll_delete = (LinearLayout) findViewById(R.id.dm_item_ll_delete);
|
||||
}
|
||||
|
||||
public void showDeleteView(int position) {
|
||||
this.position = position;
|
||||
isSliding = true;
|
||||
dm_item_ll_delete.setVisibility(View.VISIBLE);
|
||||
removeCallbacks(hide);
|
||||
post(show);
|
||||
getHandler();
|
||||
}
|
||||
|
||||
public void hideDeleteView() {
|
||||
isSliding = true;
|
||||
removeCallbacks(show);
|
||||
post(hide);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user