当前位置: 首页>>代码示例>>Java>>正文


Java Pair.create方法代码示例

本文整理汇总了Java中android.support.v4.util.Pair.create方法的典型用法代码示例。如果您正苦于以下问题:Java Pair.create方法的具体用法?Java Pair.create怎么用?Java Pair.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.util.Pair的用法示例。


在下文中一共展示了Pair.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getViewBlockAttrs

import android.support.v4.util.Pair; //导入方法依赖的package包/类
private Pair<Integer, String> getViewBlockAttrs(AttributeSet attrs) {
    int resourceId = NO_ID;
    String name = null;

    TypedArray array = getContext().obtainStyledAttributes(attrs, AndroidAttrs.ATTRS);
    int indexCount = array.getIndexCount();
    for (int i = 0; i < indexCount; i++) {
        int index = array.getIndex(i);
        switch (index) {
            case AndroidAttrs.ID_INDEX:
                resourceId = array.getResourceId(index, NO_ID);
                break;
            case AndroidAttrs.NAME_INDEX:
                name = array.getString(index);
                break;
            case AndroidAttrs.BLOCK_CLASS_INDEX:
                name = array.getString(index);
                break;
        }
    }
    array.recycle();
    return Pair.create(resourceId, name);
}
 
开发者ID:iflove,项目名称:UIKit-ViewBlock,代码行数:24,代码来源:UIKitHelper.java

示例2: itemClicked

import android.support.v4.util.Pair; //导入方法依赖的package包/类
@Override
public void itemClicked(View view, MediaInfo item, int position) {
    if (view instanceof ImageButton) {
        Utils.showQueuePopup(getActivity(), view, item);
    } else {
        String transitionName = getString(R.string.transition_image);
        VideoListAdapter.ViewHolder viewHolder =
                (VideoListAdapter.ViewHolder) mRecyclerView.findViewHolderForPosition(position);
        Pair<View, String> imagePair = Pair
                .create((View) viewHolder.getImageView(), transitionName);
        ActivityOptionsCompat options = ActivityOptionsCompat
                .makeSceneTransitionAnimation(getActivity(), imagePair);

        Intent intent = new Intent(getActivity(), LocalPlayerActivity.class);
        intent.putExtra("media", item);
        intent.putExtra("shouldStart", false);
        ActivityCompat.startActivity(getActivity(), intent, options.toBundle());
    }
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:20,代码来源:VideoBrowserFragment.java

示例3: onClick

import android.support.v4.util.Pair; //导入方法依赖的package包/类
/**
 * When the user clicks/touches an app card, we launch the {@link AppDetails2} activity in response.
 */
@Override
public void onClick(View v) {
    if (currentApp == null) {
        return;
    }

    Intent intent = new Intent(activity, AppDetails2.class);
    intent.putExtra(AppDetails2.EXTRA_APPID, currentApp.packageName);
    if (Build.VERSION.SDK_INT >= 21) {
        Pair<View, String> iconTransitionPair = Pair.create((View) icon,
                activity.getString(R.string.transition_app_item_icon));

        @SuppressWarnings("unchecked") // the right type is passed as 2nd varargs arg: Pair<View, String>
        Bundle b = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, iconTransitionPair).toBundle();
        activity.startActivity(intent, b);
    } else {
        activity.startActivity(intent);
    }
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:23,代码来源:AppCardController.java

示例4: onClick

import android.support.v4.util.Pair; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    if (currentApp == null) {
        return;
    }

    Intent intent = new Intent(activity, AppDetails2.class);
    intent.putExtra(AppDetails2.EXTRA_APPID, currentApp.packageName);
    if (Build.VERSION.SDK_INT >= 21) {
        String transitionAppIcon = activity.getString(R.string.transition_app_item_icon);
        Pair<View, String> iconTransitionPair = Pair.create((View) icon, transitionAppIcon);
        Bundle bundle = ActivityOptionsCompat
                .makeSceneTransitionAnimation(activity, iconTransitionPair).toBundle();
        activity.startActivity(intent, bundle);
    } else {
        activity.startActivity(intent);
    }
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:19,代码来源:AppListItemController.java

示例5: onItemClick

import android.support.v4.util.Pair; //导入方法依赖的package包/类
@Override
public void onItemClick(int item, ProfesoresAdapter.ViewHolder view) {

    View imageView = view.profile;
    Intent intent = new Intent(ProfesoresActivity.this, ProfesoresViewActivity.class);
    Gson gson = new Gson();
    intent.putExtra("JDATA", gson.toJson(teachers.get(item)));
    overridePendingTransition(R.anim.fade_in,R.anim.fade_out);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Pair<View, String> pair1 = Pair.create(imageView, getString(R.string.activity_profesores_image_trans));
        ActivityOptionsCompat options = ActivityOptionsCompat.
                makeSceneTransitionAnimation(ProfesoresActivity.this, pair1);
        startActivity(intent, options.toBundle());
    }
    else {
        startActivity(intent);
    }

}
 
开发者ID:Onelio,项目名称:ConnectU,代码行数:20,代码来源:ProfesoresActivity.java

示例6: onClick

import android.support.v4.util.Pair; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    if (isInQuickSelectMode()) {
        toggleChecked(getAdapterPosition());
    } else {
        Pair[] artistPairs = new Pair[]{Pair.create(image, activity.getResources().getString(R.string.transition_artist_image))};
        NavigationUtil.goToArtist(activity, dataSet.get(getAdapterPosition()).getId(), artistPairs);
    }
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:10,代码来源:ArtistAdapter.java

示例7: onItemClick

import android.support.v4.util.Pair; //导入方法依赖的package包/类
@Override
public void onItemClick(PokeRecyclerAdapter adapter, int position, PokeItemViewHolder
        viewHolder) {
    Pokemon p = adapter.getItem(position);
    Intent intent = PokeDetailActivity.createIntent(this, p, viewHolder.imPokemon.getDrawable());
    Pair<View, String> pairIm = Pair.create(viewHolder.imPokemon, getString(R.string
            .transition_name_im_poke));
    Pair<View, String> pairTv = Pair.create(viewHolder.tvPokemonName, getString(R
            .string.transition_name_tv_poke_name));
    ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(this,
            pairIm, pairTv);
    ActivityCompat.startActivity(this, intent, options.toBundle());
}
 
开发者ID:datdescartes,项目名称:pokequest,代码行数:14,代码来源:PokeDictActivity.java

示例8: onSongMenuItemClick

import android.support.v4.util.Pair; //导入方法依赖的package包/类
protected boolean onSongMenuItemClick(MenuItem item) {
    if (image != null && image.getVisibility() == View.VISIBLE) {
        switch (item.getItemId()) {
            case R.id.action_go_to_album:
                Pair[] albumPairs = new Pair[]{
                        Pair.create(image, activity.getResources().getString(R.string.transition_album_art))
                };
                NavigationUtil.goToAlbum(activity, getSong().albumId, albumPairs);
                return true;
        }
    }
    return false;
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:14,代码来源:SongAdapter.java

示例9: onSongMenuItemClick

import android.support.v4.util.Pair; //导入方法依赖的package包/类
@Override
protected boolean onSongMenuItemClick(MenuItem item) {
    if (item.getItemId() == R.id.action_go_to_album) {
        Pair[] albumPairs = new Pair[]{
                Pair.create(image, activity.getString(R.string.transition_album_art))
        };
        NavigationUtil.goToAlbum(activity, dataSet.get(getAdapterPosition()).albumId, albumPairs);
        return true;
    }
    return super.onSongMenuItemClick(item);
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:12,代码来源:CustomPlaylistSongAdapter.java

示例10: onSongMenuItemClick

import android.support.v4.util.Pair; //导入方法依赖的package包/类
protected boolean onSongMenuItemClick(MenuItem item) {
    if (image != null && image.getVisibility() == View.VISIBLE) {
        switch (item.getItemId()) {
            case R.id.action_go_to_album:
                Pair[] albumPairs = new Pair[]{
                        Pair.create(imageContainer, activity.getResources().getString(R.string.transition_album_art))
                };
                NavigationUtil.goToAlbum(activity, getSong().albumId, albumPairs);
                return true;
        }
    }
    return false;
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:14,代码来源:SongAdapter.java

示例11: onClick

import android.support.v4.util.Pair; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    if (isInQuickSelectMode()) {
        toggleChecked(getAdapterPosition());
    } else {
        Pair[] artistPairs = new Pair[]{
                Pair.create(image,
                        activity.getResources().getString(R.string.transition_artist_image)
                )};
        NavigationUtil.goToArtist(activity, dataSet.get(getAdapterPosition()).getId(), artistPairs);
    }
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:13,代码来源:ArtistAdapter.java

示例12: onDetachLayout

import android.support.v4.util.Pair; //导入方法依赖的package包/类
@Nullable
@Override
protected final Pair<Integer, Float> onDetachLayout(final boolean tabsOnly) {
    Pair<Integer, Float> result = null;

    if (getTabSwitcher().isSwitcherShown() && getFirstVisibleIndex() != -1) {
        TabItem tabItem =
                TabItem.create(getModel(), getTabViewRecycler(), getFirstVisibleIndex());
        Tag tag = tabItem.getTag();

        if (tag.getState() != State.HIDDEN) {
            float position = tag.getPosition();
            float draggingAxisSize =
                    getArithmetics().getTabContainerSize(Axis.DRAGGING_AXIS, false);
            float orthogonalAxisSize =
                    getArithmetics().getTabContainerSize(Axis.ORTHOGONAL_AXIS, false);
            result = Pair.create(getFirstVisibleIndex(),
                    position / Math.max(draggingAxisSize, orthogonalAxisSize));
        }
    }

    contentViewRecycler.removeAll();
    contentViewRecycler.clearCache();
    tabRecyclerAdapter.clearCachedPreviews();
    detachEmptyView();

    if (!tabsOnly) {
        getModel().removeListener(tabRecyclerAdapter);
    }

    return result;
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:33,代码来源:PhoneTabSwitcherLayout.java

示例13: show

import android.support.v4.util.Pair; //导入方法依赖的package包/类
public static void show(@NonNull Activity activity, @NonNull View avatarView,
                        @NonNull View titleView, @NonNull Issue issue) {
    Intent intent = new Intent(activity, IssueDetailActivity.class);
    Pair<View, String> avatarPair = Pair.create(avatarView, "userAvatar");
    Pair<View, String> titlePair = Pair.create(titleView, "issueTitle");
    ActivityOptionsCompat optionsCompat = ActivityOptionsCompat
            .makeSceneTransitionAnimation(activity, avatarPair, titlePair);
    intent.putExtras(BundleHelper.builder().put("issue", issue).build());
    activity.startActivity(intent, optionsCompat.toBundle());
}
 
开发者ID:ThirtyDegreesRay,项目名称:OpenHub,代码行数:11,代码来源:IssueDetailActivity.java

示例14: onDetachLayout

import android.support.v4.util.Pair; //导入方法依赖的package包/类
@Nullable
@Override
protected final Pair<Integer, Float> onDetachLayout(final boolean tabsOnly) {
    Pair<Integer, Float> result = null;

    if (getModel().isSwitcherShown() && firstVisibleIndex != -1) {
        TabItem tabItem = TabItem.create(getModel(), viewRecycler, firstVisibleIndex);
        Tag tag = tabItem.getTag();

        if (tag.getState() != State.HIDDEN) {
            float firstVisibleTabPosition = tabItem.getTag().getPosition();
            result = Pair.create(firstVisibleIndex, firstVisibleTabPosition);
        }
    }

    childViewRecycler.removeAll();
    childViewRecycler.clearCache();
    viewRecycler.removeAll();
    viewRecycler.clearCache();
    recyclerAdapter.clearCachedPreviews();

    if (!tabsOnly) {
        getModel().removeListener(recyclerAdapter);
        getTabSwitcher().removeView(toolbar);
        getTabSwitcher().removeView(tabContainer);
    }

    return result;
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:30,代码来源:PhoneTabSwitcherLayout.java

示例15: sharedElement

import android.support.v4.util.Pair; //导入方法依赖的package包/类
@Override
public Pair<View, String> sharedElement() {
    DetailsKey detailsKey = getKey();
    String transitionName = detailsKey.transitionName();
    if(image == null) {
        return null; // View is not yet initialized.
    }
    return Pair.create(image, transitionName);
}
 
开发者ID:Zhuinden,项目名称:simple-stack,代码行数:10,代码来源:DetailsFragment.java


注:本文中的android.support.v4.util.Pair.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。