Created
May 22, 2018 13:07
-
-
Save gdacciaro/658fa13c2327a3590d36ef230ee1db20 to your computer and use it in GitHub Desktop.
Dialog with custom background color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="white_trasparent">#afffffff</color> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/layout_root" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" > | |
<com.airbnb.lottie.LottieAnimationView | |
android:id="@+id/animation_view" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
app:lottie_autoPlay="true" | |
app:lottie_fileName="loader.json" | |
app:lottie_loop="true" /> | |
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.annotation.SuppressLint; | |
import android.app.Dialog; | |
import android.content.Context; | |
import me.pushapp.sosmedico.R; | |
/** | |
* Created by Denny on 21/11/2017 with pizza | |
*/ | |
public class LoadingDialog { | |
private Dialog dialog; | |
@SuppressLint("SetTextI18n") | |
public LoadingDialog(Context context, boolean cancellable) { | |
dialog = new Dialog(context,R.style.custom_dialog_theme); | |
dialog.setCancelable(cancellable); | |
dialog.setContentView(R.layout.custom_dialog_loading); | |
} | |
public void show() { | |
if (dialog != null) | |
dialog.show(); | |
} | |
public void dismiss() { | |
dialog.dismiss(); | |
} | |
public boolean isShowing(){ | |
return dialog.isShowing(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style name="custom_dialog_theme" parent="@android:style/Theme.Translucent.NoTitleBar"> | |
<item name="android:windowBackground">@color/white_trasparent</item> | |
<item name="android:windowIsFloating">false</item> | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment