List of usage examples for android.view View startAnimation
public void startAnimation(Animation animation)
From source file:com.mercandalli.android.apps.files.file.FileAddDialog.java
@SuppressWarnings("PMD.AvoidUsingHardCodedIP") public FileAddDialog(@NonNull final Activity activity, final int id_file_parent, @Nullable final IListener listener, @Nullable final IListener dismissListener) { super(activity, R.style.DialogFullscreen); mActivity = activity;//from w ww . jav a2s. com mDismissListener = dismissListener; mFileParentId = id_file_parent; mListener = listener; setContentView(R.layout.dialog_add_file); setCancelable(true); final View rootView = findViewById(R.id.dialog_add_file_root); rootView.startAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.dialog_add_file_open)); rootView.setOnClickListener(this); findViewById(R.id.dialog_add_file_upload_file).setOnClickListener(this); findViewById(R.id.dialog_add_file_add_directory).setOnClickListener(this); findViewById(R.id.dialog_add_file_text_doc).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DialogUtils.prompt(mActivity, mActivity.getString(R.string.dialog_file_create_txt), mActivity.getString(R.string.dialog_file_name_interrogation), mActivity.getString(R.string.dialog_file_create), new DialogUtils.OnDialogUtilsStringListener() { @Override public void onDialogUtilsStringCalledBack(String text) { //TODO create a online txt with content Toast.makeText(getContext(), getContext().getString(R.string.not_implemented), Toast.LENGTH_SHORT).show(); } }, mActivity.getString(android.R.string.cancel), null); FileAddDialog.this.dismiss(); } }); findViewById(R.id.dialog_add_file_scan).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // Ensure that there's a camera activity to handle the intent if (takePictureIntent.resolveActivity(mActivity.getPackageManager()) != null) { // Create the File where the photo should go ApplicationActivity.sPhotoFile = createImageFile(); // Continue only if the File was successfully created if (ApplicationActivity.sPhotoFile != null) { if (listener != null) { ApplicationActivity.sPhotoFileListener = listener; } takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(ApplicationActivity.sPhotoFile.getFile())); mActivity.startActivityForResult(takePictureIntent, ApplicationActivity.REQUEST_TAKE_PHOTO); } } FileAddDialog.this.dismiss(); } }); findViewById(R.id.dialog_add_file_add_timer).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Calendar currentTime = Calendar.getInstance(); DialogDatePicker dialogDate = new DialogDatePicker(mActivity, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, final int year, final int monthOfYear, final int dayOfMonth) { Calendar currentTime = Calendar.getInstance(); DialogTimePicker dialogTime = new DialogTimePicker(mActivity, new TimePickerDialog.OnTimeSetListener() { @Override public void onTimeSet(TimePicker view, int hourOfDay, int minute) { Log.d("TIme Picker", hourOfDay + ":" + minute); final SimpleDateFormat dateFormatGmt = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.US); dateFormatGmt.setTimeZone(TimeZone.getTimeZone("UTC")); final SimpleDateFormat dateFormatLocal = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss", Locale.US); String nowAsISO = dateFormatGmt.format(new Date()); final JSONObject json = new JSONObject(); try { json.put("type", "timer"); json.put("date_creation", nowAsISO); json.put("timer_date", "" + dateFormatGmt.format(dateFormatLocal.parse(year + "-" + (monthOfYear + 1) + "-" + dayOfMonth + " " + hourOfDay + ":" + minute + ":00"))); final SimpleDateFormat dateFormatGmtTZ = new SimpleDateFormat( "yyyy-MM-dd'T'HH-mm'Z'", Locale.US); dateFormatGmtTZ.setTimeZone(TimeZone.getTimeZone("UTC")); nowAsISO = dateFormatGmtTZ.format(new Date()); final List<StringPair> parameters = new ArrayList<>(); parameters.add(new StringPair("content", json.toString())); parameters.add(new StringPair("name", "TIMER_" + nowAsISO)); parameters.add( new StringPair("id_file_parent", "" + id_file_parent)); new TaskPost(mActivity, Constants.URL_DOMAIN + Config.ROUTE_FILE, new IPostExecuteListener() { @Override public void onPostExecute(JSONObject json, String body) { if (listener != null) { listener.execute(); } } }, parameters).execute(); } catch (JSONException | ParseException e) { Log.e(getClass().getName(), "Failed to convert Json", e); } } }, currentTime.get(Calendar.HOUR_OF_DAY), currentTime.get(Calendar.MINUTE), true); dialogTime.show(); } }, currentTime.get(Calendar.YEAR), currentTime.get(Calendar.MONTH), currentTime.get(Calendar.DAY_OF_MONTH)); dialogDate.show(); FileAddDialog.this.dismiss(); } }); findViewById(R.id.dialog_add_file_article).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DialogCreateArticle dialogCreateArticle = new DialogCreateArticle(mActivity, listener); dialogCreateArticle.show(); FileAddDialog.this.dismiss(); } }); FileAddDialog.this.show(); }
From source file:edu.mit.mobile.android.livingpostcards.CardViewActivity.java
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor c) { if (c.moveToFirst()) { // don't show deleted cards. This just confuses things. if (Card.isDeleted(c)) { finish();//ww w.ja va 2s . c o m return; } final int videoCol = c.getColumnIndexOrThrow(Card.COL_VIDEO_RENDER); // if the card has a video render, show that mHasVideo = !c.isNull(videoCol) && c.getString(videoCol).length() > 0; mHandler.sendEmptyMessage(MSG_LOAD_CARD_MEDIA); setTitle(Card.getTitle(this, c)); mSherlock.getActionBar().setSubtitle(c.getString(c.getColumnIndexOrThrow(Card.COL_AUTHOR))); mIsEditable = PrivatelyAuthorable.canEdit(mUserUri, c); mIsOwner = mUserUri.equals(c.getString(c.getColumnIndexOrThrow(Card.COL_AUTHOR_URI))); final View addPicture = findViewById(R.id.add_frame); if (mIsEditable) { addPicture.setVisibility(View.VISIBLE); addPicture.startAnimation(AnimationUtils.makeInChildBottomAnimation(this)); } else { addPicture.setVisibility(View.GONE); } mWebUrl = c.getString(c.getColumnIndexOrThrow(Card.COL_WEB_URL)); // resolve to a full URL final NetworkClient nc = LocastApplication.getNetworkClient(this, Authenticator.getFirstAccount(this)); mWebUrl = mWebUrl != null ? nc.getFullUrlAsString(mWebUrl) : null; try { mSherlock.dispatchInvalidateOptionsMenu(); } catch (final OutOfMemoryError oom) { // well, damn. } } else { finish(); } }
From source file:com.ricardotrujillo.appstore.viewmodel.adapter.StoreRecyclerViewAdapter.java
private void setAnimation(View viewToAnimate, int position) { if (position > lastPosition) { Animation animation = AnimationUtils.loadAnimation(activity, R.anim.slide_in_bottom); viewToAnimate.startAnimation(animation); lastPosition = position;// w ww. j av a 2 s .co m } }
From source file:com.artur.softwareproject.BluetoothConnectionListAdapter.java
@Override @NonNull//from w ww .ja va 2 s . c om public View getView(final int position, View convertView, @NonNull ViewGroup parent) { ViewHolder mViewHolder; if (convertView == null) { mViewHolder = new ViewHolder(); LayoutInflater ListInflater = LayoutInflater.from(getContext()); convertView = ListInflater.inflate(R.layout.bluetooth_list_pattern, parent, false); mViewHolder.bluetoothConnectionName = (TextView) convertView .findViewById(R.id.bluetooth_connection_name); mViewHolder.bluetoothConnectionStatus = (TextView) convertView .findViewById(R.id.bluetooth_connection_status); convertView.setTag(mViewHolder); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //What happens if you press on the list items at the bluetooth activity. Animation animation = new AlphaAnimation(0.3f, 1.0f); animation.setDuration(1000); v.startAnimation(animation); intent = new Intent(contextActivity, BluetoothService.class); intent.putExtra("device", bDevices.get(position)); intent.putExtra("deviceList", bDevices); contextActivity.startService(intent); final ProgressDialog connectingDialog = new ProgressDialog(contextActivity); connectDialog = connectingDialog; connectingDialog.setMessage("Connecting..."); connectingDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); connectingDialog.setCancelable(false); connectingDialog.show(); final ConnectionHandlerClass connectHandler = new ConnectionHandlerClass(bclaReference); connectThread = new Thread(new Runnable() { @Override public void run() { int stop = 0; int counter = 0; //Timeout after 10 seconds. while (stop == 0 && counter < 5) { stop = getConnected(); counter++; sleep(2000); } //Timeout occurred after 10s of waiting and stop is still 0. if (stop == 0 && counter == 4) { timeout = true; } connectHandler.sendEmptyMessage(0); } }); connectThread.start(); } }); } else { mViewHolder = (ViewHolder) convertView.getTag(); } mViewHolder.bluetoothConnectionName.setText(bluetoothAddress.get(position)); mViewHolder.bluetoothConnectionStatus.setText(bluetoothName.get(position)); return convertView; }
From source file:com.ricardotrujillo.prueba.viewmodel.adapter.StoreRecyclerViewAdapter.java
private void setAnimation(View viewToAnimate, int position) { if (position > lastPosition) { Animation animation = AnimationUtils.loadAnimation(activity, R.anim.slide_in_bottom); viewToAnimate.startAnimation(animation); lastPosition = position;// www .j a va2s . c om } }
From source file:com.example.bufferandroidproject.abs.ItemListFragment.java
private ItemListFragment<E> fadeIn(final View view, final boolean animate) { if (view != null) if (animate) view.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); else//from w w w.j a v a2 s . com view.clearAnimation(); return this; }
From source file:com.github.pockethub.android.ui.ItemListFragment.java
private ItemListFragment<E> fadeIn(final View view, final boolean animate) { if (view != null) { if (animate) { view.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } else {// w w w . j a v a2 s.c o m view.clearAnimation(); } } return this; }
From source file:ca.rmen.android.networkmonitor.app.log.LogActivity.java
private void startRefreshIconAnimation() { Log.v(TAG, "startRefreshIconAnimation"); if (mMenu == null) return; // This is null when we first enter the activity and the page loads. MenuItem menuItemRefresh = mMenu.findItem(R.id.action_refresh); if (menuItemRefresh == null) return;//from w ww .j a va 2 s . c om View refreshIcon = View.inflate(this, R.layout.refresh_icon, null); Animation rotation = AnimationUtils.loadAnimation(this, R.anim.rotate); rotation.setRepeatCount(Animation.INFINITE); refreshIcon.startAnimation(rotation); MenuItemCompat.setActionView(menuItemRefresh, refreshIcon); }
From source file:com.lithiumli.fiction.LibraryActivity.java
private void hidePlayerInfo() { View bab = findViewById(R.id.bab); View bab_hr = findViewById(R.id.bab_hr); if (bab.getVisibility() == View.VISIBLE) { Animation hideBab = AnimationUtils.loadAnimation(this, R.anim.bab_hide); bab.startAnimation(hideBab); bab_hr.startAnimation(hideBab);//w w w.j a v a 2 s . c o m bab.setVisibility(View.GONE); } }
From source file:com.hemou.android.ui.base._ItemListFragment.java
private _ItemListFragment<E> fadeIn(final View view, final boolean animate) { if (view != null) if (animate) view.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); else/* w w w. ja v a2 s . c o m*/ view.clearAnimation(); return this; }