Skip to content

Default UI Fragment

You can use the inheritance from FaceDefaultUiFragment to make small changes to the default UI, for example, change the visibility of some elements or change it to drawable.

Find below a couple of examples:

Change Image Drawable for Flash Light button

public class FlashButtonFragment extends FaceDefaultUiFragment {

    View mFlashLightBtn;

    @Override
    protected View getFlashLightButton(@NonNull View view) {
        mFlashLightBtn = super.getFlashLightButton(view);
        return mFlashLightBtn;
    }

    @Override
    protected void updateFlashLightButton(boolean isLightOn) {
        if (mFlashLightBtn == null)
            return;

        if (mFlashLightBtn instanceof ImageButton)
            ((ImageButton) mFlashLightBtn).setImageDrawable(getResources().getDrawable(isLightOn ? R.drawable.flash_light_on : R.drawable.flash_light_off));
    }
}

�Update NotificationTextView

public class NotificationViewFragment extends FaceDefaultUiFragment {

    protected Drawable getNotificationBackgroundDrawable(Context context, boolean isLightOn) {
        return ContextCompat.getDrawable(context, isLightOn ? R.drawable.notification_view_background_dark : R.drawable.notification_view_background_white);
    }

    @Override
    protected int getNotificationTextColor(boolean isLightOn) {
        return getResources().getColor(isLightOn ? R.color.notification_view_text_color_light_on : R.color.notification_view_text_color_light_off);
    }
}

Success

Sample Apps cover a lot of examples and show the source code for customization ways described in this section.\ It is highly recommended to see the code and what it affects on the UI yourself!

Back to top