List of usage examples for android.view.animation AnimationUtils loadAnimation
public static Animation loadAnimation(Context context, @AnimRes int id) throws NotFoundException
From source file:com.github.shareme.gwsmaterialuikit.library.material.app.Dialog.java
@Override public void dismiss() { if (!isShowing() || mDismissPending) return;//from w ww . j a v a 2 s. c o m if (mOutAnimationId != 0) { Animation anim = AnimationUtils.loadAnimation(mContainer.getContext(), mOutAnimationId); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { mDismissPending = true; } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { mDismissPending = false; mCardView.setVisibility(View.GONE); mHandler.post(mDismissAction); } }); mCardView.startAnimation(anim); } else mHandler.post(mDismissAction); }
From source file:com.tdispatch.passenger.fragment.ControlCenterFragment.java
protected void hideAimPoint() { if (mAimPointVisible) { mAimPointVisible = false;//from w ww . ja v a2s . c om View v = mFragmentView.findViewById(R.id.map_aim_point_container); v.clearAnimation(); v.startAnimation(AnimationUtils.loadAnimation(mContext, R.anim.fade_out)); WebnetTools.setVisibility(mFragmentView, R.id.map_aim_point_minimal_container, View.VISIBLE); int[] ids = { R.id.button_set_as_pickup, R.id.button_set_as_dropoff }; for (int id : ids) { v = mFragmentView.findViewById(id); v.setClickable(false); v.setLongClickable(false); } } }
From source file:com.bernard.beaconportal.activities.activity.MessageList.java
@SuppressLint("ResourceAsColor") @Override/*w ww. j a va 2 s. c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_PROGRESS); if (!K9.isHideSpecialAccounts()) { createSpecialAccounts(); } Account[] accounts = Preferences.getPreferences(this).getAccounts(); Intent intent = getIntent(); // onNewIntent(intent); // see if we should show the welcome message if (ACTION_IMPORT_SETTINGS.equals(intent.getAction())) { mAccounts.onImport(); } else if (accounts.length < 1) { WelcomeMessage.showWelcomeMessage(this); finish(); return; } if (UpgradeDatabases.actionUpgradeDatabases(this, intent)) { finish(); return; } Log.d(TAG, "onCreate()"); String packageName = "com.bernard.beaconportal.activities"; counterss = "0"; int versionNumber = 0; try { PackageInfo pi = getApplicationContext().getPackageManager().getPackageInfo(packageName, PackageManager.GET_META_DATA); versionNumber = pi.versionCode; String versionName = pi.versionName; Log.d(TAG, "K-9 is installed - " + versionNumber + " " + versionName); } catch (NameNotFoundException e) { Log.d(TAG, "K-9 not found"); } if (versionNumber <= 1) { // Register a listener for broadcasts (needed for the older versions // of k9) Log.d(TAG, "Initialising BroadcastReceiver for old K-9 version"); receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "receiver.onReceive()"); doRefresh(); } }; filter = new IntentFilter(); filter.addAction("com.bernard.beaconportal.activities.intent.action.EMAIL_RECEIVED"); filter.addAction("com.bernard.beaconportal.activities.intent.action.EMAIL_DELETED"); filter.addDataScheme("email"); registerReceiver(receiver, filter); } else { // Register our own content observer, rather than using // addWatchContentUris() // since DashClock might not have permission to access the database Log.d(TAG, "Initialising ContentObserver for new K-9 version"); contentObserver = new ContentObserver(null) { @Override public void onChange(boolean selfChange) { Log.d(TAG, "contentResolver.onChange()"); doRefresh(); } }; getContentResolver().registerContentObserver(Uri.parse(k9UnreadUri), true, contentObserver); } doRefresh(); if (UpgradeDatabases.actionUpgradeDatabases(this, getIntent())) { finish(); return; } if (useSplitView()) { setContentView(R.layout.split_drawer_main); } else { setContentView(R.layout.drawermain1); mViewSwitcher = (ViewSwitcher) findViewById(R.id.container); mViewSwitcher.setFirstInAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_left)); mViewSwitcher.setFirstOutAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_right)); mViewSwitcher.setSecondInAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_right)); mViewSwitcher.setSecondOutAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_left)); mViewSwitcher.setOnSwitchCompleteListener(this); } mergeadapter = new MergeAdapter(); LayoutInflater inflater = getLayoutInflater(); accounts_view = inflater.inflate(R.layout.accounts_list, null); portals_view = inflater.inflate(R.layout.portal_list, null); folders_view = inflater.inflate(R.layout.folders_list, null); header_folders = inflater.inflate(R.layout.header_folders, null); header_drawer = inflater.inflate(R.layout.header_drawer, null); initializeActionBar(); mListView = (ListView) findViewById(android.R.id.list); // mListView.addHeaderView(header_folders, null, false); mListView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); mListView.setLongClickable(true); mListView.setFastScrollEnabled(true); mListView.setScrollingCacheEnabled(false); // mListView.setOnItemClickListener(new OnItemClickListener() { // public void onItemClick(AdapterView<?> parent, View view, // int position, long id) { // // onOpenFolder(((FolderInfoHolder) mAdapter.getItem(position)).name); // // Log.d("Folder Click Listener", "clicked"); // // } // }); setResult(RESULT_CANCELED); // mDrawerList_Inbox = (ListView) findViewById(R.id.listview_inbox); // // View header_inbox = (View) inflater // .inflate(R.layout.header_inbox, null); // // mDrawerList_Inbox.setOnItemClickListener(this); // // mDrawerList_Inbox.setItemsCanFocus(false); // // mDrawerList_Inbox.setLongClickable(true); mListView.setSaveEnabled(true); mInflater = getLayoutInflater(); onNewIntent(getIntent()); context = this; SharedPreferences sharedpre = getSharedPreferences("show_view", Context.MODE_PRIVATE); Show_View = sharedpre.getString("show_view", ""); SharedPreferences Today_Homework = getApplicationContext().getSharedPreferences("due_today", Context.MODE_PRIVATE); SharedPreferences counts = getSharedPreferences("due_today", Context.MODE_PRIVATE); if (counts.contains("homeworkdue")) { counterss = counts.getString("homeworkdue", null); } else { counterss = null; } title_Inbox = new String[] { "Inbox" }; icon_Inbox = new int[] { R.drawable.ic_action_email }; count_Inbox = new String[] { K9counts }; if (Show_View.equals("Homework Due")) { title = new String[] { "Homework Due", "Schedule", "Resources", "Options", "Logout" }; icon = new int[] { R.drawable.ic_action_duehomework, R.drawable.ic_action_go_to_today, R.drawable.ic_action_resources, R.drawable.ic_action_settings, R.drawable.ic_action_logout }; if (counterss == null && counterss.isEmpty()) { count = new String[] { "", "", "", "", "" }; } else { count = new String[] { counterss, "", "", "", "" }; } } else { if (counterss == null && counterss.isEmpty()) { count = new String[] { "", "", "", "", "" }; } else { count = new String[] { "", counterss, "", "", "" }; } title = new String[] { "Schedule", "Homework Due", "Resources", "Options", "Logout" }; icon = new int[] { R.drawable.ic_action_go_to_today, R.drawable.ic_action_duehomework, R.drawable.ic_action_resources, R.drawable.ic_action_settings, R.drawable.ic_action_logout }; } mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLinear = (LinearLayout) findViewById(R.id.left_drawer); // mDrawerList_Inbox = (ListView) findViewById(R.id.listview_inbox); // mDrawerList = (ListView) findViewById(R.id.listview_drawer); // mDrawer_Scroll = (ScrollView) // findViewById(R.id.left_drawer_scrollview); // mDrawerList.addHeaderView(header_drawer, null, false); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // mMenuAdapter_Inbox = new MenuListAdapter(MessageList.this, // title_Inbox, // icon_Inbox, count_Inbox); // mDrawerList_Inbox.setAdapter(mMenuAdapter_Inbox); // mDrawerList_Inbox // .setOnItemClickListener(new DrawerItemClickListener_Inbox()); mMenuAdapter = new MenuListAdapter(MessageList.this, title, icon, count); // mDrawerList.setAdapter(mMenuAdapter); // mergeadapter.addView(header_drawer); // // mergeadapter.addAdapter(mMenuAdapter); // // mergeadapter.addadapter(AccountsAdapter); // // mDrawerList.setAdapter(mergeadapter); getListView().setOnItemClickListener(new DrawerItemClickListener()); // mDrawerList_Inbox.setOnItemClickListener(new // DrawerItemClickListener()); // // if (savedInstanceState == null) { // selectItem_Inbox(1); // } SharedPreferences sharedpref = getSharedPreferences("actionbar_color", Context.MODE_PRIVATE); final int splitBarId = getResources().getIdentifier("split_action_bar", "id", "android"); final View splitActionBar = findViewById(splitBarId); if (!sharedpref.contains("actionbar_color")) { getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4285f4"))); if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4285f4"))); } } else { actionbar_colors = sharedpref.getString("actionbar_color", null); getActionBar().setBackgroundDrawable( new ColorDrawable(Color.parseColor(actionbar_colors))); if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(actionbar_colors))); } } android.app.ActionBar bar = getActionBar(); bar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); // Enable gesture detection for MessageLists // setupGestureDetector(this); if (!decodeExtras(getIntent())) { return; } findFragments(); initializeDisplayMode(savedInstanceState); initializeLayout(); initializeFragments(); displayViews(); // registerForContextMenu(mDrawerList_Inbox); registerForContextMenu(mListView); getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { @Override public void onDrawerClosed(View view) { // TODO Auto-generated method stub super.onDrawerClosed(view); } @Override public void onDrawerOpened(View drawerView) { // TODO Auto-generated method stub super.onDrawerOpened(drawerView); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); }
From source file:com.tdispatch.passenger.fragment.ControlCenterFragment.java
protected void showAimPoint(Boolean animate) { if (mAimPointVisible == false) { mAimPointVisible = true;//from w w w. j av a 2s . c o m View v = mFragmentView.findViewById(R.id.map_aim_point_container); v.clearAnimation(); v.startAnimation( AnimationUtils.loadAnimation(mContext, (animate) ? R.anim.fade_in : R.anim.fade_in_instant)); WebnetTools.setVisibility(mFragmentView, R.id.map_aim_point_minimal_container, View.INVISIBLE); int[] ids = { R.id.button_set_as_pickup, R.id.button_set_as_dropoff }; for (int id : ids) { v = mFragmentView.findViewById(id); v.setClickable(true); v.setLongClickable(true); } } }
From source file:com.google.android.apps.santatracker.launch.StartupActivity.java
private void animateSanta() { boolean play = false; if (mWavingAnim == null) { mWavingAnim = AnimationUtils.loadAnimation(this, R.anim.santa_wave); play = true;/*from ww w . jav a2 s. c o m*/ } else if (mWavingAnim.hasEnded()) { play = true; } if (play) { playSoundOnce(R.raw.ho_ho_ho); mWavingSantaArm.startAnimation(mWavingAnim); } }
From source file:github.popeen.dsub.activity.SubsonicActivity.java
public void removeCurrent() { // Don't try to remove current if there is no backstack to remove from if (backStack.isEmpty()) { return;//from w w w .ja va 2 s . c om } if (currentFragment != null) { currentFragment.setPrimaryFragment(false); } SubsonicFragment oldFragment = currentFragment; currentFragment = backStack.remove(backStack.size() - 1); currentFragment.setPrimaryFragment(true, false); supportInvalidateOptionsMenu(); if (secondaryContainer == null || currentFragment.isAlwaysFullscreen() || oldFragment.isAlwaysStartFullscreen()) { FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left); trans.remove(oldFragment); trans.show(currentFragment); trans.commit(); } else { FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); // Remove old right fragment trans.setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left); trans.remove(oldFragment); // Only switch places if there is a backstack, otherwise primary container is correct if (backStack.size() > 0 && !backStack.get(backStack.size() - 1).isAlwaysFullscreen() && !currentFragment.isAlwaysStartFullscreen()) { trans.setCustomAnimations(0, 0, 0, 0); // Add current left fragment to right side trans.remove(currentFragment); // Make sure remove is finished before adding trans.commit(); getSupportFragmentManager().executePendingTransactions(); trans = getSupportFragmentManager().beginTransaction(); // trans.setCustomAnimations(R.anim.enter_from_left, R.anim.exit_to_right, R.anim.enter_from_right, R.anim.exit_to_left); trans.add(R.id.fragment_second_container, currentFragment, currentFragment.getSupportTag() + ""); SubsonicFragment newLeftFragment = backStack.get(backStack.size() - 1); newLeftFragment.setSecondaryFragment(true); trans.show(newLeftFragment); } else { secondaryContainer.startAnimation(AnimationUtils.loadAnimation(this, R.anim.exit_to_right)); secondaryContainer.setVisibility(View.GONE); currentFragment.setIsOnlyVisible(true); } trans.commit(); } recreateSpinner(); }
From source file:com.app.blockydemo.ui.adapter.BrickAdapter.java
private void animateSelectedBricks() { if (!animatedBricks.isEmpty()) { for (final Brick animationBrick : animatedBricks) { Animation animation = AnimationUtils.loadAnimation(context, R.anim.blink); animation.setAnimationListener(new AnimationListener() { @Override// ww w . ja v a 2s .co m public void onAnimationStart(Animation animation) { animationBrick.setAnimationState(true); } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { animationBrick.setAnimationState(false); } }); int position = animatedBricks.indexOf(animationBrick); animationBrick.setAnimationState(true); View view = animationBrick.getView(context, position, this); if (view.hasWindowFocus()) { view.startAnimation(animation); } } } animatedBricks.clear(); }
From source file:com.mitre.holdshort.MainActivity.java
public void displaySummaryInfo() { rwyMgr.updateHoldShortStatus();//from w w w . j a v a 2s . c om if (summaryIndex + 1 > rwyMgr.getRwyHoldShortSize()) { summaryIndex = 0; } if (rwyMgr.getRwyHoldShortSize() > 0) { Animation fadeIn = AnimationUtils.loadAnimation(this, android.R.anim.fade_in); fadeIn.setDuration(1000); summaryInfo.setAnimation(fadeIn); summary_index.setText((summaryIndex + 1) + " of " + rwyMgr.getRwyHoldShortSize()); summary_thumb.setText(rwyMgr.rwyHoldShort.get(summaryIndex).getRunwayText()); summaryInfo.setVisibility(RelativeLayout.VISIBLE); } else { summaryInfo.setVisibility(RelativeLayout.INVISIBLE); } }
From source file:com.synox.android.ui.activity.FileActivity.java
/** * Retrieves user quota if available//from w ww . ja v a 2 s. c om * * @param navigationDrawerLayout */ private void getUserQuota(final NavigationView navigationDrawerLayout, final String user) { // set user space information Thread t = new Thread(new Runnable() { public void run() { try { OwnCloudAccount ocAccount = new OwnCloudAccount(mAccount, MainApp.getAppContext()); OwnCloudClient client = OwnCloudClientManagerFactory.getDefaultSingleton() .getClientFor(ocAccount, MainApp.getAppContext()); GetMethod get = null; final ProgressBar quotaProgress = (ProgressBar) navigationDrawerLayout .findViewById(R.id.usage_progress); final LinearLayout quotaInformation = (LinearLayout) navigationDrawerLayout .findViewById(R.id.quotaInformation); try { get = new GetMethod( client.getBaseUri() + "/ocs/v1.php/cloud/users/" + user + "?format=json"); int status = client.executeMethod(get); if (status == HttpStatus.SC_OK) { JSONObject json = new JSONObject(get.getResponseBodyAsString()); JSONObject ocs = json.getJSONObject("ocs"); JSONObject meta = ocs.getJSONObject("meta"); JSONObject data = ocs.getJSONObject("data"); JSONObject quota = data.getJSONObject("quota"); if (meta.getString("statuscode").equals("100")) { try { final long used = Long.parseLong(quota.getString("used")); final long total = Long.parseLong(quota.getString("total")); final int relative = (int) Math.ceil(quota.getDouble("relative")); runOnUiThread(new Runnable() { @Override public void run() { if (quotaProgress != null) { if (quotaInformation.getVisibility() == View.INVISIBLE) { Animation animation = AnimationUtils.loadAnimation( navigationDrawerLayout.getContext(), R.anim.abc_slide_in_bottom); quotaInformation.setAnimation(animation); } quotaInformation.setVisibility(View.VISIBLE); quotaProgress.setProgress(relative); } else { quotaInformation.setVisibility(View.INVISIBLE); } TextView usageText = (TextView) navigationDrawerLayout .findViewById(R.id.usage_text); usageText.setText(String.format(getString(R.string.usage_text), DisplayUtils.bytesToHumanReadable(used), DisplayUtils.bytesToHumanReadable(total))); } }); } catch (NumberFormatException nfe) { Log_OC.e(this.getClass().getName(), "Error retrieving quota usage from server."); } } } else { client.exhaustResponse(get.getResponseBodyAsStream()); } } catch (final Exception e) { runOnUiThread(new Runnable() { @Override public void run() { quotaInformation.setVisibility(View.INVISIBLE); e.printStackTrace(); } }); } finally { if (get != null) { get.releaseConnection(); } } } catch (com.synox.android.lib.common.accounts.AccountUtils.AccountNotFoundException e) { Log_OC.e(this.getClass().getName(), e.getMessage()); } catch (AuthenticatorException | OperationCanceledException | IOException e) { Log_OC.e(this.getClass().getName(), e.getMessage()); } } }); t.start(); }
From source file:com.saulcintero.moveon.fragments.Main.java
private void defineWidgets(LinearLayout fragmentView) { chrono = (Chronometer) fragmentView.findViewById(R.id.chrono); display1_icon = (ImageView) fragmentView.findViewById(R.id.practice_display1_icon); display1_text1 = (TextView) fragmentView.findViewById(R.id.practice_display1_item_one); display1_text2 = (TextView) fragmentView.findViewById(R.id.practice_display1_item_two); display1_label = (TextView) fragmentView.findViewById(R.id.practice_display1_item_three); display2_icon = (ImageView) fragmentView.findViewById(R.id.practice_display2_icon); display2_text1 = (TextView) fragmentView.findViewById(R.id.practice_display2_item_one); display2_text2 = (TextView) fragmentView.findViewById(R.id.practice_display2_item_two); display2_label = (TextView) fragmentView.findViewById(R.id.practice_display2_item_three); display3_icon = (ImageView) fragmentView.findViewById(R.id.practice_display3_icon); display3_text1 = (TextView) fragmentView.findViewById(R.id.practice_display3_item_one); display3_text2 = (TextView) fragmentView.findViewById(R.id.practice_display3_item_two); display3_label = (TextView) fragmentView.findViewById(R.id.practice_display3_item_three); display4_icon = (ImageView) fragmentView.findViewById(R.id.practice_display4_icon); display4_text1 = (TextView) fragmentView.findViewById(R.id.practice_display4_item_one); display4_text2 = (TextView) fragmentView.findViewById(R.id.practice_display4_item_two); display4_label = (TextView) fragmentView.findViewById(R.id.practice_display4_item_three); display5_label = (TextView) fragmentView.findViewById(R.id.practice_display5_item_one); display5_text1 = (TextView) fragmentView.findViewById(R.id.practice_display5_item_two); display5_image = (ImageView) fragmentView.findViewById(R.id.practice_display5_item_three); display6_text1 = (TextView) fragmentView.findViewById(R.id.practice_display6_item_one); display6_image = (ImageView) fragmentView.findViewById(R.id.practice_display6_item_three); start_button = (ImageView) fragmentView.findViewById(R.id.practice_start_image); pauseresume_button = (ImageView) fragmentView.findViewById(R.id.practice_pauseresume_image); stop_button = (ImageView) fragmentView.findViewById(R.id.practice_stop_image); start_text = (TextView) fragmentView.findViewById(R.id.practice_start_item); pauseresume_text = (TextView) fragmentView.findViewById(R.id.practice_pauseresume_item); stop_text = (TextView) fragmentView.findViewById(R.id.practice_stop_item); coach_button = (ImageView) fragmentView.findViewById(R.id.main_action_bar_item_one); follow_button = (ImageView) fragmentView.findViewById(R.id.practice_mapview_followlocation); locked_button = (ImageView) fragmentView.findViewById(R.id.main_action_bar_item_two); full_mapview = (ImageButton) fragmentView.findViewById(R.id.practice_mapview_fullscreen); animationFadeIn = AnimationUtils.loadAnimation(mContext, R.anim.fadein_slow); animationFadeOut = AnimationUtils.loadAnimation(mContext, R.anim.fadeout_slow); animationFadeIn.setAnimationListener(animationInListener); animationFadeOut.setAnimationListener(animationOutListener); loadDisplays();/* www .ja va 2 s . c o m*/ }