<repo_name>yyyAndroid/Sproject<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/ui/activity/BaseActivity.java
package com.abe.dwwd.sporjectone.ui.activity;

import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;

import com.abe.dwwd.sporjectone.utils.LogUtils;

import java.util.HashMap;
import java.util.Map;

import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/1/16.
 */

public class BaseActivity extends AppCompatActivity {
    /**
     * group:android.permission-group.CONTACTS//联系人
     * permission:android.permission.WRITE_CONTACTS//写写联系人
     * permission:android.permission.GET_ACCOUNTS//得到账号
     * permission:android.permission.READ_CONTACTS//读联系人
     * <p>
     * group:android.permission-group.PHONE
     * permission:android.permission.READ_CALL_LOG
     * permission:android.permission.READ_PHONE_STATE
     * permission:android.permission.CALL_PHONE
     * permission:android.permission.WRITE_CALL_LOG
     * permission:android.permission.USE_SIP
     * permission:android.permission.PROCESS_OUTGOING_CALLS
     * permission:com.android.voicemail.permission.ADD_VOICEMAIL
     * <p>
     * group:android.permission-group.CALENDAR
     * permission:android.permission.READ_CALENDAR
     * permission:android.permission.WRITE_CALENDAR
     * <p>
     * group:android.permission-group.CAMERA
     * permission:android.permission.CAMERA
     * <p>
     * group:android.permission-group.SENSORS
     * permission:android.permission.BODY_SENSORS
     * <p>
     * group:android.permission-group.LOCATION
     * permission:android.permission.ACCESS_FINE_LOCATION
     * permission:android.permission.ACCESS_COARSE_LOCATION
     * <p>
     * group:android.permission-group.STORAGE
     * permission:android.permission.READ_EXTERNAL_STORAGE
     * permission:android.permission.WRITE_EXTERNAL_STORAGE
     * <p>
     * group:android.permission-group.MICROPHONE
     * permission:android.permission.RECORD_AUDIO
     * <p>
     * group:android.permission-group.SMS
     * permission:android.permission.READ_SMS
     * permission:android.permission.RECEIVE_WAP_PUSH
     * permission:android.permission.RECEIVE_MMS
     * permission:android.permission.RECEIVE_SMS
     * permission:android.permission.SEND_SMS
     * permission:android.permission.READ_CELL_BROADCASTS
     *
     * @param savedInstanceState
     * @param persistentState
     */
    private static final String TAG = "BaseActivity";


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.bind(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    /**
     * 检查权限并申请
     */
    private Map<Integer, String> requestCodes;

    protected boolean checkAppPermission(final String permission, final int requestCode, String message) {
        if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {
            if (ActivityCompat.shouldShowRequestPermissionRationale(this, permission)) {
                new AlertDialog.Builder(this)
                        .setMessage(message)
                        .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                requestPermission(permission, requestCode);
                            }
                        }).show();
            } else {
                //申请权限
                requestPermission(permission, requestCode);
            }
            return false;
        }
        return true;
    }

    /**
     * 申请权限
     */
    private void requestPermission(String permission, int requestCode) {

        if (requestCodes == null) {
            requestCodes = new HashMap();
        }
        if (!requestCodes.containsKey(requestCode)) {
            requestCodes.put(requestCode, permission);
        }
        //申请权限
        ActivityCompat.requestPermissions(this, new String[]{permission}, requestCode);
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (requestCodes.containsKey(requestCode)) {
            if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                permissionCallback(true, requestCode, requestCodes.get(requestCode));
            } else {
                permissionCallback(false, requestCode, requestCodes.get(requestCode));
            }
            requestCodes.remove(requestCode);
        }
    }

    /**
     * 权限返回状态
     *
     * @param successed
     * @param requestCode
     */
    protected void permissionCallback(boolean successed, int requestCode, String permission) {
        LogUtils.d("permission:" + permission + " requestCode:" + requestCode + " success:" + successed);
    }
}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/facetory/ExportDBOperator.java
package com.abe.dwwd.sporjectone.facetory;

/**
 * Created by Administrator on 2017/2/15.
 */

public class ExportDBOperator extends ExportOperate{

    @Override
    public ExportFileApi newFile() {
        return new ExportDBFile();
    }

    public void export(String data){
        ExportDBFile file = new ExportDBFile();
        file.export(data);
    }
}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/facetory/ExportTextOperator.java
package com.abe.dwwd.sporjectone.facetory;

/**
 * Created by Administrator on 2017/2/15.
 */

public class ExportTextOperator {

}
<file_sep>/README.md
# Sproject
####动画百分比柱状图

<img src="https://github.com/yyyAndroid/Sproject/blob/master/gif/GIF.gif" width = "320" height = "640" align=center />

####ViewPage效果

<img src="https://github.com/yyyAndroid/Sproject/blob/master/gif/GIF2.gif" width = "320" height = "640" align=center />

#####下拉刷新 

<img src="https://github.com/yyyAndroid/Sproject/blob/master/gif/GIF3.gif" width = "320" height = "640" align=center />

```
//支持ListView ScrolView  RecyclerView
<com.abe.dwwd.sporjectone.view.refresh.RefreshLayout
        android:id="@+id/refresh_layout"
        android:layout_height="match_parent"
        android:layout_width="match_parent">
        <ListView
            android:id="@+id/list_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
        
        </ListView>

</com.abe.dwwd.sporjectone.view.refresh.RefreshLayout>
```

#####签到dialog
<img src="https://github.com/yyyAndroid/Sproject/blob/master/gif/GIF4.gif" width = "320" height = "640" align=center />
<file_sep>/app/src/androidTest/java/com/abe/dwwd/sporjectone/until/CalculatorTest.java
package com.abe.dwwd.sporjectone.until;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Created by Administrator on 2017/2/16.
 */
public class CalculatorTest {

    private Calculator mCalculator;
    @Before
    public void setUp() throws Exception {
        mCalculator = new Calculator();
    }

    @Test
    public void sum() throws Exception {
        assertEquals(6d,mCalculator.sum(1d,5d),0);
    }

    @Test
    public void substract() throws Exception {
        assertEquals(1d,mCalculator.substract(5d,4d),0);
    }

    @Test
    public void divide() throws Exception {
        assertEquals(4d,mCalculator.divide(20d,5d),0);
    }

    @Test
    public void multiply() throws Exception {
        assertEquals(10d,mCalculator.multiply(2d,5d),0);
    }

}<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/view/CustomDrawText.java
package com.abe.dwwd.sporjectone.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by Administrator on 2017/1/6.
 * 绘制文字方法
 * //第一类  只能在指定文本极限位置（基线x默认在字符串左侧，基线y默认在字符串下方）
 *
 * public void drawText(String text,float x,float y,Paint paint);
 * public void drawText(String text,int start,int end,float x,float y,Paint paint);
 * public void drawText(CharSequence text,int start,int end,float x,float y,Paint paint);
 * public void drawText(char[] text,int index,int count,float x,float y,Paint paint);
 *
 * //第二类 可以分别指定每个文字的位置
 * public void drawPostText(String text,float[] pos,Paint paint)
 * public void drawPostText(char[] text,int index,int count,float[] pos,Paint);
 *
 * //第三类 指定一个路径，根据路径绘制文字
 * public drawTextOnPath(String text,Path path,float hOffsef,float voffset,Paint paint);
 * public drawTextOnPath(char[] text,int index,int count,Path path,float hOffset,float vOffset,Paint paint);
 *
 *
 * Paint文本相关常用的方法
 * setColor,setARGB,setAlpha
 * setTextSize
 * setTypeface
 * setStyle FILL,STROKE,FILL_AND_STROKE
 * setTestAlign 左对齐（LEFT),居中（CENTER），右对齐（RIGHT）
 * measureText 测量文字大小（注意，请在设置完文本各项参数后条用）
 *
 */

public class CustomDrawText extends View {
    public CustomDrawText(Context context) {
        super(context);
    }

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

    public CustomDrawText(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint textPaint = new Paint();
        textPaint.setColor(Color.BLACK);
        textPaint.setStyle(Paint.Style.FILL);
//        textPaint.setTypeface(Typeface.SERIF);
        textPaint.setTextSize(50);
        textPaint.setTypeface(Typeface.DEFAULT_BOLD);
        String str = "HELL";
        // 第一类方法：参数分别为 （文本，基线x，基线y，画笔）
//        canvas.drawText(str,200,500,textPaint);
        //第二类方法：
     /*   canvas.drawPosText(str,new float[]{
                100,100,
                200,200,
                300,300,
                400,400
        },textPaint);*/

        //第三类(drawTextOnPath)
    }
}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/facetory/ExportFileOperator.java
package com.abe.dwwd.sporjectone.facetory;

/**
 * Created by Administrator on 2017/2/15.
 */

public class ExportFileOperator extends ExportOperate{

    @Override
    public ExportFileApi newFile() {
        return new ExportTextFile();
    }

    public void export(String data) {
        ExportTextFile file = new ExportTextFile();
        file.export(data);
    }
}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/bean/Course.java
package com.abe.dwwd.sporjectone.bean;

/**
 * Created by Administrator on 2017/2/28.
 */

public class Course {
    private double math;
    private double english;

    public double getMath() {
        return math;
    }

    public void setMath(double math) {
        this.math = math;
    }

    public double getEnglish() {
        return english;
    }

    public void setEnglish(double english) {
        this.english = english;
    }
}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/facetory/ExportOperate.java
package com.abe.dwwd.sporjectone.facetory;

/**
 * Created by Administrator on 2017/2/15.
 */

public abstract class ExportOperate {

        public abstract ExportFileApi newFile();

    /**
     * 导出数据
     * @param data
     */
       public void export(String data){
            ExportFileApi file = newFile();
       }
}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/CustomView/CustomImageCharacterView.java
package com.abe.dwwd.sporjectone.CustomView;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Picture;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.PictureDrawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;

import java.io.IOException;
import java.io.InputStream;

/**
 * Created by Administrator on 2017/1/3.
 * 绘制图片  使用Picture是要关闭硬件加速
 * drawPicture(矢量图)
 * drawBitmap(位图)
 * public int getWidth()//获取宽度
 * public int getHeight()//获取高度
 * public Canvas beginRecordin(int width,int height)//开始录制返回一个Canvas，在
 * Canvas中素有的绘制都会存储在Picture
 * public void endRecoding()//结束录制
 * public void draw(Canvas canvas)将Picture中内容会知道Canvas中
 * public static Picture createFromStream(InputStream stream)//通过输入流常见一个Picture
 * public static Picture writeToStream(OutputStream stream)//将Picture中内容写出到
 */

public class CustomImageCharacterView extends View {
    //1.创建Picture
    private Picture mPicture = new Picture();
    private static final String TAG = "CustomImageCharacterVie";
    private static final String TAG_NAME = "图片文字控件";
    private Context mContext;
    public CustomImageCharacterView(Context context) {
        this(context, null);
        Log.e(TAG, TAG_NAME + "this(context, null);");
    }

    public CustomImageCharacterView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
        Log.e(TAG, TAG_NAME + "this(context, null,0);");
    }

    public CustomImageCharacterView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mContext = context;
        Log.e(TAG, TAG_NAME + "super(context, attrs,defStyleAttr);");
        recording();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Log.e(TAG, TAG_NAME + "mPicture.getHeight():" + mPicture.getHeight() + "  mPicture.getWidth():" + mPicture.getWidth());
//        drawPictureMethod(canvas);
        drawBitmapMethod(canvas);
    }

    /**
     * 注注：需要关闭硬件加速
     * 注注：需要关闭硬件加速
     * 注注：需要关闭硬件加速
     * 注注：需要关闭硬件加速
     * 注注：需要关闭硬件加速
     * 注注：需要关闭硬件加速
     * 注注：需要关闭硬件加速
     * @param canvas
     */
    private void drawPictureMethod(Canvas canvas) {
        //第一种使用方式   对Canvas有影响，绘制完成后会影响
        mPicture.draw(canvas);
        //第二种使用方式  对Canvas操作无影响
        canvas.drawPicture(mPicture, new RectF(0, 0, mPicture.getWidth(), 200));
        //第三种使用方式
        PictureDrawable drawable = new PictureDrawable(mPicture);
        drawable.setBounds(0, 0, 250, mPicture.getHeight());
        drawable.draw(canvas);
        Log.e(TAG, TAG_NAME + "onDraw(Canvas canvas)");
    }

    /**
     * 在Canvas中绘制图片
     * @param canvas
     */
    private void drawBitmapMethod(Canvas canvas){
        //第一种
//        canvas.drawBitmap(getBitmap(),new Matrix(),new Paint());
        //第二种
        canvas.drawBitmap(getBitmap(),200,500,new Paint());
        //第三种
        canvas.drawBitmap(getBitmap(),new Rect(0,0,getBitmap().getWidth()/2,getBitmap().getHeight()/2),
                new RectF(0,0,200,100),null);
    }

    private Bitmap getBitmap(){
        //资源文件 raw
        Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), android.R.mipmap.sym_def_app_icon);
        //assets 资源文件
      /*  Bitmap bitmap1 = null;
        try {
            InputStream is = mContext.getAssets().open("bitmap.png");
            bitmap = BitmapFactory.decodeStream(is);
            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        //内存卡读取文件
        Bitmap bitmap2 = BitmapFactory.decodeFile("/sdcard/bitmap.png");*/
        return bitmap;
    }
    //2.录制内容方法
    private void recording() {
        //开始录制

        Canvas canvas = mPicture.beginRecording(300, 300);
        //创建一个画笔
        Paint paint = new Paint();
        paint.setColor(Color.BLUE);
        paint.setStyle(Paint.Style.FILL);
        //在Canvas中的具体操作
        canvas.translate(250, 250);
        //绘制一个圆
        canvas.drawCircle(0, 0, 100, paint);

        mPicture.endRecording();//结束录制
    }
}
<file_sep>/text/rxjava_read.md
##Rxjava到底是什么？
Rxjava在Github主页上的自我介绍是：一个在Java VM上使用__可观测的序列__  来组成异步的，基于事件的程序库
然而，对于初学者来说，这太难看懂了，因为它是一个 总结，而初学者需要一个引言。

###RxJva好在哪里
换句话说，【同样是异步，为什么人们用它，而不用现成的  AsyncTask、Handler//xxx】
一个词：简洁


RxJava的观察者模式
RxJava有四个基本概念：Observable（可观察者，既被观察者）、Observer（观察者）、subscribe(订阅）、事件。Observable和Observer通过subscribe（）
方法实现订阅关系，从而Observable可以在需要的时候发出事件来通知Observer


与传统观察者模式不同RxJava的事件毁掉方法除了普通事件onNext（） （相当于onClick（）/onEvent()）之外，还定义了两个特殊的事件：
onCompleted()和onError();

onComplete():事件队列完结。RxJava不仅把每个事件丹徒处理，还会把它看做一个队列。RxJava规定，当不在有新的onNext()发出时，需要出发onCompleted()
方法作为标志

onError():事件队列异常。事件处理过程中出现异常时，onError()会被出发，同时队列会自动终止，不允许再有事件发出

在一个正确运行的事件序列中，onComlplete()和onError()有且只有一个，并且是事件序列中的最后一个。需要注意的是，onCompleted()和onError()二者也是互相
排斥的，既在队列中调用了其中一个，就不应该在调用另一个。


2.基本实现
    RxJava的基本实现由3点：
    1).创建Observer
    Observer既观察者，它决定事件触发的时候将有怎样的操作的行为。RxJava中的Observer接口的实现方式：

    除了Observer接口之外，RxJava还内置了一个实现Observer的抽象类：Subscriber.Subscriber对Observer接口进行了一些扩展
    ,但他们的基本使用方式是完全一样的


    不仅基本使用方式一样，实质上，在RxJava的subscriber过程中，Observer也是会先被转换成一个Subscriber再使用。所以如果你
    只想使用基本功能，选择Observer和Subscriber是完全一样的。它们的区别对于使用者来说主要有两点：
    1). onStart()：这是Subscriber增加的方法。它会在subscribe刚开始，而时间还未发送之前被调用，可以用于做一些准备工作，例如数据的清零和重置。这是一个
    可选择的方法，默认情况下它的实现为空。需要注意的是，如果对准备工作的线程有要求（例如弹出一个显示进度的对话框，这必须在主线程），onStart()就不适用了，
    因为它总是在subscribe所发生的线程被调用，而不能指定线程。要在指定的线程来做准备工作，可以使用doOnSubscribe()方法，具体可以在后面的稳重看到。

    2.）unSubscribe():这是subscriber所实现的另一个接口Subscription的方法，用于取消订阅。
    在这个方法调用后，Subscriber将不在接受时间。一般在这个方法钱，可以使用isUnsubscribe()先判断一下状态、unsubscibe()这个方法很重要，
    因为在subscribe()之后，Observable会持有Subscriber的引用，这个引用如果不能及时被释放，将有内存泄漏的的风险。所以最好保持一个原则：
    要在不在使用的时候尽快的合适的地方（例如onPauser() onStop()等方法中）电泳unSubscribe()来解除引用关系，以避免内存泄漏的发生。

2.创建Observable
    Observable既被观察者，它决定什么时候触发事件以及触发怎样的事件。RxJava使用create()方法来创建一个Observable，
    并为它定义事件触发规则：

3.Subscribe(订阅)
    1).创建了Observable()和Observer()之后，再用subscriber()方法将他们链接起来，整条链子就可以工作了。代码形式很简单：

<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/facetory/ExportExceOperator.java
package com.abe.dwwd.sporjectone.facetory;

/**
 * Created by Administrator on 2017/2/15.
 */

public class ExportExceOperator {
}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/MainActivity.java
package com.abe.dwwd.sporjectone;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.ViewCompat;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.abe.dwwd.sporjectone.rxjava.RxJavaSecondActivity;
import com.abe.dwwd.sporjectone.rxjava.RxJavaVaryActivity;
import com.abe.dwwd.sporjectone.ui.activity.BaseActivity;
import com.abe.dwwd.sporjectone.ui.activity.ChartActivity;
import com.abe.dwwd.sporjectone.ui.activity.MoveActivity;
import com.abe.dwwd.sporjectone.ui.activity.OkHttpActivity;
import com.abe.dwwd.sporjectone.ui.activity.PathPainterActivity;
import com.abe.dwwd.sporjectone.ui.activity.PullToRefreshActivity;
import com.abe.dwwd.sporjectone.ui.activity.SearchViewActivity;
import com.abe.dwwd.sporjectone.ui.activity.VLayoutActivity;
import com.abe.dwwd.sporjectone.ui.activity.ViewPageActivity;
import com.abe.dwwd.sporjectone.view.SignInDialog;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainActivity extends BaseActivity {
    Button btChart;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btChart = (Button) findViewById(R.id.bt_chart);
    }

    public void clickChart(View view){
        if (btChart == null){
            Toast.makeText(this, "bt为空", Toast.LENGTH_SHORT).show();
        }
        startActivity(new Intent(this, ChartActivity.class));
    }

    public void clickOkHttp(View view){
        startActivity(new Intent(this, OkHttpActivity.class));
    }

    public void clickViewpage(View view){
        startActivity(new Intent(this, ViewPageActivity.class));
    }

    public void clickMove(View view){
        startActivity(new Intent(this, MoveActivity.class));
    }

    public void clickRefresh(View view){
        startActivity(new Intent(this, PullToRefreshActivity.class));
    }

    public void clickSignDialog(View view){
        SignInDialog signInDialog = new SignInDialog(this,null);
        signInDialog.show();
    }
    public void clickRx(View view){
        startActivity(new Intent(this, RxJavaSecondActivity.class));
    }
    public void clickRxVary(View view){
        startActivity(new Intent(this, RxJavaVaryActivity.class));
    }

    public void clickVLayout(View view){
        startActivity(new Intent(this, VLayoutActivity.class));
    }

    public void clickSearch(View view){
        startActivity(new Intent(this, SearchViewActivity.class));
    }
    public void clickPathMeasure(View view){
        startActivity(new Intent(this, PathPainterActivity.class));
    }
}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/facetory/ExportExceFile.java
package com.abe.dwwd.sporjectone.facetory;

/**
 * Created by Administrator on 2017/2/15.
 */

public class ExportExceFile implements ExportFileApi {
    @Override
    public void export(String data) {

    }
}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/facetory/ExportDBFile.java
package com.abe.dwwd.sporjectone.facetory;

/**
 * Created by Administrator on 2017/2/15.
 * 数据库文件
 */

public class ExportDBFile implements ExportFileApi{

    @Override
    public void export(String data) {
        System.out.println("导出到数据库文件");
    }
}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/ui/activity/OkHttpActivity.java
package com.abe.dwwd.sporjectone.ui.activity;

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

import com.abe.dwwd.sporjectone.R;

public class OkHttpActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ok_http);
    }

    public void clickRequest(View view){

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


repositories {
    flatDir {
        dirs 'libs/aar'
    }
    mavenCentral()
    jcenter()
    maven {
        url "http://mvn.gt.igexin.com/nexus/content/repositories/releases/"
    }
    maven { url "https://jitpack.io" }
}
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.abe.dwwd.sporjectone"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    // View注入框架
    compile 'com.jakewharton:butterknife:+'
    compile 'com.orhanobut:logger:+'
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.squareup.okhttp:okhttp:+'
    compile 'com.squareup.okio:okio:+'
    compile 'com.android.support:design:25.1.0'

    //RxJava
    compile 'io.reactivex:rxjava:1.0.14'
    compile 'io.reactivex:rxandroid:1.0.1'

    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services-appindexing:8.4.0'
    compile('com.alibaba.android:vlayout:1.0.2@aar') {
        transitive = true
    }

    //可选，用于生成application类
/*        compile('com.tencent.tinker:tinker-android-anno:1.7.1')
        //tinker的核心库
        compile('com.tencent.tinker:tinker-android-lib:1.7.1')*/

    //    compile 'cn.pedant.sweetalert:library:1.3'

}



<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/view/SignInDialog.java
package com.abe.dwwd.sporjectone.view;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;

import com.abe.dwwd.sporjectone.R;


/**
 * Created by yanyangy on 2017/2/23.
 * 签到dialog
 */

public class SignInDialog extends Dialog {
    ImageView ivBack;//返回
    ImageView ivHeader;//头像
    String headerUrl;
    View view;
    public SignInDialog(Context context, String headerUrl) {
        super(context, R.style.sign_in_dialog);
        this.headerUrl = headerUrl;
        init();
    }

    private void init(){
        view = LayoutInflater.from(getContext()).inflate(R.layout.view_sign_in, null);
        ivBack = (ImageView) view.findViewById(R.id.sign_in_back);
        ivHeader = (ImageView) view.findViewById(R.id.sign_in_header);

        setContentView(view);

        configurationWindow();
    }

    /**
     * 配置windows
     */
    private void configurationWindow() {
        this.setCanceledOnTouchOutside(false);
        Window select_window = getWindow();
        select_window.setGravity(Gravity.TOP);
        WindowManager.LayoutParams lp = select_window.getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        select_window.setAttributes(lp);
    }

    @Override
    public void show() {
        super.show();
    }

    @Override
    public void dismiss() {
        super.dismiss();

    }
}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/ui/activity/PullToRefreshActivity.java
package com.abe.dwwd.sporjectone.ui.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;
import android.widget.Toast;

import com.abe.dwwd.sporjectone.R;
import com.abe.dwwd.sporjectone.view.refresh.OnRefreshListener;
import com.abe.dwwd.sporjectone.view.refresh.RefreshLayout;

import butterknife.BindView;

public class PullToRefreshActivity extends BaseActivity {

    RefreshLayout refreshLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pull_to_reflsh);
        refreshLayout = (RefreshLayout) findViewById(R.id.refresh_layout);
        refreshLayout.setEnabled(true);
        refreshLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh() {
                Toast.makeText(PullToRefreshActivity.this, "下拉刷新", Toast.LENGTH_SHORT).show();

                refreshLayout.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        refreshLayout.setRefreshing(false);
                    }
                },3000);
            }
        });



    }



}
<file_sep>/app/src/main/java/com/abe/dwwd/sporjectone/rxjava/RxJavaActivity.java
package com.abe.dwwd.sporjectone.rxjava;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;

import com.abe.dwwd.sporjectone.R;

import rx.Observable;
import rx.Observer;
import rx.Subscriber;
import rx.functions.Action0;
import rx.functions.Action1;
import rx.functions.ActionN;


public class RxJavaActivity extends AppCompatActivity {

    private static final String TAG = "RxJavaActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rx_java);
    }


    /**
     * 创建 Observer观察者
     */
    Observer<String> observer = new Observer<String>() {
        @Override
        public void onCompleted() {
            Log.d(TAG, TAG + "  onCompleted()");
        }

        @Override
        public void onError(Throwable e) {
            Log.d(TAG, TAG + "   onError()" + e);
        }

        @Override
        public void onNext(String s) {
            Log.d(TAG, TAG + "   s:" + s);
        }
    };
    /**
     * RxJava还内置了一个实现Observer的抽象类：Subscriber.Subscriber对Observer接口进行了一些扩展，但他们的基本使用方式是完全一样的：
     */

    Subscriber<String> subscriber = new Subscriber<String>() {
        @Override
        public void onCompleted() {
            Log.d(TAG, TAG + " onCompleted");
        }

        @Override
        public void onError(Throwable e) {
            Log.d(TAG, TAG + "  onError():" + e);
        }

        @Override
        public void onNext(String s) {
            Log.d(TAG, TAG + "   onNext():" + s);
        }
    };


    /**
     * 这里传入了一个OnSubscribe对象作为参数。OnSubscribe会被存储在返回的Observable对象中，它的作用相当于一个计划表，当
     * Observable被订阅的时候，OnSubscriber的call()方法 会自动被调用，时间序列就会依照设定一次触发（对于上面的代码，就是观察者Subscriber将会
     * 被调用三次onNext()和一次 onComplete()。这样，有被观察者调用了观察者的回调方法，就实现了由被观察者向观察者的事件传递，既观察者模式。
     */
    Observable observable = Observable.create(new Observable.OnSubscribe<String>() {
        @Override
        public void call(Subscriber<? super String> subscriber) {
            subscriber.onNext("Hello");
            subscriber.onNext("Hi");
            subscriber.onNext("abe");
            subscriber.onCompleted();
        }
    });

    /**
     * create()方法是RxJava最基本的创造事件序列的方法。基于这个方法，RxJava还提供了一些方法用来快捷创建事件队列，例如：
     * <p>
     * just(T...):将传入的参数一次发送出来。
     */

    Observable observable2 = Observable.just("Hello", "hi", "abe");
    /*将会一次调用：
    onNext("Hello");
    onNext("Hi");
    noNext("abe");
    onCompleted();
    */

    /**
     * from(T[]) / from(Iterable<? extend T>); 将传入的数组或Iterable拆分成具体对象后，依次发送出来。
     */

    String[] words = {"Hello", "Hi", "abe"};
    Observable observable3 = Observable.from(words);
    /*
    讲一次调用：
    onNext("Hello");
    onNext("Hi");
    onNext("abe");
    onCompleted();
     */
    //上面just（T...)的例子，都和之前的create（OnSubscribe)的例子是等价的



    /**
     * 除了subscribe(Observer)和subscriber(Subscriber),subscribe()还支持不完整定义的回调，
     * RxJava会自动根据定义创建出Subscriber。形式如下：
     */

    Action1<String> onNextAction = new Action1<String>() {
        @Override
        public void call(String s) {
            Log.d(TAG," onNext "+s);
        }
    };

    Action1<String> onErrorAction = new Action1<String>() {
        @Override
        public void call(String s) {
            Log.d(TAG,"error :"+s);
        }
    };

    Action0 onCompleteAction = new Action0() {
        @Override
        public void call() {
            Log.d(TAG," onCompleteAction ");
        }
    };
    /**
     * Subscribe(订阅)
     */
    public void init() {
        //observable.subscribe(subscriber);
        //或者
        //observable.subscribe(observer);
        //自动创建 Subscriber，并使用onNextAction 来定义 onNext();
        observable.subscribe(onNextAction);
        //自动创建 Subscriber, 并使用onNextAction和 onErrorAction()来定义 onNext()和onError();
        observable.subscribe(onNextAction,onErrorAction);

        //自动创建 Subscriber,并使用onNextAction 和 onErrorAction() 和 onCompleteAction() 来定义 onNext()和onError和 onComplete();
        observable.subscribe(onNextAction,onErrorAction,onCompleteAction);

    }

    //简单的RxJava例子
    public void clickBt(View view){
        String[] names = new String[]{"",""};
        Observable.from(names).subscribe(new Action1<String>() {
            @Override
            public void call(String s) {
                Log.d(TAG,s);
            }
        });
    }
/**
 * 3.线程控制 -- Scheduler (一)
 * 在不指定线程的情况下，RxJava遵循的是线程不变原则，既：在哪一个线程调用Subscriber()，就在哪个线程生产事件；在哪个线程消费事件。如果需要切换线程，
 * 就系要用到Scheduler(调度器)
 *
 *   1).Schedule的API（一）
 *   在RxJava中，Scheduler -- 调度器，相当于相当于线程控制器，RxJava通过它来指定每一段代码应该运行在什么样的线程。RxJava已经内置了
 *   几个Scheduler,它们已近适合大多数的使用场景：
 *
 *      1.Schedulers.immediate():直接在当前线程运行，相当于不指定线程。这是模式的Scheduler
 *      2.Schedulers.newThread():总是启用新线程，并在新县城执行操作
 *      3.Schedulers.io():I/O操作（读写文件、读写数据库、网络信息交互等）所使用的Scheduler。行为模式和newThread（）差不多，
 *      区别在于io（）的内部实现的是一个无数量限制的线程池，可以重用空闲的线程，因此多数情况下io()比newThread（）更有效。
 *      不要把计算工作放在io（）中，可以避免创建不必要的线程。
 *      4.Schedulers.computation():计算所使用的Scheduler。这个计算值得是CPU密集型计算，既不会被i/o等操作限制性能的操作，例如图形计算
 *      。这个Scheduler使用的固定的线程池，大小为CPU核数。不要把i/o操作放在computation（）中，否则i/o操作的等待会时间会浪费CPU资源
 *      5.另外，Android还有一个专用的AndroidSchedulers.mainThread(),它指定的操作将在Android主线程中运行。
 *
 */


}
