Commit 33b175bc by sikang

潜伏包

parent 9e8f733f
...@@ -20,8 +20,10 @@ import com.common.base.BaseActivity; ...@@ -20,8 +20,10 @@ import com.common.base.BaseActivity;
import com.common.bean.ProductBean; import com.common.bean.ProductBean;
import com.common.toolbox.app_utils.DeviceInfo; import com.common.toolbox.app_utils.DeviceInfo;
import com.common.toolbox.tracker.TrackEvent; import com.common.toolbox.tracker.TrackEvent;
import com.common.widget.CircleLayout;
import com.common.widget.PenetrateFrameLayout; import com.common.widget.PenetrateFrameLayout;
import com.common.widget.TopBar; import com.common.widget.TopBar;
import com.common.widget.TouchView;
import com.facebook.accountkit.AccountKitError; import com.facebook.accountkit.AccountKitError;
import com.facebook.accountkit.AccountKitLoginResult; import com.facebook.accountkit.AccountKitLoginResult;
import com.qmuiteam.qmui.util.QMUIStatusBarHelper; import com.qmuiteam.qmui.util.QMUIStatusBarHelper;
...@@ -72,6 +74,7 @@ public class ReviewHookActivity extends BaseActivity { ...@@ -72,6 +74,7 @@ public class ReviewHookActivity extends BaseActivity {
@Override @Override
public int bindLayout() { public int bindLayout() {
return R.layout.activity_review_hook; return R.layout.activity_review_hook;
// return R.layout.activity_rotate;
} }
@Override @Override
...@@ -117,6 +120,7 @@ public class ReviewHookActivity extends BaseActivity { ...@@ -117,6 +120,7 @@ public class ReviewHookActivity extends BaseActivity {
startLogin(); startLogin();
}); });
// Dialog ysDialog = DialogFactory.createCustomDialog(this, R.layout.dialog_collect_tip, // Dialog ysDialog = DialogFactory.createCustomDialog(this, R.layout.dialog_collect_tip,
// (dialog, viewHolder) -> { // (dialog, viewHolder) -> {
// CheckBox checkBox = viewHolder.getCheckBox(R.id.dialog_collect_checkbox); // CheckBox checkBox = viewHolder.getCheckBox(R.id.dialog_collect_checkbox);
...@@ -194,7 +198,7 @@ public class ReviewHookActivity extends BaseActivity { ...@@ -194,7 +198,7 @@ public class ReviewHookActivity extends BaseActivity {
} else { } else {
fragmentLayout.setClickable(true); fragmentLayout.setClickable(true);
} }
mTopBar.setAlpha(slideOffset); mTopBar.setAlpha(1);
} }
@Override @Override
......
package com.common.widget;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Point;
import android.graphics.PointF;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
/**
* Created by SiKang on 2016/3/2.
*/
public class CircleLayout extends ViewGroup {
private final String TAG = "CircleLayoutDebug";
private int mWidth;
private int mHeight;
private double mLayoutRadius;
private PointF mCenterPoint;
public CircleLayout(Context context) {
super(context);
init();
}
public CircleLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
mCenterPoint = new PointF();
}
@Override
public void onViewAdded(View child) {
if (getChildCount() <= 12) {
super.onViewAdded(child);
} else {
removeViewAt(getChildCount() - 1);
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mWidth = measureHanlder(widthMeasureSpec);
mHeight = measureHanlder(heightMeasureSpec);
mCenterPoint.x = mWidth / 2;
mCenterPoint.y = mHeight / 2;
mLayoutRadius = mWidth < mHeight ? mWidth / 2 : mHeight / 2;
Log.d(TAG, "onMeasure()");
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
if (!changed)
return;
setChildLayout();
}
//设置所有子View位置
private void setChildLayout() {
int childCount = getChildCount();
double childAngle = 360 / childCount;
double layoutAngle = 270;
double rotateAngle = 0;
Log.d(TAG, "onLayout() " + childAngle);
for (int i = 0; i < childCount; i++) {
//得到子View
TouchView childView = (TouchView) getChildAt(i);
//为子View设置宽高
int childHalfWidth = 100;
int childHalfHeight = 100;
Log.d("RotateViewDebug", "fathre onLayout" + childHalfWidth);
//计算半径
double radius = mLayoutRadius - (childHalfWidth < childHalfHeight ? childHalfWidth : childHalfHeight);
//计算元素的坐标
Point viewPoint = getPoint(mCenterPoint, layoutAngle, radius);
//初始化必要参数
childView.setmParentCenterPoint(mCenterPoint);
childView.setmPointInParent(viewPoint);
childView.setNowAngle(layoutAngle);
childView.initMatrix((float) rotateAngle, childHalfWidth * 2, childHalfHeight * 2);
//设置子View的位置
childView.layout(viewPoint.x - childHalfWidth, viewPoint.y - childHalfHeight, viewPoint.x + childHalfWidth, viewPoint.y + childHalfHeight);
//更新角度
layoutAngle = (layoutAngle + childAngle) % 360;
rotateAngle = (rotateAngle + childAngle) % 360;
}
}
@Override
public void onViewRemoved(View child) {
TouchView view = (TouchView) child;
view.destory();
if (view.isNormalDestory()) {
setChildCount(getChildCount());
}
super.onViewRemoved(child);
}
public void setChildCount(int count) {
removeAllViews();
for (int i = 0; i < count; i++) {
addView(new TouchView(getContext()));
}
setChildLayout();
}
/**
* 根据圆心和角度计算下一个view的位置
*/
private Point getPoint(PointF center, double angle, double radius) {
Point point = new Point();
double angleHude = angle * Math.PI / 180;
point.x = (int) (radius * Math.cos(angleHude) + center.x);
point.y = (int) (radius * Math.sin(angleHude) + center.y);
return point;
}
//处理Spec
private int measureHanlder(int measureSpec) {
int result;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
if (specMode == MeasureSpec.EXACTLY) {
result = specSize;
} else if (specMode == MeasureSpec.AT_MOST) {
result = Math.min(100, specSize);
} else {
result = 100;
}
return result;
}
public static class TouchActionController {
private List<ViewTouchActionListener> mActionListener = new ArrayList<ViewTouchActionListener>(12);
public static TouchActionController mTouchActionController = null;
private boolean isMaxMove, isMinMove;
private TouchActionController() {
isMaxMove = false;
isMinMove = false;
}
public static TouchActionController getInstance() {
if (mTouchActionController == null) {
synchronized (TouchActionController.class) {
if (mTouchActionController == null) {
mTouchActionController = new TouchActionController();
}
}
}
return mTouchActionController;
}
public void registerTouchActionListener(ViewTouchActionListener listener) {
if (!mActionListener.contains(listener)) {
mActionListener.add(listener);
}
}
public void unRegisterActionListener(ViewTouchActionListener listener) {
if (mActionListener.contains(listener)) {
mActionListener.remove(listener);
}
}
public void notifyListener(ViewTouchActionListener sender, final int ACTION_ID, final Object... args) {
for (final ViewTouchActionListener listener : mActionListener) {
if (sender != listener) {
listener.onTouchAction(ACTION_ID, args);
}
}
}
public boolean isMaxMove() {
return isMaxMove;
}
public boolean isMinMove() {
return isMinMove;
}
public void setIsMaxMove(boolean isMaxMove) {
this.isMaxMove = isMaxMove;
}
public void setIsMinMove(boolean isMinMove) {
this.isMinMove = isMinMove;
}
}
/**
* Created by SiKang on 2016/3/3.
*/
public interface ViewTouchActionListener {
void onTouchAction(int ACTION_ID, Object... args);
}
}
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<com.common.widget.PenetrateFrameLayout <com.common.widget.PenetrateFrameLayout
android:id="@+id/activity_review_fragmentLayout" android:id="@+id/activity_review_fragmentLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -16,20 +17,64 @@ ...@@ -16,20 +17,64 @@
android:id="@+id/activity_review_content" android:id="@+id/activity_review_content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white" android:background="@color/gray_bg"
android:orientation="vertical"> android:orientation="vertical">
<com.common.widget.CircleLayout
android:id="@+id/activity_hook_circle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<com.common.widget.TouchView
android:layout_width="100dp"
android:layout_height="100dp"
android:alpha="50" />
<com.common.widget.TouchView
android:layout_width="100dp"
android:layout_height="100dp"
android:alpha="50" />
<com.common.widget.TouchView
android:layout_width="100dp"
android:layout_height="100dp"
android:alpha="50" />
<com.common.widget.TouchView
android:layout_width="100dp"
android:layout_height="100dp"
android:alpha="50" />
<com.common.widget.TouchView
android:layout_width="100dp"
android:layout_height="100dp"
android:alpha="50" />
<com.common.widget.TouchView
android:layout_width="100dp"
android:layout_height="100dp"
android:alpha="50" />
<com.common.widget.TouchView
android:layout_width="100dp"
android:layout_height="100dp"
android:alpha="50" />
</com.common.widget.CircleLayout>
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="190dp" android:layout_height="190dp"
android:background="@drawable/banner02" android:background="@drawable/banner02"
android:clickable="false" android:clickable="false"
android:longClickable="false" /> android:longClickable="false"
android:visibility="gone" />
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/activity_review_productList_rv" android:id="@+id/activity_review_productList_rv"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent"
android:visibility="gone" />
</LinearLayout> </LinearLayout>
</com.common.widget.PenetrateFrameLayout> </com.common.widget.PenetrateFrameLayout>
...@@ -48,15 +93,13 @@ ...@@ -48,15 +93,13 @@
android:id="@+id/activity_review_topbar" android:id="@+id/activity_review_topbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:alpha="0"
android:background="@drawable/app_bar_bg" /> android:background="@drawable/app_bar_bg" />
<RelativeLayout <RelativeLayout
android:id="@+id/activity_review_menu_layout" android:id="@+id/activity_review_menu_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="50dp" android:layout_height="50dp">
android:layout_centerVertical="true">
<ImageButton <ImageButton
android:id="@+id/activity_review_menu_btn" android:id="@+id/activity_review_menu_btn"
...@@ -156,6 +199,7 @@ ...@@ -156,6 +199,7 @@
android:layout_height="50dp" android:layout_height="50dp"
android:background="@drawable/selector_recycler_item" android:background="@drawable/selector_recycler_item"
android:gravity="center_vertical" android:gravity="center_vertical"
android:visibility="gone"
android:paddingLeft="15dp"> android:paddingLeft="15dp">
<TextView <TextView
...@@ -216,10 +260,10 @@ ...@@ -216,10 +260,10 @@
<com.common.widget.SpanButton <com.common.widget.SpanButton
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:visibility="gone"
android:background="@drawable/selector_recycler_item" android:background="@drawable/selector_recycler_item"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingLeft="15dp"> android:paddingLeft="15dp"
android:visibility="gone">
<TextView <TextView
...@@ -326,10 +370,10 @@ ...@@ -326,10 +370,10 @@
android:id="@+id/activity_review_onlineQA_btn" android:id="@+id/activity_review_onlineQA_btn"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:visibility="gone"
android:background="@drawable/selector_recycler_item" android:background="@drawable/selector_recycler_item"
android:gravity="center_vertical" android:gravity="center_vertical"
android:paddingLeft="15dp"> android:paddingLeft="15dp"
android:visibility="gone">
<TextView <TextView
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<com.common.widget.CircleLayout
android:id="@+id/activity_rotate_circleLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"></com.common.widget.CircleLayout>
</LinearLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment