package com.abhi.fyberdemo.fragments;


import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.EditText;

import com.abhi.fyberdemo.R;
import com.abhi.fyberdemo.listeners.FragmentListener;
import com.abhi.fyberdemo.listeners.OfferListener;
import com.abhi.fyberdemo.models.OfferResponse;
import com.abhi.fyberdemo.utilities.FiberController;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * A simple {@link Fragment} subclass.
 * Use the {@link FormFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class FormFragment extends BaseFragment {
    @BindView(R.id.edit_uid)
    protected EditText mUidEditText;
    @BindView(R.id.edit_api_key)
    protected EditText mApiKeyEditText;
    @BindView(R.id.edit_app_id)
    protected EditText mAppIdEditText;
    @BindView(R.id.edit_pub0)
    protected EditText mPub0EditText;

    private FragmentListener mFragmentListener;

    public FormFragment() {
        // Required empty public constructor
    }

    /**
     * Use this factory method to create a new instance of
     * this fragment using the provided parameters.
     *
     * @return A new instance of fragment FormFragment.
     */
    public static FormFragment newInstance(FragmentListener listener) {
        FormFragment _fragment = new FormFragment();
        _fragment.setFragmentListener(listener);
        return _fragment;
    }

    @Override
    protected void setupUI(View parent) {
        addDefaultData();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_form;
    }

    private void addDefaultData() {
        mUidEditText.setText("spiderman");
        mApiKeyEditText.setText("1c915e3b5d42d05136185030892fbb846c278927");
        mAppIdEditText.setText("2070");
        mPub0EditText.setText("MainActivity");
    }

    @OnClick(R.id.button_get_data)
    public void onGetDataClick(final View view) {
        String uid = mUidEditText.getText().toString();
        String apiKey = mApiKeyEditText.getText().toString();
        String appId = mAppIdEditText.getText().toString();
        String pub0 = mPub0EditText.getText().toString();

        view.setEnabled(false);
        getFragmentListener().onShowProgress();

        FiberController.getInstance().getOfferWall(uid, apiKey, appId, pub0, new OfferListener() {
            @Override
            public void onOfferReceived(OfferResponse response) {
                getFragmentListener().onOfferReceived(response);
                getFragmentListener().onHideProgress();
                view.setEnabled(true);
            }
        });
    }

    //region Accessors
    @Override
    public FragmentListener getFragmentListener() {
        return mFragmentListener;
    }

    @Override
    public void setFragmentListener(FragmentListener fragmentListener) {
        mFragmentListener = fragmentListener;
    }
    //endregion
}

@@ -73,16 +73,59 @@
 agment;%0A
+import android.support.v7.app.AlertDialog;%0A
 import a
@@ -2223,24 +2223,399 @@
 oString();%0A%0A
+        if (uid.isEmpty() %7C%7C apiKey.isEmpty() %7C%7C appId.isEmpty() %7C%7C pub0.isEmpty()) %7B%0A            new AlertDialog.Builder(getActivity())%0A                    .setTitle(%22Error%22)%0A                    .setMessage(%22All fields are necessary%22)%0A                    .setNeutralButton(%22OK%22, null)%0A                    .create()%0A                    .show();%0A            return;%0A        %7D%0A
         view

Add AlertDialog in FormFragment for empty fields