Skip to content

Instantly share code, notes, and snippets.

@Android-s14
Last active August 29, 2015 14:17
Show Gist options
  • Save Android-s14/95089628ddd7112a2f35 to your computer and use it in GitHub Desktop.
Save Android-s14/95089628ddd7112a2f35 to your computer and use it in GitHub Desktop.
Dialog Circular Reveal/Hide
private Dialog dialog;
private void buildDialog() {
dialog = new Dialog(activity);
dialogView = activity.getLayoutInflater().inflate(R.layout.dialog_new_participant, null);
dialogField = ButterKnife.findById(dialogView, R.id.edittext_new_participant);
dialogFab = ButterKnife.findById(dialogView, R.id.fab_new_participant_dialog);
dialog.setContentView(dialogView);
clearBackgrounds(dialogView);
setListeners();
}
private void clearBackgrounds(View view) {
while (view != null) {
final ViewParent parent = view.getParent();
if (parent instanceof View) {
view = (View) parent;
view.setBackgroundResource(android.graphics.Color.TRANSPARENT);
} else {
view = null;
}
}
}
<io.codetail.widget.RevealFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/reveal_layout"
android:orientation="vertical"
>
<RelativeLayout
android:id="@+id/dialog_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
>
<TextView
android:id="@+id/textview_new_participant_dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="14dp"
android:padding="10dp"
android:text="Enter new name"
android:textColor="@android:color/black"
android:textSize="25sp"
/>
<com.getbase.floatingactionbutton.AddFloatingActionButton
android:id="@+id/fab_new_participant_dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:visibility="invisible"
fab:fab_colorNormal="@color/material_blue"
fab:fab_colorPressed="@color/material_blue"
fab:fab_plusIconColor="@color/material_pink"
android:layout_below="@+id/textview_new_participant_dialog_title"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
/>
<EditText
android:id="@+id/edittext_new_participant"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:hint="Name"
android:inputType="text"
android:padding="10dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/textview_new_participant_dialog_title"
android:layout_toLeftOf="@+id/fab_new_participant_dialog"
android:layout_toStartOf="@+id/fab_new_participant_dialog"
/>
</RelativeLayout>
</io.codetail.widget.RevealFrameLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment