Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
搭建好基础架构
  • Loading branch information
liuzipengWally committed Feb 20, 2017
0 parents commit c4638c5
Show file tree
Hide file tree
Showing 91 changed files with 2,756 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/
out/
build/

# Local configuration file (sdk path, etc)
local.properties

# Windows thumbnail db
Thumbs.db

# OSX files
.DS_Store

# Eclipse project files
.classpath
.project

# Android Studio
*.iml
.idea
gradle
# Local IDEA workspace
.idea/workspace.xml
.idea/gradle.xml
# Gradle cache
.gradle
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
49 changes: 49 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.twobbble"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.anko:anko-common:$anko_version"
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:design:25.1.1'
compile 'com.android.support:recyclerview-v7:25.1.1'
compile 'com.android.support:cardview-v7:25.1.1'
compile 'com.android.support:support-v13:25.1.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.1.2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.commit451:PhotoView:1.2.5'
compile 'com.zhy:flowlayout-lib:1.0.3'
compile 'com.android.support:support-vector-drawable:25.1.1'
compile 'io.reactivex.rxjava2:rxjava:2.x.y'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.1@aar'
compile 'com.android.support:palette-v7:25.1.1'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.android.support:support-v4:25.1.1'
compile 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
}
25 changes: 25 additions & 0 deletions app/proguard-rules.pro
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/liuzipeng/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
29 changes: 29 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.twobbble">

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

<application
android:name=".application.App"
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=".view.activity.BaseActivity" />
<activity
android:name=".view.activity.MainActivity"
android:launchMode="singleTask"
android:theme="@style/TransparentTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
Binary file added app/src/main/assets/fonts/yuehei.ttf
Binary file not shown.
31 changes: 31 additions & 0 deletions app/src/main/java/com/twobbble/application/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.twobbble.application

import android.app.Application
import com.twobbble.R
import uk.co.chrisjenx.calligraphy.CalligraphyConfig

/**
* Created by liuzipeng on 2017/2/15.
*/
class App : Application() {
//将Application 单利化,可供全局调用 Context
companion object { //companion为伴随对象 object 为单利对象
private var instance: Application? = null //申明一个可为空的instance
fun getInstace() = instance!! //返回一个不能为空的instance !!表示这个对象如果不为空就返回,为空就抛出异常
}

override fun onCreate() {
super.onCreate()
init()
initFont()
}

private fun initFont() {
CalligraphyConfig.initDefault(CalligraphyConfig.Builder().
setDefaultFontPath("fonts/yuehei.ttf").setFontAttrId(R.attr.fontPath).build())
}

private fun init() {
instance = this
}
}
8 changes: 8 additions & 0 deletions app/src/main/java/com/twobbble/event/OpenDrawerEvent.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.twobbble.event

/**
* Created by liuzipeng on 2017/2/18.
* 这个事件用于打开抽屉菜单
*/
class OpenDrawerEvent {
}
12 changes: 12 additions & 0 deletions app/src/main/java/com/twobbble/tools/Constant.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.twobbble.tools

/**
* Created by liuzipeng on 2017/2/17.
*/
class Constant {
companion object {
val CLIENT_ID = "14736e3fe75031a8eb83a3b9e762ec32bc31de4024bfc7cc238e50abaaf8c760"
val CLIENT_SECRET = "ef8eb3102694ad0f8ce55172cb0fcacb4363106542987936437fb54b39f39955"
val ACCESS_TOKEN = "ee607f434ed5fe4ac833c7d22f541245f95f2c99ecdef57900e74e4d6bf7e4cd"
}
}
35 changes: 35 additions & 0 deletions app/src/main/java/com/twobbble/tools/ExtendFunUtils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.twobbble.tools

import android.app.Activity
import android.app.Fragment
import android.support.design.widget.Snackbar
import android.util.Log
import android.view.View

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

fun Activity.showSnackbar(view: View, msg: String, time: Int = Snackbar.LENGTH_SHORT) {
Snackbar.make(view, msg, time).show()
}

fun Activity.showSnackbar(view: View, msg: String, time: Int = Snackbar.LENGTH_SHORT, actionMsg: String = "重试", action: (View) -> Unit) {
Snackbar.make(view, msg, time).setAction(actionMsg, View.OnClickListener { action.invoke(view) }).show()
}

fun Fragment.showSnackbar(view: View, msg: String, time: Int = Snackbar.LENGTH_SHORT) {
Snackbar.make(view, msg, time).show()
}

fun Fragment.showSnackbar(view: View, msg: String, time: Int = Snackbar.LENGTH_SHORT, actionMsg: String = "重试", action: (View) -> Unit) {
Snackbar.make(view, msg, time).setAction(actionMsg, View.OnClickListener { action.invoke(view) }).show()
}

fun Activity.log(msg: String) {
Log.d(this.javaClass.simpleName, msg)
}

fun Fragment.log(msg: String) {
Log.d(this.javaClass.simpleName, msg)
}
Loading

0 comments on commit c4638c5

Please sign in to comment.