Skip to content

Commit

Permalink
第一次提交代码
Browse files Browse the repository at this point in the history
  • Loading branch information
wanyt committed Jul 9, 2016
0 parents commit 6bdfe58
Show file tree
Hide file tree
Showing 44 changed files with 1,280 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
36 changes: 36 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apply plugin: 'com.android.application'
apply plugin: 'android-apt'

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
applicationId "com.okhttppractices.wanyt"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.orhanobut:logger:1.15'
//Butter Knife
compile 'com.jakewharton:butterknife:8.1.0'
apt 'com.jakewharton:butterknife-compiler:8.1.0'
//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
}
17 changes: 17 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in E:\AndroidStudio\Studio_SDK/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.okhttppractices.wanyt;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
22 changes: 22 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.okhttppractices.wanyt">

<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
12 changes: 12 additions & 0 deletions app/src/main/java/com/okhttppractices/wanyt/AppConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.okhttppractices.wanyt;

/**
* Created on 2016/7/9 13:55
* <p>
* author wanyt
* <p>
* Description:
*/
public class AppConfig {
public static boolean DEBUG = true;
}
100 changes: 100 additions & 0 deletions app/src/main/java/com/okhttppractices/wanyt/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.okhttppractices.wanyt;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;

import com.okhttppractices.wanyt.Request.Requester;
import com.okhttppractices.wanyt.http.HttpMethod;
import com.orhanobut.logger.Logger;

import java.io.IOException;
import java.util.HashMap;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import okhttp3.ResponseBody;
import rx.Observer;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class MainActivity extends AppCompatActivity {

@BindView(R.id.button)
Button btRequest;
@BindView(R.id.bt_login)
Button btLogin;
@BindView(R.id.bt_hot)
Button btHot;
// @BindView(R.id.edit_url)
// EditText etUrl;

// private HttpMethod requestMethod;
// private HttpMethod phpMethods;

private HttpMethod newRequester;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);

// RetrofitBuilder request = RetrofitBuilder.getIntance();

// requestMethod = request.getHttpMethods();
// phpMethods = request.getPhpMethods();

Requester requester = Requester.instance();
newRequester = requester.createRxRequest(HttpMethod.class);
}

@OnClick(R.id.bt_hot)
public void getHotThing(){

}

@OnClick(R.id.bt_login)
public void login(){
HashMap<String, String> map = new HashMap<>();

map.put("userName", "aabc");
map.put("pwd", "aabc11");
map.put("sid", "21000000000");

// Observable<ResponseBody> login = newRequester.login(map);

newRequester.login(map)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<ResponseBody>() {
@Override
public void onCompleted() {

}

@Override
public void onError(Throwable e) {

}

@Override
public void onNext(ResponseBody responseBody) {
try {
String response = responseBody.string();
Logger.d(response);
} catch (IOException e) {
e.printStackTrace();
}
}
});

}

@OnClick(R.id.button)
public void sendARequest(){

}

}
Loading

0 comments on commit 6bdfe58

Please sign in to comment.