Example usage for android.widget ViewSwitcher postInvalidate

List of usage examples for android.widget ViewSwitcher postInvalidate

Introduction

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

Prototype

public void postInvalidate() 

Source Link

Document

Cause an invalidate to happen on a subsequent cycle through the event loop.

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  . c  o  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();
}