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:de.geeksfactory.opacclient.frontend.AccountEditActivity.java

public void setProgress(boolean show, boolean animate) {
    ProgressBar progress = (ProgressBar) findViewById(R.id.progressBar);
    View content = findViewById(R.id.svAccount);

    if (show) {/*from  ww w  .  ja v  a  2  s . c  o  m*/
        if (animate) {
            progress.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
            content.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
        } else {
            progress.clearAnimation();
            content.clearAnimation();
        }
        progress.setVisibility(View.VISIBLE);
        content.setVisibility(View.GONE);
    } else {
        if (animate) {
            progress.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
            content.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
        } else {
            progress.clearAnimation();
            content.clearAnimation();
        }
        progress.setVisibility(View.GONE);
        content.setVisibility(View.VISIBLE);
    }
}

From source file:com.artur.softwareproject.Main.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.disconnect:

        if (!recording) {
            stopService(bluetoothServiceIntent);

            final ProgressDialog disconnectingDialog = new ProgressDialog(Main.this);

            disconnectingDialog.setMessage("Disconnecting...");
            disconnectingDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            disconnectingDialog.setCancelable(false);
            disconnectingDialog.show();/*w  w  w  .  ja  v  a  2s.  c o  m*/

            disconDialog = disconnectingDialog;

            final DisconnectHandlerClass disconnectHandler = new DisconnectHandlerClass(this);

            disconnectThread = new Thread(new Runnable() {
                @Override
                public void run() {
                    int stop = 0;

                    while (stop == 0) {
                        stop = getDisconnect();
                        sleep(1500);
                    }

                    disconnectHandler.sendEmptyMessage(0);
                }
            });

            disconnectThread.start();
        }

        return true;

    case R.id.record_data:

        Log.d(TAG, "Record button was Pressed. Gps status: " + gpsStatus);

        if (!recording && gpsStatus) {
            Intent resetIntent = new Intent();

            resetIntent.putExtra("reset", "");
            resetIntent.setAction("resetFilter");

            LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(resetIntent);

            item.setIcon(R.drawable.ic_action_stop);

            Toast.makeText(getApplicationContext(), "Start recording data", Toast.LENGTH_LONG).show();

            currentTime = System.currentTimeMillis();
            recordClock.setVisibility(View.VISIBLE);

            Animation a = AnimationUtils.loadAnimation(this, R.anim.textslide);
            TextView tv = (TextView) findViewById(R.id.recordClock);

            tv.startAnimation(a);

            recording = true;

            if (!rBound) {
                Intent intent = new Intent(this, RecordService.class);
                bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
            }
        } else if (recording) {
            stopRecording();
        }

        return true;

    case R.id.vr_menu:

        if (!recording) {
            Intent vrIntent = new Intent(Main.this, VRmenuMap.class);
            Main.this.startActivity(vrIntent);
        }

        return true;

    default:

        return super.onOptionsItemSelected(item);
    }
}

From source file:com.songcode.materialnotes.ui.NotesListActivity.java

private void initResources() {
    mContentResolver = this.getContentResolver();
    mBackgroundQueryHandler = new BackgroundQueryHandler(this.getContentResolver());
    mCurrentFolderId = Notes.ID_ROOT_FOLDER;
    //drawerlayout
    initDrawerLayout();/* w  w w. ja v  a  2 s.c om*/
    //toolbar
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);
    mActionBar = getSupportActionBar();
    mActionBar.setDisplayHomeAsUpEnabled(true);
    mActionBar.setTitle(getResources().getString(R.string.app_name));
    ActionBarDrawerToggle actionBarDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar,
            R.string.app_name, R.string.app_name);
    actionBarDrawerToggle.syncState();
    mDrawerLayout.setDrawerListener(actionBarDrawerToggle);

    //listview
    mNotesListView = (ListView) findViewById(R.id.notes_list);
    mNotesListView.addFooterView(LayoutInflater.from(this).inflate(R.layout.note_list_footer, null), null,
            false);
    mNotesListView.setOnItemClickListener(new OnListItemClickListener());
    mNotesListView.setOnItemLongClickListener(this);
    mNotesListAdapter = new NotesListAdapter(this);
    mNotesListView.setAdapter(mNotesListAdapter);
    //add new note btn
    mAddNewNote = (FloatingActionButton) findViewById(R.id.btn_new_note);
    mAddNewNote.setOnClickListener(this);
    mAddNewNote.setShowAnimation(AnimationUtils.loadAnimation(this, R.anim.show_from_bottom));
    mAddNewNote.setHideAnimation(AnimationUtils.loadAnimation(this, R.anim.hide_to_bottom));
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            mAddNewNote.show(true);
        }
    }, ANIM_DURATION);
    mNotesListView.setOnScrollListener(new AbsListView.OnScrollListener() {
        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            if (firstVisibleItem > mPreviousVisibleItem) {
                mAddNewNote.hide(true);
            } else if (firstVisibleItem < mPreviousVisibleItem) {
                mAddNewNote.show(true);
            }
            mPreviousVisibleItem = firstVisibleItem;
        }
    });

    mDispatch = false;
    mDispatchY = 0;
    mOriginY = 0;
    mTitleBar = (TextView) findViewById(R.id.tv_title_bar);
    mState = ListEditState.NOTE_LIST;
    updateDrawerWithState(mState);
    mModeCallBack = new ModeCallback();
}

From source file:cc.softwarefactory.lokki.android.fragments.MapViewFragment.java

private void showAddPlaceButtons() {
    Animation slideUp = AnimationUtils.loadAnimation(this.getActivity().getApplicationContext(),
            R.anim.add_place_buttons_show);
    getView().findViewById(R.id.add_place_buttons).startAnimation(slideUp);
    getView().findViewById(R.id.add_place_overlay).setVisibility(View.VISIBLE);
}

From source file:com.hamsik2046.password.view.SingleInputFormActivity.java

private void setupDetails() {
    mDetailsSwitcher.setInAnimation(AnimationUtils.loadAnimation(activity, R.anim.alpha_in));
    mDetailsSwitcher.setOutAnimation(AnimationUtils.loadAnimation(activity, R.anim.alpha_out));

    mDetailsSwitcher.setFactory(new ViewSwitcher.ViewFactory() {

        @Override//from   www .  ja  v  a 2  s .c  om
        public View makeView() {
            TextView view = (TextView) activity.getLayoutInflater().inflate(R.layout.view_details, null);
            if (view != null) {
                view.setTextColor(mDetailsTextColor);
            }
            return view;
        }
    });

    mDetailsSwitcher.setText("");
}

From source file:com.forrestguice.suntimeswidget.LocationConfigView.java

/**
 *
 * @param context a context used to access resources
 *//*from   ww  w.j a  v a  2 s.c  om*/
protected void initViews(Context context) {
    //Log.d("DEBUG", "LocationConfigView initViews");
    WidgetSettings.initDisplayStrings(context);

    flipper = (ViewFlipper) findViewById(R.id.view_flip);
    flipper.setInAnimation(AnimationUtils.loadAnimation(context, R.anim.fade_in));
    flipper.setOutAnimation(AnimationUtils.loadAnimation(context, R.anim.fade_out));

    flipper2 = (ViewFlipper) findViewById(R.id.view_flip2);
    flipper2.setInAnimation(AnimationUtils.loadAnimation(context, R.anim.fade_in));
    flipper2.setOutAnimation(AnimationUtils.loadAnimation(context, R.anim.fade_out));

    ArrayAdapter<WidgetSettings.LocationMode> spinner_locationModeAdapter = new LocationModeAdapter(myParent,
            WidgetSettings.LocationMode.values());
    spinner_locationModeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    spinner_locationMode = (Spinner) findViewById(R.id.appwidget_location_mode);
    spinner_locationMode.setAdapter(spinner_locationModeAdapter);
    spinner_locationMode.setOnItemSelectedListener(onLocationModeSelected);

    layout_locationName = (LinearLayout) findViewById(R.id.appwidget_location_name_layout);
    labl_locationName = (TextView) findViewById(R.id.appwidget_location_name_label);
    text_locationName = (EditText) findViewById(R.id.appwidget_location_name);

    String[] from = new String[] { "name" };
    int[] to = new int[] { android.R.id.text1 };

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        getFixAdapter = new SimpleCursorAdapter(myParent, R.layout.layout_listitem_locations, null, from, to,
                0);
    else
        getFixAdapter = new SimpleCursorAdapter(myParent, R.layout.layout_listitem_locations, null, from, to);

    getFixAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    spin_locationName = (Spinner) findViewById(R.id.appwidget_location_nameSelect);
    spin_locationName.setAdapter(getFixAdapter);
    spin_locationName.setOnItemSelectedListener(onCustomLocationSelected);

    labl_locationLat = (TextView) findViewById(R.id.appwidget_location_lat_label);
    text_locationLat = (EditText) findViewById(R.id.appwidget_location_lat);

    inputOverlay = findViewById(R.id.appwidget_location_latlon_overlay);
    inputOverlay.setVisibility(View.GONE);
    inputOverlay.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mode == LocationViewMode.MODE_CUSTOM_SELECT) {
                setMode(LocationViewMode.MODE_CUSTOM_EDIT);
            }
        }
    });

    labl_locationLon = (TextView) findViewById(R.id.appwidget_location_lon_label);
    text_locationLon = (EditText) findViewById(R.id.appwidget_location_lon);

    // custom mode: toggle edit mode
    button_edit = (ImageButton) findViewById(R.id.appwidget_location_edit);
    button_edit.setOnClickListener(onEditButtonClicked);

    // custom mode: save location
    button_save = (ImageButton) findViewById(R.id.appwidget_location_save);
    button_save.setOnClickListener(onSaveButtonClicked);

    // custom mode: get GPS fix
    progress_getfix = (ProgressBar) findViewById(R.id.appwidget_location_getfixprogress);
    progress_getfix.setVisibility(View.GONE);

    button_getfix = (ImageButton) findViewById(R.id.appwidget_location_getfix);
    getFixUI_editMode = new GetFixUI1(text_locationName, text_locationLat, text_locationLon, progress_getfix,
            button_getfix);

    button_getfix.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getFixHelper.getFix(0);
        }
    });

    // auto mode: get GPS fix
    progress_auto = (ProgressBar) findViewById(R.id.appwidget_location_auto_progress);
    progress_auto.setVisibility(View.GONE);

    button_auto = (ImageButton) findViewById(R.id.appwidget_location_auto);
    getFixUI_autoMode = new GetFixUI2(text_locationName, text_locationLat, text_locationLon, progress_auto,
            button_auto);
    button_auto.setOnClickListener(onAutoButtonClicked);

    getFixHelper = new GetFixHelper(myParent, getFixUI_editMode); // 0; getFixUI_editMode
    getFixHelper.addUI(getFixUI_autoMode); // 1; getFixUI_autoMode
    updateGPSButtonIcons();
}

From source file:com.samebits.beacon.locator.ui.activity.MainNavigationActivity.java

public void swappingFabAway() {
    fab.clearAnimation();
    Animation animation = AnimationUtils.loadAnimation(this, R.anim.pop_down);
    fab.startAnimation(animation);
}

From source file:com.hackvg.android.views.activities.MoviesActivity.java

private void showToolbar() {

    mToolbar.startAnimation(AnimationUtils.loadAnimation(this, R.anim.translate_up_off));
}

From source file:com.tdispatch.passenger.fragment.ControlCenterFragment.java

@Override
protected void onPostCreateView() {

    initBusyIndicators();/*  ww w . j a v  a  2 s. c  o m*/
    showAimPoint(true);

    // try to fix another GMaps v2 related issue
    // http://code.google.com/p/gmaps-api-issues/issues/detail?id=4639
    ViewGroup mapHost = (ViewGroup) mFragmentView.findViewById(R.id.map_container);
    mapHost.requestTransparentRegion(mapHost);

    updateAddresses();
    setUIControlsVisibility(true);

    // disable debug controls
    WebnetTools.setVisibility(mFragmentView, R.id.debug_container,
            TDApplication.isDebuggable() ? View.INVISIBLE : View.INVISIBLE);

    MapFragment mapFragment = (MapFragment) mFragmentManager.findFragmentById(R.id.map_fragment);
    if (mapFragment != null) {
        CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(15f);

        GoogleMap map = mapFragment.getMap();

        Location currentPosition = map.getMyLocation();
        if (currentPosition != null) {
            LatLng latLng = new LatLng(currentPosition.getLatitude(), currentPosition.getLongitude());
            cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 15f);
        }
        map.moveCamera(cameraUpdate);

        map.setOnCameraChangeListener(mMapCameraListener);
        map.setOnMapClickListener(mOnMapClickListener);
        map.setOnMyLocationChangeListener(mOnMyLocationChangeListener);
    } else {
        throw new IllegalStateException("Map is not ready");
    }

    WebnetTools.setVisibility(mFragmentView, R.id.price_box_container, View.INVISIBLE);

    int ids[] = { R.id.pickup_location, R.id.dropoff_location,

            R.id.button_mylocation, R.id.button_book, R.id.button_start_new_booking,

            R.id.left_menu_drag_handle, R.id.right_menu_drag_handle,

            R.id.button_set_as_pickup, R.id.button_set_as_dropoff, };
    for (int id : ids) {
        View v = mFragmentView.findViewById(id);
        if (v != null) {
            v.setOnClickListener(mOnClickListener);
        }
    }

    ids = new int[] { R.id.button_set_as_pickup, R.id.button_set_as_dropoff, R.id.button_mylocation };
    for (int id : ids) {
        View v = mFragmentView.findViewById(id);
        if (v != null) {
            v.setOnLongClickListener(mOnLongClickListener);
        }
    }

    // unveil map
    View mapCurtain = mFragmentView.findViewById(R.id.map_curtain);
    mapCurtain.startAnimation(
            AnimationUtils.loadAnimation(TDApplication.getAppContext(), R.anim.map_curtain_fade_out));
}

From source file:com.samebits.beacon.locator.ui.activity.MainNavigationActivity.java

public void swappingFabUp() {
    fab.clearAnimation();
    Animation animation = AnimationUtils.loadAnimation(this, R.anim.pop_up);
    fab.startAnimation(animation);
}