[TIMOB-27312] Android: Refactor "ProgressIndicator" status bar handling
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Low |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Android |
| Labels | ProgressIndicator, android, progress, statusbar |
| Reporter | Joshua Quick |
| Assignee | Joshua Quick |
| Created | 2019-08-06T21:57:38.000+0000 |
| Updated | 2021-02-22T18:41:03.000+0000 |
Description
*Summary:*
The
Ti.UI.Android.ProgressIndicator whose "location" property is set to Ti.UI.Android.PROGRESS_INDICATOR_STATUS_BAR no longer displays a progress indicator in the activity window's ActionBar. This feature no longer works.
The ProgressIndicator object's defaults to using the status bar, making this an issue. All Titanium developers need to set it to Ti.UI.Android.PROGRESS_INDICATOR_DIALOG to see progress. This is the only "location" property setting that works.
*Reason:*
Google has stopped supporting this feature as of Android 5.0.
https://developer.android.com/reference/android/app/Activity#setProgress(int)
This feature does not work on Android 4.4 either. Likely because the Google Support library's ActionBar and/or AppCompatActivity class dropped support of this feature as well.
*Test Code:*
The below code does *NOT* show a progress indicator on Android 4.4 and above anymore. This feature appears to be dead.
var progressIndicator = Ti.UI.Android.createProgressIndicator({
message: "Progressing...",
location: Ti.UI.Android.PROGRESS_INDICATOR_STATUS_BAR,
type: Ti.UI.Android.PROGRESS_INDICATOR_INDETERMINANT,
});
var window = Ti.UI.createWindow();
window.add(Ti.UI.createLabel({ text: "Progress Indicator Test" }));
window.addEventListener("open", function() {
progressIndicator.show();
});
window.open();
*Recommended Solution:*
We should do one of the following...
Find an alternative solution for showing progress in the action bar or status bar. _(Note that Google's guidelines do not recommend this anymore.)_
Drop status bar progress support and have "location" default to showing a dialog.
If we remove the status bar feature, then we may want to remove theTiBaseActivity.requestWindowFeature() method calls for constants FEATURE_PROGRESS and FEATURE_INDETERMINATE_PROGRESS here...
[TiBaseActivity.java#L694](https://github.com/appcelerator/titanium_mobile/blob/3386d95fb6203138428f1dcc4736448a569692bc/android/titanium/src/java/org/appcelerator/titanium/TiBaseActivity.java#L694)
No comments