question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Animate and Screen rotation

See original GitHub issue

Здравствуйте! При повороте экрана приложение вылетает без каких либо сообщений в лог.

LoginView

public interface LoginView extends MvpView {
    void showLoginScreen();
    void showRegisterScreen();
}

LoginPresenter

@InjectViewState
public class LoginPresenter extends MvpPresenter<LoginView> {
    public LoginPresenter() { }

    public void changeScreen(int screen) {
        if (screen==0){
            getViewState().showLoginScreen();
        }else{
            getViewState().showRegisterScreen();
        }
    }
}

ActivityLogin

public class ActivityLogin extends MvpAppCompatActivity implements LoginView {
    @InjectPresenter
    LoginPresenter pLoginPresenter;

    @Bind(R.id.tvBottomMessage_login) TextView tvBottomMessage_login;
    @Bind(R.id.tvBottomMessage_register) TextView tvBottomMessage_register;
    @Bind(R.id.rlLogin) View myViewLog;
    @Bind(R.id.rlRegister) View myViewReg;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        ButterKnife.bind(this);

        tvBottomMessage_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                pLoginPresenter.changeScreen(1);
            }
        });

        tvBottomMessage_register.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                pLoginPresenter.changeScreen(0);
            }
        });
    }

    @Override
    public void showLoginScreen() {
        int finalRadius2 = Math.max(myViewLog.getWidth(), myViewLog.getHeight());
        Animator anim = ViewAnimationUtils.createCircularReveal(myViewLog, myViewLog.getWidth() / 2, myViewLog.getHeight(), 0, finalRadius2);
        myViewReg.setZ(0);
        myViewLog.setZ(1);
        anim.start();
    }

    @Override
    public void showRegisterScreen() {
        int finalRadius2 = Math.max(myViewReg.getWidth(), myViewReg.getHeight());
        Animator anim = ViewAnimationUtils.createCircularReveal(myViewReg, myViewReg.getWidth() / 2, myViewReg.getHeight(), 0, finalRadius2);
        myViewReg.setZ(1);
        myViewLog.setZ(0);
        anim.start();
    }
}

Не могу понять, как сохранить текущий вид, для его последующего отображения после поворота экрана.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
sennecocommented, Nov 1, 2016

There has two solution:

  1. Add id to EditText field(much simply)
  2. Pass text from EditText to presenter on onStop called. Then send command like getViewState().setText(text) and make special strategy for this command like DeleteAfterExecuteStrategy that delete this command in afterApply
1reaction
sennecocommented, Nov 1, 2016
    @Override
    public void showLoginScreen() {
        if (pLoginPresenter.isInRestoreState(this)) {
            myViewLog.setVisibility(View.VISIBLE);
            myViewReg.setVisibility(View.GONE);
            return;
        }
        int finalRadius2 = Math.max(myViewLog.getWidth(), myViewLog.getHeight());
        Animator anim = ViewAnimationUtils.createCircularReveal(myViewLog, myViewLog.getWidth() / 2, myViewLog.getHeight(), 0, finalRadius2);
        myViewReg.setZ(0);
        myViewLog.setZ(1);
        anim.start();
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I reset the stage rotation?! - Adobe Support Community
Press Ctrl + 0 (Win) or Cmd + 0 (Mac). Likes.
Read more >
CSS3 Rotate Animation - Stack Overflow
I have a rotating image using the same thing as you: .knoop1 img{ position:absolute; width:114px; height:114px; top:400px; margin:0 auto; ...
Read more >
Rotation in animations - Unity - Manual
Animation from external sources often contains rotational keyframeA frame that marks the start or end point of a transition in an animation. Frames...
Read more >
Rotate Phone on Lottiefiles. Free Lottie Animation
Ever needed to someone to rotate their phone to get a landscape experience? Do it with this.. Use on your web, react, flutter,...
Read more >
Android needs to improve the screen rotation animation. - Reddit
Or, speed up overall screen rotation. Even with animations disabled, you can be sitting there for a second or two just waiting.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found