Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18964] Android: Update Android Alert Dialogs with Material

GitHub Issuen/a
TypeSub-task
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2015-06-16T21:43:56.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.1.0
ComponentsAndroid
Labelsn/a
ReporterAshraf Abu
AssigneeAshraf Abu
Created2015-05-29T06:28:39.000+0000
Updated2015-06-17T18:34:30.000+0000

Description

Comments

  1. Ashraf Abu 2015-06-03

    PR: https://github.com/appcelerator/titanium_mobile/pull/6889 Testing includes Progress Indicator as part of the code that handles that is changed. Please test this on an Android version below 5.0 (before Lollipop). This will allow Alert Dialogs to have the material design look in versions below Lollipop. Test code:-
       
       Ti.UI.backgroundColor = 'white';
       
       var win = Ti.UI.createWindow({
         backgroundColor: 'blue'
       });
       
       var button = Ti.UI.createButton({
         title: 'Show Progress Dialog',
         top: 10
       });
       
       var buttonAlert = Ti.UI.createButton({
         title: 'Show Alert Dialog',
         top: 110
       });
       
       var buttonAlert2 = Ti.UI.createButton({
         title: 'Show Alert Dialog 2',
         top: 210
       });
       
       var progressIndicator = Ti.UI.Android.createProgressIndicator({
         message: 'Loading...',
         location: Ti.UI.Android.PROGRESS_INDICATOR_DIALOG,
         type: Ti.UI.Android.PROGRESS_INDICATOR_DETERMINANT,
         cancelable: true,
         min: 0,
         max: 10
       });
       
       button.addEventListener('click', function (e) {
         progressIndicator.show();
         var value = 0;
         setInterval(function(){
           if (value > 10) {
               return;
           }
           progressIndicator.value = value;
           value ++;
         }, 200);
         // do some work that takes 3 seconds
         // ie. replace the following setTimeout block with your code
         setTimeout(function(){
           progressIndicator.hide();
         }, 3000);
       });
       
       buttonAlert.addEventListener('click', function (e) {
         var dialog = Ti.UI.createAlertDialog({
       	message: 'This is a message',
       	ok: 'Okay',
       	title: 'This is a title'
         });
         dialog.show();
       });
       
       buttonAlert2.addEventListener('click', function (e) {
       	alert('Alert call 2');
       });
       
       
       win.add(button);
       win.add(buttonAlert);
       win.add(buttonAlert2);
       win.open();
       
  2. Lokesh Choudhary 2015-06-17

    Verified the implementation. The alert dialogs now have material theme for android versions below android 5.0. Tested on android 4.4.4 & 4.2.2. Looks good. Closing. Environment: Appc Studio : 4.1.0.201506151224 Ti SDK : 4.1.0.v20150616225249 Ti CLI : 4.0.1 Alloy : 1.6.2 MAC Yosemite : 10.10.3 Appc NPM : 4.1.0-1 Appc CLI : 4.1.0-1 Node: v0.10.37 Nexus 5 - Android 5.1.1 Samsung Galaxy S4 - Android 4.4.4 Samsung Galaxy S3 - Android 4.2.2

JSON Source