Search in sources :

Example 1 with LinearProgressIndicator

use of com.google.android.material.progressindicator.LinearProgressIndicator in project ods-android by Orange-OpenSource.

the class ProgressIndicatorDeterminateDemoFragment method initialize.

public void initialize(@NonNull View view) {
    List<LinearProgressIndicator> linearProgressIndicatorList = DemoUtils.findViewsWithType(view, LinearProgressIndicator.class);
    List<CircularProgressIndicator> circularProgressIndicatorList = DemoUtils.findViewsWithType(view, CircularProgressIndicator.class);
    Slider slider = view.findViewById(R.id.slider);
    Button showButton = view.findViewById(R.id.show_button);
    Button hideButton = view.findViewById(R.id.hide_button);
    slider.addOnChangeListener((sliderObj, value, fromUser) -> {
        for (LinearProgressIndicator indicator : linearProgressIndicatorList) {
            indicator.setProgressCompat((int) value, true);
        }
        for (CircularProgressIndicator indicator : circularProgressIndicatorList) {
            indicator.setProgressCompat((int) value, true);
        }
    });
    showButton.setOnClickListener(v -> {
        for (LinearProgressIndicator indicator : linearProgressIndicatorList) {
            indicator.show();
        }
        for (CircularProgressIndicator indicator : circularProgressIndicatorList) {
            indicator.show();
        }
    });
    hideButton.setOnClickListener(v -> {
        for (LinearProgressIndicator indicator : linearProgressIndicatorList) {
            indicator.hide();
        }
        for (CircularProgressIndicator indicator : circularProgressIndicatorList) {
            indicator.hide();
        }
    });
}
Also used : Slider(com.google.android.material.slider.Slider) Button(android.widget.Button) LinearProgressIndicator(com.google.android.material.progressindicator.LinearProgressIndicator) CircularProgressIndicator(com.google.android.material.progressindicator.CircularProgressIndicator)

Example 2 with LinearProgressIndicator

use of com.google.android.material.progressindicator.LinearProgressIndicator in project ods-android by Orange-OpenSource.

the class ProgressIndicatorIndeterminateDemoFragment method initialize.

private void initialize(View view) {
    List<LinearProgressIndicator> linearProgressIndicatorList = DemoUtils.findViewsWithType(view, LinearProgressIndicator.class);
    List<CircularProgressIndicator> circularProgressIndicatorList = DemoUtils.findViewsWithType(view, CircularProgressIndicator.class);
    EditText progressInput = view.findViewById(R.id.progress_input);
    Button updateButton = view.findViewById(R.id.update_button);
    Button showButton = view.findViewById(R.id.show_button);
    Button hideButton = view.findViewById(R.id.hide_button);
    updateButton.setOnClickListener(v -> {
        int progress;
        try {
            progress = Integer.parseInt(progressInput.getEditableText().toString());
        } catch (NumberFormatException e) {
            progress = 0;
        }
        for (LinearProgressIndicator indicator : linearProgressIndicatorList) {
            updateLinearProgressIndicator(indicator, progress);
        }
        for (CircularProgressIndicator indicator : circularProgressIndicatorList) {
            updateCircularProgressIndicator(indicator, progress);
        }
    });
    showButton.setOnClickListener(v -> {
        for (LinearProgressIndicator indicator : linearProgressIndicatorList) {
            resetLinearProgressIndicator(indicator);
            indicator.show();
        }
        for (CircularProgressIndicator indicator : circularProgressIndicatorList) {
            resetCircularProgressIndicator(indicator);
            indicator.show();
        }
    });
    hideButton.setOnClickListener(v -> {
        for (LinearProgressIndicator indicator : linearProgressIndicatorList) {
            indicator.hide();
        }
        for (CircularProgressIndicator indicator : circularProgressIndicatorList) {
            indicator.hide();
        }
    });
}
Also used : EditText(android.widget.EditText) Button(android.widget.Button) LinearProgressIndicator(com.google.android.material.progressindicator.LinearProgressIndicator) CircularProgressIndicator(com.google.android.material.progressindicator.CircularProgressIndicator)

Example 3 with LinearProgressIndicator

use of com.google.android.material.progressindicator.LinearProgressIndicator in project ods-android by Orange-OpenSource.

the class ProgressIndicatorMainDemoFragment method initialize.

public void initialize(@NonNull View view) {
    LinearProgressIndicator linearDeterminate = view.findViewById(R.id.linear_determinate);
    CircularProgressIndicator circularDeterminate = view.findViewById(R.id.circular_determinate);
    EditText progressInput = view.findViewById(R.id.progress_input);
    Button updateButton = view.findViewById(R.id.update_button);
    updateButton.setOnClickListener(v -> {
        int progress;
        try {
            progress = Integer.parseInt(progressInput.getEditableText().toString());
        } catch (Exception e) {
            progress = 0;
        }
        linearDeterminate.setProgressCompat(progress, true);
        circularDeterminate.setProgressCompat(progress, true);
    });
}
Also used : EditText(android.widget.EditText) Button(android.widget.Button) LinearProgressIndicator(com.google.android.material.progressindicator.LinearProgressIndicator) CircularProgressIndicator(com.google.android.material.progressindicator.CircularProgressIndicator)

Example 4 with LinearProgressIndicator

use of com.google.android.material.progressindicator.LinearProgressIndicator in project Fermata by AndreyPavlenko.

the class MediaItemView method setProgress.

private void setProgress(Item i, long start, long end) {
    LinearProgressIndicator p = getProgress();
    if (progressUpdater != null) {
        progressUpdater.cancel();
        progressUpdater = null;
    }
    if ((start > 0) && (end > start)) {
        progressUpdater = new ProgressUpdater(i, p, start, end);
        progressUpdater.run();
        p.setVisibility(VISIBLE);
    } else {
        p.setVisibility(GONE);
    }
}
Also used : LinearProgressIndicator(com.google.android.material.progressindicator.LinearProgressIndicator)

Aggregations

LinearProgressIndicator (com.google.android.material.progressindicator.LinearProgressIndicator)4 Button (android.widget.Button)3 CircularProgressIndicator (com.google.android.material.progressindicator.CircularProgressIndicator)3 EditText (android.widget.EditText)2 Slider (com.google.android.material.slider.Slider)1