Example usage for android.view.animation AnimationUtils loadAnimation

List of usage examples for android.view.animation AnimationUtils loadAnimation

Introduction

In this page you can find the example usage for android.view.animation AnimationUtils loadAnimation.

Prototype

public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException 

Source Link

Document

Loads an Animation object from a resource

Usage

From source file:com.cnm.cnmrc.popup.PopupBase1.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = (View) inflater.inflate(R.layout.popup1, container, false);

    animation = AnimationUtils.loadAnimation(context, R.anim.gtv_progressbar);
    mProgressBar = (ImageView) layout.findViewById(R.id.popup_progressbar);
    mProgressBar.setVisibility(View.INVISIBLE);

    mTitle = (TextView) layout.findViewById(R.id.popup_title);

    mLine1 = (TextView) layout.findViewById(R.id.popup_line_1);

    mYes = (Button) layout.findViewById(R.id.popup_yes);
    mYes.setText(getString(R.string.popup_yes));
    mYes.setOnClickListener(this);

    mNo = (Button) layout.findViewById(R.id.popup_no);
    mNo.setText(getString(R.string.popup_no));
    mNo.setOnClickListener(this);

    return layout;
}

From source file:com.cnm.cnmrc.popup.PopupBase2.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = (View) inflater.inflate(R.layout.popup2, container, false);

    animation = AnimationUtils.loadAnimation(context, R.anim.gtv_progressbar);
    mProgressBar = (ImageView) layout.findViewById(R.id.popup_progressbar);
    mProgressBar.setVisibility(View.INVISIBLE);

    mTitle = (TextView) layout.findViewById(R.id.popup_title);

    mLine1 = (TextView) layout.findViewById(R.id.popup_line_1);
    mLine2 = (TextView) layout.findViewById(R.id.popup_line_2);

    mYes = (Button) layout.findViewById(R.id.popup_yes);
    mYes.setText(getString(R.string.popup_yes));
    mYes.setOnClickListener(this);

    mNo = (Button) layout.findViewById(R.id.popup_no);
    mNo.setText(getString(R.string.popup_no));
    mNo.setOnClickListener(this);

    return layout;
}

From source file:com.cnm.cnmrc.popup.PopupBase22.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = (View) inflater.inflate(R.layout.popup22, container, false);

    animation = AnimationUtils.loadAnimation(context, R.anim.gtv_progressbar);
    mProgressBar = (ImageView) layout.findViewById(R.id.popup_progressbar);
    mProgressBar.setVisibility(View.INVISIBLE);

    mTitle = (TextView) layout.findViewById(R.id.popup_title);

    mLine1 = (TextView) layout.findViewById(R.id.popup_line_1);
    mLine2 = (TextView) layout.findViewById(R.id.popup_line_2);

    mYes = (Button) layout.findViewById(R.id.popup_yes);
    mYes.setText(getString(R.string.popup_yes));
    mYes.setOnClickListener(this);

    mNo = (Button) layout.findViewById(R.id.popup_no);
    mNo.setText(getString(R.string.popup_no));
    mNo.setOnClickListener(this);

    return layout;
}

From source file:com.cnm.cnmrc.popup.PopupBase3.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = (View) inflater.inflate(R.layout.popup3, container, false);

    animation = AnimationUtils.loadAnimation(context, R.anim.gtv_progressbar);
    mProgressBar = (ImageView) layout.findViewById(R.id.popup_progressbar);
    mProgressBar.setVisibility(View.INVISIBLE);

    mTitle = (TextView) layout.findViewById(R.id.popup_title);

    mLine1 = (TextView) layout.findViewById(R.id.popup_line_1);
    mLine2 = (TextView) layout.findViewById(R.id.popup_line_2);
    mLine3 = (TextView) layout.findViewById(R.id.popup_line_3);

    mYes = (Button) layout.findViewById(R.id.popup_yes);
    mYes.setText(getString(R.string.popup_yes));
    mYes.setOnClickListener(this);

    mNo = (Button) layout.findViewById(R.id.popup_no);
    mNo.setText(getString(R.string.popup_no));
    mNo.setOnClickListener(this);

    return layout;
}

From source file:id.zelory.tanipedia.activity.RegisterActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_register);
    Animation animation = AnimationUtils.loadAnimation(this, R.anim.simple_grow);
    findViewById(R.id.tanipedia).startAnimation(animation);
    findViewById(R.id.card).startAnimation(animation);
    Button daftar = (Button) findViewById(R.id.daftar);
    daftar.startAnimation(animation);/*w w  w  .jav  a2  s.c  o m*/
    daftar.setOnClickListener(this);
    editNama = (EditText) findViewById(R.id.nama);
    editEmail = (EditText) findViewById(R.id.email);
    editPass = (EditText) findViewById(R.id.password);
}

From source file:com.manning.androidhacks.hack006.MainActivity.java

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

    getListView().setLayoutAnimation(/* w  w w.j ava  2 s  .c o m*/
            new LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.list_animation), 0.5f));

    setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, Countries.COUNTRIES));
}

From source file:com.github.pennyfive.cinemafinlando.ui.UiUtils.java

public static View inflateDefaultLoadingView(Context context) {
    View view = View.inflate(context, R.layout.state_loading, null);
    view.findViewById(R.id.spinner)//from w  w w .  j av a  2 s. c om
            .startAnimation(AnimationUtils.loadAnimation(context, R.anim.spinner_spin_around));
    return view;
}

From source file:com.mercandalli.android.apps.files.admin.RequestFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_request, container, false);

    Animation animOpen = AnimationUtils.loadAnimation(getContext(), R.anim.circle_button_bottom_open);
    rootView.findViewById(R.id.circle).startAnimation(animOpen);

    rootView.findViewById(R.id.circle).setOnClickListener(new OnClickListener() {
        @Override//  w ww.  j av  a  2  s. co m
        public void onClick(View v) {
            new DialogRequest(getActivity(), new IPostExecuteListener() {
                @Override
                public void onPostExecute(JSONObject json, String body) {
                    if (json != null) {
                        ((EditText) rootView.findViewById(R.id.console))
                                .setText(((EditText) rootView.findViewById(R.id.console)).getText().toString()
                                        + "JSON : " + json + "\n\n");
                    } else {
                        ((EditText) rootView.findViewById(R.id.console))
                                .setText(((EditText) rootView.findViewById(R.id.console)).getText().toString()
                                        + "BODY : " + body + "\n\n");
                    }
                }
            });
        }
    });

    return rootView;
}

From source file:id.zelory.tanipedia.activity.LoginActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (PrefUtils.ambilString(this, "nama") != null) {
        Intent intent = new Intent(LoginActivity.this, CuacaActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);/* w  w w . j  ava2  s  . co m*/
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    Animation animation = AnimationUtils.loadAnimation(this, R.anim.simple_grow);
    findViewById(R.id.tanipedia).startAnimation(animation);
    findViewById(R.id.card).startAnimation(animation);
    Button login = (Button) findViewById(R.id.login);
    login.startAnimation(animation);
    login.setOnClickListener(this);
    TextView daftar = (TextView) findViewById(R.id.register);
    daftar.startAnimation(animation);
    daftar.setOnClickListener(this);
    editEmail = (EditText) findViewById(R.id.email);
    editPass = (EditText) findViewById(R.id.password);
}

From source file:models.newArrivalFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_newarrival, container, false);
    getActivity().setTitle("New Arrivals!");

    //animation when enter home page
    rootView.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.image_click));

    //download the URL's asynchronously (put the info in the teaInfo object)
    try {/*from ww w.  j  a v a 2 s  .  c om*/
        teaInfo = new GetTeaInfoTask().execute(new ApiConnector()).get();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
    //make the gridview and set its adapter
    GridView gridView = (GridView) rootView.findViewById(R.id.grid_view_new_arrival);
    GridViewCustomAdapter gvAdapter = new GridViewCustomAdapter(getActivity(), teaInfo.imageURLs,
            teaInfo.teaNames);
    gridView.setAdapter(gvAdapter);

    //onclick listener for gridview
    gridView.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {

            Bundle teaViewArgs = new Bundle();
            teaViewArgs.putString("teaName", teaInfo.teaNames.get(position));
            teaViewArgs.putString("teaImgUrl", teaInfo.imageURLs.get(position));
            teaViewArgs.putString("teaDesc", teaInfo.teaDescriptions.get(position));
            Fragment newFragment = new TeaViewFragment();
            newFragment.setArguments(teaViewArgs);

            if (newFragment != null) {
                flipCard(newFragment);
            }
        }

        private void flipCard(Fragment newFragment) {
            mShowingBack = true;
            FragmentManager fragmentManager = getFragmentManager();
            fragmentManager.beginTransaction()
                    .setCustomAnimations(R.anim.card_flip_right_in, R.anim.card_flip_right_out,
                            R.anim.card_flip_left_in, R.anim.card_flip_left_out)
                    .replace(R.id.frame_container, newFragment).addToBackStack(null).commit(); // create new fragment and allow user to go back to previous fragment          
        }

    });

    return rootView;
}