package com.rv.travel;

import android.app.Activity;

import com.base.utils.tools.android.IntentUtil;
import com.rv.travel.fragment.TravelFragmentCommitOrder;
import com.rv.travel.fragment.TravelWebFragment;
import com.rv.travel.other.OtherClickListener;
import com.rv.travel.other.OtherOption;
import com.rv.travel.other.TravelFragmentActivity;

public class GoOtherUtil {
    public static String travelDetailId = "0";

    //去旅游详情
    public static void goTravelDetailWeb(String id, Activity activity) {
        GoOtherUtil.travelDetailId = id;
        String url = "https://xxtest.upyuns.com/h5/appHtml/view/travelDetails.html?id=" + id;
        //TravelFragmentActivity.currentFragment = TravelWebFragment.getInstance(url);
        TravelFragmentActivity.currentFragment = TravelWebFragment.getInstance(url);
        OtherOption otherOption = new OtherOption();
        otherOption.setTitle("详情");
        otherOption.setClickListener(new OtherClickListener() {
            @Override
            public void onBack() {
                TravelFragmentActivity.getInstance().finish();

            }

            @Override
            public void onButton() {

            }
        });
        TravelFragmentActivity.option = otherOption;
        IntentUtil.goActivityWithAnimationAlpha(activity, TravelFragmentActivity.class);
    }

    //去确认订单
    public static void goTravelCommitOrder(String data,final Activity activity) {
        TravelFragmentActivity.currentFragment = TravelFragmentCommitOrder.getInstance(data);
        OtherOption otherOption = new OtherOption();
        otherOption.setTitle("确认下单");
        otherOption.setClickListener(new OtherClickListener() {
            @Override
            public void onBack() {
                GoOtherUtil.goTravelDetailWeb(GoOtherUtil.travelDetailId, activity);
            }

            @Override
            public void onButton() {

            }
        });
        TravelFragmentActivity.option = otherOption;
        IntentUtil.goActivityWithAnimationAlpha(activity, TravelFragmentActivity.class);
    }
}
