Search in sources :

Example 66 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project Ency by xiarunhao123.

the class ImageAdapter method instantiateItem.

@Override
public Object instantiateItem(ViewGroup container, final int position) {
    final ImageView imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    if (isPTP && AppNetWorkUtil.getNetworkType(context) == AppNetWorkUtil.TYPE_MOBILE) {
        ImageLoader.loadDefault(context, imageView);
    } else {
        ImageLoader.loadAllAsBitmap(context, imgs.get(position), R.drawable.icon_default, imageView);
    }
    imageView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(context, ImageActivity.class);
            intent.putExtra("imgurl", imgs.get(position));
            ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, imageView, context.getString(R.string.transition_img));
            ActivityCompat.startActivity(context, intent, options.toBundle());
        }
    });
    container.addView(imageView);
    return imageView;
}
Also used : ImageActivity(com.xxx.ency.view.gank.ImageActivity) ViewGroup(android.view.ViewGroup) ImageActivity(com.xxx.ency.view.gank.ImageActivity) Activity(android.app.Activity) Intent(android.content.Intent) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Example 67 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project Now by XunMengWinter.

the class BigImageActivity method startThis.

public static void startThis(Context context, View view, String imageUrl) {
    Intent intent = new Intent(context, BigImageActivity.class);
    intent.putExtra(BigImageActivity.IMAGE_URL, imageUrl);
    ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation((Activity) context, view, BigImageActivity.TRANSIT_PIC);
    try {
        ActivityCompat.startActivity(context, intent, optionsCompat.toBundle());
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
        context.startActivity(intent);
    }
}
Also used : Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Example 68 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project opacclient by opacapp.

the class LibraryListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(null);
    setContentView(R.layout.activity_library_list);
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    if (getIntent().hasExtra(EXTRA_WELCOME) && savedInstanceState == null) {
        getSupportActionBar().setHomeButtonEnabled(false);
        startActivity(new Intent(this, WelcomeActivity.class));
    } else {
        getSupportActionBar().setHomeButtonEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    final LinearLayout llLocate = (LinearLayout) findViewById(R.id.llLocate);
    tvLocateString = (TextView) findViewById(R.id.tvLocateString);
    ivLocationIcon = (ImageView) findViewById(R.id.ivLocationIcon);
    loadLibrariesTask = new LoadLibrariesTask();
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        final LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        Criteria criteria = new Criteria();
        // no GPS
        criteria.setAccuracy(Criteria.ACCURACY_COARSE);
        final String provider = locationManager.getBestProvider(criteria, true);
        if (provider == null) {
            // no geolocation available
            llLocate.setVisibility(View.GONE);
        }
    }
    llLocate.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (fragment instanceof LocatedLibraryListFragment) {
                MenuItemCompat.collapseActionView(searchItem);
                showListCountries(true);
                tvLocateString.setText(R.string.geolocate);
                ivLocationIcon.setImageResource(R.drawable.ic_locate_24dp);
            } else {
                tvLocateString.setText(R.string.geolocate_progress);
                ivLocationIcon.setImageResource(R.drawable.ic_locate_24dp);
                showListGeo();
            }
        }
    });
    final RelativeLayout rlSuggestLibrary = (RelativeLayout) findViewById(R.id.rlSuggestLibrary);
    rlSuggestLibrary.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent intent = new Intent(LibraryListActivity.this, SuggestLibraryActivity.class);
            if (getIntent().hasExtra("welcome")) {
                intent.putExtra("welcome", true);
            }
            ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(rlSuggestLibrary, rlSuggestLibrary.getLeft(), rlSuggestLibrary.getTop(), rlSuggestLibrary.getWidth(), rlSuggestLibrary.getHeight());
            ActivityCompat.startActivity(LibraryListActivity.this, intent, options.toBundle());
        }
    });
}
Also used : LocationManager(android.location.LocationManager) Intent(android.content.Intent) Criteria(android.location.Criteria) SearchView(android.support.v7.widget.SearchView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat) RelativeLayout(android.widget.RelativeLayout) OnClickListener(android.view.View.OnClickListener) LinearLayout(android.widget.LinearLayout)

Example 69 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project opacclient by opacapp.

the class AccountFragment method showDetailActivity.

private void showDetailActivity(AccountItem item, AccountAdapter.ViewHolder view) {
    Intent intent = new Intent(getContext(), AccountItemDetailActivity.class);
    intent.putExtra(AccountItemDetailActivity.EXTRA_ITEM, item);
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), view.itemView, getString(R.string.transition_background));
    ActivityCompat.startActivityForResult(getActivity(), intent, REQUEST_DETAIL, options.toBundle());
}
Also used : Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Example 70 with ActivityOptionsCompat

use of android.support.v4.app.ActivityOptionsCompat in project opacclient by opacapp.

the class AccountListActivity method add.

public void add() {
    Intent i = new Intent(this, LibraryListActivity.class);
    ActivityOptionsCompat options = ActivityOptionsCompat.makeScaleUpAnimation(fab, fab.getLeft(), fab.getTop(), fab.getWidth(), fab.getHeight());
    ActivityCompat.startActivityForResult(this, i, ACCOUNT_EDIT_REQUEST_CODE, options.toBundle());
}
Also used : Intent(android.content.Intent) ActivityOptionsCompat(android.support.v4.app.ActivityOptionsCompat)

Aggregations

ActivityOptionsCompat (android.support.v4.app.ActivityOptionsCompat)94 Intent (android.content.Intent)74 View (android.view.View)32 Pair (android.support.v4.util.Pair)18 RecyclerView (android.support.v7.widget.RecyclerView)15 Activity (android.app.Activity)14 ImageView (android.widget.ImageView)14 TextView (android.widget.TextView)13 OnClick (butterknife.OnClick)7 ActivityOptions (android.app.ActivityOptions)4 Context (android.content.Context)4 Bundle (android.os.Bundle)4 Handler (android.os.Handler)4 BindView (butterknife.BindView)4 CardView (android.support.v7.widget.CardView)3 Explode (android.transition.Explode)3 AdapterView (android.widget.AdapterView)3 LinearLayout (android.widget.LinearLayout)3 Uri (android.net.Uri)2 LayoutInflater (android.view.LayoutInflater)2