-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
TBXark
committed
May 17, 2017
0 parents
commit d2a20b4
Showing
93 changed files
with
5,523 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
reated by https://www.gitignore.io/api/android | ||
gradlew.bat | ||
.idea/ | ||
### Android ### | ||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# Intellij | ||
*.iml | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/gradle.xml | ||
.idea/dictionaries | ||
.idea/libraries | ||
|
||
# Keystore files | ||
*.jks | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
google-services.json | ||
|
||
# Freeline | ||
freeline.py | ||
freeline/ | ||
freeline_project_description.json | ||
|
||
### Android Patch ### | ||
gen-external-apklibs | ||
|
||
# End of https://www.gitignore.io/api/android |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 25 | ||
buildToolsVersion "25.0.3" | ||
defaultConfig { | ||
applicationId "com.example.develop.base" | ||
minSdkVersion 15 | ||
targetSdkVersion 25 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
|
||
jackOptions { | ||
enabled true | ||
} | ||
} | ||
|
||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
|
||
} | ||
compileOptions { | ||
targetCompatibility 1.8 | ||
sourceCompatibility 1.8 | ||
} | ||
|
||
} | ||
|
||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile 'com.android.support:appcompat-v7:25.3.1' | ||
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8' | ||
|
||
compile 'com.android.support:design:25.3.1' | ||
compile 'com.android.support:recyclerview-v7:25.3.1' | ||
compile 'com.android.support:cardview-v7:25.3.1' | ||
compile 'com.android.support:support-annotations:25.3.1' | ||
compile 'com.jakewharton:butterknife:8.4.0' | ||
|
||
compile 'com.squareup.okio:okio:1.12.0' | ||
compile 'com.squareup.retrofit2:retrofit:2.2.0' | ||
compile 'com.squareup.retrofit2:converter-gson:2.2.0' | ||
compile 'com.squareup.retrofit2:adapter-rxjava:2.2.0' | ||
compile 'com.squareup.okhttp3:okhttp:3.7.0' | ||
compile 'com.squareup.okhttp3:logging-interceptor:3.7.0' | ||
compile 'com.github.Aspsine:SwipeToLoadLayout:1.0.4' | ||
|
||
compile 'io.reactivex:rxandroid:1.2.1' | ||
compile 'io.reactivex:rxjava:1.2.9' | ||
|
||
compile 'com.google.dagger:dagger:2.10' | ||
annotationProcessor 'com.google.dagger:dagger-compiler:2.10' | ||
|
||
provided 'org.glassfish:javax.annotation:10.0-b28' | ||
compile 'com.facebook.fresco:fresco:1.3.0' | ||
compile 'com.facebook.fresco:imagepipeline-okhttp3:0.13.0' | ||
|
||
//tencent bugly | ||
compile 'com.tencent.bugly:crashreport_upgrade:latest.release' | ||
compile 'com.tencent.bugly:nativecrashreport:latest.release' | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Users/develop/Library/Android/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 *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.develop.base"> | ||
|
||
<application | ||
android:name=".MyApplication" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:launchMode="singleTask" | ||
android:screenOrientation="portrait" | ||
android:theme="@style/AppTheme.AppCompat" | ||
android:windowSoftInputMode="adjustPan"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.example.develop.base; | ||
|
||
/** | ||
* Created by develop on 2017/5/17. | ||
*/ | ||
|
||
public class Config { | ||
public static final String BASE_URL = "https://api.playalot.cn/v1/"; | ||
public static final String USER_AGENT_HEAD = "Play/"; | ||
public static final String APP_VERSION_HEAD = "Android/"; | ||
public static final long NET_TIME_OUT = 1000; | ||
|
||
public static final String KEY_TOKEN_HEAD = "X-Auth-Token"; | ||
public static final String KEY_AGENT = "User-Agent"; | ||
public static final String KEY_PLAY_VERSION = "Play-Version"; | ||
public static final String KEY_TIME_OUT ="Timestamp"; | ||
} |
18 changes: 18 additions & 0 deletions
18
app/src/main/java/com/example/develop/base/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.example.develop.base; | ||
|
||
import android.os.Bundle; | ||
|
||
import com.example.develop.base.ui.BaseActivity; | ||
|
||
import butterknife.ButterKnife; | ||
|
||
public class MainActivity extends BaseActivity { | ||
|
||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
ButterKnife.bind(this); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
app/src/main/java/com/example/develop/base/MyApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.example.develop.base; | ||
|
||
import android.app.Application; | ||
|
||
import com.example.develop.base.net.ApplicationModule; | ||
import com.example.develop.base.net.BaseRepositoryComponent; | ||
import com.example.develop.base.net.BasePreferenceServiceModule; | ||
import com.example.develop.base.net.BaseRepositoryModule; | ||
import com.example.develop.base.net.DaggerBaseRepositoryComponent; | ||
import com.example.develop.base.net.service.PreferenceService; | ||
import com.example.develop.base.utils.FrescoUtils; | ||
import com.tencent.bugly.crashreport.CrashReport; | ||
|
||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import okhttp3.OkHttpClient; | ||
|
||
|
||
/** | ||
* Created by develop on 2017/5/17. | ||
*/ | ||
|
||
public class MyApplication extends Application { | ||
|
||
|
||
private BaseRepositoryComponent mBaseRepositoryComponent; | ||
|
||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
initRepositoryComponent(); | ||
// initBugly(); | ||
} | ||
|
||
private void initBugly() { | ||
CrashReport.initCrashReport(getApplicationContext(), "", false); | ||
} | ||
|
||
|
||
private void initRepositoryComponent() { | ||
mBaseRepositoryComponent = DaggerBaseRepositoryComponent | ||
.builder() | ||
.applicationModule(new ApplicationModule(getApplicationContext())) | ||
.basePreferenceServiceModule(new BasePreferenceServiceModule(new PreferenceService(getApplicationContext()))) | ||
.baseRepositoryModule(new BaseRepositoryModule()).build(); | ||
|
||
if (mBaseRepositoryComponent != null && mBaseRepositoryComponent.getBaseRepository() != null) { | ||
OkHttpClient okHttpClient = new OkHttpClient.Builder() | ||
.retryOnConnectionFailure(true) | ||
.connectTimeout(15, TimeUnit.SECONDS) | ||
.build(); | ||
FrescoUtils.initFresco(this, okHttpClient); | ||
} | ||
} | ||
|
||
|
||
} |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/example/develop/base/TokenThrowable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.example.develop.base; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Created by developer on 17-7-17. | ||
*/ | ||
public class TokenThrowable extends Throwable implements Serializable { | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
app/src/main/java/com/example/develop/base/cache/LolipopBitmapMemoryCacheSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.example.develop.base.cache; | ||
|
||
import android.app.ActivityManager; | ||
import android.os.Build; | ||
|
||
import com.facebook.common.internal.Supplier; | ||
import com.facebook.common.util.ByteConstants; | ||
import com.facebook.imagepipeline.cache.MemoryCacheParams; | ||
|
||
public class LolipopBitmapMemoryCacheSupplier implements Supplier<MemoryCacheParams> { | ||
private ActivityManager activityManager; | ||
|
||
public LolipopBitmapMemoryCacheSupplier(ActivityManager activityManager) { | ||
this.activityManager = activityManager; | ||
} | ||
|
||
@Override | ||
public MemoryCacheParams get() { | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
return new MemoryCacheParams(getMaxCacheSize(), 56, Integer.MAX_VALUE, | ||
Integer.MAX_VALUE, | ||
Integer.MAX_VALUE); | ||
} else { | ||
return new MemoryCacheParams( | ||
getMaxCacheSize(), | ||
256, | ||
Integer.MAX_VALUE, | ||
Integer.MAX_VALUE, | ||
Integer.MAX_VALUE); | ||
} | ||
} | ||
|
||
private int getMaxCacheSize() { | ||
final int maxMemory = Math.min(activityManager.getMemoryClass() * ByteConstants.MB, Integer.MAX_VALUE); | ||
|
||
if (maxMemory < 32 * ByteConstants.MB) { | ||
return 4 * ByteConstants.MB; | ||
} else if (maxMemory < 64 * ByteConstants.MB) { | ||
return 6 * ByteConstants.MB; | ||
} else { | ||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD) { | ||
return 8 * ByteConstants.MB; | ||
} else { | ||
return maxMemory / 4; | ||
} | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/example/develop/base/modle/entity/response/UserData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.develop.base.modle.entity.response; | ||
|
||
import android.os.Parcel; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by snowbean on 16-6-9. | ||
*/ | ||
public class UserData { | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/example/develop/base/modle/entity/response/UserToken.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.example.develop.base.modle.entity.response; | ||
|
||
public class UserToken { | ||
private String user_id; | ||
private String access_token; | ||
private long expires; | ||
|
||
public String getUser_id() { | ||
return user_id; | ||
} | ||
|
||
public void setUser_id(String user_id) { | ||
this.user_id = user_id; | ||
} | ||
|
||
public String getAccess_token() { | ||
return access_token; | ||
} | ||
|
||
public void setAccess_token(String access_token) { | ||
this.access_token = access_token; | ||
} | ||
|
||
public long getExpires() { | ||
return expires; | ||
} | ||
|
||
public void setExpires(long expires) { | ||
this.expires = expires; | ||
} | ||
} |
Oops, something went wrong.