showNext ( )源码实例Demo

android.widget.ViewSwitcher#showNext ( )源码实例Demo

下面列出了android.widget.ViewSwitcher#showNext ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ToDay   文件: TheHubActivity.java
/**
 * Hides the Options Menu and uses a ViewSwitcher to quick turn the exisiting TextView with the
 * Flow's name into an EditText for the user to rename.
 *
 * @param cardPosition position of cardview in adapter
 * @param cardViewClicked the cardview view object clicked
 */
private void renameFlow(final int cardPosition, final View cardViewClicked) {
    menuState = AppConstants.MENU_ITEMS_HIDE;
    invalidateOptionsMenu();
    final ViewSwitcher switcher = (ViewSwitcher) cardViewClicked.findViewById(R.id.hub_rename_switcher);
    final EditText rename = (EditText) switcher.findViewById(R.id.hub_item_flow_rename);

    AppUtils.setNameInputFilters(rename);

    rename.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @RequiresApi(api = Build.VERSION_CODES.KITKAT)
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (rename.hasFocus()) {
                showEditPopupWindow(rename, cardViewClicked, switcher, cardPosition);
            }
        }
    });

    switcher.showNext();

    rename.requestFocus();
    /* Forces keyboard */


}
 
源代码2 项目: BatteryFu   文件: ListContentFragment.java
public void setContent(Fragment content) {
    Fragment last = mCurrentContent;
    mCurrentContent = content;
    FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
    if (last != null)
        ft.replace(R.id.content, mCurrentContent);
    else
        ft.add(R.id.content, mCurrentContent);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    if (mContainer instanceof ViewSwitcher) {
        ViewSwitcher switcher = (ViewSwitcher)mContainer;
        if (mContent != switcher.getCurrentView())
            switcher.showNext();
    }
    ft.commit();
}
 
源代码3 项目: ToDay   文件: ShowElementFragment.java
private void switchersShowNext() {
    ViewSwitcher switcherName = (ViewSwitcher) getView().findViewById(R.id.fragment_se_switcher_name);
    ViewSwitcher switcherTime = (ViewSwitcher) getView().findViewById(R.id.fragment_se_switcher_time);
    ViewSwitcher switcherNotes = (ViewSwitcher) getView().findViewById(R.id.fragment_se_switcher_notes);
    switcherName.showNext();
    switcherTime.showNext();
    switcherNotes.showNext();
}
 
源代码4 项目: QuickLyric   文件: LyricsViewFragment.java
private void showFirstStart() {
    stopRefreshAnimation();
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    ViewGroup parent = (ViewGroup) ((ViewGroup) getActivity().findViewById(R.id.scrollview)).getChildAt(0);
    if (parent.findViewById(R.id.tracks_msg) == null)
        inflater.inflate(R.layout.no_tracks, parent);

    TypedValue typedValue = new TypedValue();
    getActivity().getTheme().resolveAttribute(R.attr.firstLaunchCoverDrawable, typedValue, true);
    int firstLaunchBGid = typedValue.resourceId;
    @SuppressWarnings("deprecation")
    BitmapDrawable bd = ((BitmapDrawable) getResources().getDrawable(firstLaunchBGid));

    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());

    setCoverArt(bd != null ? bd.getBitmap() : null, null, true);
    ViewSwitcher viewSwitcher = getActivity().findViewById(R.id.switcher);
    if (viewSwitcher.getChildCount() > 1)
        viewSwitcher.removeViewAt(0);
    viewSwitcher.addView(new View(getActivity()));
    viewSwitcher.showNext();

    int themeNum = Integer.valueOf(sharedPref.getString("pref_theme", "0"));
    if (themeNum > 0 && themeNum != 7) {
        TypedValue darkColorValue = new TypedValue();
        getActivity().getTheme().resolveAttribute(R.attr.colorPrimaryDark, darkColorValue, true);
        ((FadeInNetworkImageView) getActivity().findViewById(R.id.cover))
                .setColorFilter(darkColorValue.data, PorterDuff.Mode.OVERLAY);
    }

    getActivity().findViewById(R.id.error_msg).setVisibility(View.INVISIBLE);
    ((TextView) getActivity().findViewById(R.id.artist)).setText("");
    ((TextView) getActivity().findViewById(R.id.song)).setText("");
    getActivity().findViewById(R.id.top_gradient).setVisibility(View.INVISIBLE);
    getActivity().findViewById(R.id.bottom_gradient).setVisibility(View.INVISIBLE);
    getActivity().findViewById(R.id.edit_tags_btn).setVisibility(View.INVISIBLE);
}
 
源代码5 项目: ContactMerger   文件: MergeActivity.java
public void updateList() {
    progressContainer = findViewById(R.id.progress_bar_container);
    progressBar = (ProgressBar)findViewById(R.id.analyze_progress);
    progressContainer.setVisibility(View.GONE);

    loadText = (TextView) findViewById(R.id.load_text);

    TextView stopScan = (TextView) findViewById(R.id.stop_scan);
    Typeface font = Typeface.createFromAsset(getAssets(), "fontawesome-webfont.ttf");
    stopScan.setTypeface(font);
    stopScan.setClickable(true);
    stopScan.setOnClickListener(this);

    startScan = (Button) findViewById(R.id.start_scan);
    startScan.setOnClickListener(this);

    ViewSwitcher switcher = (ViewSwitcher)findViewById(R.id.switcher);
    ViewSwitcher switcher_list = (ViewSwitcher)findViewById(R.id.switcher_list);

    Context context = getApplicationContext();
    File path = context.getDatabasePath("contactsgraph");
    File modelFile = new File(path, "model.kryo.gz");

    if (path.exists() && modelFile.exists()) {
        this.adapter.update();
        while (switcher.getCurrentView().getId() != R.id.switcher_list) {
            switcher.showNext();
        }
        if (adapter.getCount() == 0) {
            while (switcher_list.getCurrentView().getId() != R.id.all_done) {
                switcher_list.showNext();
            }
        } else {
            while (switcher_list.getCurrentView().getId() != R.id.contact_merge_list) {
                switcher_list.showPrevious();
            }
        }
        switcher_list.postInvalidate();
    } else {
        if (switcher.getCurrentView().getId() == R.id.contact_merge_list) {
            switcher.showPrevious();
        }
        Intent intent = new Intent(getApplicationContext(), AnalyzerService.class);
        intent.putExtra("forceRunning", true);
        startService(intent);
    }
    switcher.postInvalidate();
}
 
源代码评论
动弹
沙发等你来抢
 方法所在类