add shared element transition for article images pager
This commit is contained in:
parent
abc9c4cbf6
commit
f46552126a
@ -10,6 +10,7 @@ import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.util.Log;
|
||||
@ -126,8 +127,10 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
|
||||
}
|
||||
});
|
||||
|
||||
if (position == 0)
|
||||
ViewCompat.setTransitionName(imgView, "TRANSITION:ARTICLE_IMAGES_PAGER");
|
||||
|
||||
registerForContextMenu(imgView);
|
||||
getSupportActionBar().hide();
|
||||
|
||||
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||
.cacheInMemory(true)
|
||||
@ -241,6 +244,7 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
|
||||
setContentView(R.layout.article_images_pager);
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().hide();
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
m_title = getIntent().getStringExtra("title");
|
||||
|
@ -14,7 +14,10 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.ActivityOptionsCompat;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.text.Html;
|
||||
import android.util.DisplayMetrics;
|
||||
@ -901,6 +904,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
.cacheOnDisk(true)
|
||||
.build();
|
||||
|
||||
ViewCompat.setTransitionName(holder.flavorImageView, "TRANSITION:ARTICLE_IMAGES_PAGER");
|
||||
|
||||
holder.flavorImageView.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@ -910,7 +915,14 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
intent.putExtra("title", article.title);
|
||||
intent.putExtra("content", article.content);
|
||||
|
||||
startActivityForResult(intent, 0);
|
||||
ActivityOptionsCompat options =
|
||||
ActivityOptionsCompat.makeSceneTransitionAnimation(m_activity,
|
||||
holder.flavorImageView, // The view which starts the transition
|
||||
"TRANSITION:ARTICLE_IMAGES_PAGER" // The transitionName of the view we’re transitioning to
|
||||
);
|
||||
ActivityCompat.startActivity(m_activity, intent, options.toBundle());
|
||||
|
||||
//startActivityForResult(intent, 0);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user