Compare commits

...

23 Commits

Author SHA1 Message Date
ram 2ddaa47425 9.1 2016-09-01 23:05:49 +08:00
ram 150c992c2f 代码更新 2016-08-30 08:26:39 +08:00
ram f934535d05 代码修正 2016-08-30 08:22:31 +08:00
ram 901bc5957c ppt介绍 2016-08-30 08:05:36 +08:00
ram 91a4e1466b 需求说明书-更新 2016-08-29 10:12:56 +08:00
ram 22eeccc855 需求规格说明书 2016-08-29 09:59:04 +08:00
ram e7ebadd8fb 顺序图 2016-08-26 11:16:15 +08:00
ram 6c1a742493 8.25 代码纠错 2016-08-25 23:44:47 +08:00
ram 3bafd50028 代码更新 8.24 2016-08-24 23:40:21 +08:00
ram a18130c45e 8.24 更新代码 2016-08-24 10:25:53 +08:00
ram b3599841e9 类图 2016-08-23 21:31:50 +08:00
ram 5bc0b9345d 需求说明书,更改 2016-08-22 23:20:47 +08:00
ram 8623a1e6ea 界面类图 2016-08-21 21:26:58 +08:00
ram a67a90e849 8.19 修改 2016-08-19 10:25:54 +08:00
ram 39fb66d3ec LoginActivity.java 2016-08-18 21:32:25 +08:00
ram 76e0c6fb5f 徐航 滑屏控制 2016-08-18 21:29:31 +08:00
ram 75771e8dbb 徐航-两周任务计划表 2016-08-18 20:11:53 +08:00
ram 238adf5886 上传 2016-08-18 09:27:19 +08:00
ram 4882dc9389 重传 2016-08-18 09:07:58 +08:00
ram 3ddd9c87ef 需求 2016-08-17 22:02:13 +08:00
ram 71413acf82 try.txt 2016-08-17 21:30:16 +08:00
ram 44118da4c2 try.txt 2016-08-17 21:29:21 +08:00
ram ba7b76d1e7 xuhang 2016-04-22 15:43:55 +08:00
559 changed files with 4128 additions and 978 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/文档/图标.jpg

View File

@ -3,11 +3,6 @@
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry exported="true" kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry exported="true" kind="lib" path="libs/open_sdk.jar"/>
<classpathentry exported="true" kind="lib" path="libs/mta-sdk-1.0.0.jar"/>
<classpathentry exported="true" kind="lib" path="libs/bmob_v3.1.0beta.jar"/>
<classpathentry kind="lib" path="libs/bmobPush_0.1beta.jar"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>

33
WeiXinOpen/.project Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>WeiXinOpen</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,3 @@
#Thu Mar 29 14:07:16 CST 2012
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,3 +1,4 @@
#Thu May 17 12:01:16 CST 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yyy.weixin"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name="com.yyy.weixin.TestWeiXinOpen" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.yyy.weixin.OtherActivity"></activity>
</application>
</manifest>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yyy.weixin"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name="com.yyy.weixin.TestWeiXinOpen" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.yyy.weixin.OtherActivity"></activity>
</application>
</manifest>

Binary file not shown.

BIN
WeiXinOpen/bin/classes.dex Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

View File

@ -0,0 +1,6 @@
/** Automatically generated file. DO NOT MODIFY */
package com.yyy.weixin;
public final class BuildConfig {
public final static boolean DEBUG = true;
}

View File

@ -0,0 +1,65 @@
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.yyy.weixin;
public final class R {
public static final class anim {
public static final int translate_left=0x7f040000;
public static final int translate_right=0x7f040001;
public static final int zoom_out_enter=0x7f040002;
public static final int zoom_out_exit=0x7f040003;
}
public static final class attr {
}
public static final class color {
public static final int TextColor=0x7f050000;
public static final int bgColor=0x7f050001;
}
public static final class drawable {
public static final int button_bg=0x7f020000;
public static final int ic_launcher=0x7f020001;
public static final int page_indicator_bg=0x7f020002;
public static final int page_indicator_focused=0x7f020003;
public static final int page_indicator_unfocused=0x7f020004;
public static final int show=0x7f020005;
public static final int w01=0x7f020006;
public static final int w02=0x7f020007;
public static final int w03=0x7f020008;
public static final int w04=0x7f020009;
public static final int w05=0x7f02000a;
public static final int w06=0x7f02000b;
public static final int w07=0x7f02000c;
public static final int w08=0x7f02000d;
public static final int whatsnew_bg=0x7f02000e;
public static final int whatsnew_btn_nor=0x7f02000f;
public static final int whatsnew_btn_pressed=0x7f020010;
public static final int whatsnew_left=0x7f020011;
public static final int whatsnew_left_m=0x7f020012;
public static final int whatsnew_right=0x7f020013;
public static final int whatsnew_right_m=0x7f020014;
}
public static final class id {
public static final int ScrollLayout=0x7f070001;
public static final int animLayout=0x7f070005;
public static final int leftLayout=0x7f070006;
public static final int llayout=0x7f070004;
public static final int mainRLayout=0x7f070000;
public static final int rightLayout=0x7f070007;
public static final int startBtn=0x7f070003;
public static final int t1=0x7f070002;
public static final int textView1=0x7f070008;
}
public static final class layout {
public static final int main=0x7f030000;
public static final int other=0x7f030001;
}
public static final class string {
public static final int app_name=0x7f060001;
public static final int hello=0x7f060000;
}
}

3
WeiXinOpen/lint.xml Normal file
View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
</lint>

40
WeiXinOpen/proguard.cfg Normal file
View File

@ -0,0 +1,40 @@
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

View File

@ -0,0 +1,11 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-20

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="false" >
<translate
android:duration="10000"
android:fromXDelta="-3.0"
android:fromYDelta="0.0"
android:toXDelta="-50.0%p"
android:toYDelta="0.0" />
</set>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="false" >
<translate
android:duration="10000"
android:fromXDelta="0.0"
android:fromYDelta="0.0"
android:toXDelta="50.0%p"
android:toYDelta="0.0" />
</set>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/overshoot_interpolator" >
<scale
android:duration="@android:integer/config_shortAnimTime"
android:fromXScale="0.7"
android:fromYScale="0.7"
android:pivotX="50.0%"
android:pivotY="50.0%"
android:toXScale="1.0"
android:toYScale="1.0" />
</set>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator" >
<scale
android:duration="@android:integer/config_shortAnimTime"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50.0%"
android:pivotY="50.0%"
android:toXScale="0.8"
android:toYScale="0.8" />
<alpha
android:duration="@android:integer/config_shortAnimTime"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 932 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/whatsnew_btn_pressed" /> <!-- pressed -->
<item android:state_focused="true"
android:drawable="@drawable/whatsnew_btn_pressed" /> <!-- focused -->
<item android:drawable="@drawable/whatsnew_btn_nor" /> <!-- default -->
</selector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true" android:drawable="@drawable/page_indicator_unfocused" />
<item android:state_enabled="false" android:drawable="@drawable/page_indicator_focused" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/mainRLayout"
android:background="#000000"
>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/show"
/>
<com.yyy.weixin.MyScrollLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ScrollLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="visible"
>
<RelativeLayout android:background="@drawable/w01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="89dp"
android:text="微信,不只是个聊天工具"
android:textColor="@color/TextColor"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout android:background="@drawable/w02"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/t1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="96dp"
android:text="第一次,你可以使用透明背景的动画表情,来表达你此刻的心情"
android:gravity="center_horizontal"
android:textColor="@color/TextColor"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout android:background="@drawable/w03"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<RelativeLayout android:background="@drawable/w04"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<RelativeLayout android:background="@drawable/w05"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<RelativeLayout android:background="@drawable/w06"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<RelativeLayout android:background="@drawable/w07"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<RelativeLayout android:background="@drawable/w08"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<RelativeLayout android:background="@drawable/w01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/startBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="98dp"
android:text="开始我的微信生活"
android:textSize="22sp"
android:textColor="@color/TextColor"
android:background="@drawable/button_bg"
android:layout_gravity="center_vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="15dp"
android:paddingBottom="15dp"
/>
</RelativeLayout>
</com.yyy.weixin.MyScrollLayout>
<LinearLayout
android:orientation="horizontal"
android:id="@+id/llayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="24.0dip"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:visibility="visible">
<ImageView android:clickable="true" android:padding="5.0dip" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/page_indicator_bg" />
<ImageView android:clickable="true" android:padding="5.0dip" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/page_indicator_bg" />
<ImageView android:clickable="true" android:padding="5.0dip" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/page_indicator_bg" />
<ImageView android:clickable="true" android:padding="5.0dip" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/page_indicator_bg" />
<ImageView android:clickable="true" android:padding="5.0dip" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/page_indicator_bg" />
<ImageView android:clickable="true" android:padding="5.0dip" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/page_indicator_bg" />
<ImageView android:clickable="true" android:padding="5.0dip" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/page_indicator_bg" />
<ImageView android:clickable="true" android:padding="5.0dip" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/page_indicator_bg" />
<ImageView android:clickable="true" android:padding="5.0dip" android:layout_gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/page_indicator_bg" />
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
android:id="@+id/animLayout"
>
<LinearLayout
android:id="@+id/leftLayout"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/whatsnew_left"/>
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/whatsnew_left_m"
android:layout_marginLeft="-3dp"/>
</LinearLayout>
<LinearLayout
android:id="@+id/rightLayout"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<ImageView android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:src="@drawable/whatsnew_right_m"/>
<ImageButton android:layout_height="fill_parent"
android:layout_width="wrap_content"
android:src="@drawable/whatsnew_right"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -0,0 +1,14 @@
<?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:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="亲,可以开始你的生活了!0.0" />
</LinearLayout>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="TextColor">#FFFFFF</color>
<color name="bgColor">#000000</color>
</resources>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, TestWeiXinWhatsNewActivity!</string>
<string name="app_name">TestWeiXinOpen</string>
</resources>

View File

@ -0,0 +1,200 @@
package com.yyy.weixin;
import android.R.bool;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.View.MeasureSpec;
import android.widget.Scroller;
public class MyScrollLayout extends ViewGroup {
private static final String TAG = "ScrollLayout";
private VelocityTracker mVelocityTracker; // 用于判断甩动手势
private static final int SNAP_VELOCITY = 600; //X轴速度基值大于该值时进行切换
private Scroller mScroller; // 滑动控制<EFBFBD>?
private int mCurScreen; //当前页面为第几屏
private int mDefaultScreen = 0;
private float mLastMotionX;
private OnViewChangeListener mOnViewChangeListener;
public MyScrollLayout(Context context) {
super(context);
// TODO Auto-generated constructor stub
init(context);
}
public MyScrollLayout(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
init(context);
}
private void init(Context context) {
mCurScreen = mDefaultScreen;
mScroller = new Scroller(context);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// TODO Auto-generated method stub
Log.e("a", "a");
if (changed) {
int childLeft = 0;
final int childCount = getChildCount();
Log.e("count", childCount+"");
for (int i = 0; i < childCount; i++) {
final View childView = getChildAt(i);
if (childView.getVisibility() != View.GONE) {
final int childWidth = childView.getMeasuredWidth();
childView.layout(childLeft, 0, childLeft + childWidth,
childView.getMeasuredHeight());
childLeft += childWidth;
}
}
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// TODO Auto-generated method stub
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
Log.e("b", "b");
final int width = MeasureSpec.getSize(widthMeasureSpec);
final int count = getChildCount();
for (int i = 0; i < count; i++) {
getChildAt(i).measure(widthMeasureSpec, heightMeasureSpec);
}
scrollTo(mCurScreen * width, 0);
}
public void snapToDestination() {
final int screenWidth = getWidth();
final int destScreen = (getScrollX() + screenWidth / 2) / screenWidth;
snapToScreen(destScreen);
}
//使屏幕移动到第whichScreen+1屏
public void snapToScreen(int whichScreen) {
if (getScrollX() != (whichScreen * getWidth())) {
final int delta = whichScreen * getWidth() - getScrollX();
mScroller.startScroll(getScrollX(), 0, delta, 0,
Math.abs(delta) * 2);
mCurScreen = whichScreen;
invalidate();
if (mOnViewChangeListener != null) {
mOnViewChangeListener.OnViewChange(mCurScreen);
}
}
}
@Override
public void computeScroll() {
// TODO Auto-generated method stub
if (mScroller.computeScrollOffset()) {
scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
postInvalidate();
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
final int action = event.getAction();
final float x = event.getX();
final float y = event.getY();
switch (action) {
case MotionEvent.ACTION_DOWN:
Log.i("", "onTouchEvent ACTION_DOWN");
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
mVelocityTracker.addMovement(event);
}
if (!mScroller.isFinished()) {
mScroller.abortAnimation();
}
mLastMotionX = x;
break;
case MotionEvent.ACTION_MOVE:
int deltaX = (int) (mLastMotionX - x);
if (IsCanMove(deltaX)) {
if (mVelocityTracker != null) {
mVelocityTracker.addMovement(event);
}
mLastMotionX = x;
//正向或者负向移动屏幕跟随手指移动
scrollBy(deltaX, 0);
}
break;
case MotionEvent.ACTION_UP:
int velocityX = 0;
if (mVelocityTracker != null) {
mVelocityTracker.addMovement(event);
mVelocityTracker.computeCurrentVelocity(1000);
//得到X轴方向手指移动速度
velocityX = (int) mVelocityTracker.getXVelocity();
}
//velocityX为正值说明手指向右滑动为负值说明手指向左滑动
if (velocityX > SNAP_VELOCITY && mCurScreen > 0) {
// Fling enough to move left
Log.e(TAG, "snap left");
snapToScreen(mCurScreen - 1);
} else if (velocityX < -SNAP_VELOCITY
&& mCurScreen < getChildCount() - 1) {
// Fling enough to move right
Log.e(TAG, "snap right");
snapToScreen(mCurScreen + 1);
} else {
snapToDestination();
}
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker = null;
}
break;
}
return true;
}
private boolean IsCanMove(int deltaX) {
//deltaX<0说明手指向右划
if (getScrollX() <= 0 && deltaX < 0) {
return false;
}
//deltaX>0说明手指向左划
if (getScrollX() >= (getChildCount() - 1) * getWidth() && deltaX > 0) {
return false;
}
return true;
}
public void SetOnViewChangeListener(OnViewChangeListener listener) {
mOnViewChangeListener = listener;
}
}

View File

@ -0,0 +1,5 @@
package com.yyy.weixin;
public interface OnViewChangeListener {
public void OnViewChange(int view);
}

View File

@ -0,0 +1,102 @@
package com.yyy.weixin;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
public class TestWeiXinOpen extends Activity implements OnViewChangeListener{
private MyScrollLayout mScrollLayout;
private ImageView[] imgs;
private int count;
private int currentItem;
private Button startBtn;
private RelativeLayout mainRLayout;
private LinearLayout pointLLayout;
private LinearLayout leftLayout;
private LinearLayout rightLayout;
private LinearLayout animLayout;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initView();
}
private void initView() {
mScrollLayout = (MyScrollLayout) findViewById(R.id.ScrollLayout);
pointLLayout = (LinearLayout) findViewById(R.id.llayout);
mainRLayout = (RelativeLayout) findViewById(R.id.mainRLayout);
startBtn = (Button) findViewById(R.id.startBtn);
startBtn.setOnClickListener(onClick);
animLayout = (LinearLayout) findViewById(R.id.animLayout);
leftLayout = (LinearLayout) findViewById(R.id.leftLayout);
rightLayout = (LinearLayout) findViewById(R.id.rightLayout);
count = mScrollLayout.getChildCount();
imgs = new ImageView[count];
for(int i = 0; i< count;i++) {
imgs[i] = (ImageView) pointLLayout.getChildAt(i);
imgs[i].setEnabled(true);
imgs[i].setTag(i);
}
currentItem = 0;
imgs[currentItem].setEnabled(false);
mScrollLayout.SetOnViewChangeListener(this);
}
private View.OnClickListener onClick = new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.startBtn:
mScrollLayout.setVisibility(View.GONE);
pointLLayout.setVisibility(View.GONE);
animLayout.setVisibility(View.VISIBLE);
mainRLayout.setBackgroundResource(R.drawable.whatsnew_bg);
Animation leftOutAnimation = AnimationUtils.loadAnimation(TestWeiXinOpen.this, R.anim.translate_left);
Animation rightOutAnimation = AnimationUtils.loadAnimation(TestWeiXinOpen.this, R.anim.translate_right);
leftLayout.startAnimation(leftOutAnimation);
rightLayout.startAnimation(rightOutAnimation);
leftOutAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
mainRLayout.setBackgroundColor(R.color.bgColor);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
leftLayout.setVisibility(View.GONE);
rightLayout.setVisibility(View.GONE);
}
});
break;
}
}
};
@Override
public void OnViewChange(int position) {
setcurrentPoint(position);
}
private void setcurrentPoint(int position) {
if(position < 0 || position > count -1 || currentItem == position) {
return;
}
imgs[currentItem].setEnabled(true);
imgs[position].setEnabled(false);
currentItem = position;
}
}

1
try.txt Normal file
View File

@ -0,0 +1 @@
aaaaaaaaaaaaa

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +0,0 @@
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Some files were not shown because too many files have changed in this diff Show More