use of android.support.v4.app.ActivityOptionsCompat in project opacclient by opacapp.
the class AccountListActivity method onStart.
@Override
public void onStart() {
super.onStart();
ListView lvAccounts = (ListView) findViewById(R.id.lvAccounts);
refreshLv();
lvAccounts.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent i = new Intent(AccountListActivity.this, AccountEditActivity.class);
i.putExtra(AccountEditActivity.EXTRA_ACCOUNT_ID, accounts.get(position).getId());
i.putExtra(AccountEditActivity.EXTRA_EDITING, true);
ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(view, view.getLeft(), view.getTop(), view.getWidth(), view.getHeight());
ActivityCompat.startActivityForResult(AccountListActivity.this, i, ACCOUNT_EDIT_REQUEST_CODE, options.toBundle());
}
});
lvAccounts.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
((OpacClient) getApplication()).setAccount(accounts.get(position).getId());
refreshLv();
return true;
}
});
}
use of android.support.v4.app.ActivityOptionsCompat in project Camera-Roll-Android-App by kollerlukas.
the class MainAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
final Album album = getData().get(position);
((AlbumHolder) holder).setAlbum(album);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(holder.itemView.getContext(), AlbumActivity.class);
// intent.putExtra(AlbumActivity.ALBUM, album);
intent.putExtra(AlbumActivity.ALBUM_PATH, album.getPath());
if (pickPhotos()) {
Context c = holder.itemView.getContext();
boolean allowMultiple = false;
if (c instanceof Activity) {
Activity a = (Activity) c;
allowMultiple = a.getIntent().getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false);
}
intent.setAction(MainActivity.PICK_PHOTOS);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, allowMultiple);
} else {
intent.setAction(AlbumActivity.VIEW_ALBUM);
}
ActivityOptionsCompat options;
Activity context = (Activity) holder.itemView.getContext();
if (!pickPhotos()) {
// noinspection unchecked
options = ActivityOptionsCompat.makeSceneTransitionAnimation(context);
context.startActivityForResult(intent, MainActivity.REFRESH_PHOTOS_REQUEST_CODE, options.toBundle());
} else {
View toolbar = context.findViewById(R.id.toolbar);
options = ActivityOptionsCompat.makeSceneTransitionAnimation(context, toolbar, context.getString(R.string.toolbar_transition_name));
context.startActivityForResult(intent, MainActivity.PICK_PHOTOS_REQUEST_CODE, options.toBundle());
}
}
});
}
use of android.support.v4.app.ActivityOptionsCompat in project Camera-Roll-Android-App by kollerlukas.
the class AlbumAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int position) {
final AlbumItem albumItem = getData().getAlbumItems().get(position);
if (!albumItem.equals(((AlbumItemHolder) holder).getAlbumItem())) {
((AlbumItemHolder) holder).setAlbumItem(albumItem);
}
boolean selected = getSelectorManager().isItemSelected(albumItem.getPath());
((AlbumItemHolder) holder).setSelected(selected);
holder.itemView.setTag(albumItem.getPath());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (getSelectorMode()) {
onItemSelected((AlbumItemHolder) holder);
} else {
Log.d("AlbumAdapter", "onClick: " + getData().getPath());
Context context = holder.itemView.getContext();
Intent intent = new Intent(context, ItemActivity.class);
intent.putExtra(ItemActivity.ALBUM_ITEM, albumItem);
intent.putExtra(ItemActivity.ALBUM_PATH, getData().getPath());
intent.putExtra(ItemActivity.ITEM_POSITION, getData().getAlbumItems().indexOf(albumItem));
if (Settings.getInstance(context).showAnimations()) {
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, holder.itemView.findViewById(R.id.image), albumItem.getPath());
ActivityCompat.startActivityForResult((Activity) context, intent, ItemActivity.VIEW_IMAGE, options.toBundle());
} else {
ActivityCompat.startActivityForResult((Activity) context, intent, ItemActivity.VIEW_IMAGE, null);
}
}
}
});
if (getSelectorManager().callbacksAttached()) {
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
if (!getSelectorMode()) {
setSelectorMode(true);
clearSelectedItemsList();
}
onItemSelected((AlbumItemHolder) holder);
if (dragSelectEnabled()) {
// notify DragSelectTouchListener
boolean selected = getSelectorManager().isItemSelected(albumItem.getPath());
if (selected) {
int position = getData().getAlbumItems().indexOf(albumItem);
dragSelectTouchListener.startDragSelection(position);
}
}
return true;
}
});
}
}
use of android.support.v4.app.ActivityOptionsCompat in project CustomViews by AndroidStudy233.
the class CommonFragment method gotoDetail.
@Override
public void gotoDetail() {
Activity activity = (Activity) getContext();
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, new Pair(imageView, DetailActivity.IMAGE_TRANSITION_NAME), new Pair(address1, DetailActivity.ADDRESS1_TRANSITION_NAME), new Pair(address2, DetailActivity.ADDRESS2_TRANSITION_NAME), new Pair(address3, DetailActivity.ADDRESS3_TRANSITION_NAME), new Pair(address4, DetailActivity.ADDRESS4_TRANSITION_NAME), new Pair(address5, DetailActivity.ADDRESS5_TRANSITION_NAME), new Pair(ratingBar, DetailActivity.RATINGBAR_TRANSITION_NAME), new Pair(head1, DetailActivity.HEAD1_TRANSITION_NAME), new Pair(head2, DetailActivity.HEAD2_TRANSITION_NAME), new Pair(head3, DetailActivity.HEAD3_TRANSITION_NAME), new Pair(head4, DetailActivity.HEAD4_TRANSITION_NAME));
Intent intent = new Intent(activity, DetailActivity.class);
intent.putExtra(DetailActivity.EXTRA_IMAGE_URL, imageUrl);
ActivityCompat.startActivity(activity, intent, options.toBundle());
}
use of android.support.v4.app.ActivityOptionsCompat in project Tapad by berict.
the class IntentHelper method intentSharedElementWithExtra.
public void intentSharedElementWithExtra(final Activity activity, final String targetName, final int start_element_id, final String transitionName, final String extraName, final String extra, int delay, final View v) {
final String classname = "com.bedrock.padder." + targetName;
final Class<Object> classToLoad;
try {
classToLoad = (Class<Object>) Class.forName(classname);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
if (Build.VERSION.SDK_INT >= 21) {
Intent intent = new Intent(activity, classToLoad);
intent.putExtra(extraName, extra);
View view = v.findViewById(start_element_id);
ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, // The view which starts the transition
view, // The transitionName of the view we’re transitioning to
transitionName);
ActivityCompat.startActivity(activity, intent, options.toBundle());
} else {
intentWithExtra(activity, targetName, extraName, extra, 0);
}
}
}, delay);
} catch (ClassNotFoundException e) {
Log.i("IntentHelper", "Error, there is no such class");
}
}
Aggregations