Skip to content

Commit

Permalink
Revert "fix some bug."
Browse files Browse the repository at this point in the history
This reverts commit 1f0c8ba.
  • Loading branch information
xinghongfei committed Aug 31, 2016
1 parent 22e8baf commit a1f429f
Show file tree
Hide file tree
Showing 28 changed files with 614 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Look.Translucent.Dribbble.Shot">

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="dribbble.com"
android:pathPrefix="/shots/"/>
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
Expand All @@ -48,7 +56,15 @@
android:screenOrientation="portrait"

android:theme="@style/Look.Translucent.Dribbble.Shot">

<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="dribbble.com"
android:pathPrefix="/shots/"/>
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public class BaseActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
// TODO: 16/8/31

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class MeiziPhotoDescribeActivity extends BaseActivity {
String mImageUrl;

PhotoViewAttacher mPhotoViewAttacher;
@InjectView(R.id.image_view)
@InjectView(R.id.shot)
ImageView mShot;
@InjectView(R.id.toolbar)
Toolbar mToolbar;
Expand Down Expand Up @@ -133,7 +133,7 @@ private void getData() {
Glide.with(this)
.load(mImageUrl)
.centerCrop()
.listener(loadListener)
.listener(shotLoadListener)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(mShot);

Expand Down Expand Up @@ -215,7 +215,7 @@ private void expandImageAndFinish() {
}
}

private RequestListener loadListener = new RequestListener<String, GlideDrawable>() {
private RequestListener shotLoadListener = new RequestListener<String, GlideDrawable>() {
@Override
public boolean onResourceReady(GlideDrawable resource, String model,
Target<GlideDrawable> target, boolean isFromMemoryCache,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
import android.widget.ProgressBar;

import com.bumptech.glide.Glide;
Expand Down Expand Up @@ -59,10 +60,12 @@ public class TopNewsDescribeActivity extends BaseActivity implements ITopNewsDes
ProgressBar mProgress;
@InjectView(R.id.htNewsContent)
HtmlTextView mHtNewsContent;
@InjectView(R.id.image_view)
ParallaxScrimageView mImageView;
@InjectView(R.id.shot)
ParallaxScrimageView mShot;
@InjectView(R.id.toolbar)
Toolbar mToolbar;
@InjectView(R.id.container)
FrameLayout mContainer;
@InjectView(R.id.draggable_frame)
ElasticDragDismissFrameLayout mDraggableFrame;
@InjectView(R.id.nest)
Expand All @@ -73,7 +76,7 @@ public class TopNewsDescribeActivity extends BaseActivity implements ITopNewsDes
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (oldScrollY < 168) {
mImageView.setOffset(-oldScrollY);
mShot.setOffset(-oldScrollY);
mTextView.setOffset(-oldScrollY);
}
}
Expand All @@ -96,7 +99,7 @@ public void onTransitionStart(Transition transition) {
.setDuration(100)
.setInterpolator(new AccelerateInterpolator());
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){
mImageView.setElevation(1f);
mShot.setElevation(1f);
mToolbar.setElevation(0f);
}
mNest.animate()
Expand All @@ -111,20 +114,21 @@ public void onTransitionStart(Transition transition) {
public void onTransitionEnd(Transition transition) {
super.onTransitionEnd(transition);

// 解决5.0 shara element bug
ValueAnimator valueAnimator = ValueAnimator.ofInt(0, 100).setDuration(100);


valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
// mImageView.setOffset((Integer) valueAnimator.getAnimatedValue() * 10);
// mShot.setOffset((Integer) valueAnimator.getAnimatedValue() * 10);
mNest.smoothScrollTo((Integer) valueAnimator.getAnimatedValue() / 10, 0);

}
});
valueAnimator.start();
// mImageView.setAlpha(0.5f);
// mImageView.animate().alpha(1f).setDuration(800L).start();
// mShot.setAlpha(0.5f);
// mShot.animate().alpha(1f).setDuration(800L).start();
}


Expand Down Expand Up @@ -159,7 +163,12 @@ public void onGenerated(Palette palette) {
isDark = lightness == ColorUtils.IS_DARK;
}

// // color the status bar. Set a complementary dark color on L,
// if (isDark) { // make back icon dark on light images
// mToolbar.setBackgroundColor(getResources().getColor(R.color.colorPrimary ));
// mToolbar.setTitleTextColor();
// }

// color the status bar. Set a complementary dark color on L,
// light or dark color on M (with matching status bar icons)
int statusBarColor = getWindow().getStatusBarColor();
final Palette.Swatch topColor =
Expand All @@ -170,14 +179,14 @@ public void onGenerated(Palette palette) {
isDark, SCRIM_ADJUSTMENT);
// set a light status bar on M+
if (!isDark && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ViewUtils.setLightStatusBar(mImageView);
ViewUtils.setLightStatusBar(mShot);
}
}

if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {

if (statusBarColor != getWindow().getStatusBarColor()) {
mImageView.setScrimColor(statusBarColor);
mShot.setScrimColor(statusBarColor);
ValueAnimator statusBarColorAnim = ValueAnimator.ofArgb(
getWindow().getStatusBarColor(), statusBarColor);
statusBarColorAnim.addUpdateListener(new ValueAnimator
Expand Down Expand Up @@ -206,7 +215,7 @@ public void onGenerated(Palette palette) {
// slightly more opaque ripple on the pinned image to compensate
// for the scrim
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){
mImageView.setForeground(ViewUtils.createRipple(palette, 0.3f, 0.6f,
mShot.setForeground(ViewUtils.createRipple(palette, 0.3f, 0.6f,
ContextCompat.getColor(TopNewsDescribeActivity.this, R.color.mid_grey),
true));
}
Expand All @@ -215,7 +224,7 @@ public void onGenerated(Palette palette) {
});

// TODO should keep the background if the image contains transparency?!
mImageView.setBackground(null);
mShot.setBackground(null);
return false;
}

Expand Down Expand Up @@ -261,18 +270,19 @@ private void initData() {
.listener(glideLoadListener)
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(mImageView);
.into(mShot);


mTopNewsDesPresenter = new TopNewsDesPresenterImpl(this);
mNest.setOnScrollChangeListener(scrollListener);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
postponeEnterTransition();
mImageView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
mShot.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
mImageView.getViewTreeObserver().removeOnPreDrawListener(this);

mShot.getViewTreeObserver().removeOnPreDrawListener(this);
// TODO: 16/8/16 posotion
// enterAnimation();
startPostponedEnterTransition();
return true;
}
Expand Down Expand Up @@ -339,7 +349,7 @@ private void getData() {

}

@OnClick(R.id.image_view)
@OnClick(R.id.shot)
public void onClick() {
mNest.smoothScrollTo(0, 0);

Expand Down Expand Up @@ -368,8 +378,8 @@ public void onClick(View v) {

private void expandImageAndFinish() {

if (mImageView.getOffset() != 0f) {
Animator expandImage = ObjectAnimator.ofFloat(mImageView, ParallaxScrimageView.OFFSET,
if (mShot.getOffset() != 0f) {
Animator expandImage = ObjectAnimator.ofFloat(mShot, ParallaxScrimageView.OFFSET,
0f);
expandImage.setDuration(80);
expandImage.setInterpolator(new AccelerateInterpolator());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.looklook.xinghongfei.looklook.Activity;

import android.os.Bundle;
import android.os.PersistableBundle;

/**
* Created by xinghongfei on 16/8/12.
*/
public class ZhihuActivity extends BaseActivity {

@Override
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
public class ZhihuDescribeActivity extends BaseActivity implements IZhihuStory {
private static final float SCRIM_ADJUSTMENT = 0.075f;

@InjectView(R.id.image_view)
ParallaxScrimageView mParallaxScrimageView;
@InjectView(R.id.shot)
ParallaxScrimageView mShot;
@InjectView(R.id.toolbar)
Toolbar mToolbar;
@InjectView(R.id.container)
Expand Down Expand Up @@ -92,7 +92,7 @@ public class ZhihuDescribeActivity extends BaseActivity implements IZhihuStory {
@Override
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
if (oldScrollY<168){
mParallaxScrimageView.setOffset(-oldScrollY);
mShot.setOffset(-oldScrollY);
mTranslateYTextView.setOffset(-oldScrollY);
}

Expand Down Expand Up @@ -141,10 +141,10 @@ private void initData() {
mNest.setOnScrollChangeListener(scrollListener);
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){
postponeEnterTransition();
mParallaxScrimageView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
mShot.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
mParallaxScrimageView.getViewTreeObserver().removeOnPreDrawListener(this);
mShot.getViewTreeObserver().removeOnPreDrawListener(this);
// TODO: 16/8/16 posotion
// enterAnimation();
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
Expand Down Expand Up @@ -259,7 +259,7 @@ private void getData() {

}

@OnClick(R.id.image_view)
@OnClick(R.id.shot)
public void onClick() {
mNest.smoothScrollTo(0, 0);

Expand All @@ -280,9 +280,9 @@ public void showZhihuStory(ZhihuStory zhihuStory) {

Glide.with(this)
.load(zhihuStory.getImage()).centerCrop()
.listener(mRequestListener).override(width,heigh)
.listener(shotLoadListener).override(width,heigh)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(mParallaxScrimageView);
.into(mShot);
url = zhihuStory.getShareUrl();
isEmpty=TextUtils.isEmpty(zhihuStory.getBody());
mBody=zhihuStory.getBody();
Expand All @@ -300,8 +300,8 @@ public void showZhihuStory(ZhihuStory zhihuStory) {


private void expandImageAndFinish() {
if (mParallaxScrimageView.getOffset() != 0f) {
Animator expandImage = ObjectAnimator.ofFloat(mParallaxScrimageView, ParallaxScrimageView.OFFSET,
if (mShot.getOffset() != 0f) {
Animator expandImage = ObjectAnimator.ofFloat(mShot, ParallaxScrimageView.OFFSET,
0f);
expandImage.setDuration(80);
expandImage.setInterpolator(new AccelerateInterpolator());
Expand Down Expand Up @@ -336,7 +336,7 @@ public void onTransitionStart(Transition transition) {
.setDuration(100)
.setInterpolator(new AccelerateInterpolator());
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) {
mParallaxScrimageView.setElevation(1f);
mShot.setElevation(1f);
mToolbar.setElevation(0f);
}
mNest.animate()
Expand All @@ -357,14 +357,14 @@ public void onTransitionEnd(Transition transition) {
// valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
// @Override
// public void onAnimationUpdate(ValueAnimator valueAnimator) {
// mImageView.setOffset((Float) valueAnimator.getAnimatedValue() * 10);
// mShot.setOffset((Float) valueAnimator.getAnimatedValue() * 10);
// mNest.smoothScrollTo((Integer) valueAnimator.getAnimatedValue()/100,0);
// }
// });
// valueAnimator.start();
// enterAnimation();
// mImageView.setAlpha(0.5f);
// mImageView.animate().alpha(1f).setDuration(50).start();
// mShot.setAlpha(0.5f);
// mShot.animate().alpha(1f).setDuration(50).start();
}


Expand All @@ -374,7 +374,7 @@ public void onTransitionResume(Transition transition) {

}
};
private RequestListener mRequestListener = new RequestListener<String, GlideDrawable>() {
private RequestListener shotLoadListener = new RequestListener<String, GlideDrawable>() {
@Override
public boolean onResourceReady(GlideDrawable resource, String model,
Target<GlideDrawable> target, boolean isFromMemoryCache,
Expand Down Expand Up @@ -418,12 +418,12 @@ public void onGenerated(Palette palette) {
isDark, SCRIM_ADJUSTMENT);
// set a light status bar on M+
if (!isDark && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ViewUtils.setLightStatusBar(mParallaxScrimageView);
ViewUtils.setLightStatusBar(mShot);
}
}

if (statusBarColor != getWindow().getStatusBarColor()) {
mParallaxScrimageView.setScrimColor(statusBarColor);
mShot.setScrimColor(statusBarColor);
ValueAnimator statusBarColorAnim = ValueAnimator.ofArgb(
getWindow().getStatusBarColor(), statusBarColor);
statusBarColorAnim.addUpdateListener(new ValueAnimator
Expand Down Expand Up @@ -455,15 +455,15 @@ public void onGenerated(Palette palette) {
// for the scrim
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP){

mParallaxScrimageView.setForeground(ViewUtils.createRipple(palette, 0.3f, 0.6f,
mShot.setForeground(ViewUtils.createRipple(palette, 0.3f, 0.6f,
ContextCompat.getColor(ZhihuDescribeActivity.this, R.color.mid_grey),
true));
}
}
});

// TODO should keep the background if the image contains transparency?!
mParallaxScrimageView.setBackground(null);
mShot.setBackground(null);
return false;
}

Expand All @@ -477,7 +477,7 @@ public boolean onException(Exception e, String model, Target<GlideDrawable> targ
private void enterAnimation() {
float offSet = mToolbar.getHeight();
LinearInterpolator interpolator=new LinearInterpolator();
viewEnterAnimation(mParallaxScrimageView, offSet, interpolator);
viewEnterAnimation(mShot, offSet, interpolator);
viewEnterAnimationNest(mNest,0f,interpolator);

}
Expand Down
Loading

0 comments on commit a1f429f

Please sign in to comment.