Flyy custom checkin view implementation
This document will guide you with adding flyy custom checkin view in your android layout and how to use it in your app.
You can add flyy's custom checkin view inside any layout or an cardview as per your requirement. Following is the example of how to add the custom view inside a cardview.
<!--CardView-->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
app:cardCornerRadius="8dp">
<!--Flyy custom checkin view-->
<theflyy.com.flyy.customview.FlyyCheckInView
android:id="@+id/flyy_checkin_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone" />
</androidx.cardview.widget.CardView>
In your java class implement FlyyCheckInViewOfferStatus interface to know if checkin offer is live or not.
To implement interface, set the FlyyCheckInViewOfferStatus as given below.
public class HomeFragment extends AppCompatActivity implements FlyyCheckInViewOfferStatus {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Flyy.setFlyyCheckInViewOfferStatus(this);
}
}
You can hide or show your custom view according to flyy checkin offer live status as follows.
public class HomeFragment extends AppCompatActivity implements FlyyCheckInViewOfferStatus {
@Override
public void isFlyyCheckInOfferLive(boolean isLive) {
if (isLive) {
//Checkin offer is live, make your custom view visible
flyyCheckInView.setVisibility(View.VISIBLE);
} else {
//Checkin offer is not live, make your custom view gone
flyyCheckInView.setVisibility(View.GONE);
}
}
@Override
public void flyyCheckInError(String errorMessage) {
//you can hide your custom view here
Log.d(HomeFragment.class.getSimpleName(), "flyyCheckInError: " + errorMessage);
}
}
To give your own colors to the flyy custom checkin view, checkout the following example for custom parameters to be added in your xml layout file.
<theflyy.com.flyy.customview.FlyyCheckInView
android:id="@+id/flyy_checkin_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:fitsSystemWindows="true"
<!--to change color of checkin button text-->
app:checkin_btn_text_color="@color/colorPrimary"
<!--to change color of checkin title text-->
app:checkin_days_color="@color/colorPrimary"
<!--to change color of checkin description text-->
app:checkin_description_color="@color/colorPrimary"
<!--to change color of checkin earn text-->
app:checkin_earn_color="@color/colorPrimary"
<!--to change color of checkin days text-->
app:checkin_title_color="@color/colorPrimary" />
Updated about 3 years ago