//
// DO NOT EDIT THIS FILE, IT HAS BEEN GENERATED USING AndroidAnnotations 3.0.1.
//


package com.gitonway.fineday.activity;

import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.gitonway.fineday.MyApp_;
import com.gitonway.fineday.R.anim;
import com.gitonway.fineday.R.layout;
import com.gitonway.fineday.R.string;
import com.gitonway.fineday.adapter.CityAdapter_;
import com.gitonway.fineday.adapter.MyCityAapter_;
import com.gitonway.fineday.domain.model.CityModel;
import com.gitonway.fineday.widget.jazzylistview.JazzyListView;
import com.gitonway.fineday.widget.shimmer.ShimmerTextView;
import com.gitonway.fineday.widget.swipelistview.SwipeListView;
import org.androidannotations.api.BackgroundExecutor;
import org.androidannotations.api.view.HasViews;
import org.androidannotations.api.view.OnViewChangedListener;
import org.androidannotations.api.view.OnViewChangedNotifier;

public final class CitySelectionActivity_
    extends CitySelectionActivity
    implements HasViews, OnViewChangedListener
{

    private final OnViewChangedNotifier onViewChangedNotifier_ = new OnViewChangedNotifier();
    private Handler handler_ = new Handler(Looper.getMainLooper());

    @Override
    public void onCreate(Bundle savedInstanceState) {
        OnViewChangedNotifier previousNotifier = OnViewChangedNotifier.replaceNotifier(onViewChangedNotifier_);
        init_(savedInstanceState);
        super.onCreate(savedInstanceState);
        OnViewChangedNotifier.replaceNotifier(previousNotifier);
        setContentView(layout.activity_city_selection);
    }

    private void init_(Bundle savedInstanceState) {
        OnViewChangedNotifier.registerOnViewChangedListener(this);
        Resources resources_ = this.getResources();
        myCity = resources_.getString(string.my_city);
        selectCity = resources_.getString(string.select_city);
        fadeIn = AnimationUtils.loadAnimation(this, anim.fade_in);
        app = MyApp_.getInstance();
        getWindow().setFlags(android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN, android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN);
        adapterMyCity = MyCityAapter_.getInstance_(this);
        adapterTown = CityAdapter_.getInstance_(this);
        adapterProvince = CityAdapter_.getInstance_(this);
        adapterCity = CityAdapter_.getInstance_(this);
    }

    @Override
    public void setContentView(int layoutResID) {
        super.setContentView(layoutResID);
        onViewChangedNotifier_.notifyViewChanged(this);
    }

    @Override
    public void setContentView(View view, android.view.ViewGroup.LayoutParams params) {
        super.setContentView(view, params);
        onViewChangedNotifier_.notifyViewChanged(this);
    }

    @Override
    public void setContentView(View view) {
        super.setContentView(view);
        onViewChangedNotifier_.notifyViewChanged(this);
    }

    public static CitySelectionActivity_.IntentBuilder_ intent(Context context) {
        return new CitySelectionActivity_.IntentBuilder_(context);
    }

    public static CitySelectionActivity_.IntentBuilder_ intent(android.app.Fragment fragment) {
        return new CitySelectionActivity_.IntentBuilder_(fragment);
    }

    public static CitySelectionActivity_.IntentBuilder_ intent(android.support.v4.app.Fragment supportFragment) {
        return new CitySelectionActivity_.IntentBuilder_(supportFragment);
    }

    @Override
    public void onViewChanged(HasViews hasViews) {
        mLayoutCityTitle = ((LinearLayout) hasViews.findViewById(com.gitonway.fineday.R.id.cityTitle));
        c1 = ((TextView) hasViews.findViewById(com.gitonway.fineday.R.id.c1));
        mButtonAddCity = ((ImageButton) hasViews.findViewById(com.gitonway.fineday.R.id.addCity));
        mLayoutCityContent = ((LinearLayout) hasViews.findViewById(com.gitonway.fineday.R.id.cityContent));
        mListViewProvince = ((JazzyListView) hasViews.findViewById(com.gitonway.fineday.R.id.listProvince));
        mLayoutSelectCity = ((LinearLayout) hasViews.findViewById(com.gitonway.fineday.R.id.selectCity));
        mListViewMyCity = ((SwipeListView) hasViews.findViewById(com.gitonway.fineday.R.id.currentCityList));
        mListViewCurrentCity = ((ListView) hasViews.findViewById(com.gitonway.fineday.R.id.currentCityList));
        mTextViewTitle = ((ShimmerTextView) hasViews.findViewById(com.gitonway.fineday.R.id.currentCityTxt));
        c2 = ((TextView) hasViews.findViewById(com.gitonway.fineday.R.id.c2));
        mListViewTown = ((JazzyListView) hasViews.findViewById(com.gitonway.fineday.R.id.listTown));
        mLayoutCity = ((LinearLayout) hasViews.findViewById(com.gitonway.fineday.R.id.cityLayout));
        c3 = ((TextView) hasViews.findViewById(com.gitonway.fineday.R.id.c3));
        mListViewCity = ((JazzyListView) hasViews.findViewById(com.gitonway.fineday.R.id.listCity));
        {
            View view = hasViews.findViewById(com.gitonway.fineday.R.id.addCity);
            if (view!= null) {
                view.setOnClickListener(new OnClickListener() {


                    @Override
                    public void onClick(View view) {
                        CitySelectionActivity_.this.addCityClicked();
                    }

                }
                );
            }
        }
        {
            View view = hasViews.findViewById(com.gitonway.fineday.R.id.currentCityTxt);
            if (view!= null) {
                view.setOnClickListener(new OnClickListener() {


                    @Override
                    public void onClick(View view) {
                        CitySelectionActivity_.this.currentCityTxtClicked();
                    }

                }
                );
            }
        }
        {
            AdapterView<?> view = ((AdapterView<?> ) hasViews.findViewById(com.gitonway.fineday.R.id.listProvince));
            if (view!= null) {
                view.setOnItemClickListener(new OnItemClickListener() {


                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        CitySelectionActivity_.this.listProvinceItemClicked(((CityModel) parent.getAdapter().getItem(position)));
                    }

                }
                );
            }
        }
        {
            AdapterView<?> view = ((AdapterView<?> ) hasViews.findViewById(com.gitonway.fineday.R.id.listTown));
            if (view!= null) {
                view.setOnItemClickListener(new OnItemClickListener() {


                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        CitySelectionActivity_.this.listTownItemClicked(((CityModel) parent.getAdapter().getItem(position)));
                    }

                }
                );
            }
        }
        {
            AdapterView<?> view = ((AdapterView<?> ) hasViews.findViewById(com.gitonway.fineday.R.id.listCity));
            if (view!= null) {
                view.setOnItemClickListener(new OnItemClickListener() {


                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        CitySelectionActivity_.this.listCityItemClicked(((CityModel) parent.getAdapter().getItem(position)));
                    }

                }
                );
            }
        }
        initActivity();
    }

    @Override
    public void updateCityList(final List<CityModel> models, final String type) {
        handler_.post(new Runnable() {


            @Override
            public void run() {
                CitySelectionActivity_.super.updateCityList(models, type);
            }

        }
        );
    }

    @Override
    public void getCityList(final String type, final String cityid, final String jsonp) {
        BackgroundExecutor.execute(new BackgroundExecutor.Task("", 0, "") {


            @Override
            public void execute() {
                try {
                    CitySelectionActivity_.super.getCityList(type, cityid, jsonp);
                } catch (Throwable e) {
                    Thread.getDefaultUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
                }
            }

        }
        );
    }

    public static class IntentBuilder_ {

        private Context context_;
        private final Intent intent_;
        private android.app.Fragment fragment_;
        private android.support.v4.app.Fragment fragmentSupport_;

        public IntentBuilder_(Context context) {
            context_ = context;
            intent_ = new Intent(context, CitySelectionActivity_.class);
        }

        public IntentBuilder_(android.app.Fragment fragment) {
            fragment_ = fragment;
            context_ = fragment.getActivity();
            intent_ = new Intent(context_, CitySelectionActivity_.class);
        }

        public IntentBuilder_(android.support.v4.app.Fragment fragment) {
            fragmentSupport_ = fragment;
            context_ = fragment.getActivity();
            intent_ = new Intent(context_, CitySelectionActivity_.class);
        }

        public Intent get() {
            return intent_;
        }

        public CitySelectionActivity_.IntentBuilder_ flags(int flags) {
            intent_.setFlags(flags);
            return this;
        }

        public void start() {
            context_.startActivity(intent_);
        }

        public void startForResult(int requestCode) {
            if (fragmentSupport_!= null) {
                fragmentSupport_.startActivityForResult(intent_, requestCode);
            } else {
                if (fragment_!= null) {
                    fragment_.startActivityForResult(intent_, requestCode);
                } else {
                    if (context_ instanceof Activity) {
                        ((Activity) context_).startActivityForResult(intent_, requestCode);
                    } else {
                        context_.startActivity(intent_);
                    }
                }
            }
        }

    }

}
