How to create a Lottie Alert Dialog in Java - java

I've tried searching for the Java tutorial regarding creating my LottieAlertDialog, but I can't find any. Everywhere it's in Kotlin, but I need the Java code as my project is in Java.
I've tried creating my LottieAlertDialog in this way:
LottieAlertDialog.Builder alert=new LottieAlertDialog.Builder(context,DialogTypes.TYPE_CUSTOM,
"social.json") //Here social.json is inside assets folder
.setTitle("Social")
.setDescription("social");
alert.build();
But the dialogbox doesn't show, when I run the app. To check whether my alert dialogbox was being created or not I tried testing it by printing the description set in the dialog in a Toast:
Toast.makeText(context,alert.getDescription(),Toast.LENGTH_SHORT).show();
The toast works and its showing "social"! That means the dialog is being created. But unfortunately it doesn't show in my app. What do I do? I've implemented all the dependencies as shown in the below link:
lottiealertdialog

Ok, after much hankering, I finally came to the solution. It's
alert.build().show();

The thing is not related to Kotlin or Java as such, you need to show the dialog once you have built it. So far your code is correct. You just need to show it further like this
LottieAlertDialog.Builder alert = new LottieAlertDialog.Builder(context, DialogTypes.TYPE_CUSTOM,
"social.json")
.setTitle("Social")
.setDescription("Social")
.build()
.show();

Related

Google App Script logger.log not showing anything

I writing a simple google web app. this .gs basically open a html file that require user to input his name then click. after the user clicked it, the function checkGCR() should log the username in logger.log. but nothing show in logger.log. if run the function checkGCR(), the log does record "null" since nothing input in the input box. One thing I notice is eventhough the logger.log didn't show anything, but stackdriver log doesn't showing something going on there. Please check my code is that something wrong I did here because I follow online tutorial with exact same coding but logger.log just doesn't seem to work.
//This is code.gs
function checkGCR(myid){
Logger.log(myid);
}
//This is html
document.getElementById("btn").addEventListener("click", doStuff);
function doStuff(){
var myid=document.getElementById("mykidid").value;
google.script.run.checkGCR(myid);
}
I just found out that eventhough it doesn't show up at Logger.log, but it does show up in Stackdriver log. So I just use that instead.

How do I change the text shown in GooglePlayServicesUtil.getErrorDialog()?

I am trying to follow the gcm tutorial from Googles docs. They say to call this method if Play Services are out of date:
GooglePlayServicesUtil.getErrorDialog(resultCode, activity, 9000).show();
That's fine, but it puts a dialog that says "This app won't run unless you update Google Play Services" with an "Update" button. I want to change the title and the message text. My users CAN skip the update, and the app will still run. They just won't get push notifications. How do I change the message of the dialog?
I would like to do something like:
Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(resultCode, activity, 9000);
errorDialog.setTitle("out of date");
errorDialog.setMessage("Please update or push notifications won't work. Thank you");
errorDialog.show();
You can override desired string value in your application's strings.xml like this. Simply add these lines in your strings.xml
For message on dialog
<string name="common_google_play_services_update_text" msgid="448354684997260580">This app won\'t run unless you update Google Play services.</string>
For title on dialog
<string name="common_google_play_services_update_title" msgid="6006316683626838685">out of date</string>
EDIT
You could find more information here
http://blog.elsdoerfer.name/2010/04/08/android2po-managing-android-translations/
and What's the meaning of attribute 'msgid' in strings.xml?
msgid is used in android internal strings for localization but I never found any documentation about it. Two reference I have as above. I believe if you remove the msgid still it would work, although I never tried it.
The source of this code is
android_sdk\extras\google\google_play_services\libproject\google-play-services_lib\res\values\common_strings.xml

How can I testing the Message Dialog/Box from SWT(with SWTBot)?

Is the message box native SWT? I ask, because SWTBot can't handle native SWT dialogs like message boxes or file dialogs.
Suggestion: work in your application code with (JFace) MessageDialog.openInformation(....) and not nativ SWT dialogs. This works fine with SWTBot.<
I can with MessageDialog.openInformation(....) create a MessageDialog, but I will testing what happens when I click "Yes" or "No".
I tried to interpreted the "Yes" and "No" Buttons in der MessageDialog as Buttons.
okButton = bot.button("Yes");
However I get a "org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: Could not find widget."
Who I can test it?
You cannot test the native dialog with SWTBot.
Reference: SWTBot Wiki

UISpec4J File Chooser Testing

I'm trying to use UISpec4J to test a file chooser.
A button is supposed to make the file chooser pop up. I found an example for a file chooser that pops up from a menu option:
WindowInterceptor
.run(openMenu.triggerClick())
.process(FileChooserHandler.init()
.titleEquals("Select a template file")
.assertAcceptsFilesOnly()
.select("/home/bond/file.txt"))
.run();
But I can't seem to get it to work with a simple button click instead - I know this is probably a really simple question but I can't seem to find other documentation to get this to work and I am pretty stuck... Can someone explain how to test this? Thanks!
I've also tried example from documentation and failed. Little change could help:
WindowInterceptor
.init(openMenu.triggerClick())
.process(FileChooserHandler.init()
.titleEquals("Select a template file")
.assertAcceptsFilesOnly()
.select("/home/bond/file.txt"))
.run();
I've replaced first instance of run to init.
Probably, it's a typo in docs.

jquery-mobile spinner loading

i tried to do that while js is creating a timetable... it shows spinner loading..
i tried to do this $.mobile.pageLoading(); $.mobile.pageLoading(true); and also tried to use this plugin http://contextllc.com/tools/jQuery-showLoading
The result is the same.. it shows spinner after he generate time table.. and i don't know why...here is where i tried to use it...
$('#timeDropList').change(function() {
$.mobile.pageLoading(false);
$('div.addedEntry').remove();
drawTemplate();
});
Are you using the right version of jQuery Mobile? Looks like they took away the pageLoading method in 1.0b1 in favor of two separate methods: showPageLoadingMsg and hidePageLoadingMsg. The last reference I see to pageLoading is in 1.0a4.1.
$('#home').live('pagebeforecreate',function(event){
alert('This page was just enhanced by jQuery Mobile!');
$.mobile.loadingMessage = "pagebeforeshow Page...";
$.mobile.showPageLoadingMsg();
});

Categories