Example usage for android.widget ViewSwitcher getCurrentView

List of usage examples for android.widget ViewSwitcher getCurrentView

Introduction

In this page you can find the example usage for android.widget ViewSwitcher getCurrentView.

Prototype

public View getCurrentView() 

Source Link

Document

Returns the View corresponding to the currently displayed child.

Usage

From source file:de.measite.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);//from   w  ww. j a v  a 2 s  .  co  m
    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();
}

From source file:de.tum.frm2.nicos_android.gui.MainActivity.java

@Override
protected void onResume() {
    super.onResume();
    _visible = true;/*from w ww . j a va 2s.c om*/

    // Initialize design for buttons.
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    boolean useJK = prefs.getBoolean(getResources().getString(R.string.key_jk_design_switch), false);
    ViewSwitcher switcher = (ViewSwitcher) findViewById(R.id.viewSwitch);
    if (useJK) {
        if (switcher.getCurrentView() == findViewById(R.id.layoutSmallButtons)) {
            switcher.showNext();
            setPanelHeight(false);
        }
    } else {
        if (switcher.getCurrentView() == findViewById(R.id.layoutBigButtons)) {
            switcher.showNext();
            setPanelHeight(true);
        }
    }
}