<repo_name>blythe104/looking<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/main/fragment/MusicFragment.java
package com.looking.classicalparty.moudles.main.fragment;

import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.google.gson.Gson;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.looking.classicalparty.R;
import com.looking.classicalparty.lib.base.fragment.BaseFragment;
import com.looking.classicalparty.lib.constants.ConstantApi;
import com.looking.classicalparty.lib.constants.StringContants;
import com.looking.classicalparty.lib.http.HttpUtils;
import com.looking.classicalparty.lib.http.Param;
import com.looking.classicalparty.lib.http.ResultCallback;
import com.looking.classicalparty.lib.utils.SharedPreUtils;
import com.looking.classicalparty.moudles.music.adapter.MusicAdapter;
import com.looking.classicalparty.moudles.music.bean.MusicDetailBean;
import com.looking.classicalparty.moudles.music.dialog.MusicDetailDialog;
import com.looking.classicalparty.moudles.music.dialog.MusicDialog;
import com.squareup.okhttp.Request;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xin on 2016/10/19.
 */
public class MusicFragment extends BaseFragment implements View.OnClickListener {
    
    private ListView lv_music;
    private List<MusicDetailBean.ActivityEntity> musicDatas;
    private MusicAdapter musicAdapter;
    private int curPage = 1;
    private View loadMoreFoot;
    private LinearLayout loadMore;
    private TextView mTvDesc;
    private int totalPage;
    private ImageButton btnListener;
    private TextView music_name;
    private PullToRefreshListView plistview_music;
    
    @Override
    public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.music_fragment_layout, null);
        
        
        lv_music = (ListView) view.findViewById(R.id.listview_music);
        
        plistview_music = (PullToRefreshListView) view.findViewById(R.id.plistview_music);
        
        music_name = (TextView) view.findViewById(R.id.music_name);
        
        btnListener = (ImageButton) view.findViewById(R.id.btn_listener);
        loadMoreFoot = View.inflate(getActivity(), R.layout.ll_foot_layout, null);
        loadMore = (LinearLayout) loadMoreFoot.findViewById(R.id.ll_load_more);
        mTvDesc = (TextView) loadMoreFoot.findViewById(R.id.tv_desc);
        
        lv_music.addFooterView(loadMoreFoot);
        
        musicDatas = new ArrayList<>();
        musicAdapter = new MusicAdapter(getActivity(), musicDatas);
        lv_music.setAdapter(musicAdapter);
        
        plistview_music.setAdapter(musicAdapter);
        plistview_music.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
            @Override
            public void onPullDownToRefresh(PullToRefreshBase<ListView> pullToRefreshBase) {
                musicDatas.clear();
                getMusicDatas(1);
                new FinishRefresh().execute();
            }
            
            @Override
            public void onPullUpToRefresh(PullToRefreshBase<ListView> pullToRefreshBase) {
                if (curPage < totalPage) {
                    getMusicDatas(++curPage);
                }
                musicAdapter.notifyDataSetChanged();
                
                new FinishRefresh().execute();
                
            }
        });
        loadMore.setOnClickListener(this);
        musicAdapter.setMusicListener(new MusicAdapter.MusicListener() {
            @Override
            public void showListenerDialog(int position) {
                musicDialog("http://www.jingdian.party/" + musicDatas.get(position).getCover_path(), "http://www" +
                        "" + ".jingdian.party/" + musicDatas.get(position).getV_path(), musicDatas.get(position)
                        .getTitle(), musicDatas.get(position).getDirector());
            }
            
            @Override
            public void showMusicDetail(int position) {
                
                musicDetail(musicDatas.get(position).getTitle(),musicDatas.get(position).getDirector(),musicDatas.get(position).getSummary());
                
            }
        });
        return view;
    }
    
    private void musicDetail(String title,String singer,String summary) {
        MusicDetailDialog musicDetailDialog = new MusicDetailDialog(getActivity());
        musicDetailDialog.show();
        musicDetailDialog.initMusicData(title,singer,summary);
    }
    
    private void musicDialog(String imgPath, String path, String title, String singer) {
        MusicDialog musicDialog = new MusicDialog(getActivity());
        musicDialog.show();
        musicDialog.initMusicData(imgPath, path, title, singer);
    }
    
    @Override
    public void loadData() {
        super.loadData();
        //首次加载第一页的数据
        getMusicDatas(1);
    }
    
    /**
     * 获取音乐列表数据
     */
    private void getMusicDatas(int curPages) {
        List<Param> paramList = new ArrayList<>();
        Param key = new Param("key", SharedPreUtils.getString(StringContants.KEY));
        Param page = new Param("page", curPages + "");
        Param pageCount = new Param("pageCount", 10 + "");
        paramList.add(key);
        paramList.add(page);
        paramList.add(pageCount);
        HttpUtils.post(ConstantApi.MUSIC, paramList, new ResultCallback() {
            @Override
            public void onSuccess(Object response) {
                MusicDetailBean musicDetailBean = new Gson().fromJson(response.toString(), MusicDetailBean.class);
                Log.d("musicDetail---", musicDetailBean.toString());
                if (musicDetailBean.getResult() == 200) {
                    musicDatas.addAll(musicDetailBean.getActivity());
                }
                totalPage = musicDetailBean.getTotalPage();
                curPage = Integer.parseInt(musicDetailBean.getCurrPage());
                
                musicAdapter.notifyDataSetChanged();
                plistview_music.onRefreshComplete();
                
            }
            
            @Override
            public void onFailure(Request request, Exception e) {
                
            }
            
            @Override
            public void onNoNetWork(String resultMsg) {
                
            }
        });
    }
    
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ll_load_more:
                curPage++;
                if (curPage <= totalPage) {
                    getMusicDatas(curPage);
                } else {
                    mTvDesc.setText("已加载全部");
                    mTvDesc.setTextColor(Color.parseColor("#8c909d"));
                }
                break;
        }
        
    }
    
    private class FinishRefresh extends AsyncTask<Void, Void, Void> {
        @Override
        protected Void doInBackground(Void... params) {
            return null;
        }
        
        @Override
        protected void onPreExecute() {
            plistview_music.onRefreshComplete();
            super.onPreExecute();
        }
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/main/fragment/MovieFragment.java
package com.looking.classicalparty.moudles.main.fragment;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.gson.Gson;
import com.looking.classicalparty.R;
import com.looking.classicalparty.lib.base.fragment.BaseFragment;
import com.looking.classicalparty.lib.constants.ConstantApi;
import com.looking.classicalparty.lib.constants.StringContants;
import com.looking.classicalparty.lib.http.HttpUtils;
import com.looking.classicalparty.lib.http.Param;
import com.looking.classicalparty.lib.http.ResultCallback;
import com.looking.classicalparty.lib.utils.SharedPreUtils;
import com.looking.classicalparty.moudles.movie.adapter.SimpleFragmentPagerAdapter;
import com.looking.classicalparty.moudles.movie.bean.CategoryBean;
import com.squareup.okhttp.Request;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xin on 2016/10/19.
 */
public class MovieFragment extends BaseFragment implements TabLayout.OnTabSelectedListener {

    List<CategoryBean.CategoryEntity> categoryBeen;
    private TabLayout mTab;
    private ViewPager mViewPager;
    private SimpleFragmentPagerAdapter fragmentPagerAdapter;

    @Override
    public View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.movie_fragment_layout, null);
        mTab = (TabLayout) view.findViewById(R.id.tab);
        mViewPager = (ViewPager) view.findViewById(R.id.viewpager);
        categoryBeen = new ArrayList<>();

        fragmentPagerAdapter = new SimpleFragmentPagerAdapter(getFragmentManager(), getActivity(), categoryBeen);
        mViewPager.setAdapter(fragmentPagerAdapter);
        mTab.setOnTabSelectedListener(this);
        mTab.setupWithViewPager(mViewPager);

        return view;

    }

    @Override
    protected void loadData() {
        super.loadData();
        getCategory();
    }

    @Override
    public void onTabSelected(TabLayout.Tab tab) {
        //设置viewpager与tab的位置同步变化
        mViewPager.setCurrentItem(tab.getPosition());

    }

    @Override
    public void onTabUnselected(TabLayout.Tab tab) {

    }

    @Override
    public void onTabReselected(TabLayout.Tab tab) {

    }

    /**
     * 获取类别列表
     */
    private void getCategory() {
        List<Param> paramList = new ArrayList<>();
        Param key = new Param("key", SharedPreUtils.getString(StringContants.KEY));
        paramList.add(key);

        HttpUtils.post(ConstantApi.CATEGORY, paramList, new ResultCallback() {
            @Override
            public void onSuccess(Object response) {
                CategoryBean categoryBean = new Gson().fromJson(response.toString(), CategoryBean.class);
                if (categoryBean.getResult() == 200) {
                    categoryBeen.addAll(categoryBean.getCategory());
                }
                fragmentPagerAdapter.notifyDataSetChanged();
            }

            @Override
            public void onFailure(Request request, Exception e) {

            }

            @Override
            public void onNoNetWork(String resultMsg) {

            }
        });
    }
}
<file_sep>/app/build.gradle
apply plugin: 'com.android.application'

android {
    useLibrary 'org.apache.http.legacy'
    compileSdkVersion 'Google Inc.:Google APIs:24'
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.looking.classicalparty"
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        jackOptions {
            enabled true
        }
        ndk {
            // 设置支持的 SO 库构架，一般而言，取你所有的库支持的构架的`交集`。
            abiFilters 'armeabi' // 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64', 'mips', 'mips64'
        }
    }
    //应用 Bugtags 插件
    apply plugin: 'com.bugtags.library.plugin'

    bugtags {
        appKey "<KEY>" //这里是你的 appKey
        appSecret "d7ef6550ecafbe1a5e943dada811aeb6" //这里是你的 appSecret，管理员在设置页可以查看
        mappingUploadEnabled true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    signingConfigs {
        debugConfig {
            keyAlias 'classical'
            keyPassword '<PASSWORD>' //System.console().readLine(" :input keyPassword : ")
            storeFile file('../classical.jks')
            storePassword '<PASSWORD>' //System.console().readLine(" :input storePassword : ");
        }

        releaseConfig {
            keyAlias 'classical'
            keyPassword '<PASSWORD>' //System.console().readLine(" :input keyPassword : ")
            storeFile file('../classical.jks')
            storePassword '<PASSWORD>' //System.console().readLine(" :input storePassword : ");
        }
    }

    //修改生成的apk名字
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def oldFile = output.outputFile
            if (variant.buildType.name.equals('release')) {
                def releaseApkName = 'classical-v' + defaultConfig.versionName + '-' + productFlavors.name + '.apk'
                output.outputFile = new File(oldFile.parent, releaseApkName)
            } else if (variant.buildType.name.equals('debug')) {
                //                def releaseApkName = getDebugApkName()
                //                output.outputFile = new File(oldFile.parent, releaseApkName)
            }

        }
    }
    buildTypes {
        release {
            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            resValue("string", "app_name", "classical")
            //            buildConfigField "String", "BASE_URL", "http://www.jingdian.party/api/"

        }

        //修改生成的apk名字
        applicationVariants.all { variant ->
            variant.outputs.each { output ->
                def oldFile = output.outputFile
                if (variant.buildType.name.equals('release')) {
                    def releaseApkName = 'classical-v' + defaultConfig.versionName + '-' + productFlavors.name + '.apk'
                    output.outputFile = new File(oldFile.parent, releaseApkName)
                } else if (variant.buildType.name.equals('debug')) {
                    def releaseApkName = getDebugApkName()
                    output.outputFile = new File(oldFile.parent, releaseApkName)
                }
            }
        }


        debug {
            minifyEnabled false
            resValue("string", "app_name", "classical")
            //            buildConfigField "String", "BASE_URL", "http://www.jingdian.party/api/"
            signingConfig signingConfigs.debugConfig

        }
    }
}


def releaseTime() {
    new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("UTC"));
}

def getDebugApkName() {
    'classicalParty-v' + android.defaultConfig.versionName + '-' + "(" + releaseTime() + ")" + '-' + '01' + '.apk'
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile('de.keyboardsurfer.android.widget:crouton:1.8.4@aar') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
    //时间选择控件
    //二维码生成
    compile files('libs/zxing.jar')
    //banner依赖库
    compile 'com.squareup.okhttp:okhttp:2.7.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.android.support:design:25.1.0'
    compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2'
    compile 'com.youth.banner:banner:1.4.9'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.github.tgioihan:imageloader:1.0.3'
    compile 'com.bugtags.library:bugtags-lib:latest.integration'
    compile 'me.wcy:lrcview:1.4.1'
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.github.userswlwork:pull-to-refresh:1.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    //日历控件
    compile 'com.joybar.calendar:librarycalendar:1.0.5'
    testCompile 'junit:junit:4.12'

}
//配置lambda表达式
buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:3.2.5'
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/login/observer/SubjectListener.java
package com.looking.classicalparty.moudles.login.observer;

/**
 * Created by xin on 2017/4/12.
 */

public interface SubjectListener {
    void add(ObserverListener observerListener);
    
    void notifyObserver(int status);
    
    void remove(ObserverListener observerListener);
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/mine/dialog/ChooiseDateDialog.java
package com.looking.classicalparty.moudles.mine.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.DatePicker;

import com.looking.classicalparty.R;

import java.util.Calendar;

/**
 * Created by xin on 2016/10/28.
 */

public class ChooiseDateDialog extends Dialog {
    
    private DatePicker datePicker;
    private Calendar calendar;
    private int year;
    private int month;
    private int day;
    private  onDateSetListener listener;
    
    public ChooiseDateDialog(Context context) {
        this(context, R.style.base_dialog_theme);
    }
    
    public ChooiseDateDialog(Context context, int themeResId) {
        super(context, themeResId);
    }
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.chooise_date_layout);
        datePicker = (DatePicker) findViewById(R.id.datePicker);
        calendar = Calendar.getInstance();
        year = calendar.get(Calendar.YEAR);
        month = calendar.get(Calendar.MONTH) + 1;
        day = calendar.get(Calendar.DAY_OF_MONTH);
    }
    
    public void setDateListener(onDateSetListener listener){
        this.listener=listener;
    }
    
    public interface onDateSetListener{
        void setDate(int year,int month,int day);
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/movie/fragment/PageFragment.java
package com.looking.classicalparty.moudles.movie.fragment;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.google.gson.Gson;
import com.looking.classicalparty.R;
import com.looking.classicalparty.lib.base.fragment.BaseFragment;
import com.looking.classicalparty.lib.constants.ConstantApi;
import com.looking.classicalparty.lib.constants.StringContants;
import com.looking.classicalparty.lib.http.HttpUtils;
import com.looking.classicalparty.lib.http.Param;
import com.looking.classicalparty.lib.http.ResultCallback;
import com.looking.classicalparty.lib.utils.SharedPreUtils;
import com.looking.classicalparty.moudles.movie.adapter.VideoAdapter;
import com.looking.classicalparty.moudles.movie.bean.GetVideoBean;
import com.looking.classicalparty.moudles.movie.view.MovieDetailActivity;
import com.squareup.okhttp.Request;

import java.util.ArrayList;
import java.util.List;

public class PageFragment extends BaseFragment implements View.OnClickListener {

    public static final String ARG_PAGE = "ARG_PAGE";
    List<GetVideoBean.ActivityEntity> videoDatas;
    int curPage = 1;
    private String mVid;
    private ListView llVideo;
    private int totalPage;
    private VideoAdapter videoAdapter;
    private View loadMoreFoot;
    private LinearLayout loadMore;
    private TextView mTvDesc;

    public static PageFragment newInstance(int page, String vid) {
        Bundle args = new Bundle();
        args.putString(ARG_PAGE, vid);
        PageFragment pageFragment = new PageFragment();
        pageFragment.setArguments(args);
        return pageFragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mVid = getArguments().getString(ARG_PAGE);
    }


    @Override
    protected View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_page, container, false);
        llVideo = (ListView) view.findViewById(R.id.ll_video);

        loadMoreFoot = View.inflate(getActivity(), R.layout.ll_foot_layout, null);
        loadMore = (LinearLayout) loadMoreFoot.findViewById(R.id.ll_load_more);
        mTvDesc = (TextView) loadMoreFoot.findViewById(R.id.tv_desc);

        llVideo.addFooterView(loadMoreFoot);

        videoDatas = new ArrayList<>();
        videoAdapter = new VideoAdapter(getActivity(), videoDatas);
        llVideo.setAdapter(videoAdapter);
        loadMore.setOnClickListener(this);
        llVideo.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent detailIntent = new Intent(getActivity(), MovieDetailActivity.class);
                detailIntent.putExtra("id", videoDatas.get(position).getId());
                startActivity(detailIntent);

            }
        });
        return view;
    }

    @Override
    protected void loadData() {
        super.loadData();
        getVideoDatas(curPage, mVid);
    }

    /**
     * 获取音乐列表数据
     */
    private void getVideoDatas(int curPage, String vid) {
        List<Param> paramList = new ArrayList<>();
        Param key = new Param("key", SharedPreUtils.getString(StringContants.KEY));
        Param page = new Param("page", curPage + "");
        Param videoid = new Param("cate_id", vid);
        Param pageCount = new Param("pageCount", 10 + "");
        paramList.add(key);
        paramList.add(page);
        paramList.add(pageCount);
        paramList.add(videoid);
        HttpUtils.post(ConstantApi.VIDEO, paramList, new ResultCallback() {
            @Override
            public void onSuccess(Object response) {
                GetVideoBean getVideoBean = new Gson().fromJson(response.toString(), GetVideoBean.class);
                if (getVideoBean.getResult() == 200) {
                    videoDatas.addAll(getVideoBean.getActivity());
                }
                totalPage = getVideoBean.getTotalPage();
                videoAdapter.notifyDataSetChanged();
            }

            @Override
            public void onFailure(Request request, Exception e) {

            }

            @Override
            public void onNoNetWork(String resultMsg) {

            }
        });
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.ll_load_more:
                curPage++;
                if (curPage <= totalPage) {
                    getVideoDatas(curPage, mVid);
                } else {
                    mTvDesc.setText("已加载全部");
                    mTvDesc.setTextColor(Color.parseColor("#8c909d"));
                }
                break;
        }


    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/login/bean/UserBean.java
package com.looking.classicalparty.moudles.login.bean;

import com.looking.classicalparty.lib.base.Bean.BaseBean;

/**
 * Created by xin on 2016/10/19.
 */
public class UserBean extends BaseBean {


    /**
     * token :
     * user :
     */

    private String token;
    /**
     * mid : 11
     * musername : blythe
     */

    private UserEntity user;

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public UserEntity getUser() {
        return user;
    }

    public void setUser(UserEntity user) {
        this.user = user;
    }


    public static class UserEntity {
        private String mid;
        private String musername;

        public String getMid() {
            return mid;
        }

        public void setMid(String mid) {
            this.mid = mid;
        }

        public String getMusername() {
            return musername;
        }

        public void setMusername(String musername) {
            this.musername = musername;
        }
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/lib/ui/BaseUi.java
package com.looking.classicalparty.lib.ui;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;

import com.looking.classicalparty.lib.listener.IUIListener;


/**
 * Created by  chuangtou on 16/7/18.
 * 国丞创投
 */
public abstract class BaseUi extends LinearLayout implements IUIListener {

    protected LayoutInflater mInflater;
    protected View rootView;

    public BaseUi(Context context) {
        super(context);
        mInflater = LayoutInflater.from(getContext());
        initView();
    }

    public BaseUi(Context context, AttributeSet attrs) {
        super(context, attrs);
        mInflater = LayoutInflater.from(getContext());
        initView();
    }

    public BaseUi(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mInflater = LayoutInflater.from(getContext());
        initView();
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/lib/widget/CustomBaseInterface.java
package com.looking.classicalparty.lib.widget;

/**
 * Created by xin on 2016/10/20.
 */
public interface CustomBaseInterface {
    public void setMenuName(String menuName);
    public void setIcon(int rid);
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/find/bean/ReviewsBean.java
package com.looking.classicalparty.moudles.find.bean;

/**
 * Created by xin on 2017/3/29.
 */

public class ReviewsBean  {
        private String id;
        private String title;
        private String director;
        private String cover_path;
        private String summary;
        private String vscreate_time;
        private String musername;
        private String url;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getDirector() {
            return director;
        }

        public void setDirector(String director) {
            this.director = director;
        }

        public String getCover_path() {
            return cover_path;
        }

        public void setCover_path(String cover_path) {
            this.cover_path = cover_path;
        }

        public String getSummary() {
            return summary;
        }

        public void setSummary(String summary) {
            this.summary = summary;
        }

        public String getVscreate_time() {
            return vscreate_time;
        }

        public void setVscreate_time(String vscreate_time) {
            this.vscreate_time = vscreate_time;
        }

        public String getMusername() {
            return musername;
        }

        public void setMusername(String musername) {
            this.musername = musername;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/mine/dialog/ChooiseGenderDialog.java
package com.looking.classicalparty.moudles.mine.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;

import com.looking.classicalparty.R;

/**
 * Created by xin on 2016/10/28.
 */

public class ChooiseGenderDialog extends Dialog {

    public ChooiseGenderDialog(Context context) {
        this(context, R.style.base_dialog_theme);
    }

    public ChooiseGenderDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.change_gender_layout);
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/movie/adapter/VideoAdapter.java
package com.looking.classicalparty.moudles.movie.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.looking.classicalparty.R;
import com.looking.classicalparty.lib.utils.ImageLoaderUtils;
import com.looking.classicalparty.moudles.movie.bean.GetVideoBean;

import java.util.List;

/**
 * Created by xin on 2017/3/29.
 */

public class VideoAdapter extends BaseAdapter {
    private Context context;
    
    private List<GetVideoBean.ActivityEntity> musicDatas;
    
    public VideoAdapter(Context context, List<GetVideoBean.ActivityEntity> musicDatas) {
        this.context = context;
        this.musicDatas = musicDatas;
    }
    
    @Override
    public int getCount() {
        if (null == musicDatas) {
            return 0;
        }
        return musicDatas.size();
    }
    
    @Override
    public GetVideoBean.ActivityEntity getItem(int position) {
        return musicDatas.get(position);
    }
    
    @Override
    public long getItemId(int position) {
        return position;
    }
    
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder mViewHolder = null;
        
        if (null == convertView) {
            mViewHolder = new ViewHolder();
            convertView = View.inflate(context, R.layout.item_movie_layout, null);
            mViewHolder.iv_movie = (ImageView) convertView.findViewById(R.id.iv_movie);
            mViewHolder.movie = (TextView) convertView.findViewById(R.id.movie);
            mViewHolder.score = (TextView) convertView.findViewById(R.id.score);
            mViewHolder.director = (TextView) convertView.findViewById(R.id.director);
            mViewHolder.actors = (TextView) convertView.findViewById(R.id.actors);
            mViewHolder.musername = (TextView) convertView.findViewById(R.id.musername);
            
            convertView.setTag(mViewHolder);
        } else {
            mViewHolder = (ViewHolder) convertView.getTag();
        }
        ImageLoaderUtils.display(context, "http://www.jingdian.party/" + musicDatas.get(position).getCover_path(),
                mViewHolder.iv_movie);
        mViewHolder.movie.setText(musicDatas.get(position).getTitle());
        mViewHolder.director.setText("导演：" + musicDatas.get(position).getDirector());
        mViewHolder.score.setText(musicDatas.get(position).getScores());
        mViewHolder.actors.setText("演员：" + musicDatas.get(position).getActors());
        String musername;
        if (TextUtils.isEmpty(musicDatas.get(position).getMusername())) {
            musername = "classical";
        } else {
            musername = musicDatas.get(position).getMusername();
        }
        mViewHolder.musername.setText("推荐者：" + musername);
        
        return convertView;
    }
    
    static class ViewHolder {
        
        public TextView movie;
        public ImageView iv_movie;
        public TextView score;
        public TextView director;
        public TextView actors;
        public TextView musername;
        
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/mine/bean/VersionBean.java
package com.looking.classicalparty.moudles.mine.bean;

/**
 * Created by xin on 2017/4/11.
 */

public class VersionBean {
    /**
     * versionName : 经典party-安卓版-1.0
     * versionCode : 1.0
     * versionRemark : 版本描述
     * versionFile : 暂无
     */
    
    private String versionName;
    private String versionCode;
    private String versionRemark;
    private String versionFile;
    
    public String getVersionName() {
        return versionName;
    }
    
    public void setVersionName(String versionName) {
        this.versionName = versionName;
    }
    
    public String getVersionCode() {
        return versionCode;
    }
    
    public void setVersionCode(String versionCode) {
        this.versionCode = versionCode;
    }
    
    public String getVersionRemark() {
        return versionRemark;
    }
    
    public void setVersionRemark(String versionRemark) {
        this.versionRemark = versionRemark;
    }
    
    public String getVersionFile() {
        return versionFile;
    }
    
    public void setVersionFile(String versionFile) {
        this.versionFile = versionFile;
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/lib/common/UserInfo.java
package com.looking.classicalparty.lib.common;

import android.content.Context;

import com.looking.classicalparty.lib.constants.StringContants;
import com.looking.classicalparty.lib.utils.SharedPreUtils;

/**
 * Created by xin on 2016/10/24.
 */
public class UserInfo {
    String token = "";
    private Context context;

    public UserInfo() {
        token = SharedPreUtils.getString(StringContants.TOKEN,"");
    }


    public void clear() {
        SharedPreUtils.saveString(StringContants.TOKEN, "");
    }

    public boolean isLogin() {
        if (null == token) {
            return false;
        }
        if ("".equals(token)) {
            return false;
        }
        if (token.isEmpty()) {
            return false;
        }
        return true;
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/register/view/RegisterActivity.java
package com.looking.classicalparty.moudles.register.view;

import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.google.gson.Gson;
import com.looking.classicalparty.R;
import com.looking.classicalparty.lib.base.Bean.BaseBean;
import com.looking.classicalparty.lib.base.activity.BaseActivity;
import com.looking.classicalparty.lib.constants.ConstantApi;
import com.looking.classicalparty.lib.constants.StringContants;
import com.looking.classicalparty.lib.http.HttpUtils;
import com.looking.classicalparty.lib.http.Param;
import com.looking.classicalparty.lib.http.ResultCallback;
import com.looking.classicalparty.lib.ui.TitleBar;
import com.looking.classicalparty.lib.utils.SharedPreUtils;
import com.looking.classicalparty.moudles.login.view.LoginActivity;
import com.looking.classicalparty.moudles.register.bean.RegisterBean;
import com.squareup.okhttp.Request;

import java.util.ArrayList;
import java.util.List;

import de.keyboardsurfer.android.widget.crouton.Crouton;
import de.keyboardsurfer.android.widget.crouton.Style;

public class RegisterActivity extends BaseActivity {
    
    
    private Button btn_Register;
    private EditText mEtUserName;
    private EditText mEtPassword;
    private TitleBar mTitle;
    
    @Override
    public void initView() {
        setContentView(R.layout.activity_register);
        mTitle = (TitleBar) findViewById(R.id.title_bar);
        btn_Register = (Button) findViewById(R.id.btn_register);
        mEtUserName = (EditText) findViewById(R.id.username);
        mEtPassword = (EditText) findViewById(R.id.password);
        btn_Register.setOnClickListener(this);
    }
    
    @Override
    public void initListener() {
        
        mTitle.setOnClickListener(new TitleBar.OnClickListener() {
            @Override
            public void OnLeftClick() {
                finish();
                
            }
            
            @Override
            public void OnRightClick() {
            }
        });
        
        
    }
    
    @Override
    public void initData() {
        mTitle.setTitle("注册");
    }
    
    /**
     * 检测用户名是否可用
     *
     * @param username
     */
    public void checkUser(String username, String pwd) {
        List<Param> paramList = new ArrayList<>();
        Param key = new Param("key", SharedPreUtils.getString(StringContants.KEY, ""));
        Param musername = new Param("musername", username);
        paramList.add(key);
        paramList.add(musername);
        HttpUtils.post(ConstantApi.checkUser, paramList, new ResultCallback() {
            @Override
            public void onSuccess(Object response) {
                BaseBean baseBean = new Gson().fromJson(response.toString(), BaseBean.class);
                Log.d("check----", baseBean.toString());
                if (baseBean.getResult() == 200) {
                    //调用注册接口
                    userRegister(username, pwd);
                } else {
                    //该用户名存在
                    Toast.makeText(RegisterActivity.this, "该用户名已经存在", Toast.LENGTH_SHORT).show();
                }
            }
            
            @Override
            public void onFailure(Request request, Exception e) {
                
            }
            
            @Override
            public void onNoNetWork(String resultMsg) {
                
            }
        });
    }
    
    /**
     * 注册接口
     *
     * @param username
     * @param pwd
     */
    private void userRegister(String username, String pwd) {
        List<Param> paramlist = new ArrayList<>();
        Param key = new Param("key", SharedPreUtils.getString(StringContants.KEY));
        Param name = new Param("musername", username);
        Param password = new Param("mpassword", pwd);
        Param mmobile = new Param("mmobile", "");
        paramlist.add(mmobile);
        paramlist.add(name);
        paramlist.add(key);
        paramlist.add(password);
        HttpUtils.post(ConstantApi.register, paramlist, new ResultCallback() {
            @Override
            public void onSuccess(Object response) {
                Log.d("register---", response.toString());
                RegisterBean registerBean = new Gson().fromJson(response.toString(), RegisterBean.class);
                if (registerBean.getResult() == 200) {
                    Toast.makeText(RegisterActivity.this, "注册成功,请登录", Toast.LENGTH_SHORT).show();
                    startActivity(new Intent(RegisterActivity.this, LoginActivity.class));
                } else {
                    Toast.makeText(RegisterActivity.this, "注册失败", Toast.LENGTH_SHORT).show();
                }
                
            }
            
            @Override
            public void onFailure(Request request, Exception e) {
                
            }
            
            @Override
            public void onNoNetWork(String resultMsg) {
                
            }
        });
    }
    
    
    @Override
    public void processClick(View v) {
        switch (v.getId()) {
            case R.id.btn_register:
                //检测用户名是否可用
                String username = mEtUserName.getText().toString().trim();
                String password = <PASSWORD>().<PASSWORD>();
                if (!TextUtils.isEmpty(username)) {
                    if (TextUtils.isEmpty(password)) {
                        Crouton.makeText(RegisterActivity.this, "密码不能为空", Style.CONFIRM).show();
                    } else {
                        checkUser(username, password);
                    }
                    
                } else {
                    Crouton.makeText(RegisterActivity.this, "用户名不能为空", Style.CONFIRM).show();
                }
                break;
        }
        
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/mine/view/PersonalActivity.java
package com.looking.classicalparty.moudles.mine.view;

import android.Manifest;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.hardware.Camera;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.fourmob.datetimepicker.date.DatePickerDialog;
import com.google.gson.Gson;
import com.joybar.librarycalendar.data.CalendarDate;
import com.joybar.librarycalendar.fragment.CalendarViewFragment;
import com.joybar.librarycalendar.fragment.CalendarViewPagerFragment;
import com.looking.classicalparty.R;
import com.looking.classicalparty.lib.base.activity.BaseActivity;
import com.looking.classicalparty.lib.constants.ConstantApi;
import com.looking.classicalparty.lib.constants.StringContants;
import com.looking.classicalparty.lib.http.HttpUtils;
import com.looking.classicalparty.lib.http.Param;
import com.looking.classicalparty.lib.http.ResultCallback;
import com.looking.classicalparty.lib.utils.FileSizeUtil;
import com.looking.classicalparty.lib.utils.GetPathUri4kitk;
import com.looking.classicalparty.lib.utils.ImageLoaderUtils;
import com.looking.classicalparty.lib.utils.LogUtils;
import com.looking.classicalparty.lib.utils.SDCardUtils;
import com.looking.classicalparty.lib.utils.SharedPreUtils;
import com.looking.classicalparty.lib.widget.CircleImageView;
import com.looking.classicalparty.moudles.mine.PersonBean;
import com.looking.classicalparty.moudles.mine.bean.MemberBean;
import com.looking.classicalparty.moudles.mine.bean.UploadAvaBean;
import com.looking.classicalparty.moudles.mine.dialog.ChooiseDateDialog;
import com.looking.classicalparty.moudles.mine.dialog.ChooiseGenderDialog;
import com.looking.classicalparty.moudles.mine.dialog.ChooisePhotoDialog;
import com.looking.classicalparty.moudles.mine.dialog.NicknameDialog;
import com.looking.classicalparty.moudles.mine.observer.ConcreteSubject;
import com.looking.classicalparty.moudles.mine.observer.Observer;
import com.squareup.okhttp.Request;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import de.keyboardsurfer.android.widget.crouton.Crouton;
import de.keyboardsurfer.android.widget.crouton.Style;

public class PersonalActivity extends BaseActivity implements CalendarViewPagerFragment.OnPageChangeListener, 
        CalendarViewFragment.OnDateClickListener, CalendarViewFragment.OnDateCancelListener {
    
    
    private static final int CAMERA_REQUEST_CODE = 1001;
    private static final int PHOTO_REQUEST_CODE = 1002;
    private static final int CROPPHOTO = 1003;
    private static String path = "/sdcard/myHead/";
    private FrameLayout mFrBack;
    private TextView mTvTitle;
    private CircleImageView circleImageView;
    private LinearLayout mLlChangePhoto;
    private ChooisePhotoDialog chooisePhotoDialog;
    private DatePickerDialog datePickerDialog;
    private ChooiseGenderDialog genderDialog;
    private ChangeDescObserver changeDescObserver;
    private NicknameDialog nicknameDialog;
    private EditText etNickName;
    private EditText etSexy;
    private EditText etSign;
    private TextView tvBirthday;
    private PersonBean.User user;
    private TextView updatePerson;
    private ChooiseDateDialog chooiseDateDialog;
    private boolean isChoiceModelSingle = true;
    private List<CalendarDate> mListDate = new ArrayList<>();
    private File updatefile;
    private File file;
    private File filepath;
    
    private static String listToString(List<CalendarDate> list) {
        StringBuffer stringBuffer = new StringBuffer();
        for (CalendarDate date : list) {
            stringBuffer.append(date.getSolar().solarYear + "-" + date.getSolar().solarMonth + "-" + date.getSolar()
                    .solarDay).append(" ");
        }
        return stringBuffer.toString();
    }
    
    @Override
    public void initView() {
        setContentView(R.layout.activity_person);
        initTitle();
        //        initFragment();
        user = (PersonBean.User) getIntent().getSerializableExtra("user");
        final Calendar calendar = Calendar.getInstance();
        etNickName = (EditText) findViewById(R.id.et_nickname);
        etSexy = (EditText) findViewById(R.id.et_sexy);
        etSign = (EditText) findViewById(R.id.et_sign);
        tvBirthday = (TextView) findViewById(R.id.tv_birthday);
        updatePerson = (TextView) findViewById(R.id.tv_update_person);
        genderDialog = new ChooiseGenderDialog(this);
        nicknameDialog = new NicknameDialog(this);
        changeDescObserver = new ChangeDescObserver();
        ConcreteSubject.getInstance().register(changeDescObserver);
        updatePerson.setOnClickListener(this);
        tvBirthday.setOnClickListener(this);
        datePickerDialog = DatePickerDialog.newInstance((ddg, year, month, day) -> {
                }, //
                calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
        chooisePhotoDialog.setPhotoListener(new ChooisePhotoDialog.PhotoListener() {
            @Override
            public void takePhoto() {
                requstPermission(CAMERA_REQUEST_CODE);
            }
            
            @Override
            public void chooisePhoto() {
                requstPermission(PHOTO_REQUEST_CODE);
            }
        });
    }
    
    private void nicknameDialog() {
        nicknameDialog.show();
    }
    
    @Override
    protected void onDestroy() {
        ConcreteSubject.getInstance().unRegister(changeDescObserver);
        super.onDestroy();
        
    }
    
    private void loadAvatarImg(String res) {
        ImageLoaderUtils.display(getApplication(), res, R.mipmap.mine_two, circleImageView);
    }
    
    /**
     * 提交用户更新信息
     */
    private void updatePersonInfo() {
        List<Param> paramList = new ArrayList<>();
        Param key = new Param("key", SharedPreUtils.getString(StringContants.KEY));
        Param token = new Param("Token", SharedPreUtils.getString(StringContants.TOKEN));
        Param nickname = new Param("mnickname", etNickName.getText().toString().trim());
        Param birthday = new Param("mbirthday", tvBirthday.getText().toString().trim());
        Param gender = new Param("mgender", etSexy.getText().toString().trim());
        Param sign = new Param("msignature", etSign.getText().toString().trim());
        paramList.add(key);
        paramList.add(token);
        paramList.add(nickname);
        paramList.add(birthday);
        paramList.add(gender);
        paramList.add(sign);
        HttpUtils.post(ConstantApi.UPDATEINFO, paramList, new ResultCallback() {
            @Override
            public void onSuccess(Object response) {
                MemberBean memberBean = new Gson().fromJson(response.toString(), MemberBean.class);
                if (200 == memberBean.getResult()) {
                    Toast.makeText(PersonalActivity.this, "更新个人信息成功", Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(PersonalActivity.this, "信息更新失败", Toast.LENGTH_SHORT).show();
                }
                
            }
            
            @Override
            public void onFailure(Request request, Exception e) {
                
            }
            
            @Override
            public void onNoNetWork(String resultMsg) {
                
            }
        });
        
        
    }
    
    /**
     * 选择性别
     */
    private void chooiseGender() {
        genderDialog.show();
    }
    
    /**
     * 选择出生日期
     */
    private void chooiseBirthday() {
        datePickerDialog.setYearRange(1985, 2028);
        
    }
    
    private void requstPermission(int code) {
        switch (code) {
            case 1001:
                //没有相机权限
                if (PackageManager.PERMISSION_GRANTED != ContextCompat.checkSelfPermission(this, android.Manifest
                        .permission.CAMERA)) {
                    if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
                        AlertDialog.Builder builder = new AlertDialog.Builder(this);
                        builder.setTitle(R.string.app_name).setMessage("申请相机权限").setPositiveButton("确定", (dialog, v) 
                                -> {
                            //申请相机权限
                            ActivityCompat.requestPermissions(PersonalActivity.this, new String[]{Manifest.permission
                                    .CAMERA}, CAMERA_REQUEST_CODE);
                            // 跳转到系统的界面
                            Intent intent = new Intent();
                            intent.setAction("android.intent.action.MAIN");
                            intent.setClassName("com.android.settings", "com.android.settings.ManageApplications");
                            startActivity(intent);
                        }).setNegativeButton("暂不申请", null).show();
                    } else {
                        //申请相机权限
                        Crouton.makeText(PersonalActivity.this, "没有相机权限", Style.CONFIRM).show();
                        ActivityCompat.requestPermissions(PersonalActivity.this, new String[]{Manifest.permission
                                .CAMERA}, CAMERA_REQUEST_CODE);
                    }
                } else {
                    //调用相机拍照
                    // Toast.makeText(this, "相机权限已经开启", Toast.LENGTH_SHORT).show();
                    if (isCameraCanUse()) {
                        Intent camareIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                        camareIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(Environment
                                .getExternalStorageDirectory(), "head.jpg")));
                        startActivityForResult(camareIntent, CAMERA_REQUEST_CODE);
                    }
                    
                }
                break;
            case 1002:
                if (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(this, Manifest.permission
                        .WRITE_EXTERNAL_STORAGE)) {
                    Intent choiceIntent = new Intent(Intent.ACTION_PICK, null);
                    choiceIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
                    startActivityForResult(choiceIntent, PHOTO_REQUEST_CODE);
                } else {
                    AlertDialog.Builder builder = new AlertDialog.Builder(PersonalActivity.this);
                    builder.setTitle(R.string.app_name).setMessage("当前无读写权限").setPositiveButton("去设置", new 
                            DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            // 跳转到系统的设置界面
                            Intent intent = new Intent();
                            intent.setAction("android.intent.action.MAIN");
                            intent.setClassName("com.android.settings", "com.android.settings.ManageApplications");
                            startActivity(intent);
                        }
                    }).setNegativeButton("暂不设置", null).show();
                }
                break;
        }
        
    }
    
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (requestCode) {
            case CAMERA_REQUEST_CODE:
                if (SDCardUtils.isSDCardEnable()) {
                    updatefile = new File(Environment.getExternalStorageDirectory() + "/head.jpg");
                    //裁剪图片
                    cropPhoto(Uri.fromFile(updatefile));
                    LogUtils.d("updatefile----TAKEPHOTOCODE-", updatefile + "");
                } else {
                    Toast.makeText(PersonalActivity.this, "未找到SD卡", Toast.LENGTH_SHORT).show();
                }
                break;
            case CROPPHOTO:
                Bundle extras = data.getExtras();
                if (extras != null) {
                    Bitmap head = (Bitmap) extras.get("data");
                    LogUtils.d("--head-", head + "--");
                    if (head != null) {
                        setPicToView(head);//保存在SD卡中
                        // TODO: 2016/7/1 上传裁剪过后的图片
                        // mAvatarImg.setImageBitmap(head);
                        upUserHeader(filepath);
                        //用ImageView显示出来
                        if (chooisePhotoDialog != null) {
                            chooisePhotoDialog.dismiss();
                        }
                    }
                }
                break;
            //在本地选择图片
            case PHOTO_REQUEST_CODE:
                if (null == data) {
                    return;
                }
                Uri uri = data.getData();
                if (null != uri) {
                    //将图片发送到服务器
                    String ImgData = GetPathUri4kitk.getPath(PersonalActivity.this, uri);
                    double mFileSize = FileSizeUtil.getFileOrFilesSize(ImgData, 3);
                    LogUtils.d("---filesize-", mFileSize + "");
                    if (mFileSize > 5) {
                        Toast.makeText(PersonalActivity.this, "请选择5M以内的图片", Toast.LENGTH_SHORT).show();
                    } else {
                        cropPhoto(uri);//裁剪图片
                    }
                }
                break;
            
        }
        
        
        super.onActivityResult(requestCode, resultCode, data);
    }
    
    
    /**
     * 更新头像
     */
    // TODO: 2017/4/26 还需要修改，有问题，需要调试 
    private void upUserHeader(File updatefile) {
        List<Param> paramList = new ArrayList<>();
        Param key = new Param("key", SharedPreUtils.getString(StringContants.KEY));
        Param token = new Param("Token", SharedPreUtils.getString(StringContants.TOKEN));
        Param file = new Param("file", updatefile);
        paramList.add(key);
        paramList.add(token);
        paramList.add(file);
        HttpUtils.post(ConstantApi.UPLOADAVA, paramList, new ResultCallback() {
            @Override
            public void onSuccess(Object response) {
                UploadAvaBean uploadAvaBean = new Gson().fromJson(response.toString(), UploadAvaBean.class);
                Log.d("updateAva---", uploadAvaBean.toString());
                if (uploadAvaBean.getResult() == 200) {
                    Toast.makeText(PersonalActivity.this, "头像上传成功", Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(PersonalActivity.this, "头像上传失败", Toast.LENGTH_SHORT).show();
                }
                
            }
            
            @Override
            public void onFailure(Request request, Exception e) {
                
            }
            
            @Override
            public void onNoNetWork(String resultMsg) {
                
            }
        });
    }
    
    
    //将图片设置到视图
    private void setPicToView(Bitmap mBitmap) {
        String sdStatus = Environment.getExternalStorageState();
        if (!sdStatus.equals(Environment.MEDIA_MOUNTED)) {
            // 检测sd是否可用
            return;
        }
        FileOutputStream b = null;
        file = new File(path);
        file.mkdirs();// 创建文件夹
        String fileName = path + "head.jpg";//图片名字
        filepath = new File(fileName);
        try {
            b = new FileOutputStream(filepath);
            mBitmap.compress(Bitmap.CompressFormat.JPEG, 80, b);
            // 把数据写入文件
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } finally {
            try {//关闭流
                if (b != null) {
                    b.flush();
                    b.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    
    private void cropPhoto(Uri uri) {
        Intent intent = new Intent("com.android.camera.action.CROP");
        intent.setDataAndType(uri, "image/*");
        intent.putExtra("crop", "true");
        // aspectX aspectY 是宽高的比例
        intent.putExtra("aspectX", 1);
        intent.putExtra("aspectY", 1);
        // outputX outputY 是裁剪图片宽高
        intent.putExtra("outputX", 150);
        intent.putExtra("outputY", 150);
        intent.putExtra("return-data", true);
        startActivityForResult(intent, CROPPHOTO);
    }
    
    /**
     * 测试当前摄像头能否被使用
     *
     * @return
     */
    public boolean isCameraCanUse() {
        boolean canUse = true;
        Camera mCamera = null;
        try {
            mCamera = Camera.open(0);
            mCamera.setDisplayOrientation(90);
        } catch (Exception e) {
            canUse = false;
        }
        if (canUse) {
            mCamera.release();
            mCamera = null;
        }
        return canUse;
    }
    
    /**
     * 出来权限申请成功或者失败的操作
     *
     * @param requestCode
     * @param permissions
     * @param grantResults
     */
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] 
            grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (requestCode == CAMERA_REQUEST_CODE) {
            if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                Intent camareIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                camareIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(Environment
                        .getExternalStorageDirectory(), "head.jpg")));
                startActivityForResult(camareIntent, CAMERA_REQUEST_CODE);
            } else {
                if (!ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {
                    Crouton.makeText(this, "相机权限已经被禁止", Style.CONFIRM).show();
                }
            }
        }
    }
    
    private void initTitle() {
        mFrBack = (FrameLayout) findViewById(R.id.fr_back);
        mTvTitle = (TextView) findViewById(R.id.tv_title);
        chooisePhotoDialog = new ChooisePhotoDialog(this);
        chooiseDateDialog = new ChooiseDateDialog(this);
        circleImageView = (CircleImageView) findViewById(R.id.circle_image);
        mLlChangePhoto = (LinearLayout) findViewById(R.id.ll_change_photo);
        mTvTitle.setText("个人资料");
        
    }
    
    @Override
    public void initListener() {
        mFrBack.setOnClickListener(this);
        mLlChangePhoto.setOnClickListener(this);
        circleImageView.setOnClickListener(this);
    }
    
    @Override
    public void initData() {
        //        getPersonDetail();
        etNickName.setText(user.getMusername());
        etSexy.setText(user.getMsex() == "1" ? "男" : "女");
        etSign.setText(user.getMsignature());
        loadAvatarImg(user.getMavatar());
    }
    
    @Override
    public void processClick(View v) {
        switch (v.getId()) {
            case R.id.fr_back:
                finish();
                break;
            case R.id.circle_image:
                chooisePhotoDialog.show();
                break;
            case R.id.tv_update_person:
                updatePersonInfo();
                break;
            case R.id.tv_birthday:
                //                isChoiceModelSingle = true;
                //                initFragment();
                //                chooiseDateDialog.show();
                break;
        }
        
    }
    
    private void initFragment() {
        FragmentManager fm = getSupportFragmentManager();
        FragmentTransaction tx = fm.beginTransaction();
        Fragment fragment = CalendarViewPagerFragment.newInstance(isChoiceModelSingle);
        tx.replace(R.id.fl_content, fragment);
        tx.commit();
    }
    
    @Override
    public void onDateCancel(CalendarDate calendarDate) {
        int count = mListDate.size();
        for (int i = 0; i < count; i++) {
            CalendarDate date = mListDate.get(i);
            if (date.getSolar().solarDay == calendarDate.getSolar().solarDay) {
                mListDate.remove(i);
                break;
            }
        }
        tvBirthday.setText(listToString(mListDate));
        
    }
    
    @Override
    public void onDateClick(CalendarDate calendarDate) {
        int year = calendarDate.getSolar().solarYear;
        int month = calendarDate.getSolar().solarMonth;
        int day = calendarDate.getSolar().solarDay;
        if (isChoiceModelSingle) {
            tvBirthday.setText(year + "-" + month + "-" + day);
        } else {
            //System.out.println(calendarDate.getSolar().solarDay);
            mListDate.add(calendarDate);
            tvBirthday.setText(listToString(mListDate));
        }
        
    }
    
    @Override
    public void onPageChange(int year, int month) {
        tvBirthday.setText(year + "-" + month);
        mListDate.clear();
    }
    
    private class ChangeDescObserver implements Observer {
        private String getDesc;
        
        @Override
        public void update(String desc) {
            getDesc = desc;
            LogUtils.d("desc------", getDesc);
            SharedPreUtils.saveString("sign", getDesc);
        }
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/lib/common/PullToRefreshListView.java
package com.looking.classicalparty.lib.common;

import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.looking.classicalparty.R;
import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.ValueAnimator;

public class PullToRefreshListView extends ListView {

    private View mHeaderView;
    private View mFooterView;

    private int mHeaderViewHeight;
    private int mFooterViewHeight;

    private boolean isHeaderViewEnable = true;// 头布局是否可用，默认可用
    private boolean isFooterViewEnable = true;// 脚布局是否可用，默认可用

    private TextView tv_header_title;
    private ImageView iv_arrow;
    private ImageView iv_refresh;
    private ImageView iv_refresh_complete;

    private TextView tv_footer_title;
    private ImageView iv_footer_arrow;
    private ImageView iv_footer_refresh;

    private int startY = -1;
    private boolean isOnRefresh = false;// 当前是否正在刷新
    private boolean isOnLoadingMore = false;// 当前是否加载更多
    private final static int RATIO = 3; // 实际的padding的距离与界面上偏移距离的比例

    private static final int STATE_PULL_TO_REFRESH = 1;// 下拉刷新
    private static final int STATE_RELEASE_TO_REFRESH = 2;// 松开刷新
    private static final int STATE_REFRESHING = 3;// 正在刷新
    private int mCurrentRefreshState = STATE_PULL_TO_REFRESH;// 当前状态初始值为下拉刷新

    private static final int STATE_PULL_TO_LOADMORE = 4;// 上拉加载更多
    private static final int STATE_RELEASE_TO_LOADMORE = 5;// 松开载入更多
    private static final int STATE_LOADMOREING = 6;// 正在加载更多
    private int mCurrentFooterState = STATE_PULL_TO_LOADMORE;// 当前状态初始值为上拉加载更多

    private RotateAnimation animUp;// 箭头向上动画
    private RotateAnimation animDown;// 箭头向下动画
    private RotateAnimation animRefresh;// 正在刷新动画

    private OnRefreshListener mListener;

    public PullToRefreshListView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        initView();
    }

    public PullToRefreshListView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView();
    }

    public PullToRefreshListView(Context context) {
        super(context);
        initView();
    }

    private void initView() {
//        initAnim();// 初始化动画效果
        initHeaderView();
        initFooterView();
    }

    /**
     * 设置头布局刷新是否可用，默认true
     */
    public void setHeaderViewEnable(boolean isHeaderViewEnable) {
        this.isHeaderViewEnable = isHeaderViewEnable;
    }

    /**
     * 设置脚布局加载更多是否可用，默认true
     */
    public void setFooterViewEnable(boolean isFooterViewEnable) {
        this.isFooterViewEnable = isFooterViewEnable;
    }

    /**
     * 设置刷新头布局的背景颜色
     */
    public void setHeaderBackGround(int color) {
        mHeaderView.setBackgroundColor(color);
    }

    /**
     * 设置加载教布局的背景颜色
     */
    public void setFooterBackGround(int color) {
        mFooterView.setBackgroundColor(color);
    }

    /**
     * 初始化头布局
     */
    private void initHeaderView() {
        mHeaderView = View.inflate(getContext(), R.layout.item_refresh_header, null);
        // 在activity创建时，手动测量布局，获取测量布局的高度
        measureView(mHeaderView);
        mHeaderViewHeight = mHeaderView.getMeasuredHeight();
        // 设置padding隐藏头布局
        mHeaderView.setPadding(0, -mHeaderViewHeight, 0, 0);
        mHeaderView.invalidate();
        iv_refresh_complete = (ImageView) mHeaderView.findViewById(R.id.iv_refresh_complete);
        tv_header_title = (TextView) mHeaderView.findViewById(R.id.tv_header_title);

        final AnimationDrawable anim = (AnimationDrawable) iv_refresh.getDrawable();

        iv_refresh.post(new Runnable() {
            @Override
            public void run() {
                anim.stop();
                anim.start();
            }
        });

        this.addHeaderView(mHeaderView);// 添加头布局
    }

    /**
     * 初始化脚布局
     */
    private void initFooterView() {
        mFooterView = View.inflate(getContext(), R.layout.item_refresh_footer, null);
        // 在activity创建时，手动测量布局，获取测量布局的高度
        measureView(mFooterView);
        mFooterViewHeight = mFooterView.getMeasuredHeight();
        // 设置padding隐藏脚布局
        mFooterView.setPadding(0, 0, 0, -mFooterViewHeight);
        mFooterView.invalidate();

        tv_footer_title = (TextView) mFooterView.findViewById(R.id.tv_footer_title);
        iv_footer_refresh = (ImageView) mFooterView.findViewById(R.id.iv_footer_refresh);

        final AnimationDrawable anim = (AnimationDrawable) iv_footer_refresh.getDrawable();

        iv_footer_refresh.post(new Runnable() {
            @Override
            public void run() {
                anim.stop();
                anim.start();
            }
        });

        this.addFooterView(mFooterView);// 添加脚布局
    }

    /**
     * 初始化箭头的动画效果
     */
    private void initAnim() {
        // 向上转动的动画效果
        animUp = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        animUp.setDuration(500);
        animUp.setFillAfter(true);
        // 向下转动的动画效果
        animDown = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        animDown.setDuration(500);
        animDown.setFillAfter(true);
        // 正在刷新的动画效果
        animRefresh = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        animRefresh.setDuration(500);
        animRefresh.setInterpolator(new LinearInterpolator());
        animRefresh.setRepeatCount(-1);
        animRefresh.setRepeatMode(Animation.RESTART);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        switch (ev.getAction()) {
            case MotionEvent.ACTION_DOWN:
                startY = (int) ev.getY(); // 设置初始值为-1
                break;
            case MotionEvent.ACTION_MOVE:
                // 触摸按下时的事件有可能没有响应到，再次获取开始时的坐标
                if (startY == -1) {
                    startY = (int) ev.getY();
                }
                // 滑动时当前状态为正在刷新，什么都不用做
                if (mCurrentRefreshState == STATE_REFRESHING || mCurrentFooterState == STATE_LOADMOREING) {
                    break;
                }

                int endY = (int) ev.getY();
                int dY = endY - startY;

                /******** 向下划并且当前在第一个条目位置 ********/
                if (dY > 0 && getFirstVisiblePosition() == 0 && !isOnRefresh && !isOnLoadingMore && isHeaderViewEnable) {
                    int paddingTop = dY / RATIO - mHeaderViewHeight;
                    // 控制下拉的居上的间距不能超过控件高度
                    if (paddingTop > mHeaderViewHeight) {
                        paddingTop = mHeaderViewHeight;
                    }
                    if (paddingTop >= 0 && mCurrentRefreshState != STATE_RELEASE_TO_REFRESH) {
                        // 切换到松开刷新
                        mCurrentRefreshState = STATE_RELEASE_TO_REFRESH;
                        refreshHeaderState();
                    } else if (paddingTop < 0 && mCurrentRefreshState != STATE_PULL_TO_REFRESH) {
                        // 切换到下拉刷新
                        mCurrentRefreshState = STATE_PULL_TO_REFRESH;
                        refreshHeaderState();
                    }
                    mHeaderView.setPadding(0, paddingTop, 0, 0);
                    setSelection(0);
                }

                /******** 向上划且当前在最后一个条目位置 ********/
                if (dY < 0 && getLastVisiblePosition() == getCount() - 1 && !isOnLoadingMore && !isOnRefresh
                        && isFooterViewEnable && isFillScreenItem()) {
                    int paddingBottom = Math.abs(dY) / RATIO - mFooterViewHeight;
                    if (paddingBottom > mFooterViewHeight) {
                        paddingBottom = mFooterViewHeight;
                    }
                    if (paddingBottom >= 0 && mCurrentFooterState != STATE_RELEASE_TO_LOADMORE) {
                        // 切换到松开载入更多
                        mCurrentFooterState = STATE_RELEASE_TO_LOADMORE;
                        refreshFooterState();
                    } else if (paddingBottom <= 0 && mCurrentFooterState != STATE_PULL_TO_LOADMORE) {
                        // 切换到上拉加载更多
                        mCurrentFooterState = STATE_PULL_TO_LOADMORE;
                        refreshFooterState();
                    }
                    mFooterView.setPadding(0, 0, 0, paddingBottom);
                    setSelection(getCount() - 1);// 显示最后一个位置
                }
                break;
            case MotionEvent.ACTION_UP:
                startY = -1;// 起始坐标归零

                /******** 刷新操作 ********/
                if (isHeaderViewEnable) {
                    if (mCurrentRefreshState == STATE_RELEASE_TO_REFRESH) {
                        // 如果当前是松开刷新, 就要切换为正在刷新
                        mCurrentRefreshState = STATE_REFRESHING;
                        isOnRefresh = true;
                        // 显示头布局
                        mHeaderView.setPadding(0, 0, 0, 0);
                        refreshHeaderState();
                        // 下拉刷新回调
                        if (mListener != null) {
                            mListener.onrefresh();
                        }
                    } else if (mCurrentRefreshState == STATE_PULL_TO_REFRESH) {
                        // 隐藏头布局
                        mHeaderView.setPadding(0, 0, 0, -mHeaderViewHeight);
                    }
                }

                /******** 加载更多操作 ********/
                if (isFooterViewEnable) {
                    if (mCurrentFooterState == STATE_RELEASE_TO_LOADMORE) {
                        // 如果当前是松开载入更多, 就要切换为正在加载更多
                        mCurrentFooterState = STATE_LOADMOREING;
                        isOnLoadingMore = true;
                        // 显示脚布局
                        mFooterView.setPadding(0, 0, 0, 0);
                        refreshFooterState();
                        // 加载更多回调
                        if (mListener != null) {
                            mListener.onLoadMore();
                        }
                    } else if (mCurrentFooterState == STATE_PULL_TO_LOADMORE) {
                        // 隐藏脚布局
                        mFooterView.setPadding(0, 0, 0, -mFooterViewHeight);
                    }
                }
                break;
            default:
                break;
        }


        return super.onTouchEvent(ev);
    }

    /**
     * 根据当前的刷新状态刷新头布局
     */
    private void refreshHeaderState() {
        switch (mCurrentRefreshState) {
            case STATE_PULL_TO_REFRESH:
                tv_header_title.setText("下拉刷新↓");
                iv_refresh.clearAnimation();
                iv_refresh.setVisibility(View.INVISIBLE);
                iv_arrow.clearAnimation();
                iv_arrow.setVisibility(View.INVISIBLE);
//                iv_arrow.startAnimation(animDown);
                break;
            case STATE_RELEASE_TO_REFRESH:
                tv_header_title.setText("松开立即刷新↑");
                iv_arrow.setVisibility(View.INVISIBLE);
                iv_refresh.setVisibility(View.VISIBLE);
                final AnimationDrawable anim = (AnimationDrawable) iv_refresh.getDrawable();
                anim.start();
                break;
            case STATE_REFRESHING:
                tv_header_title.setText("努力加载中...");
                iv_refresh.setVisibility(View.VISIBLE);
                iv_arrow.clearAnimation();// 必须清除动画,才能隐藏控件
                iv_arrow.setVisibility(View.INVISIBLE);
                break;
            default:
                break;
        }
    }

    /**
     * 根据当前加载更多的状态刷新脚布局
     */
    private void refreshFooterState() {
        switch (mCurrentFooterState) {
            case STATE_PULL_TO_LOADMORE:
                tv_footer_title.setText("上拉加载更多↑");
                iv_footer_refresh.clearAnimation();
                iv_footer_refresh.setVisibility(View.INVISIBLE);
                iv_footer_arrow.setVisibility(View.VISIBLE);
                break;
            case STATE_RELEASE_TO_LOADMORE:
                tv_footer_title.setText("松开立即加载↓");
                iv_footer_refresh.clearAnimation();
                iv_footer_refresh.setVisibility(View.INVISIBLE);
                iv_footer_arrow.setVisibility(View.VISIBLE);
                break;
            case STATE_LOADMOREING:
                tv_footer_title.setText("努力加载中...");
                iv_footer_refresh.setVisibility(View.VISIBLE);
                iv_footer_arrow.clearAnimation();
                iv_footer_arrow.setVisibility(View.INVISIBLE);
                break;
        }
    }

    /**
     * 刷新完成调用的方法
     */
    public void onRefreshAndLoadComplete() {
        if (isOnRefresh) {
            // 隐藏头布局，恢复初始状态
            isOnRefresh = false;
            final ValueAnimator va = ValueAnimator.ofInt(0, mHeaderViewHeight);
            va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

                @Override
                public void onAnimationUpdate(ValueAnimator animation) {
                    int height = (Integer) va.getAnimatedValue();
                    mHeaderView.setPadding(0, -height, 0, 0);
                }

            });
            va.addListener(new Animator.AnimatorListener() {

                @Override
                public void onAnimationStart(Animator animation) {
                }

                @Override
                public void onAnimationEnd(Animator animation) {
                    mCurrentRefreshState = STATE_PULL_TO_REFRESH;
                    tv_header_title.setText("下拉刷新↓");
                    iv_refresh_complete.setVisibility(View.INVISIBLE);
                    iv_arrow.setVisibility(View.VISIBLE);
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                }

                @Override
                public void onAnimationRepeat(Animator animation) {
                }

            });
            va.setDuration(500);
            va.start();
            tv_header_title.setText("刷新完成");
            iv_refresh.clearAnimation();
            iv_refresh.setVisibility(View.INVISIBLE);
            iv_refresh_complete.setVisibility(View.VISIBLE);
        }
        if (isOnLoadingMore) {
            // 隐藏脚布局，恢复初始状态
            isOnLoadingMore = false;
            mFooterView.setPadding(0, 0, 0, -mFooterViewHeight);
            mCurrentFooterState = STATE_PULL_TO_LOADMORE;
            tv_footer_title.setText("上拉加载更多");
            iv_footer_refresh.clearAnimation();
            iv_footer_refresh.setVisibility(INVISIBLE);
            iv_footer_arrow.setVisibility(View.VISIBLE);
        }
    }

    /**
     * 条目是否填满整个屏幕
     */
    private boolean isFillScreenItem() {

        final int firstVisiblePosition = this.getFirstVisiblePosition();
        final int lastVisiblePostion = this.getLastVisiblePosition();

        final int visibleItemCount = lastVisiblePostion - firstVisiblePosition + 1;
        final int totalItemCount = this.getCount();

        if (visibleItemCount < totalItemCount) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * 测量View的宽高
     */
    private void measureView(View child) {
        ViewGroup.LayoutParams p = child.getLayoutParams();
        if (p == null) {
            p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        }
        int childWidthSpec = ViewGroup.getChildMeasureSpec(0, 0 + 0, p.width);
        int lpHeight = p.height;
        int childHeightSpec;
        if (lpHeight > 0) {
            childHeightSpec = MeasureSpec.makeMeasureSpec(lpHeight, MeasureSpec.EXACTLY);
        } else {
            childHeightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
        }
        child.measure(childWidthSpec, childHeightSpec);
    }

    /**
     * 重写条目item点击事件
     */
    private OnItemClickListener mItemListener;

    public void setOnItemClickListener(OnItemClickListener listener) {
        mItemListener = listener;
        super.setOnItemClickListener(new OnItemClickListener() {// 将点击事件由当前类实现

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (mItemListener != null) {
                    mItemListener.onItemClick(parent, view, position - getHeaderViewsCount(), id);
                }
            }
        });
    }

    /**
     * 重写条目item长按事件
     */
    private OnItemLongClickListener mItemLongClickListener;

    public void setOnItemLongClickListener(OnItemLongClickListener listener) {
        mItemLongClickListener = listener;
        super.setOnItemLongClickListener(new OnItemLongClickListener() {

            @Override
            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
                if (mItemLongClickListener != null) {
                    mItemLongClickListener.onItemLongClick(parent, view, position - getHeaderViewsCount(), id);
                }
                return true;
            }
        });
    }

    /**
     * 设置回调接口
     */
    public void setOnRefreshListener(OnRefreshListener listener) {
        mListener = listener;
    }

    public interface OnRefreshListener {
        // 下拉刷新的回调用法
        public void onrefresh();

        // 上拉加载更多回调方法
        public void onLoadMore();
    }

}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/register/bean/RegisterBean.java
package com.looking.classicalparty.moudles.register.bean;

import com.looking.classicalparty.lib.base.Bean.BaseBean;

/**
 * Created by xin on 2016/10/24.
 */

public class RegisterBean extends BaseBean{


    /**
     * user : {"mid":20}
     */

    private UserEntity user;

    public UserEntity getUser() {
        return user;
    }

    public void setUser(UserEntity user) {
        this.user = user;
    }

    public static class UserEntity {
        /**
         * mid : 20
         */

        private int mid;

        public int getMid() {
            return mid;
        }

        public void setMid(int mid) {
            this.mid = mid;
        }
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/music/adapter/MusicAdapter.java
package com.looking.classicalparty.moudles.music.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.looking.classicalparty.R;
import com.looking.classicalparty.lib.utils.ImageLoaderUtils;
import com.looking.classicalparty.moudles.music.bean.MusicDetailBean;

import java.util.List;

/**
 * Created by xin on 2017/3/29.
 */

public class MusicAdapter extends BaseAdapter {
    private Context context;
    private MusicListener listener;
    
    private List<MusicDetailBean.ActivityEntity> musicDatas;
    
    public MusicAdapter(Context context, List<MusicDetailBean.ActivityEntity> musicDatas) {
        this.context = context;
        this.musicDatas = musicDatas;
    }
    
    @Override
    public int getCount() {
        if (null == musicDatas) {
            return 0;
        }
        return musicDatas.size();
    }
    
    @Override
    public MusicDetailBean.ActivityEntity getItem(int position) {
        return musicDatas.get(position);
    }
    
    @Override
    public long getItemId(int position) {
        return position;
    }
    
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder mViewHolder = null;
        
        if (null == convertView) {
            mViewHolder = new ViewHolder();
            convertView = View.inflate(context, R.layout.item_music_layout, null);
            mViewHolder.iv_music = (ImageView) convertView.findViewById(R.id.iv_music);
            mViewHolder.tv_musicName = (TextView) convertView.findViewById(R.id.tv_musicName);
            mViewHolder.tv_singer = (TextView) convertView.findViewById(R.id.tv_singer);
            mViewHolder.iv_more = (ImageView) convertView.findViewById(R.id.iv_more);
            mViewHolder.ll_listener_music = (LinearLayout) convertView.findViewById(R.id.ll_listener_music);
            
            convertView.setTag(mViewHolder);
        } else {
            mViewHolder = (ViewHolder) convertView.getTag();
        }
        ImageLoaderUtils.display(context, "http://www.jingdian.party/" + musicDatas.get(position).getCover_path(),
                mViewHolder.iv_music);
        mViewHolder.tv_musicName.setText(musicDatas.get(position).getTitle());
        mViewHolder.tv_singer.setText(musicDatas.get(position).getDirector());
        mViewHolder.ll_listener_music.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.showListenerDialog(position);
                
            }
        });
        mViewHolder.iv_more.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.showMusicDetail(position);
                
            }
        });
        
        
        return convertView;
    }
    
    public void setMusicListener(MusicListener listener) {
        this.listener = listener;
        
    }
    
    public interface MusicListener {
        public void showListenerDialog(int position);
        
        public void showMusicDetail(int position);
    }
    
    static class ViewHolder {
        
        public TextView tv_musicName;
        public TextView tv_singer;
        public ImageView iv_music;
        public ImageView iv_more;
        public LinearLayout ll_listener_music;
        
    }
}
<file_sep>/README.md
# looking
music  or video

关于经典的视频和音乐
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/find/bean/MusicBean.java
package com.looking.classicalparty.moudles.find.bean;

/**
 * Created by xin on 2017/3/29.
 */

public class MusicBean {

        private String id;
        private String title;
        private String director;
        private String cover_path;
        private String v_path;
        private Object vscreate_time;
        private String musername;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getDirector() {
            return director;
        }

        public void setDirector(String director) {
            this.director = director;
        }

        public String getCover_path() {
            return cover_path;
        }

        public void setCover_path(String cover_path) {
            this.cover_path = cover_path;
        }

        public String getV_path() {
            return v_path;
        }

        public void setV_path(String v_path) {
            this.v_path = v_path;
        }

        public Object getVscreate_time() {
            return vscreate_time;
        }

        public void setVscreate_time(Object vscreate_time) {
            this.vscreate_time = vscreate_time;
        }

        public String getMusername() {
            return musername;
        }

        public void setMusername(String musername) {
            this.musername = musername;
        }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/lib/common/UpdateDialog.java
package com.looking.classicalparty.lib.common;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.looking.classicalparty.R;

/**
 * Created by xin on 2016/10/24.
 */
public class UpdateDialog extends Dialog implements View.OnClickListener {
    private Button btnUpdate;
    private Button btnCancel;
    private UpdateListener listener;
    
    public UpdateDialog(Context context) {
        this(context, R.style.base_dialog_theme);
    }
    
    public UpdateDialog(Context context, int themeResId) {
        super(context, themeResId);
    }
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tips_dialog_layout);
        btnUpdate = (Button) findViewById(R.id.btn_update);
        btnCancel = (Button) findViewById(R.id.btn_cancel);
        btnUpdate.setOnClickListener(this);
        btnCancel.setOnClickListener(this);
    }
    
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_update:
                if (listener != null) {
                    listener.update();
                }
                break;
            case R.id.btn_cancel:
                dismiss();
                break;
        }
        
    }
    
    public void setUpdateListener(UpdateListener listener) {
        this.listener = listener;
    }
    
    public interface tipsListener {
        void getAppData();
        
        
    }
    
    public interface UpdateListener {
        public void update();
        
        public void closeDialog();
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/find/adapter/ReviewAdapter.java
package com.looking.classicalparty.moudles.find.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.looking.classicalparty.R;
import com.looking.classicalparty.lib.utils.ImageLoaderUtils;
import com.looking.classicalparty.moudles.find.bean.ReviewsBean;

import java.util.List;

/**
 * Created by xin on 2016/10/25.
 */

public class ReviewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    public List<ReviewsBean> mDatas;
    private OnItemClickListener mOnItemClickListener;
    private Context context;


    public ReviewAdapter(Context context, List<ReviewsBean> datas) {
        this.context = context;
        this.mDatas = datas;
    }

    public void setOnItemClickListener(OnItemClickListener listener) {
        this.mOnItemClickListener = listener;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        if (viewType == ITEM_TYPE.ITEM_TYPE_THEME.ordinal()) {
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.theme_desc_layout, parent, false);
            return new ThemeViewHolder(view);
        } else if (viewType == ITEM_TYPE.ITEM_TYPE_MOVIE.ordinal()) {
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.movie_detail_layout, parent, false);
            return new MovieViewHolder(view);
        }
        return null;
    }

    @Override
    public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) {
        if (holder instanceof ThemeViewHolder) {
            ((ThemeViewHolder) holder).mTvTitle.setText("MOVIE");
            ((ThemeViewHolder) holder).mIvTitle.setImageResource(R.mipmap.img_music);
        } else if (holder instanceof MovieViewHolder) {
            ImageLoaderUtils.display(context, mDatas.get(position).getCover_path(), ((MovieViewHolder) holder)
                    .mIvPhoto);
            ((MovieViewHolder) holder).mTvName.setText(mDatas.get(position).getTitle());
            ((MovieViewHolder) holder).mTvWriter.setText(mDatas.get(position).getDirector());
            ((MovieViewHolder) holder).mRecommer.setText(mDatas.get(position).getMusername());
            if (mOnItemClickListener != null) {
                holder.itemView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mOnItemClickListener.onItemClick(((MovieViewHolder) holder).mIvPhoto, position);
                    }
                });
            }
        }

    }


    @Override
    public int getItemViewType(int position) {
        return position < 0 ? ITEM_TYPE.ITEM_TYPE_THEME.ordinal() : ITEM_TYPE.ITEM_TYPE_MOVIE.ordinal();
    }

    @Override
    public int getItemCount() {
        return mDatas.size();
    }

    // 定义类型
    public static enum ITEM_TYPE {
        ITEM_TYPE_THEME,
        ITEM_TYPE_MOVIE,

    }

    public static interface OnItemClickListener {
        void onItemClick(View view, int positon);
    }

    /**
     * 定义的主题ViewHolder
     */
    public class ThemeViewHolder extends RecyclerView.ViewHolder {

        private ImageView mIvTitle;
        private TextView mTvTitle;

        public ThemeViewHolder(View itemView) {
            super(itemView);
            mIvTitle = (ImageView) itemView.findViewById(R.id.iv_title);
            mTvTitle = (TextView) itemView.findViewById(R.id.tv_title);
        }
    }

    public class MovieViewHolder extends RecyclerView.ViewHolder {
        private ImageView mIvPhoto;
        private TextView mTvName;
        private TextView mTvWriter;
        private TextView mRecommer;

        public MovieViewHolder(View itemView) {
            super(itemView);
            mIvPhoto = (ImageView) itemView.findViewById(R.id.iv_photo);
            mTvName = (TextView) itemView.findViewById(R.id.tv_name);
            mTvWriter = (TextView) itemView.findViewById(R.id.tv_writer);
            mRecommer = (TextView) itemView.findViewById(R.id.tv_recommer);
        }
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/about/view/AboutUsActivity.java
package com.looking.classicalparty.moudles.about.view;

import android.view.View;
import android.widget.ImageView;

import com.looking.classicalparty.R;
import com.looking.classicalparty.lib.base.activity.BaseActivity;
import com.looking.classicalparty.lib.ui.TitleBar;

public class AboutUsActivity extends BaseActivity {

    private TitleBar mTitleBar;
    private ImageView mImgCode;


    @Override
    public void initView() {
        setContentView(R.layout.activity_about_us);
        mTitleBar = (TitleBar) findViewById(R.id.title_bar);
        //二维码位置
        mImgCode = (ImageView) findViewById(R.id.img_code);

    }

    @Override
    public void initListener() {

    }

    @Override
    public void initData() {
        mTitleBar.setTitle("关于我们");
        mTitleBar.setOnClickListener(new TitleBar.OnClickListener() {
            @Override
            public void OnLeftClick() {
                finish();
            }

            @Override
            public void OnRightClick() {

            }
        });
//        setImgCode();
    }

//    /**
//     * 设置二维码到指定位置
//     */
//    private void setImgCode() {
//
//        String content = "hello welcome!";
//        try {
//            if (!TextUtils.isEmpty(content)) {
//                LogoConfig logoConfig = new LogoConfig();
//                Bitmap logoBitmap = logoConfig.modifyLogo(BitmapFactory.decodeResource(getResources(), R.mipmap
//                        .img_logo), BitmapFactory.decodeResource(getResources(), R.mipmap.img_logo));
//                Bitmap codeBitmap = logoConfig.createCode(content, logoBitmap);
//                mImgCode.setImageBitmap(codeBitmap);
//            } else {
//                Crouton.makeText(this, "请输入要生成的字符串", Style.CONFIRM).show();
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }


    @Override
    public void processClick(View v) {

    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/launch/LaunchActivity.java
package com.looking.classicalparty.moudles.launch;

import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.google.gson.Gson;
import com.looking.classicalparty.R;
import com.looking.classicalparty.lib.base.activity.BaseActivity;
import com.looking.classicalparty.lib.common.TipDialog;
import com.looking.classicalparty.lib.common.UpdateDialog;
import com.looking.classicalparty.lib.constants.ConstantApi;
import com.looking.classicalparty.lib.constants.StringContants;
import com.looking.classicalparty.lib.http.HttpUtils;
import com.looking.classicalparty.lib.http.Param;
import com.looking.classicalparty.lib.http.ResultCallback;
import com.looking.classicalparty.lib.utils.LogUtils;
import com.looking.classicalparty.lib.utils.PackageManagerUtils;
import com.looking.classicalparty.lib.utils.SharedPreUtils;
import com.looking.classicalparty.moudles.launch.bean.AppKeyBean;
import com.looking.classicalparty.moudles.main.MainActivity;
import com.looking.classicalparty.moudles.mine.bean.VersionBean;
import com.looking.classicalparty.moudles.mine.bean.VersionResponse;
import com.squareup.okhttp.Request;

import java.util.ArrayList;
import java.util.List;

public class LaunchActivity extends BaseActivity {
    
    
    private static final String TAG = "SplashActivity";
    
    private static final int GO_MAIN = 100;
    private static final int GO_GUIDE = 200;
    private static final int GO_UPDATE = 300;
    
    // 延迟3秒
    private static final long SPLASH_DELAY_MILLIS = 3000;
    private TipDialog tipDialog;
    private VersionBean mVersion;
    private Button inApp;
    private boolean isDownload;
    private Handler mHandler = new Handler() {
        
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            switch (msg.what) {
                case GO_MAIN:
                    goMain();
                    break;
                case GO_GUIDE:
                    goGuide();
                    break;
                case GO_UPDATE:
                    showUpdateDialog();
                    break;
            }
        }
    };
    
    /**
     * 获取AppKey
     */
    public void getAppKey() {
        List<Param> paramList = new ArrayList<>();
        Param key = new Param("", "");
        paramList.add(key);
        HttpUtils.post(ConstantApi.getkey, paramList, new ResultCallback() {
            @Override
            public void onSuccess(Object response) {
                LogUtils.d("appkey", response.toString());
                AppKeyBean keyBean = new Gson().fromJson(response.toString(), AppKeyBean.class);
                if (keyBean.getResult() == 200) {
                    SharedPreUtils.saveString(StringContants.KEY, keyBean.getKey());
                }
            }
            
            @Override
            public void onFailure(Request request, Exception e) {
                
            }
            
            @Override
            public void onNoNetWork(String resultMsg) {
                
            }
        });
    }
    
    public void goGuide() {
        
    }
    
    /**
     * 判断弹出框是否出现
     */
    private void isHasTips() {
        if (TextUtils.isEmpty(SharedPreUtils.getString(StringContants.KEY, ""))) {
            tipDialog = new TipDialog(this);
            tipDialog.setTipsListener(new TipDialog.tipsListener() {
                @Override
                public void getAppData() {
                    getAppKey();
                }
            });
            tipDialog.show();
        }
    }
    
    /**
     * 跳转到主页面
     */
    private void goMain() {
        startActivity(new Intent(this, MainActivity.class));
    }
    
    @Override
    public void initView() {
        setContentView(R.layout.activity_launch);
        inApp = (Button) findViewById(R.id.inapp);
    }
    
    @Override
    public void initListener() {
        inApp.setOnClickListener(this);
    }
    
    
    @Override
    public void initData() {
        getAppKey();
        getAppVersion();
        //判断是否有key
        //isHasTips();
        
    }
    
    @Override
    public void processClick(View v) {
        switch (v.getId()) {
            case R.id.inapp:
                mHandler.sendEmptyMessage(GO_MAIN);
                break;
        }
        
    }
    
    /**
     * 获取AppVersion
     */
    private void getAppVersion() {
        //跳转到主界面
        List<Param> paramList = new ArrayList<>();
        Param key = new Param("key", SharedPreUtils.getString(StringContants.KEY));
        Param apptype = new Param("apptype", "android");
        paramList.add(key);
        paramList.add(apptype);
        HttpUtils.post(ConstantApi.VERSION, paramList, new ResultCallback() {
            @Override
            public void onSuccess(Object response) {
                VersionResponse versionResponse = new Gson().fromJson(response.toString(), VersionResponse.class);
                Log.d("version---", versionResponse.toString());
                if (200 == versionResponse.getResult()) {
                    mVersion = versionResponse.getVersion();
                    if (mVersion == null) {
                        //版本信息为空
                    } else {
                        //判断版本信息  版本高的话弹窗提示是否更新
                        if (PackageManagerUtils.getVersionCode(LaunchActivity.this) < Double.parseDouble(mVersion
                                .getVersionCode())) {
                            
                            Toast.makeText(LaunchActivity.this, "更新", Toast.LENGTH_SHORT).show();
                            mHandler.sendEmptyMessage(GO_UPDATE);
                        }
                    }
                }
            }
            
            @Override
            public void onFailure(Request request, Exception e) {
                
            }
            
            @Override
            public void onNoNetWork(String resultMsg) {
                
            }
        });
        
    }
    
    
    /**
     * 显示更新对话框
     */
    protected void showUpdateDialog() {
        UpdateDialog updateDialog = new UpdateDialog(this);
        updateDialog.setCanceledOnTouchOutside(false);
        updateDialog.setUpdateListener(new UpdateDialog.UpdateListener() {
            @Override
            public void update() {
                downloadApk();
                isDownload = true;
                updateDialog.dismiss();
            }
            
            @Override
            public void closeDialog() {
                finish();
                
            }
        });
        updateDialog.show();
        
    }
    
    private void downloadApk() {
        
        
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/login/observer/ObserverListener.java
package com.looking.classicalparty.moudles.login.observer;

/**
 * Created by xin on 2017/4/12.
 * 使用观察者模式，实现登录和退出的同步
 */

public interface ObserverListener {
    void observerIsLogin(int isLogin);
}
<file_sep>/app/src/main/java/com/looking/classicalparty/lib/utils/PlayOnlineMusic.java
package com.looking.classicalparty.lib.utils;

import android.app.Activity;
import android.text.TextUtils;

import com.looking.classicalparty.moudles.find.bean.MusicBean;

import java.io.File;

public abstract class PlayOnlineMusic extends PlayMusic {
    private MusicBean mOnlineMusic;

    public PlayOnlineMusic(Activity activity, MusicBean onlineMusic) {
        super(activity, 3);
        mOnlineMusic = onlineMusic;
    }

    @Override
    protected void getPlayInfo() {
        String artist = mOnlineMusic.getMusername();
        String title = mOnlineMusic.getTitle();

        // 下载封面
        String albumFileName = FileUtils.getAlbumFileName(artist, title);
        File albumFile = new File(FileUtils.getAlbumDir(), albumFileName);
        String picUrl = "http://www.jingdian.party/" + mOnlineMusic.getCover_path();
        if (!albumFile.exists() && !TextUtils.isEmpty(picUrl)) {
            downloadAlbum(picUrl, albumFileName);
        } else {
            mCounter++;
        }

        music = new MusicBean();
        music.setTitle(title);
        music.setMusername(artist);

    }

    private void downloadAlbum(String picUrl, String fileName) {

    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/moudles/mine/observer/ConcreteObserver.java
package com.looking.classicalparty.moudles.mine.observer;

/**
 * Created by xin on 2016/11/2.
 * 实体观察者对象
 */


public class ConcreteObserver implements Observer {
    private String desco;

    @Override
    public void update(String desc) {
        this.desco = desc;
    }
}
<file_sep>/app/src/main/java/com/looking/classicalparty/lib/common/TipDialog.java
package com.looking.classicalparty.lib.common;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.looking.classicalparty.R;

/**
 * Created by xin on 2016/10/24.
 */
public class TipDialog extends Dialog implements View.OnClickListener {
    private tipsListener listener;
    private Button mBtnTipsOne;
    private Button mBtnTipTwo;
    
    public TipDialog(Context context) {
        this(context, R.style.base_dialog_theme);
    }
    
    public TipDialog(Context context, int themeResId) {
        super(context, themeResId);
    }
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tips_dialog_layout);
        mBtnTipsOne = (Button) findViewById(R.id.btn_tips_one);
        mBtnTipTwo = (Button) findViewById(R.id.btn_tips_two);
        mBtnTipsOne.setOnClickListener(this);
        mBtnTipTwo.setOnClickListener(this);
    }
    
    public void setTipsListener(tipsListener listener) {
        this.listener = listener;
    }
    
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_tips_one:
                if (listener != null) {
                    listener.getAppData();
                }
                break;
            case R.id.btn_tips_two:
                dismiss();
                break;
        }
        
    }
    
    public interface tipsListener {
        void getAppData();
        
    }
}
