@@ -6,6 +6,7 @@ import android.os.AsyncTask; |
||
| 6 | 6 |
import android.os.Bundle; |
| 7 | 7 |
import android.support.v4.app.FragmentActivity; |
| 8 | 8 |
import android.support.v4.view.ViewPager; |
| 9 |
+import android.support.v4.view.ViewPager.OnPageChangeListener; |
|
| 9 | 10 |
import android.text.SpannableString; |
| 10 | 11 |
import android.text.TextUtils; |
| 11 | 12 |
import android.text.style.UnderlineSpan; |
@@ -36,7 +37,7 @@ import ai.pai.client.db.Preferences; |
||
| 36 | 37 |
import ai.pai.client.utils.HttpPostTask; |
| 37 | 38 |
import ai.pai.client.utils.UrlContainer; |
| 38 | 39 |
|
| 39 |
-public class GuideActivity extends FragmentActivity{
|
|
| 40 |
+public class GuideActivity extends FragmentActivity implements OnPageChangeListener{
|
|
| 40 | 41 |
private IndicatorViewPager indicatorViewPager; |
| 41 | 42 |
private SHARE_MEDIA platform = SHARE_MEDIA.WEIXIN; |
| 42 | 43 |
private UMShareAPI umShareAPI; |
@@ -54,16 +55,19 @@ public class GuideActivity extends FragmentActivity{
|
||
| 54 | 55 |
|
| 55 | 56 |
private HttpPostTask LoginTask; |
| 56 | 57 |
private HttpPostTask guestLoginTask; |
| 58 |
+ private View loginView; |
|
| 57 | 59 |
|
| 58 | 60 |
@Override |
| 59 | 61 |
protected void onCreate(Bundle arg0) {
|
| 60 | 62 |
super.onCreate(arg0); |
| 61 | 63 |
setContentView(R.layout.activity_guide); |
| 64 |
+ loginView = findViewById(R.id.layout_login_part); |
|
| 62 | 65 |
wheel = (ProgressWheel)findViewById(R.id.wheel_wait_http); |
| 63 | 66 |
ViewPager viewPager = (ViewPager) findViewById(R.id.guide_viewPager); |
| 64 | 67 |
Indicator indicator = (Indicator) findViewById(R.id.guide_indicator); |
| 65 | 68 |
indicatorViewPager = new IndicatorViewPager(indicator, viewPager); |
| 66 | 69 |
indicatorViewPager.setAdapter(adapter); |
| 70 |
+ viewPager.addOnPageChangeListener(this); |
|
| 67 | 71 |
TextView guestTextView = (TextView)findViewById(R.id.tv_login_guest); |
| 68 | 72 |
SpannableString content = new SpannableString(getString(R.string.guest_login)); |
| 69 | 73 |
content.setSpan(new UnderlineSpan(),0, content.length(), 0); |
@@ -285,4 +289,22 @@ public class GuideActivity extends FragmentActivity{
|
||
| 285 | 289 |
LoginTask.executeOnExecutor(ThreadExecutor.getInstance().getExecutor(), UrlContainer.WX_AUTHORIZE_URL); |
| 286 | 290 |
} |
| 287 | 291 |
|
| 292 |
+ @Override |
|
| 293 |
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
|
| 294 |
+ |
|
| 295 |
+ } |
|
| 296 |
+ |
|
| 297 |
+ @Override |
|
| 298 |
+ public void onPageSelected(int position) {
|
|
| 299 |
+ if(position == 2){
|
|
| 300 |
+ loginView.setVisibility(View.VISIBLE); |
|
| 301 |
+ }else{
|
|
| 302 |
+ loginView.setVisibility(View.INVISIBLE); |
|
| 303 |
+ } |
|
| 304 |
+ } |
|
| 305 |
+ |
|
| 306 |
+ @Override |
|
| 307 |
+ public void onPageScrollStateChanged(int state) {
|
|
| 308 |
+ |
|
| 309 |
+ } |
|
| 288 | 310 |
} |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 |
xmlns:progress="http://schemas.android.com/apk/res-auto" |
| 4 | 4 |
android:layout_width="match_parent" |
| 5 | 5 |
android:layout_height="match_parent" |
| 6 |
- android:orientation="vertical" > |
|
| 6 |
+ android:orientation="vertical"> |
|
| 7 | 7 |
|
| 8 | 8 |
<android.support.v4.view.ViewPager |
| 9 | 9 |
android:id="@+id/guide_viewPager" |
@@ -14,75 +14,80 @@ |
||
| 14 | 14 |
android:id="@+id/guide_indicator" |
| 15 | 15 |
android:layout_width="wrap_content" |
| 16 | 16 |
android:layout_height="wrap_content" |
| 17 |
- android:layout_marginBottom="130dp" |
|
| 18 | 17 |
android:layout_gravity="center_horizontal|bottom" |
| 19 |
- /> |
|
| 18 |
+ android:layout_marginBottom="130dp" /> |
|
| 20 | 19 |
|
| 21 |
- <View android:layout_width="match_parent" |
|
| 22 |
- android:layout_height="150dp" |
|
| 23 |
- android:layout_gravity="bottom" |
|
| 24 |
- android:background="@drawable/login_bottom_mask"/> |
|
| 25 |
- |
|
| 26 |
- <RelativeLayout |
|
| 27 |
- android:id="@+id/btn_login" |
|
| 20 |
+ <FrameLayout |
|
| 21 |
+ android:id="@+id/layout_login_part" |
|
| 28 | 22 |
android:layout_width="match_parent" |
| 29 |
- android:layout_height="48dp" |
|
| 30 |
- android:layout_gravity="center_horizontal|bottom" |
|
| 31 |
- android:layout_marginLeft="24dp" |
|
| 32 |
- android:layout_marginRight="24dp" |
|
| 33 |
- android:layout_marginBottom="70dp" |
|
| 34 |
- android:gravity="center" |
|
| 35 |
- android:background="@drawable/login_btn_bg"> |
|
| 36 |
- |
|
| 37 |
- |
|
| 38 |
- <ImageView |
|
| 39 |
- android:id="@+id/iv_login_wx" |
|
| 40 |
- android:layout_width="32dp" |
|
| 41 |
- android:layout_height="32dp" |
|
| 42 |
- android:layout_centerVertical="true" |
|
| 43 |
- android:src="@drawable/login_weixin_logo"/> |
|
| 23 |
+ android:layout_height="match_parent"> |
|
| 44 | 24 |
|
| 45 |
- <TextView |
|
| 46 |
- android:layout_width="wrap_content" |
|
| 47 |
- android:layout_height="wrap_content" |
|
| 48 |
- android:layout_marginLeft="6dp" |
|
| 49 |
- android:layout_centerVertical="true" |
|
| 50 |
- android:text="@string/weixin_login" |
|
| 51 |
- android:textColor="@color/white" |
|
| 52 |
- android:layout_toRightOf="@id/iv_login_wx" |
|
| 53 |
- android:gravity="center" |
|
| 54 |
- android:textSize="16sp" |
|
| 55 |
- /> |
|
| 56 |
- </RelativeLayout> |
|
| 25 |
+ <View |
|
| 26 |
+ android:layout_width="match_parent" |
|
| 27 |
+ android:layout_height="150dp" |
|
| 28 |
+ android:layout_gravity="bottom" |
|
| 29 |
+ android:background="@drawable/login_bottom_mask" /> |
|
| 57 | 30 |
|
| 58 |
- <RelativeLayout |
|
| 59 |
- android:id="@+id/btn_login_guest" |
|
| 60 |
- android:layout_width="match_parent" |
|
| 61 |
- android:layout_height="48dp" |
|
| 62 |
- android:layout_gravity="center_horizontal|bottom" |
|
| 63 |
- android:layout_marginBottom="5dp" |
|
| 64 |
- android:layout_marginLeft="24dp" |
|
| 65 |
- android:layout_marginRight="24dp" |
|
| 66 |
- android:gravity="center" |
|
| 67 |
- android:visibility="visible"> |
|
| 31 |
+ <RelativeLayout |
|
| 32 |
+ android:id="@+id/btn_login" |
|
| 33 |
+ android:layout_width="match_parent" |
|
| 34 |
+ android:layout_height="48dp" |
|
| 35 |
+ android:layout_gravity="center_horizontal|bottom" |
|
| 36 |
+ android:layout_marginBottom="70dp" |
|
| 37 |
+ android:layout_marginLeft="24dp" |
|
| 38 |
+ android:layout_marginRight="24dp" |
|
| 39 |
+ android:background="@drawable/login_btn_bg" |
|
| 40 |
+ android:gravity="center"> |
|
| 68 | 41 |
|
| 69 |
- <TextView |
|
| 70 |
- android:id="@+id/tv_login_guest" |
|
| 71 |
- android:layout_width="wrap_content" |
|
| 72 |
- android:layout_height="wrap_content" |
|
| 73 |
- android:textColor="@color/white" |
|
| 42 |
+ |
|
| 43 |
+ <ImageView |
|
| 44 |
+ android:id="@+id/iv_login_wx" |
|
| 45 |
+ android:layout_width="32dp" |
|
| 46 |
+ android:layout_height="32dp" |
|
| 47 |
+ android:layout_centerVertical="true" |
|
| 48 |
+ android:src="@drawable/login_weixin_logo" /> |
|
| 49 |
+ |
|
| 50 |
+ <TextView |
|
| 51 |
+ android:layout_width="wrap_content" |
|
| 52 |
+ android:layout_height="wrap_content" |
|
| 53 |
+ android:layout_centerVertical="true" |
|
| 54 |
+ android:layout_marginLeft="6dp" |
|
| 55 |
+ android:layout_toRightOf="@id/iv_login_wx" |
|
| 56 |
+ android:gravity="center" |
|
| 57 |
+ android:text="@string/weixin_login" |
|
| 58 |
+ android:textColor="@color/white" |
|
| 59 |
+ android:textSize="16sp" /> |
|
| 60 |
+ </RelativeLayout> |
|
| 61 |
+ |
|
| 62 |
+ <RelativeLayout |
|
| 63 |
+ android:id="@+id/btn_login_guest" |
|
| 64 |
+ android:layout_width="match_parent" |
|
| 65 |
+ android:layout_height="48dp" |
|
| 66 |
+ android:layout_gravity="center_horizontal|bottom" |
|
| 67 |
+ android:layout_marginBottom="5dp" |
|
| 68 |
+ android:layout_marginLeft="24dp" |
|
| 69 |
+ android:layout_marginRight="24dp" |
|
| 74 | 70 |
android:gravity="center" |
| 75 |
- android:textSize="14sp" /> |
|
| 76 |
- </RelativeLayout> |
|
| 71 |
+ android:visibility="visible"> |
|
| 72 |
+ |
|
| 73 |
+ <TextView |
|
| 74 |
+ android:id="@+id/tv_login_guest" |
|
| 75 |
+ android:layout_width="wrap_content" |
|
| 76 |
+ android:layout_height="wrap_content" |
|
| 77 |
+ android:gravity="center" |
|
| 78 |
+ android:textColor="@color/white" |
|
| 79 |
+ android:textSize="14sp" /> |
|
| 80 |
+ </RelativeLayout> |
|
| 81 |
+ </FrameLayout> |
|
| 82 |
+ |
|
| 77 | 83 |
|
| 78 | 84 |
<com.android.views.progressbar.ProgressWheel |
| 79 | 85 |
android:id="@+id/wheel_wait_http" |
| 80 | 86 |
android:layout_width="80dp" |
| 81 | 87 |
android:layout_height="80dp" |
| 82 | 88 |
android:layout_gravity="center" |
| 83 |
- progress:text="@string/please_wait" |
|
| 84 | 89 |
android:visibility="invisible" |
| 85 |
- /> |
|
| 90 |
+ progress:text="@string/please_wait" /> |
|
| 86 | 91 |
|
| 87 | 92 |
|
| 88 | 93 |
</FrameLayout> |