Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24161] Android: Ti.UI.AlertDialog.androidView doesn't work when borderRadius is set

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-11-29T00:07:20.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsandroid
ReporterBaharroth
AssigneeGary Mathews
Created2016-11-21T15:04:26.000+0000
Updated2016-11-29T00:07:36.000+0000

Description

The AndroidView property doesn't work with a simple view.
Ti.UI.setBackgroundColor('white');

var win = Ti.UI.createWindow({
	title : 'Click window to test',
	backgroundColor : 'white',
	exitOnClose : true,
	fullscreen : false
});

win.addEventListener('click', function(e) {
	var dialog = Ti.UI.createAlertDialog({
		message : 'The file has been deleted',
		ok : 'Okay',
		title : 'File Deleted',
		androidView : Titanium.UI.createView({
			borderRadius : 10,
			backgroundColor : 'red',
			width : 50,
			height : 50
		})
	});
	dialog.show();
});
win.open();
Result :
{{[WARN] :   TiUIDialog: (main) [2917,2917] Context must have gone away: The specified child already has a parent. You must call removeView() on the child's parent first.
[WARN] :   TiUIDialog: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
[WARN] :   TiUIDialog: 	at android.view.ViewGroup.addViewInner(ViewGroup.java:3938)
[WARN] :   TiUIDialog: 	at android.view.ViewGroup.addView(ViewGroup.java:3788)
[WARN] :   TiUIDialog: 	at android.view.ViewGroup.addView(ViewGroup.java:3760)
[WARN] :   TiUIDialog: 	at android.support.v7.app.AlertController.setupCustomContent(AlertController.java:610)
[WARN] :   TiUIDialog: 	at android.support.v7.app.AlertController.setupView(AlertController.java:449)
[WARN] :   TiUIDialog: 	at android.support.v7.app.AlertController.installContent(AlertController.java:214)
[WARN] :   TiUIDialog: 	at android.support.v7.app.AlertDialog.onCreate(AlertDialog.java:240)
[WARN] :   TiUIDialog: 	at android.app.Dialog.dispatchOnCreate(Dialog.java:373)
[WARN] :   TiUIDialog: 	at android.app.Dialog.show(Dialog.java:274)
[WARN] :   TiUIDialog: 	at ti.modules.titanium.ui.widget.TiUIDialog.show(TiUIDialog.java:298)
[WARN] :   TiUIDialog: 	at ti.modules.titanium.ui.AlertDialogProxy$1.run(AlertDialogProxy.java:73)
[WARN] :   TiUIDialog: 	at android.os.Handler.handleCallback(Handler.java:746)
[WARN] :   TiUIDialog: 	at android.os.Handler.dispatchMessage(Handler.java:95)
[WARN] :   TiUIDialog: 	at android.os.Looper.loop(Looper.java:135)
[WARN] :   TiUIDialog: 	at android.app.ActivityThread.main(ActivityThread.java:5343)
[WARN] :   TiUIDialog: 	at java.lang.reflect.Method.invoke(Native Method)
[WARN] :   TiUIDialog: 	at java.lang.reflect.Method.invoke(Method.java:372)
[WARN] :   TiUIDialog: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
[WARN] :   TiUIDialog: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)}}

Comments

  1. Hans Knöchel 2016-11-21

    Does the Alloy-one work?
       <Alloy>
           <AlertDialog onClick="doClick" title="Delete"
               message="Would you like to delete the file?" cancel="1">
       
               <!--  Add View or AndroidView for the androidView property  -->
               <View platform="android">
                   <Label color="red" text="Warning!  This change is permanent and you cannot undo it!" />
               </View>
       
               <ButtonNames>
                   <ButtonName>Confirm</ButtonName>
                   <ButtonName>Cancel</ButtonName>
               </ButtonNames>
           </AlertDialog>
       </Alloy>
       
    Looks like a regression then.
  2. Gary Mathews 2016-11-22

    master: https://github.com/appcelerator/titanium_mobile/pull/8633
  3. Baharroth 2016-11-22

    Sorry Gary for my bad report : usually i simplify the test case and i should have removed the borderRadius, then see it's working. I let the borderRadius because, to avoid mistakes from me, i used the documentation sample which include a borderRadius. TiBaharroth
  4. Baharroth 2016-11-22

    It's not only for borderRadius, it's all border properties. Your code crash if i add a borderWidth for example.
  5. Samir Mohammed 2016-11-28

    Verified fixed. Using the code provided in the description and the code provided in the test case of https://github.com/appcelerator/titanium_mobile/pull/8633 was able to see Alert Dialogs when a border radius is set. *Environement*
       Appcelerator Command-Line Interface, version 6.0.0
       Android 7.0 (Google Nexus 6P)
       Operating System Name: Mac OS X El Capitan
       Operating System Version: 10.11.6
       Node.js Version: 4.6.0
       npm: 4.2.8
       Titanium CLI Version: 5.0.10
       Titanium SDK Version: 6.1.0.v20161128150634
       Xcode: 8.0
       Appcelerator Studio: 4.8.0.201611121409
       

JSON Source