/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.android.persistence.migrations;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

/**
 * Main screen of the app. Displays a user name and allows the option to update the user name.
 */
public class UserActivity extends AppCompatActivity implements UserView {

    private TextView mUserName;

    private EditText mUserNameInput;

    private Button mUpdateButton;

    private UserPresenter mPresenter;

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

        mUserName = (TextView) findViewById(R.id.user_name);
        mUserNameInput = (EditText) findViewById(R.id.user_name_input);
        mUpdateButton = (Button) findViewById(R.id.update_user);

        mUpdateButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String userName = mUserNameInput.getText().toString();
                mPresenter.updateUserName(userName);
            }
        });

        // Creating the repository here for simplicity.
        // In an real app, this would be a singleton injected
        UserRepository userRepository = new UserRepository(new AppExecutors(),
                LocalUserDataSource.getInstance(getApplicationContext()));

        mPresenter = new UserPresenter(userRepository, this);
    }


    @Override
    protected void onStart() {
        super.onStart();
        mPresenter.start();
    }

    @Override
    protected void onStop() {
        super.onStop();
        mPresenter.stop();
    }

    @Override
    public void showUserName(String userName) {
        mUserName.setVisibility(View.VISIBLE);
        mUserName.setText(userName);
    }

    @Override
    public void hideUserName() {
        mUserName.setVisibility(View.INVISIBLE);
    }
}

@@ -1354,206 +1354,8 @@
 );%0A%0A
-        mUserName = (TextView) findViewById(R.id.user_name);%0A        mUserNameInput = (EditText) findViewById(R.id.user_name_input);%0A        mUpdateButton = (Button) findViewById(R.id.update_user);%0A
 %0A   
@@ -1623,16 +1623,183 @@
       %7D%0A
+        mUserName = findViewById(R.id.user_name);%0A        mUserNameInput = findViewById(R.id.user_name_input);%0A        mUpdateButton = findViewById(R.id.update_user);%0A
         

Remove redundant casts