Don't stretch the image
* Even computer is not so easy to process that
This commit is contained in:
1 parent
746abe91ec
commit
4c8cb4eb97
9 files changed
+17
-153
No files matched your search
@@ -22,7 +22,6 @@ public final class Announcer {
|
||||
|
||||
Class<?> clazz;
|
||||
Bundle args;
|
||||
TransitionHelper tranHelper;
|
||||
SceneFragment requestFrom;
|
||||
int requestCode;
|
||||
|
||||
@@ -43,11 +42,6 @@ public final class Announcer {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Announcer setTranHelper(TransitionHelper tranHelper) {
|
||||
this.tranHelper = tranHelper;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Announcer setRequestCode(SceneFragment requestFrom, int requestCode) {
|
||||
this.requestFrom = requestFrom;
|
||||
this.requestCode = requestCode;
|
||||
|
||||
@@ -72,13 +72,9 @@ public class SceneFragment extends Fragment {
|
||||
}
|
||||
|
||||
public void finish() {
|
||||
finish(null);
|
||||
}
|
||||
|
||||
public void finish(TransitionHelper transitionHelper) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity instanceof StageActivity) {
|
||||
((StageActivity) activity).finishScene(this, transitionHelper);
|
||||
((StageActivity) activity).finishScene(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,6 @@ public abstract class StageActivity extends EhActivity {
|
||||
public void startScene(Announcer announcer, boolean horizontal) {
|
||||
Class<?> clazz = announcer.clazz;
|
||||
Bundle args = announcer.args;
|
||||
TransitionHelper tranHelper = announcer.tranHelper;
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
int launchMode = getSceneLaunchMode(clazz);
|
||||
|
||||
@@ -351,23 +350,20 @@ public abstract class StageActivity extends EhActivity {
|
||||
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||
// Animation
|
||||
if (currentScene != null) {
|
||||
if (tranHelper == null || !tranHelper.onTransition(
|
||||
this, transaction, currentScene, newScene)) {
|
||||
// Clear shared item
|
||||
currentScene.setSharedElementEnterTransition(null);
|
||||
currentScene.setSharedElementReturnTransition(null);
|
||||
currentScene.setEnterTransition(null);
|
||||
currentScene.setExitTransition(null);
|
||||
newScene.setSharedElementEnterTransition(null);
|
||||
newScene.setSharedElementReturnTransition(null);
|
||||
newScene.setEnterTransition(null);
|
||||
newScene.setExitTransition(null);
|
||||
// Set default animation
|
||||
if (horizontal) {
|
||||
transaction.setCustomAnimations(R.anim.scene_open_enter_horizontal, R.anim.scene_open_exit);
|
||||
} else {
|
||||
transaction.setCustomAnimations(R.anim.scene_open_enter, R.anim.scene_open_exit);
|
||||
}
|
||||
// Clear shared item
|
||||
currentScene.setSharedElementEnterTransition(null);
|
||||
currentScene.setSharedElementReturnTransition(null);
|
||||
currentScene.setEnterTransition(null);
|
||||
currentScene.setExitTransition(null);
|
||||
newScene.setSharedElementEnterTransition(null);
|
||||
newScene.setSharedElementReturnTransition(null);
|
||||
newScene.setEnterTransition(null);
|
||||
newScene.setExitTransition(null);
|
||||
// Set default animation
|
||||
if (horizontal) {
|
||||
transaction.setCustomAnimations(R.anim.scene_open_enter_horizontal, R.anim.scene_open_exit);
|
||||
} else {
|
||||
transaction.setCustomAnimations(R.anim.scene_open_enter, R.anim.scene_open_exit);
|
||||
}
|
||||
// Detach current scene
|
||||
if (!currentScene.isDetached()) {
|
||||
@@ -480,14 +476,10 @@ public abstract class StageActivity extends EhActivity {
|
||||
}
|
||||
|
||||
public void finishScene(SceneFragment scene) {
|
||||
finishScene(scene, null);
|
||||
finishScene(scene.getTag());
|
||||
}
|
||||
|
||||
public void finishScene(SceneFragment scene, TransitionHelper transitionHelper) {
|
||||
finishScene(scene.getTag(), transitionHelper);
|
||||
}
|
||||
|
||||
private void finishScene(String tag, TransitionHelper transitionHelper) {
|
||||
private void finishScene(String tag) {
|
||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
||||
|
||||
// Get scene
|
||||
@@ -519,8 +511,6 @@ public abstract class StageActivity extends EhActivity {
|
||||
|
||||
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||
if (next != null) {
|
||||
if (transitionHelper == null || !transitionHelper.onTransition(
|
||||
this, transaction, scene, next)) {
|
||||
// Clear shared item
|
||||
scene.setSharedElementEnterTransition(null);
|
||||
scene.setSharedElementReturnTransition(null);
|
||||
@@ -532,7 +522,6 @@ public abstract class StageActivity extends EhActivity {
|
||||
next.setExitTransition(null);
|
||||
// Do not show animate if it is not the first fragment
|
||||
transaction.setCustomAnimations(R.anim.scene_close_enter, R.anim.scene_close_exit);
|
||||
}
|
||||
// Attach fragment
|
||||
transaction.attach(next);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user