當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。