Put a lottie animation in a Dialog. Android - android

I'm developing an app in android, and I want to use lottie for a Dialog that could have an animated icon of checked-done or fail. Wellcome some examples or ideas. I guess this is possible.
Thanks

You can do that using the LottieDialog library
Github Repo for examples and documentation : LottieDialog
Code example:
Button button = new Button(this);
button.setText("Ok");
button.setTextColor(Color.WHITE);
button.setAllCaps(false);
int greenColor = ContextCompat.getColor(this, R.color.green);
button.setBackgroundTintList(ColorStateList.valueOf(greenColor));
LottieDialog dialog = new LottieDialog(this)
.setAnimation(R.raw.success_like)
.setAnimationRepeatCount(LottieDialog.INFINITE)
.setAutoPlayAnimation(true)
.setDialogBackground(Color.WHITE)
.setMessage("Task is Done :D")
.setMessageColor(greenColor)
.addActionButton(button);
dialog.show();
You can add more buttons, or create it with no buttons,

Related

HighCharts For Android Exporting Button

I'm using highcharts for android. I wanna change exporting button background. How can I do that?
In order to set the background color of your exporting button, you can use navigation.buttonOptions.theme.fill property. Here is how to implement it using our Android wrapper:
HINavigation navigation = new HINavigation();
navigation.buttonOptions = new HIButtonOptions();
navigation.buttonOptions.theme = new HITheme();
Navigation.buttonOptions.theme.fill = „#ff0000”;
API Reference: https://api.highcharts.com/android/highcharts/

How to achieve custom dialog at the bottom of the screen in Android

Which component do I choose to achieve custom dialog at the bottom as shown in the below image? Shall I choose alertdialog,popupwindow, or fragmentdialog?
Try this
BottomSheetDialog dialog = new BottomSheetDialog(YourActivity.this);
dialog.setContentView(YourView);
dialog.show();
Edit: I didn't there was a built in component in Android to do so. Good to know! Also, check this out:
https://medium.com/glucosio-project/moving-from-dialogs-to-bottomsheetdialogs-on-android-15fb8d140295#
I would recommend FragmentDialog without a doubt.
It's so much easier to create a customized Dialog regarding location & layout design.
Kotlin code for run custom ButtomSheetDialog (run inside Activity)
var CustomSelectProfilePicBottomSheetDialog = BottomSheetDialog(this)
val layoutButtomSheetView = this.layoutInflater.inflate(R.layout.ly_custom_buttom_sheet_frg_dialog, null)
CustomSelectProfilePicBottomSheetDialog.setContentView(layoutButtomSheetView)
CustomSelectProfilePicBottomSheetDialog.show()

How to hide two buttons in GvrView

In google's Cardboard API we can use CardboardView.setSettingsButtonEnabled(boolean) method to hide the settings button on the bottom of the screen.
Now,Google VR API is graded to 1.0. Use GvrView insteads of 'CardboardView', and the settings button is moved to top|right when adding a close button on left|top, but I can't find any GvrView's methods which can hide the two buttons.
Please help me how to fix it, Thanks
In the current version (1.170.0) of the GVR SDK. You can find the buttons and remove them (but only in older versions of Android):
// Settings Button
val settingsButton = gvrView.findViewById<ImageButton>(R.id.ui_settings_button)
settingsButton.visibility = View.GONE
// Back Button
val backButton = gvrView.findViewById<ImageButton>(R.id.ui_back_button)
backButton.visibility = View.GONE
// Alignment Marker
val alignmentMarker = gvrView.findViewById<RelativeLayout>(R.id.ui_alignment_marker)
alignmentMarker.visibility = View.GONE
Yes ,I think the developers don't plan to add this method.
[https://github.com/googlevr/gvr-android-sdk/issues/252][1]

Coloured Background of Action Button in Sweet Alert (Android)

I have written some code for showing a Dialog box using sweet alert library. It's a very popular library and contains couple of awesome features which are very useful for designing purpose and developing purpose as well. So please help to change the background color of Action button which are present at the bottom of the dialog box.
I am attaching the screen shot and as well as code. Please help me to fix this issue.
I only want to change the background color of Action Button.
MaterialDialog.Builder builder = new MaterialDialog.Builder(SignInActivity.this)
.title("Sign Up")
.titleColor(Color.BLACK)
.customView(R.layout.custom_dialog_sign_up, true)
.positiveText("Submit")
.negativeText("Cancel")
.positiveColorRes(R.color.black_color)
.negativeColorRes(R.color.gray_btn_bg_color)
.canceledOnTouchOutside(false)
.autoDismiss(false);
final MaterialDialog materialDialog = builder.build();
materialDialog.show();
it is pretty late to respond upon your question but, recently i face this issue and start digging about it on google but found nothing, so i started my own and found this perfect solution code and screen shot attached.
SweetAlertDialog sweetAlertDialogView;
sweetAlertDialogView = new SweetAlertDialog(ctx,SweetAlertDialog.ERROR_TYPE);
sweetAlertDialogView.setTitleText(ctx.getResources().getString(R.string.error_msg_oops_title))
.setContentText("Request failed :" + errMsg + " \n" + ctx.getResources().getString(R.string.error_msg_check_net_connection));
sweetAlertDialogView.show();
Button viewGroup = (Button) sweetAlertDialogView.findViewById(cn.pedant.SweetAlert.R.id.confirm_button);
if (viewGroup != null) {
Log.e(TAG, "showErrorMsg: Button view Found yep");
viewGroup.setBackgroundColor(viewGroup.getResources().getColor(R.color.colorSkyBlueButtonLoader));
} else {
Log.e(TAG, "showErrorMsg: Button view Null :( ");
}
from above logic i update the button color to dark sky blue blue, for any other help you can ask me in comment. i will try to resolve it with my best.
A far more easier way to accomplish this is to just overwrite following color values in your color.xml:
<color name="blue_btn_bg_color">#1976D2</color>
<color name="blue_btn_bg_pressed_color">#1565C0</color>

navigation in Android TV

navigation in Android TV.
How do I create just the navigation android tv. I do not care to use the entire theme, it provides android studio.
And I do not understand much of what is in the example given by android studio.
I understand that is something the String.
I looked on the internet examples, but right now, android tv has no further information at this time.
I'm interested only create menu navigation side, nothing more.
Thank you very much.
I found a really nice tutorial : http://corochann.com/browsefragment-header-customization-android-tv-application-hands-on-tutorial-17-697.html
it shows you how to create a custom navigation side with an image and a text
Here what a tried in my application :
copy his IconHeaderItem class and in your loadRows paste
IconHeaderItem gridItemPresenterHeader = new IconHeaderItem(0, BEWELL_THERMO, R.drawable.bewell_thermo);
GridItemPresenter mGridPresenter = new GridItemPresenter();
ArrayObjectAdapter gridRowAdapter = new ArrayObjectAdapter(mGridPresenter);
gridRowAdapter.add(DERNIERE_MESURE);
gridRowAdapter.add(GRID_STRING_GUIDED_STEP_FRAGMENT);
gridRowAdapter.add(GRID_STRING_RECOMMENDATION);
gridRowAdapter.add(GRID_STRING_SPINNER);
mGridItemListRow = new ListRow(gridItemPresenterHeader, gridRowAdapter);
mRowsAdapter.add(mGridItemListRow);
setAdapter(mRowsAdapter);

Categories

Resources