package com.liangmayong.superandroid;

import android.os.Bundle;
import android.os.Handler;
import android.view.View;

import com.liangmayong.base.BaseActivity;
import com.liangmayong.base.bind.annotations.ColorId;
import com.liangmayong.base.bind.annotations.Layout;
import com.liangmayong.base.bind.annotations.Title;
import com.liangmayong.base.widget.iconfont.Icon;
import com.liangmayong.base.widget.pullrefresh.PullRefreshLayout;
import com.liangmayong.base.widget.pullrefresh.drawables.PictureDrawable;
import com.liangmayong.loading.Loading;
import com.liangmayong.preferences.annotations.PreferenceValue;

@Layout(R.layout.activity_main)
public class MainActivity extends BaseActivity {

    @PreferenceValue("key")
    String app_name;

    @ColorId
    int colorPrimary;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setThemeColor(colorPrimary);
        // getDefualtToolbar().setTitle(app_name);


        getDefualtToolbar().leftOne().iconToLeft(Icon.icon_back).clicked(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        getDefualtToolbar().leftTwo().iconToRight(Icon.icon_filter);
        getDefualtToolbar().leftThree().iconToRight(Icon.icon_message);
        getDefualtToolbar().rightOne().iconToRight(Icon.icon_menu);
        getDefualtToolbar().rightTwo().iconToRight(Icon.icon_edit);
        getDefualtToolbar().rightThree().iconToRight(Icon.icon_location);
        getDefualtToolbar().rightFour().iconToRight(Icon.icon_about);
//        goTo("百度一下", "http://www.baidu.com");

        final PullRefreshLayout pullRefreshLayout = (PullRefreshLayout) findViewById(R.id.pull);
        PictureDrawable pictureDrawable = new PictureDrawable(pullRefreshLayout, R.mipmap.loading_bee, R.mipmap.loading_bee1, R.mipmap.loading_bee2, R.mipmap.loading_bee3, R.mipmap.loading_bee4, R.mipmap.loading_bee5, R.mipmap.loading_bee6);
        pullRefreshLayout.setRefreshDrawable(pictureDrawable);
        pullRefreshLayout.setOnRefreshListener(new PullRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                Loading.showLoading(MainActivity.this, "开始加载数据");
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        pullRefreshLayout.setRefreshing(false);
                        Loading.cancelLoading(MainActivity.this);
                    }
                }, 5000);
            }
        });

    }
}

@@ -640,16 +640,38 @@
 y_main)%0A
+@Title(%22AndroidBase%22)%0A
 public c
@@ -1577,78 +1577,8 @@
 n);%0A
-        getDefualtToolbar().rightFour().iconToRight(Icon.icon_about);%0A
 //  

edit defualt toolbar