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.appdupe.flamer.LoginUsingFacebook.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity);// w w w. ja va 2 s. c om /** * This code is required only once, to get the KeyHash, which will be * used in facebook while signing the app. The KeyHash will be displayed * in LogCat. Once the Keyhash has been generated, use it for signing * app, and then comment the code. Replace the package name with your * package name. */ try { PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures) { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(signature.toByteArray()); Log.i("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT)); } } catch (NameNotFoundException e) { Log.e(TAG, "Exception(NameNotFoundException) : " + e); } catch (NoSuchAlgorithmException e) { Log.e(TAG, "Exception(NoSuchAlgorithmException) : " + e); } res = getResources(); initdata(); context = getApplicationContext(); imagelist = new ArrayList<GellaryData>(); mAdapterForGalery = new HomeAdapter(this, imagelist); galleryforsuprvisore.setAdapter(mAdapterForGalery); getTemplateFromResource(); galleryforsuprvisore.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { // logDebug("onItemSelected "); // try // { System.out.println("Item Selected Position=======>>>" + pos); System.out.println("Item Selected Position=======>>> count" + count); for (int i = 0; i < count; i++) { page_text[i].setTextColor(android.graphics.Color.GRAY); } page_text[pos].setTextColor(android.graphics.Color.BLUE); // } catch (Exception e) // //{ // logError("onItemSelected Exception "+e); // } } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS); Session session = Session.getActiveSession(); // logDebug("onCreate session "+session); if (session == null) { // logDebug("onCreate savedInstanceState "+savedInstanceState); if (savedInstanceState != null) { session = Session.restoreSession(this, null, statusCallback, savedInstanceState); // logDebug("onCreate savedInstanceState restore session "+session); } if (session == null) { session = new Session(this); // logDebug("onCreate savedInstanceState create session "+session); } Session.setActiveSession(session); logDebug("onCreate savedInstanceState state session " + session.getState()); if (session.getState().equals(SessionState.CREATED_TOKEN_LOADED)) { // session.openForRead(new // Session.OpenRequest(this).setPermissions(Arrays.asList("user_birthday", // "email","user_relationships","user_photos")).setCallback(statusCallback)); } } animeBottomTOUp = AnimationUtils.loadAnimation(this, R.anim.helpscreen_in_to_out); gellarybottom = AnimationUtils.loadAnimation(this, R.anim.helpscreen_in_to_out); gellarybottom.setFillAfter(true); gellarybottom.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { } }); updateView(); cd = new ConnectionDetector(getApplicationContext()); if (cd.isConnectingToInternet()) { if (checkPlayServices()) { regid = getRegistrationId(this); if (regid.isEmpty()) { registerInBackground(); } else { logDebug("reg id saved : " + regid); } } else { return; } // LocationManager locationManager = (LocationManager) // getSystemService(LOCATION_SERVICE); // if // (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) // { // newLocationFinder = new LocationFinder(); // newLocationFinder.getLocation(LoginUsingFacebook.this, // mLocationResult); // } else { // showGPSDisabledAlertToUser(); // // } } else { AlertDialogManager.internetConnetionErrorAlertDialog(LoginUsingFacebook.this); } }
From source file:com.dabay6.libraries.androidshared.ui.fragments.LoadingFragment.java
private void setContentShown(final boolean shown, final boolean animate) { final Context context = getActivity(); Animation animation;/* www .ja va 2 s .co m*/ afterViews(); if (isContentShown == shown) { return; } isContentShown = shown; if (shown) { if (animate) { animation = AnimationUtils.loadAnimation(context, android.R.anim.fade_out); if (animation != null) { loadingContainer.startAnimation(animation); } animation = AnimationUtils.loadAnimation(context, android.R.anim.fade_in); if (animation != null) { contentContainer.startAnimation(animation); } } else { loadingContainer.clearAnimation(); contentContainer.clearAnimation(); } ViewUtils.setGone(loadingContainer, true); ViewUtils.setGone(contentContainer, false); } else { if (animate) { animation = AnimationUtils.loadAnimation(context, android.R.anim.fade_in); if (animation != null) { loadingContainer.startAnimation(animation); } animation = AnimationUtils.loadAnimation(context, android.R.anim.fade_out); if (animation != null) { contentContainer.startAnimation(animation); } } else { loadingContainer.clearAnimation(); contentContainer.clearAnimation(); } ViewUtils.setGone(loadingContainer, false); ViewUtils.setGone(contentContainer, true); } }
From source file:com.ferid.app.classroom.statistics.StatisticalListActivity.java
/** * Show graph layout with its full content *//*from w w w .jav a2s. c o m*/ private void showGraph() { if (graphLayout.getVisibility() != View.VISIBLE) { Animation animShow = AnimationUtils.loadAnimation(context, R.anim.push_from_bottom); graphLayout.startAnimation(animShow); graphLayout.setVisibility(View.VISIBLE); setStatusBarColour(); } }
From source file:com.myrippleapps.mynotes.app.FragmentNotes.java
@Override public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle savedInstanceState) { view = (FrameLayout) layoutInflater.inflate(R.layout.fragment_notes, viewGroup, false); if (getArguments() != null) { String mParam1 = getArguments().getString(ARG_PARAM1); String mParam2 = getArguments().getString(ARG_PARAM2); }//from ww w. ja va2s. c o m dataSource = new NoteDataSource(getActivity()); dataSource.open(); String sharedPreferencesNotes = "mPreferences"; SharedPreferences sharedPreferences = getActivity().getSharedPreferences(sharedPreferencesNotes, 0); String notesLayoutKey = "notesLayoutKey"; String notes_layout_to_bind = sharedPreferences.getString(notesLayoutKey, ""); String SINGLE_COLUMN_VIEW = "single"; String MULTI_COLUMN_VIEW = "mutli"; if (notes_layout_to_bind.equals("") || notes_layout_to_bind.equals(SINGLE_COLUMN_VIEW)) { layoutManager = new LinearLayoutManager(getActivity()); } else if (notes_layout_to_bind.equals(MULTI_COLUMN_VIEW)) { int SPAN_COUNT = 2; int ORIENTATION = 1; layoutManager = new StaggeredGridLayoutManager(SPAN_COUNT, ORIENTATION); } RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.noteList); no_note_layout = (LinearLayout) view.findViewById(R.id.no_note_layout); FragmentManager fragmentManager = getActivity().getSupportFragmentManager(); adapterNote = new AdapterNote(getActivity(), dataSource.getAllNotes(), recyclerView, fragmentManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.setLayoutManager(layoutManager); recyclerView.setAdapter(adapterNote); fab = (FloatingActionButton) view.findViewById(R.id.fab); fab.attachToRecyclerView(recyclerView); Animation animationGrow = AnimationUtils.loadAnimation(getActivity(), R.anim.simple_grow); fab.setOnClickListener(this); isNoteEmpty(); fab.startAnimation(animationGrow); fab.attachToRecyclerView(recyclerView); sharedPreferences = getActivity().getSharedPreferences(sharedPreferencesNotes, 0); if (!sharedPreferences.getBoolean("isPurchased", false)) { FragmentAdsListener.track(view.findViewById(R.id.adView), recyclerView, savedInstanceState); } return view; }
From source file:com.filemanager.free.adapters.Recycleradapter.java
@Override public void onBindViewHolder(RecyclerView.ViewHolder vholder, @SuppressLint("RecyclerView") final int p) { final Recycleradapter.ViewHolder holder = ((Recycleradapter.ViewHolder) vholder); if (main.IS_LIST) { if (p == getItemCount() - 1) { holder.rl.setMinimumHeight(rowHeight); if (items.size() == (main.GO_BACK_ITEM ? 1 : 0)) holder.txtTitle.setText(R.string.nofiles); else { holder.txtTitle.setText(R.string.footer); }//from w w w . java 2s . c o m return; } } if (holder.imageView == null) return; if (!this.stoppedAnimation && !myanim.get(p)) { animate(holder); myanim.put(p, true); } final Layoutelements rowItem = items.get(p); if (main.IS_LIST) { holder.rl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { main.onListItemClicked(p, v); } }); holder.rl.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View p1) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } return true; } }); filetype = -1; if (Icons.isPicture((rowItem.getDesc().toLowerCase()))) filetype = 0; else if (Icons.isApk((rowItem.getDesc()))) filetype = 1; else if (Icons.isVideo(rowItem.getDesc())) filetype = 2; holder.txtTitle.setText(rowItem.getTitle()); holder.imageView.setImageDrawable(rowItem.getImageId()); holder.ext.setText(""); if (holder.about != null) { if (main.theme1 == 0) holder.about.setColorFilter(grey_color); showPopup(holder.about, rowItem); } holder.imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } else main.goBack(); } }); holder.viewmageV.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } else main.goBack(); } }); holder.apk.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } else main.goBack(); } }); holder.imageView.setVisibility(View.VISIBLE); holder.viewmageV.setVisibility(View.INVISIBLE); if (filetype == 0) { if (main.SHOW_THUMBS) { if (main.CIRCULAR_IMAGES) { holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.GONE); holder.viewmageV.setVisibility(View.VISIBLE); holder.viewmageV.setImageDrawable(main.DARK_IMAGE); main.ic.cancelLoad(holder.viewmageV); main.ic.loadDrawable(holder.viewmageV, (rowItem.getDesc()), null); } else { holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.VISIBLE); holder.apk.setImageDrawable(main.DARK_IMAGE); main.ic.cancelLoad(holder.apk); main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null); } } } else if (filetype == 1) { if (main.SHOW_THUMBS) { holder.viewmageV.setVisibility(View.GONE); holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.VISIBLE); holder.apk.setImageDrawable(main.apk); main.ic.cancelLoad(holder.apk); main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null); } } else if (filetype == 2) { if (main.SHOW_THUMBS) { if (main.CIRCULAR_IMAGES) { holder.imageView.setVisibility(View.GONE); holder.viewmageV.setVisibility(View.VISIBLE); holder.viewmageV.setImageDrawable(main.DARK_VIDEO); main.ic.cancelLoad(holder.viewmageV); main.ic.loadDrawable(holder.viewmageV, (rowItem.getDesc()), null); } else { holder.imageView.setVisibility(View.GONE); holder.apk.setVisibility(View.VISIBLE); holder.apk.setImageDrawable(main.DARK_VIDEO); main.ic.cancelLoad(holder.apk); main.ic.loadDrawable(holder.apk, (rowItem.getDesc()), null); } } } else { holder.viewmageV.setVisibility(View.GONE); holder.apk.setVisibility(View.GONE); holder.imageView.setVisibility(View.VISIBLE); } Boolean checked = myChecked.get(p); if (checked != null) { if (main.theme1 == 0) { holder.rl.setBackgroundResource(R.drawable.safr_ripple_white); } else { holder.rl.setBackgroundResource(R.drawable.safr_ripple_black); } holder.rl.setSelected(false); if (checked) { holder.apk.setVisibility(View.GONE); holder.viewmageV.setVisibility(View.GONE); holder.imageView.setVisibility(View.VISIBLE); holder.imageView.setImageDrawable( ContextCompat.getDrawable(context, R.drawable.abc_ic_cab_done_holo_dark)); GradientDrawable gradientDrawable = (GradientDrawable) holder.imageView.getBackground(); gradientDrawable.setColor(c1); holder.rl.setSelected(true); holder.ext.setText(""); } else { GradientDrawable gradientDrawable = (GradientDrawable) holder.imageView.getBackground(); if (main.COLORISE_ICONS) { if (rowItem.isDirectory()) gradientDrawable.setColor(main.icon_skin_color); else if (Icons.isVideo(rowItem.getDesc()) || Icons.isPicture(rowItem.getDesc())) gradientDrawable.setColor(c2); else if (Icons.isAudio(rowItem.getDesc())) gradientDrawable.setColor(c3); else if (Icons.isPdf(rowItem.getDesc())) gradientDrawable.setColor(c4); else if (Icons.isCode(rowItem.getDesc())) gradientDrawable.setColor(c5); else if (Icons.isText(rowItem.getDesc())) gradientDrawable.setColor(c6); else if (Icons.isArchive(rowItem.getDesc())) gradientDrawable.setColor(c7); else if (Icons.isApk(rowItem.getDesc())) gradientDrawable.setColor(c8); else if (Icons.isgeneric(rowItem.getDesc())) { gradientDrawable.setColor(c9); String ext = MimeTypes.getExtension(new File(rowItem.getDesc()).getName()); if (ext != null && ext.trim().length() != 0) { holder.ext.setText(ext); holder.imageView.setImageDrawable(null); } } else { gradientDrawable.setColor(main.icon_skin_color); } } else gradientDrawable.setColor((main.icon_skin_color)); if (rowItem.getSize().equals(main.goback)) gradientDrawable.setColor(c1); } } if (main.SHOW_PERMISSIONS) holder.perm.setText(rowItem.getPermissions()); if (main.SHOW_LAST_MODIFIED) holder.date.setText(rowItem.getDate()); String size = rowItem.getSize(); if (size.equals(main.goback)) { holder.date.setText(size); holder.txtDesc.setText(""); } else if (main.SHOW_SIZE) holder.txtDesc.setText(rowItem.getSize()); } else { Boolean checked = myChecked.get(p); holder.rl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { main.onListItemClicked(p, v); } }); holder.rl.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View p1) { if (!rowItem.getSize().equals(main.goback)) { Animation iconAnimation = AnimationUtils.loadAnimation(context, R.anim.holder_anim); holder.imageView.setAnimation(iconAnimation); toggleChecked(p); } return true; } }); holder.txtTitle.setText(rowItem.getTitle()); holder.imageView1.setVisibility(View.INVISIBLE); holder.imageView.setVisibility(View.VISIBLE); holder.imageView.setImageDrawable(rowItem.getImageId()); if (Icons.isPicture((rowItem.getDesc().toLowerCase())) || Icons.isVideo(rowItem.getDesc().toLowerCase())) { holder.imageView.setColorFilter(null); holder.imageView1.setVisibility(View.VISIBLE); holder.imageView1.setImageDrawable(null); if (main.theme == 1) holder.imageView1.setBackgroundColor(Color.BLACK); main.ic.cancelLoad(holder.imageView1); main.ic.loadDrawable(holder.imageView1, (rowItem.getDesc()), null); } else if (Icons.isApk((rowItem.getDesc()))) { holder.imageView.setColorFilter(null); main.ic.cancelLoad(holder.imageView); main.ic.loadDrawable(holder.imageView, (rowItem.getDesc()), null); } if (rowItem.isDirectory()) holder.imageView.setColorFilter(main.icon_skin_color); else if (Icons.isVideo(rowItem.getDesc())) holder.imageView.setColorFilter(c2); else if (Icons.isAudio(rowItem.getDesc())) holder.imageView.setColorFilter(c3); else if (Icons.isPdf(rowItem.getDesc())) holder.imageView.setColorFilter(c4); else if (Icons.isCode(rowItem.getDesc())) holder.imageView.setColorFilter(c5); else if (Icons.isText(rowItem.getDesc())) holder.imageView.setColorFilter(c6); else if (Icons.isArchive(rowItem.getDesc())) holder.imageView.setColorFilter(c7); else if (Icons.isgeneric(rowItem.getDesc())) holder.imageView.setColorFilter(c9); else if (Icons.isApk(rowItem.getDesc()) || Icons.isPicture(rowItem.getDesc())) holder.imageView.setColorFilter(null); else holder.imageView.setColorFilter(main.icon_skin_color); if (rowItem.getSize().equals(main.goback)) holder.imageView.setColorFilter(c1); if (checked != null) { if (checked) { holder.imageView.setColorFilter(main.icon_skin_color); holder.imageView.setImageDrawable( ContextCompat.getDrawable(context, R.drawable.abc_ic_cab_done_holo_dark)); holder.rl.setBackgroundColor(Color.parseColor("#9f757575")); } else { if (main.theme1 == 0) holder.rl.setBackgroundResource(R.drawable.item_doc_grid); else { holder.rl.setBackgroundResource(R.drawable.ic_grid_card_background_dark); holder.rl.findViewById(R.id.icon_frame).setBackgroundColor(Color.parseColor("#303030")); } } } if (holder.about != null) { if (main.theme1 == 0) holder.about.setColorFilter(grey_color); showPopup(holder.about, rowItem); } if (main.SHOW_LAST_MODIFIED) holder.date.setText(rowItem.getDate()); if (rowItem.getSize().equals(main.goback)) { holder.date.setText(rowItem.getSize()); holder.txtDesc.setText(""); } /*else if(main.SHOW_SIZE) holder.txtDesc.setText(rowItem.getSize()); */ if (main.SHOW_PERMISSIONS) holder.perm.setText(rowItem.getPermissions()); } }
From source file:com.raja.knowme.FragmentProjects.java
private void nextCompany() { count++;/* ww w . ja v a2 s.co m*/ comapny_switcher.setInAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_left_in)); comapny_switcher.setOutAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_left_out)); projects_list.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.rail_in)); comapny_switcher.setText(mProjectsData.get(count).getCompanyName()); adapter.notifyDataSetChanged(); adapter.setListData(mProjectsData.get(count).getProjectDescription()); projects_list.setAdapter(adapter); }
From source file:com.ferid.app.classroom.statistics.StatisticalListActivity.java
/** * Hide graph layout//from w w w. j a v a 2 s . c o m */ private void hideGraph() { if (graphLayout.getVisibility() == View.VISIBLE) { Animation animHide = AnimationUtils.loadAnimation(context, R.anim.push_to_bottom); graphLayout.setAnimation(animHide); graphLayout.setVisibility(View.GONE); setStatusBarColour(); } }
From source file:baasi.hackathon.sja.TalkActivity.java
/** * ?? ?? ?/*from www .ja va 2s . c o m*/ * @param v View * @param Con Context * @param animationid animation id * @param StartOffset offset * @return animation */ public Animation PlayAnim(View v, Context Con, int animationid, int StartOffset) { if (v != null) { Animation animation = AnimationUtils.loadAnimation(Con, animationid); animation.setStartOffset(StartOffset); v.startAnimation(animation); return animation; } return null; }
From source file:com.raja.knowme.FragmentQualification.java
private void nextInstitution() { count++;/* ww w.ja va 2 s .c o m*/ institution_switcher.setInAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_left_in)); institution_switcher.setOutAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.push_left_out)); qualification_list.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.rail_in)); institution_switcher.setText(mQualificationData.get(count).getInstitutionName()); adapter.notifyDataSetChanged(); adapter.setListData(mQualificationData.get(count).getQualificationDescription()); qualification_list.setAdapter(adapter); }
From source file:com.ohso.omgubuntu.BaseFragment.java
protected void showFooterView() { if (!footerEnabled) return;/*from w ww. j av a2 s .c o m*/ if (footerView.isShown()) return; if (nextPageAllowed == false) { if (currentPage == MAXIMUM_PAGED) { footerView.setText(R.string.activity_main_footer_over); } else if (footerView.isShown()) { footerView.setVisibility(TextView.GONE); return; } } footerView.setVisibility(TextView.VISIBLE); final Animation fadeInAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in_from_bottom); footerView.startAnimation(fadeInAnimation); }