├── app ├── .gitignore ├── src │ ├── main │ │ ├── assets │ │ │ └── fonts │ │ │ │ └── Lobster-1.4.otf │ │ ├── java │ │ │ └── com │ │ │ │ └── donkor │ │ │ │ └── deepnight │ │ │ │ ├── mvp │ │ │ │ ├── a.kt │ │ │ │ └── model │ │ │ │ │ └── bean │ │ │ │ │ └── CommonBean.kt │ │ │ │ ├── utils │ │ │ │ ├── NetworkUtils.kt │ │ │ │ ├── Extension.kt │ │ │ │ └── ImageLoadUtils.kt │ │ │ │ ├── network │ │ │ │ └── ApiService.kt │ │ │ │ ├── ui │ │ │ │ ├── FixMultiViewPager.java │ │ │ │ ├── fragment │ │ │ │ │ ├── BaseFragment.kt │ │ │ │ │ ├── LegsFragment.kt │ │ │ │ │ ├── ButtocksFragment.kt │ │ │ │ │ ├── PrettyFragment.kt │ │ │ │ │ ├── HodgepodgeFragment.kt │ │ │ │ │ ├── StockingsFragment.kt │ │ │ │ │ ├── AllFragment.kt │ │ │ │ │ └── BosomFragment.kt │ │ │ │ ├── AboutActivity.kt │ │ │ │ ├── SplashActivity.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ └── DragPhotoActivity.java │ │ │ │ └── adapter │ │ │ │ └── CommonAdapter.kt │ │ ├── res │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── icon_all.png │ │ │ │ ├── head_view.jpg │ │ │ │ ├── icon_about.png │ │ │ │ ├── icon_bosom.png │ │ │ │ ├── icon_legs.png │ │ │ │ ├── icon_like.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── icon_buttocks.png │ │ │ │ ├── icon_download.png │ │ │ │ ├── icon_pretty.png │ │ │ │ ├── deepnight_logo.png │ │ │ │ ├── icon_hodgepodge.png │ │ │ │ ├── icon_stockings.png │ │ │ │ ├── ic_empty_picture.png │ │ │ │ ├── ic_image_loading.png │ │ │ │ ├── ic_launcher_round.png │ │ │ │ └── splash_activity_background.jpg │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── icon_back.png │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── anim │ │ │ │ ├── slide_in_left.xml │ │ │ │ ├── slide_out_right.xml │ │ │ │ ├── slide_in_right.xml │ │ │ │ └── slide_out_left.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── item_viewpager.xml │ │ │ │ ├── activity_splash.xml │ │ │ │ ├── head_layout.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── load_more.xml │ │ │ │ ├── fragment_common.xml │ │ │ │ ├── item_common.xml │ │ │ │ ├── toolbar_layout.xml │ │ │ │ ├── activity_drag_photo.xml │ │ │ │ └── activity_about.xml │ │ │ ├── drawable │ │ │ │ ├── linearlayout_background.xml │ │ │ │ ├── textview_background.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ ├── menu │ │ │ │ └── menu.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── donkor │ │ │ └── deepnight │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── donkor │ │ └── deepnight │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── Screenshot ├── all_pic.png ├── md_pic.png ├── drag_pic.jpeg ├── download_pic.jpg └── splash_pic.png ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── vcs.xml ├── runConfigurations.xml ├── modules.xml ├── gradle.xml └── misc.xml ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /Screenshot/all_pic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/Screenshot/all_pic.png -------------------------------------------------------------------------------- /Screenshot/md_pic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/Screenshot/md_pic.png -------------------------------------------------------------------------------- /Screenshot/drag_pic.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/Screenshot/drag_pic.jpeg -------------------------------------------------------------------------------- /Screenshot/download_pic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/Screenshot/download_pic.jpg -------------------------------------------------------------------------------- /Screenshot/splash_pic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/Screenshot/splash_pic.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/assets/fonts/Lobster-1.4.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/assets/fonts/Lobster-1.4.otf -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/mvp/a.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.mvp 2 | 3 | /** 4 | * Created by donkor on 2017/12/11. 5 | */ 6 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/icon_all.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/icon_all.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/head_view.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/head_view.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/icon_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/icon_about.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/icon_bosom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/icon_bosom.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/icon_legs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/icon_legs.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/icon_like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/icon_like.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/icon_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xxhdpi/icon_back.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/icon_buttocks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/icon_buttocks.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/icon_download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/icon_download.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/icon_pretty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/icon_pretty.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/deepnight_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/deepnight_logo.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/icon_hodgepodge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/icon_hodgepodge.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/icon_stockings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/icon_stockings.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_empty_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/ic_empty_picture.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_image_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/ic_image_loading.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/splash_activity_background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ChenYXin/DeepNight-in-kotlin/HEAD/app/src/main/res/mipmap-xhdpi/splash_activity_background.jpg -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/mvp/model/bean/CommonBean.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.mvp.model.bean 2 | 3 | /** 4 | * Created by donkor on 2017/12/13. 5 | */ 6 | data class CommonBean(var title:String,var src:String) -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 11 16:50:31 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_viewpager.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/linearlayout_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 15 | -------------------------------------------------------------------------------- /app/src/test/java/com/donkor/deepnight/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/textview_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | #848383 8 | #000 9 | 10 | #4F94CD 11 | 12 | #f0f0f0 13 | 14 | #00000000 15 | 16 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/utils/NetworkUtils.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.utils 2 | 3 | import android.content.Context 4 | import android.net.ConnectivityManager 5 | import android.net.NetworkInfo 6 | 7 | /** 8 | *网络工具 9 | * Created by Donkor on 2017/12/13. 10 | */ 11 | object NetworkUtils { 12 | fun isNetConnected(context: Context): Boolean { 13 | val connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager 14 | val networkInfo: NetworkInfo? = connectivityManager.activeNetworkInfo 15 | return if (networkInfo == null) { 16 | false 17 | } else { 18 | networkInfo.isAvailable && networkInfo.isConnected 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/head_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 21 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/donkor/deepnight/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.donkor.deepnight", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/utils/Extension.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.utils 2 | 3 | import android.app.Activity 4 | import android.content.Context 5 | import android.content.Intent 6 | import android.view.Gravity 7 | import android.widget.Toast 8 | 9 | //import io.reactivex.Observable 10 | //import io.reactivex.android.schedulers.AndroidSchedulers 11 | //import io.reactivex.schedulers.Schedulers 12 | 13 | /** 14 | * Created by donkor on 2017/12/11. 15 | */ 16 | fun Context.showToast(message: String): Toast { 17 | var toast: Toast = Toast.makeText(this, message, Toast.LENGTH_SHORT) 18 | toast.setGravity(Gravity.CENTER, 0, 0) 19 | toast.show() 20 | return toast 21 | } 22 | 23 | inline fun Activity.switchActivity() { 24 | val intent = Intent(this, T::class.java) 25 | startActivity(intent) 26 | } 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/network/ApiService.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.network 2 | 3 | /** 4 | * Created by donkor on 2017/12/11. 5 | */ 6 | interface ApiService { 7 | companion object { 8 | val BASE_URL: String 9 | get() = "https://www.dbmeinv.com/dbgroup/" 10 | val ALL_URL: String 11 | get() = "show.htm?pager_offset=" 12 | val BOSOM: String 13 | get() = "show.htm?cid=2&pager_offset=" 14 | val Buttocks: String 15 | get() = "show.htm?cid=6?pager_offset=" 16 | val Stockings: String 17 | get() = "show.htm?cid=7&pager_offset=" 18 | val Legs: String 19 | get() = "show.htm?cid=3&pager_offset=" 20 | val Pretty: String 21 | get() = "show.htm?cid=4&pager_offset=" 22 | val Hodgepodge: String 23 | get() = "show.htm?cid=5&pager_offset=" 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/load_more.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 16 | 17 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_common.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 15 | 16 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DeepNight-in-kotlin 3 | 4 | DeepNight 陪你度过每一个深夜 5 | 6 | 所有 7 | 大胸妹 8 | 小翘臀 9 | 黑丝袜 10 | 美腿控 11 | 有颜值 12 | 大杂烩 13 | 14 | 返回 15 | DeepNight-in-Kotlin 16 | 17 | 收藏 18 | 下载 19 | 20 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | android { 8 | compileSdkVersion 26 9 | defaultConfig { 10 | applicationId "com.donkor.deepnight" 11 | minSdkVersion 16 12 | targetSdkVersion 26 13 | versionCode 1 14 | versionName "1.0" 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" 27 | 28 | implementation 'com.android.support:design:26.1.0' 29 | compile 'com.gyf.barlibrary:barlibrary:2.2.5' 30 | //Jsoup 31 | compile 'org.jsoup:jsoup:1.11.2' 32 | //glide 33 | compile 'com.github.bumptech.glide:glide:3.7.0' 34 | //DragPhotoView 35 | compile 'com.github.githubwing:DragPhotoView:1.0.1' 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_common.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 21 | 22 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 23 | 24 | 25 | 26 | 31 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/ui/FixMultiViewPager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * FixMultiViewPager 2016-12-26 3 | * Copyright (c) 2016 suzeyu Co.Ltd. All right reserved 4 | */ 5 | package com.donkor.deepnight.ui; 6 | 7 | import android.content.Context; 8 | import android.support.v4.view.ViewPager; 9 | import android.util.AttributeSet; 10 | import android.util.Log; 11 | import android.view.MotionEvent; 12 | 13 | /** 14 | * Author : suzeyu 15 | * Time : 2016-12-26 上午1:41 16 | * ClassDescription : 对多点触控场景时, {@link android.support.v4.view.ViewPager#onInterceptTouchEvent(MotionEvent)}中 17 | * pointerIndex = -1. 发生IllegalArgumentException: pointerIndex out of range 处理 18 | */ 19 | public class FixMultiViewPager extends ViewPager { 20 | private static final String TAG = FixMultiViewPager.class.getSimpleName(); 21 | 22 | public FixMultiViewPager(Context context) { 23 | super(context); 24 | } 25 | 26 | public FixMultiViewPager(Context context, AttributeSet attrs) { 27 | super(context, attrs); 28 | } 29 | 30 | @Override 31 | public boolean onInterceptTouchEvent(MotionEvent ev) { 32 | try { 33 | return super.onInterceptTouchEvent(ev); 34 | } catch (IllegalArgumentException ex) { 35 | Log.w(TAG, "onInterceptTouchEvent() ", ex); 36 | ex.printStackTrace(); 37 | } 38 | return false; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 15 | 16 | 25 | 26 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/ui/fragment/BaseFragment.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.ui.fragment 2 | 3 | import android.os.Bundle 4 | import android.support.v4.app.Fragment 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import com.donkor.deepnight.adapter.CommonAdapter 9 | import com.donkor.deepnight.mvp.model.bean.CommonBean 10 | 11 | /** 12 | * 13 | * Created by Donkor on 2017/12/13. 14 | */ 15 | abstract class BaseFragment : Fragment() { 16 | protected val defaultTimeout: Int = 3000 17 | protected val defualtUserAgent = "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52" 18 | protected var mCommomAdapter: CommonAdapter? = null 19 | protected var mCommonBean: CommonBean? = null 20 | 21 | var rootView: View? = null 22 | override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? { 23 | if (rootView == null) { 24 | rootView = inflater?.inflate(getLayoutResources(), container, false) 25 | } 26 | return rootView 27 | } 28 | 29 | override fun onViewCreated(view: View?, savedInstanceState: Bundle?) { 30 | super.onViewCreated(view, savedInstanceState) 31 | initView() 32 | } 33 | 34 | override fun onHiddenChanged(hidden: Boolean) { 35 | super.onHiddenChanged(hidden) 36 | if (!hidden) 37 | loadData() 38 | 39 | } 40 | 41 | 42 | abstract fun getLayoutResources(): Int 43 | abstract fun initView() 44 | abstract fun loadData() 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/utils/ImageLoadUtils.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.utils 2 | 3 | import android.content.Context 4 | import android.widget.ImageView 5 | import com.bumptech.glide.Glide 6 | import com.bumptech.glide.load.DecodeFormat 7 | import com.bumptech.glide.load.engine.DiskCacheStrategy 8 | import com.donkor.deepnight.R 9 | 10 | /** 11 | * Created by donkor on 2017/12/13. 12 | */ 13 | class ImageLoadUtils{ 14 | companion object { 15 | fun display(context: Context?, imageView: ImageView?, url: String?) { 16 | if (imageView == null) { 17 | throw IllegalArgumentException("argument error") 18 | } 19 | Glide.with(context).load(url) 20 | .diskCacheStrategy(DiskCacheStrategy.ALL) 21 | .centerCrop() 22 | .placeholder(R.mipmap.ic_image_loading) 23 | .error(R.mipmap.ic_empty_picture) 24 | .crossFade().into(imageView) 25 | } 26 | fun displayHigh(context: Context?, imageView: ImageView?, url: String?){ 27 | if (imageView == null) { 28 | throw IllegalArgumentException("argument error") 29 | } 30 | Glide.with(context).load(url) 31 | .asBitmap() 32 | .format(DecodeFormat.PREFER_ARGB_8888) 33 | .diskCacheStrategy(DiskCacheStrategy.ALL) 34 | .centerCrop() 35 | .placeholder(R.mipmap.ic_image_loading) 36 | .error(R.mipmap.ic_empty_picture) 37 | .into(imageView) 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/ui/AboutActivity.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.ui 2 | 3 | import android.content.Context 4 | import android.os.Bundle 5 | import android.support.v7.app.AppCompatActivity 6 | import android.util.Log 7 | import android.view.View 8 | import com.donkor.deepnight.R 9 | import com.gyf.barlibrary.ImmersionBar 10 | import kotlinx.android.synthetic.main.activity_about.* 11 | 12 | 13 | /** 14 | * Created by donkor on 2017/12/14. 15 | */ 16 | class AboutActivity : AppCompatActivity() { 17 | override fun onCreate(savedInstanceState: Bundle?) { 18 | super.onCreate(savedInstanceState) 19 | ImmersionBar.with(this).transparentBar().barAlpha(0.6f).fitsSystemWindows(true).init() 20 | val window = window 21 | val params = window.attributes 22 | params.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 23 | window.attributes = params 24 | setContentView(R.layout.activity_about) 25 | 26 | tvVersion.text = getAppVersionName(this) 27 | btnBack.setOnClickListener({ 28 | finish() 29 | }) 30 | } 31 | 32 | /** 33 | * 返回当前程序版本名 34 | */ 35 | private fun getAppVersionName(context: Context): String { 36 | var versionName: String? = "" 37 | try { 38 | val pm = context.packageManager 39 | val pi = pm.getPackageInfo(context.packageName, 0) 40 | versionName = pi.versionName 41 | if (versionName == null || versionName.isEmpty()) { 42 | return "" 43 | } 44 | } catch (e: Exception) { 45 | Log.e("VersionInfo", "Exception", e) 46 | } 47 | 48 | return versionName.toString() 49 | } 50 | } -------------------------------------------------------------------------------- /app/src/main/res/menu/menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 11 | 15 | 19 | 23 | 24 | 25 | 29 | 33 | 37 | 38 | 39 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/ui/SplashActivity.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.ui 2 | 3 | import android.graphics.Typeface 4 | import android.os.Bundle 5 | import android.os.Handler 6 | import android.os.Message 7 | import android.support.v7.app.AppCompatActivity 8 | import android.view.WindowManager 9 | import com.donkor.deepnight.R 10 | import com.donkor.deepnight.utils.switchActivity 11 | import kotlinx.android.synthetic.main.activity_splash.* 12 | import java.lang.ref.WeakReference 13 | 14 | /** 15 | * 启动页 16 | */ 17 | private val SWITCH_MAINACTIVITY = 1000//跳转到主界面 18 | private val TAG: String? = "SplashActivity" 19 | 20 | class SplashActivity : AppCompatActivity() { 21 | 22 | override fun onCreate(savedInstanceState: Bundle?) { 23 | super.onCreate(savedInstanceState) 24 | //设置全屏 25 | window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN) 26 | setContentView(R.layout.activity_splash) 27 | initView() 28 | MyHandler(this).sendEmptyMessageDelayed(SWITCH_MAINACTIVITY, 1000) 29 | 30 | } 31 | 32 | private class MyHandler(activity: SplashActivity) : Handler() { 33 | private val mActivity: WeakReference = WeakReference(activity) 34 | 35 | override fun handleMessage(msg: Message) { 36 | if (mActivity.get() == null) { 37 | return 38 | } 39 | val activity = mActivity.get() 40 | when (msg.what) { 41 | SWITCH_MAINACTIVITY -> { 42 | // Log.e(TAG, "SplashActivity --- switch_MainActivity") 43 | activity!!.switchActivity() 44 | activity.finish() 45 | } 46 | else -> { 47 | } 48 | } 49 | } 50 | } 51 | 52 | private fun initView() { 53 | val font: Typeface = Typeface.createFromAsset(this.assets, "fonts/Lobster-1.4.otf") 54 | tv_splash_instruction.typeface = font 55 | tv_splash_instruction.text = getString(R.string.splash_activity_splash_instruction) 56 | } 57 | 58 | override fun onDestroy() { 59 | // Remove all Runnable and Message. 60 | MyHandler(this).removeCallbacksAndMessages(null) 61 | super.onDestroy() 62 | } 63 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DeepNight-in-kotlin 2 | DeepNight 陪你度过每一个深夜,妹纸看不停
3 | 看够了代码家的妹纸,来看看豆瓣的妹纸
4 | 5 | # Description 6 | 妹纸图片来源:
7 | - http://www.dbmeinv.com 8 | # Screenshot 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | # Features 20 | - Material Design设计风格 21 | - [Kotlin中SwipeRefreshLayout结合RecyclerView下拉刷新上拉加载](http://blog.csdn.net/donkor_/article/details/78820880) 22 | - [Kotlin实现侧滑抽屉菜单(DrawerLayout+NavigationView+Toolbar)](http://blog.csdn.net/donkor_/article/details/78819081) 23 | - [Fragment懒加载模式](http://blog.csdn.net/donkor_/article/details/78819081) 24 | - [Kotlin中handler避免内存泄漏](http://blog.csdn.net/donkor_/article/details/78796518) 25 | - [jsoup 抓取妹纸图片](https://github.com/jhy/jsoup) 26 | - [glide 图片缓存,加载缩略图,加载高清原图](https://github.com/bumptech/glide) 27 | - [DragPhotoView高仿微信可拖拽返回PhotoView](https://github.com/githubwing/DragPhotoView) 28 | 29 | # Download 30 | [火速下载](http://fir.im/DeepNight)
31 | 32 | 33 | # Platform 34 | MacBook Pro (13-inch, 2016, Four Thunderbolt 3 Ports) 35 | - macOS High Sierra(10.13.2) 36 | 37 | Android Studio 38 | 39 | - gradle 3.0.2 40 | - kotlin 1.1.51 41 | 42 | # About me 43 | ❤ 我觉得大家一起学习和交流才会更有意思,如果您觉得我的文章还不错,或是对您有过帮助,欢迎Follow、Fork、Star .咱们大家一起学习,一起交流~~❤ 44 | 45 | Email :donkor@yeah.net 46 | 47 | csdn_blog: http://blog.csdn.net/donkor_ 48 | 49 | jianshu_blog: http://www.jianshu.com/u/10f35b1d7e12 50 | 51 | QQ Group : 537891203 52 | Android开发交流群 53 | 54 | # License 55 | ``` 56 | Copyright (C) 2017 donkor@yeah.net 57 | 58 | Licensed under the Apache License, Version 2.0 (the "License"); 59 | you may not use this file except in compliance with the License. 60 | You may obtain a copy of the License at 61 | 62 | http://www.apache.org/licenses/LICENSE-2.0 63 | 64 | Unless required by applicable law or agreed to in writing, software 65 | distributed under the License is distributed on an "AS IS" BASIS, 66 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 67 | See the License for the specific language governing permissions and 68 | limitations under the License. 69 | ``` 70 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_drag_photo.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 68 | 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/ui/fragment/LegsFragment.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.ui.fragment 2 | 3 | import android.graphics.Color 4 | import android.support.v4.widget.SwipeRefreshLayout 5 | import android.support.v7.widget.LinearLayoutManager 6 | import android.support.v7.widget.RecyclerView 7 | import com.donkor.deepnight.R 8 | import com.donkor.deepnight.adapter.CommonAdapter 9 | import com.donkor.deepnight.mvp.model.bean.CommonBean 10 | import com.donkor.deepnight.network.ApiService 11 | import kotlinx.android.synthetic.main.fragment_common.* 12 | import org.jsoup.Jsoup 13 | import org.jsoup.nodes.Document 14 | import org.jsoup.select.Elements 15 | 16 | /** 17 | * 美腿控 18 | * Created by donkor on 2017/12/14. 19 | */ 20 | class LegsFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener { 21 | private var mList: ArrayList? = null 22 | override fun onRefresh() { 23 | mSwipeRefresh.isRefreshing = false 24 | legsData(mPage) 25 | } 26 | 27 | private var mPage: Int? = 1 28 | override fun loadData() { 29 | if (mList!!.isEmpty()) 30 | legsData(mPage) 31 | } 32 | 33 | override fun initView() { 34 | mSwipeRefresh.setColorSchemeColors(Color.rgb(47, 223, 189)) 35 | mSwipeRefresh.setOnRefreshListener(this) 36 | mRvCommonList.layoutManager = LinearLayoutManager(context) 37 | // mRvCommonList.layoutManager = GridLayoutManager(context, 2) 38 | mList = ArrayList() 39 | mRvCommonList.addOnScrollListener(object : RecyclerView.OnScrollListener() { 40 | var lastVisibleItem: Int? = 0 41 | override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { 42 | super.onScrollStateChanged(recyclerView, newState) 43 | if (newState == RecyclerView.SCROLL_STATE_IDLE && lastVisibleItem!! + 1 == mCommomAdapter?.itemCount) { 44 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.LOAD_MORE!!) 45 | mPage = mPage!! + 1 46 | legsData(mPage) 47 | } 48 | } 49 | 50 | override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { 51 | super.onScrolled(recyclerView, dx, dy) 52 | val layoutManager = recyclerView?.layoutManager as LinearLayoutManager 53 | //最后一个可见的ITEM 54 | lastVisibleItem = layoutManager.findLastVisibleItemPosition() 55 | } 56 | }) 57 | } 58 | 59 | private fun legsData(page: Int?) { 60 | Thread(Runnable { 61 | val doc: Document = Jsoup.connect(ApiService.BASE_URL + ApiService.Legs + page) 62 | .timeout(defaultTimeout).userAgent(defualtUserAgent).get() 63 | val imgSingle: Elements? = doc.getElementsByClass("img_single") 64 | 65 | 66 | imgSingle?.map { it.select("img") } 67 | ?.forEach { 68 | mCommonBean = CommonBean(it.attr("title"), it.attr("src")) 69 | mList!!.add(mCommonBean!!) 70 | } 71 | 72 | 73 | activity.runOnUiThread({ 74 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.PULLUP_LOAD_MORE!!) 75 | if (mPage != 1) { 76 | mRvCommonList.adapter.notifyDataSetChanged() 77 | } else { 78 | mCommomAdapter = CommonAdapter(activity, mList) 79 | mRvCommonList.adapter = mCommomAdapter 80 | } 81 | }) 82 | }).start() 83 | } 84 | 85 | 86 | override fun getLayoutResources(): Int { 87 | return R.layout.fragment_common 88 | } 89 | 90 | } -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/ui/fragment/ButtocksFragment.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.ui.fragment 2 | 3 | import android.graphics.Color 4 | import android.support.v4.widget.SwipeRefreshLayout 5 | import android.support.v7.widget.LinearLayoutManager 6 | import android.support.v7.widget.RecyclerView 7 | import com.donkor.deepnight.R 8 | import com.donkor.deepnight.adapter.CommonAdapter 9 | import com.donkor.deepnight.mvp.model.bean.CommonBean 10 | import com.donkor.deepnight.network.ApiService 11 | import kotlinx.android.synthetic.main.fragment_common.* 12 | import org.jsoup.Jsoup 13 | import org.jsoup.nodes.Document 14 | import org.jsoup.select.Elements 15 | 16 | /** 17 | * 小翘臀 18 | * Created by donkor on 2017/12/14. 19 | */ 20 | class ButtocksFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener { 21 | private var mList: ArrayList? = null 22 | override fun onRefresh() { 23 | mSwipeRefresh.isRefreshing = false 24 | buttocksData(mPage) 25 | } 26 | 27 | private var mPage: Int? = 1 28 | override fun loadData() { 29 | if (mList!!.isEmpty() ) 30 | buttocksData(mPage) 31 | } 32 | 33 | override fun initView() { 34 | mSwipeRefresh.setColorSchemeColors(Color.rgb(47, 223, 189)) 35 | mSwipeRefresh.setOnRefreshListener(this) 36 | mRvCommonList.layoutManager = LinearLayoutManager(context) 37 | // mRvCommonList.layoutManager = GridLayoutManager(context, 2) 38 | mList = ArrayList() 39 | mRvCommonList.addOnScrollListener(object : RecyclerView.OnScrollListener() { 40 | var lastVisibleItem:Int?=0 41 | override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { 42 | super.onScrollStateChanged(recyclerView, newState) 43 | if (newState == RecyclerView.SCROLL_STATE_IDLE && lastVisibleItem!! + 1 == mCommomAdapter?.itemCount) { 44 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.LOAD_MORE!!) 45 | mPage= mPage!! +1 46 | buttocksData(mPage) 47 | } 48 | } 49 | 50 | override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { 51 | super.onScrolled(recyclerView, dx, dy) 52 | val layoutManager = recyclerView?.layoutManager as LinearLayoutManager 53 | //最后一个可见的ITEM 54 | lastVisibleItem = layoutManager.findLastVisibleItemPosition() 55 | } 56 | }) 57 | } 58 | 59 | private fun buttocksData(page:Int?) { 60 | Thread(Runnable { 61 | val doc: Document = Jsoup.connect(ApiService.BASE_URL + ApiService.Buttocks+page) 62 | .timeout(defaultTimeout).userAgent(defualtUserAgent).get() 63 | val imgSingle: Elements? = doc.getElementsByClass("img_single") 64 | 65 | imgSingle?.map { it.select("img") } 66 | ?.forEach { 67 | mCommonBean = CommonBean(it.attr("title"), it.attr("src")) 68 | mList!!.add(mCommonBean!!) 69 | } 70 | 71 | 72 | activity.runOnUiThread({ 73 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.PULLUP_LOAD_MORE!!) 74 | if(mPage!=1){ 75 | mRvCommonList.adapter.notifyDataSetChanged() 76 | }else{ 77 | mCommomAdapter = CommonAdapter(activity, mList) 78 | mRvCommonList.adapter = mCommomAdapter 79 | } 80 | }) 81 | }).start() 82 | } 83 | 84 | 85 | override fun getLayoutResources(): Int { 86 | return R.layout.fragment_common 87 | } 88 | 89 | } -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/ui/fragment/PrettyFragment.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.ui.fragment 2 | 3 | import android.graphics.Color 4 | import android.support.v4.widget.SwipeRefreshLayout 5 | import android.support.v7.widget.LinearLayoutManager 6 | import android.support.v7.widget.RecyclerView 7 | import com.donkor.deepnight.R 8 | import com.donkor.deepnight.adapter.CommonAdapter 9 | import com.donkor.deepnight.mvp.model.bean.CommonBean 10 | import com.donkor.deepnight.network.ApiService 11 | import kotlinx.android.synthetic.main.fragment_common.* 12 | import org.jsoup.Jsoup 13 | import org.jsoup.nodes.Document 14 | import org.jsoup.select.Elements 15 | 16 | /** 17 | * 有颜值 18 | * Created by donkor on 2017/12/14. 19 | */ 20 | class PrettyFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener { 21 | private var mList: ArrayList? = null 22 | override fun onRefresh() { 23 | mSwipeRefresh.isRefreshing = false 24 | prettyData(mPage) 25 | } 26 | 27 | private var mPage: Int? = 1 28 | override fun loadData() { 29 | if (mList!!.isEmpty()) 30 | prettyData(mPage) 31 | } 32 | 33 | override fun initView() { 34 | mSwipeRefresh.setColorSchemeColors(Color.rgb(47, 223, 189)) 35 | mSwipeRefresh.setOnRefreshListener(this) 36 | mRvCommonList.layoutManager = LinearLayoutManager(context) 37 | // mRvCommonList.layoutManager = GridLayoutManager(context, 2) 38 | mList = ArrayList() 39 | mRvCommonList.addOnScrollListener(object : RecyclerView.OnScrollListener() { 40 | var lastVisibleItem: Int? = 0 41 | override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { 42 | super.onScrollStateChanged(recyclerView, newState) 43 | if (newState == RecyclerView.SCROLL_STATE_IDLE && lastVisibleItem!! + 1 == mCommomAdapter?.itemCount) { 44 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.LOAD_MORE!!) 45 | mPage = mPage!! + 1 46 | prettyData(mPage) 47 | } 48 | } 49 | 50 | override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { 51 | super.onScrolled(recyclerView, dx, dy) 52 | val layoutManager = recyclerView?.layoutManager as LinearLayoutManager 53 | //最后一个可见的ITEM 54 | lastVisibleItem = layoutManager.findLastVisibleItemPosition() 55 | } 56 | }) 57 | } 58 | 59 | private fun prettyData(page: Int?) { 60 | Thread(Runnable { 61 | val doc: Document = Jsoup.connect(ApiService.BASE_URL + ApiService.Pretty + page) 62 | .timeout(defaultTimeout).userAgent(defualtUserAgent).get() 63 | val imgSingle: Elements? = doc.getElementsByClass("img_single") 64 | 65 | 66 | imgSingle?.map { it.select("img") } 67 | ?.forEach { 68 | mCommonBean = CommonBean(it.attr("title"), it.attr("src")) 69 | mList!!.add(mCommonBean!!) 70 | } 71 | 72 | 73 | activity.runOnUiThread({ 74 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.PULLUP_LOAD_MORE!!) 75 | if (mPage != 1) { 76 | mRvCommonList.adapter.notifyDataSetChanged() 77 | } else { 78 | mCommomAdapter = CommonAdapter(activity, mList) 79 | mRvCommonList.adapter = mCommomAdapter 80 | } 81 | }) 82 | }).start() 83 | } 84 | 85 | 86 | override fun getLayoutResources(): Int { 87 | return R.layout.fragment_common 88 | } 89 | 90 | } -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/ui/fragment/HodgepodgeFragment.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.ui.fragment 2 | 3 | import android.graphics.Color 4 | import android.support.v4.widget.SwipeRefreshLayout 5 | import android.support.v7.widget.LinearLayoutManager 6 | import android.support.v7.widget.RecyclerView 7 | import com.donkor.deepnight.R 8 | import com.donkor.deepnight.adapter.CommonAdapter 9 | import com.donkor.deepnight.mvp.model.bean.CommonBean 10 | import com.donkor.deepnight.network.ApiService 11 | import kotlinx.android.synthetic.main.fragment_common.* 12 | import org.jsoup.Jsoup 13 | import org.jsoup.nodes.Document 14 | import org.jsoup.select.Elements 15 | 16 | /** 17 | * 大杂烩 18 | * Created by donkor on 2017/12/14. 19 | */ 20 | class HodgepodgeFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener { 21 | private var mList: ArrayList? = null 22 | override fun onRefresh() { 23 | mSwipeRefresh.isRefreshing = false 24 | hodgepodgeData(mPage) 25 | } 26 | 27 | private var mPage: Int? = 1 28 | override fun loadData() { 29 | if (mList!!.isEmpty() ) 30 | hodgepodgeData(mPage) 31 | } 32 | 33 | override fun initView() { 34 | mSwipeRefresh.setColorSchemeColors(Color.rgb(47, 223, 189)) 35 | mSwipeRefresh.setOnRefreshListener(this) 36 | mRvCommonList.layoutManager = LinearLayoutManager(context) 37 | // mRvCommonList.layoutManager = GridLayoutManager(context, 2) 38 | mList = ArrayList() 39 | mRvCommonList.addOnScrollListener(object : RecyclerView.OnScrollListener() { 40 | var lastVisibleItem:Int?=0 41 | override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { 42 | super.onScrollStateChanged(recyclerView, newState) 43 | if (newState == RecyclerView.SCROLL_STATE_IDLE && lastVisibleItem!! + 1 == mCommomAdapter?.itemCount) { 44 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.LOAD_MORE!!) 45 | mPage= mPage!! +1 46 | hodgepodgeData(mPage) 47 | } 48 | } 49 | 50 | override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { 51 | super.onScrolled(recyclerView, dx, dy) 52 | val layoutManager = recyclerView?.layoutManager as LinearLayoutManager 53 | //最后一个可见的ITEM 54 | lastVisibleItem = layoutManager.findLastVisibleItemPosition() 55 | } 56 | }) 57 | } 58 | 59 | private fun hodgepodgeData(page:Int?) { 60 | Thread(Runnable { 61 | val doc: Document = Jsoup.connect(ApiService.BASE_URL + ApiService.Hodgepodge+page) 62 | .timeout(defaultTimeout).userAgent(defualtUserAgent).get() 63 | val imgSingle: Elements? = doc.getElementsByClass("img_single") 64 | 65 | 66 | imgSingle?.map { it.select("img") } 67 | ?.forEach { 68 | mCommonBean = CommonBean(it.attr("title"), it.attr("src")) 69 | mList!!.add(mCommonBean!!) 70 | } 71 | 72 | 73 | activity.runOnUiThread({ 74 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.PULLUP_LOAD_MORE!!) 75 | if(mPage!=1){ 76 | mRvCommonList.adapter.notifyDataSetChanged() 77 | }else{ 78 | mCommomAdapter = CommonAdapter(activity, mList) 79 | mRvCommonList.adapter = mCommomAdapter 80 | } 81 | }) 82 | }).start() 83 | } 84 | 85 | 86 | override fun getLayoutResources(): Int { 87 | return R.layout.fragment_common 88 | } 89 | 90 | } -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/ui/fragment/StockingsFragment.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.ui.fragment 2 | 3 | import android.graphics.Color 4 | import android.support.v4.widget.SwipeRefreshLayout 5 | import android.support.v7.widget.LinearLayoutManager 6 | import android.support.v7.widget.RecyclerView 7 | import com.donkor.deepnight.R 8 | import com.donkor.deepnight.adapter.CommonAdapter 9 | import com.donkor.deepnight.mvp.model.bean.CommonBean 10 | import com.donkor.deepnight.network.ApiService 11 | import kotlinx.android.synthetic.main.fragment_common.* 12 | import org.jsoup.Jsoup 13 | import org.jsoup.nodes.Document 14 | import org.jsoup.select.Elements 15 | 16 | /** 17 | * 黑丝袜 18 | * Created by donkor on 2017/12/14. 19 | */ 20 | class StockingsFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener { 21 | private var mList: ArrayList? = null 22 | override fun onRefresh() { 23 | mSwipeRefresh.isRefreshing = false 24 | stockingsData(mPage) 25 | } 26 | 27 | private var mPage: Int? = 1 28 | override fun loadData() { 29 | if (mList!!.isEmpty()) 30 | stockingsData(mPage) 31 | } 32 | 33 | override fun initView() { 34 | mSwipeRefresh.setColorSchemeColors(Color.rgb(47, 223, 189)) 35 | mSwipeRefresh.setOnRefreshListener(this) 36 | mRvCommonList.layoutManager = LinearLayoutManager(context) 37 | // mRvCommonList.layoutManager = GridLayoutManager(context, 2) 38 | mList = ArrayList() 39 | mRvCommonList.addOnScrollListener(object : RecyclerView.OnScrollListener() { 40 | var lastVisibleItem: Int? = 0 41 | override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { 42 | super.onScrollStateChanged(recyclerView, newState) 43 | if (newState == RecyclerView.SCROLL_STATE_IDLE && lastVisibleItem!! + 1 == mCommomAdapter?.itemCount) { 44 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.LOAD_MORE!!) 45 | mPage = mPage!! + 1 46 | stockingsData(mPage) 47 | } 48 | } 49 | 50 | override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { 51 | super.onScrolled(recyclerView, dx, dy) 52 | val layoutManager = recyclerView?.layoutManager as LinearLayoutManager 53 | //最后一个可见的ITEM 54 | lastVisibleItem = layoutManager.findLastVisibleItemPosition() 55 | } 56 | }) 57 | } 58 | 59 | private fun stockingsData(page: Int?) { 60 | Thread(Runnable { 61 | val doc: Document = Jsoup.connect(ApiService.BASE_URL + ApiService.Stockings + page) 62 | .timeout(defaultTimeout).userAgent(defualtUserAgent).get() 63 | val imgSingle: Elements? = doc.getElementsByClass("img_single") 64 | 65 | 66 | imgSingle?.map { it.select("img") } 67 | ?.forEach { 68 | mCommonBean = CommonBean(it.attr("title"), it.attr("src")) 69 | mList!!.add(mCommonBean!!) 70 | } 71 | 72 | 73 | activity.runOnUiThread({ 74 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.PULLUP_LOAD_MORE!!) 75 | if (mPage != 1) { 76 | mRvCommonList.adapter.notifyDataSetChanged() 77 | } else { 78 | mCommomAdapter = CommonAdapter(activity, mList) 79 | mRvCommonList.adapter = mCommomAdapter 80 | } 81 | }) 82 | }).start() 83 | } 84 | 85 | 86 | override fun getLayoutResources(): Int { 87 | return R.layout.fragment_common 88 | } 89 | 90 | } -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/ui/fragment/AllFragment.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.ui.fragment 2 | 3 | import android.graphics.Color 4 | import android.support.v4.widget.SwipeRefreshLayout 5 | import android.support.v7.widget.LinearLayoutManager 6 | import android.support.v7.widget.RecyclerView 7 | import com.donkor.deepnight.R 8 | import com.donkor.deepnight.adapter.CommonAdapter 9 | import com.donkor.deepnight.mvp.model.bean.CommonBean 10 | import com.donkor.deepnight.network.ApiService 11 | import kotlinx.android.synthetic.main.fragment_common.* 12 | import org.jsoup.Jsoup 13 | import org.jsoup.nodes.Document 14 | import org.jsoup.select.Elements 15 | 16 | 17 | 18 | /** 19 | *所有 20 | * Created by Donkor on 2017/12/13. 21 | */ 22 | class AllFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener{ 23 | 24 | private var mList: ArrayList? = null 25 | 26 | private var mPage: Int? = 1 27 | override fun loadData() { 28 | if (mList == null) 29 | allData(mPage) 30 | } 31 | 32 | override fun initView() { 33 | mSwipeRefresh.setColorSchemeColors(Color.rgb(47, 223, 189)) 34 | mSwipeRefresh.setOnRefreshListener(this) 35 | mRvCommonList.layoutManager = LinearLayoutManager(context) 36 | // mRvCommonList.layoutManager = GridLayoutManager(context, 2) 37 | mList = ArrayList() 38 | mRvCommonList.addOnScrollListener(object : RecyclerView.OnScrollListener() { 39 | var lastVisibleItem:Int?=0 40 | override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { 41 | super.onScrollStateChanged(recyclerView, newState) 42 | if (newState == RecyclerView.SCROLL_STATE_IDLE && lastVisibleItem!! + 1 == mCommomAdapter?.itemCount) { 43 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.LOAD_MORE!!) 44 | mPage= mPage!! +1 45 | allData(mPage) 46 | } 47 | } 48 | 49 | override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { 50 | super.onScrolled(recyclerView, dx, dy) 51 | val layoutManager = recyclerView?.layoutManager as LinearLayoutManager 52 | //最后一个可见的ITEM 53 | lastVisibleItem = layoutManager.findLastVisibleItemPosition() 54 | } 55 | }) 56 | allData(mPage) 57 | } 58 | 59 | 60 | 61 | override fun onRefresh() { 62 | // Log.e("asd", "onRefresh") 63 | mSwipeRefresh.isRefreshing = false 64 | allData(mPage) 65 | } 66 | 67 | private fun allData(page:Int?) { 68 | Thread(Runnable { 69 | val doc: Document = Jsoup.connect(ApiService.BASE_URL + ApiService.ALL_URL+page) 70 | .timeout(defaultTimeout).userAgent(defualtUserAgent).get() 71 | val imgSingle: Elements? = doc.getElementsByClass("img_single") 72 | 73 | 74 | imgSingle?.map { it.select("img") } 75 | ?.forEach { 76 | mCommonBean = CommonBean(it.attr("title"), it.attr("src")) 77 | mList!!.add(mCommonBean!!) 78 | } 79 | 80 | 81 | activity.runOnUiThread({ 82 | if(mPage!=1){ 83 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.PULLUP_LOAD_MORE!!) 84 | mRvCommonList.adapter.notifyDataSetChanged() 85 | }else{ 86 | mCommomAdapter = CommonAdapter(activity, mList) 87 | mRvCommonList.adapter = mCommomAdapter 88 | } 89 | 90 | }) 91 | }).start() 92 | } 93 | 94 | override fun getLayoutResources(): Int { 95 | return R.layout.fragment_common 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/ui/fragment/BosomFragment.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.ui.fragment 2 | 3 | import android.graphics.Color 4 | import android.support.v4.widget.SwipeRefreshLayout 5 | import android.support.v7.widget.LinearLayoutManager 6 | import android.support.v7.widget.RecyclerView 7 | import android.util.Log 8 | import com.donkor.deepnight.R 9 | import com.donkor.deepnight.adapter.CommonAdapter 10 | import com.donkor.deepnight.mvp.model.bean.CommonBean 11 | import com.donkor.deepnight.network.ApiService 12 | import kotlinx.android.synthetic.main.fragment_common.* 13 | import org.jsoup.Jsoup 14 | import org.jsoup.nodes.Document 15 | import org.jsoup.select.Elements 16 | 17 | /** 18 | *大胸妹 19 | * Created by Donkor on 2017/12/13. 20 | */ 21 | class BosomFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener { 22 | private var mList: ArrayList? = null 23 | override fun onRefresh() { 24 | mSwipeRefresh.isRefreshing = false 25 | bosomData(mPage) 26 | } 27 | 28 | private var mPage: Int? = 1 29 | override fun loadData() { 30 | if (mList!!.isEmpty() ) 31 | bosomData(mPage) 32 | } 33 | 34 | override fun initView() { 35 | mSwipeRefresh.setColorSchemeColors(Color.rgb(47, 223, 189)) 36 | mSwipeRefresh.setOnRefreshListener(this) 37 | mRvCommonList.layoutManager = LinearLayoutManager(context) 38 | // mRvCommonList.layoutManager = GridLayoutManager(context, 2) 39 | mList = ArrayList() 40 | mRvCommonList.addOnScrollListener(object : RecyclerView.OnScrollListener() { 41 | var lastVisibleItem:Int?=0 42 | override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) { 43 | super.onScrollStateChanged(recyclerView, newState) 44 | if (newState == RecyclerView.SCROLL_STATE_IDLE && lastVisibleItem!! + 1 == mCommomAdapter?.itemCount) { 45 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.LOAD_MORE!!) 46 | mPage= mPage!! +1 47 | bosomData(mPage) 48 | } 49 | } 50 | 51 | override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) { 52 | super.onScrolled(recyclerView, dx, dy) 53 | val layoutManager = recyclerView?.layoutManager as LinearLayoutManager 54 | //最后一个可见的ITEM 55 | lastVisibleItem = layoutManager.findLastVisibleItemPosition() 56 | } 57 | }) 58 | } 59 | 60 | private fun bosomData(page:Int?) { 61 | Thread(Runnable { 62 | Log.e("asd","url : "+ApiService.BASE_URL + ApiService.BOSOM+page) 63 | val doc: Document = Jsoup.connect(ApiService.BASE_URL + ApiService.BOSOM+page) 64 | .timeout(defaultTimeout).userAgent(defualtUserAgent).get() 65 | val imgSingle: Elements? = doc.getElementsByClass("img_single") 66 | 67 | imgSingle?.map { it.select("img") } 68 | ?.forEach { 69 | mCommonBean = CommonBean(it.attr("title"), it.attr("src")) 70 | mList!!.add(mCommonBean!!) 71 | } 72 | 73 | 74 | activity.runOnUiThread({ 75 | mCommomAdapter?.changeMoreStatus(mCommomAdapter?.PULLUP_LOAD_MORE!!) 76 | if(mPage!=1){ 77 | mRvCommonList.adapter.notifyDataSetChanged() 78 | }else{ 79 | mCommomAdapter = CommonAdapter(activity, mList) 80 | mRvCommonList.adapter = mCommomAdapter 81 | } 82 | }) 83 | }).start() 84 | } 85 | 86 | 87 | override fun getLayoutResources(): Int { 88 | return R.layout.fragment_common 89 | } 90 | 91 | 92 | } -------------------------------------------------------------------------------- /app/src/main/java/com/donkor/deepnight/adapter/CommonAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.donkor.deepnight.adapter 2 | 3 | import android.app.Activity 4 | import android.content.Intent 5 | import android.support.v7.widget.RecyclerView 6 | import android.view.LayoutInflater 7 | import android.view.View 8 | import android.view.ViewGroup 9 | import android.widget.ImageView 10 | import android.widget.LinearLayout 11 | import android.widget.ProgressBar 12 | import android.widget.TextView 13 | import com.donkor.deepnight.R 14 | import com.donkor.deepnight.mvp.model.bean.CommonBean 15 | import com.donkor.deepnight.ui.DragPhotoActivity 16 | import com.donkor.deepnight.utils.ImageLoadUtils 17 | 18 | 19 | /** 20 | * Created by donkor on 2017/12/13. 21 | */ 22 | class CommonAdapter(context: Activity?, list: ArrayList?) : RecyclerView.Adapter() { 23 | var mContext: Activity? = null 24 | private var mList: ArrayList? = null 25 | private var mInflater: LayoutInflater? = null 26 | private val TYPE_ITEM: Int? = 0 27 | private val TYPE_FOOTER: Int? = 1 28 | 29 | //上拉加载更多 30 | val PULLUP_LOAD_MORE: Int? = 0 31 | //正在加载中 32 | val LOAD_MORE: Int? = 1 33 | //没有加载更多 隐藏 34 | val NO_LOAD_MORE: Int? = 2 35 | 36 | //上拉加载更多状态-默认为0 37 | private var mLoadMoreStatus: Int? = 0 38 | 39 | init { 40 | mContext = context 41 | mList = list 42 | mInflater = LayoutInflater.from(context) 43 | } 44 | 45 | override fun getItemCount(): Int { 46 | return mList?.size ?: 0 47 | } 48 | 49 | override fun getItemViewType(position: Int): Int { 50 | return if (position + 1 == itemCount) { 51 | TYPE_FOOTER!! 52 | } else { 53 | TYPE_ITEM!! 54 | } 55 | } 56 | 57 | override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder? { 58 | when (viewType) { 59 | TYPE_ITEM -> return CommonHolder(mInflater?.inflate(R.layout.item_common, parent, false)) 60 | TYPE_FOOTER -> return FooterViewHolder(mInflater?.inflate(R.layout.load_more, parent, false)) 61 | } 62 | return null 63 | } 64 | 65 | override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) { 66 | val title: String? = mList?.get(position)?.title 67 | if (holder is CommonHolder) { 68 | holder.tvTitle.text = title 69 | ImageLoadUtils.display(mContext, holder.ivPic, mList?.get(position)?.src) 70 | holder.ivPic.setOnClickListener({ 71 | startPhotoActivity(mContext, holder.ivPic, mList?.get(position)?.src) 72 | }) 73 | } else if (holder is FooterViewHolder) { 74 | when (mLoadMoreStatus) { 75 | PULLUP_LOAD_MORE -> holder.tvLoadText?.text = "上拉加载更多" 76 | LOAD_MORE -> holder.tvLoadText?.text = "正在加载更多..." 77 | NO_LOAD_MORE -> holder.linLoadLayout?.visibility = View.GONE 78 | } 79 | } 80 | } 81 | 82 | class CommonHolder(itemView: View?) : RecyclerView.ViewHolder(itemView) { 83 | var ivPic: ImageView = itemView?.findViewById(R.id.iv_pic) as ImageView 84 | var tvTitle: TextView = itemView?.findViewById(R.id.tv_title) as TextView 85 | } 86 | 87 | class FooterViewHolder(itemView: View?) : RecyclerView.ViewHolder(itemView) { 88 | var pbLoad: ProgressBar? = null 89 | var tvLoadText: TextView? = null 90 | var linLoadLayout: LinearLayout? = null 91 | 92 | init { 93 | pbLoad = itemView?.findViewById(R.id.pb_load) 94 | tvLoadText = itemView?.findViewById(R.id.tv_load_text) 95 | linLoadLayout = itemView?.findViewById(R.id.lin_load_layout) 96 | } 97 | } 98 | 99 | fun changeMoreStatus(status: Int) { 100 | mLoadMoreStatus = status 101 | notifyDataSetChanged() 102 | } 103 | 104 | private fun startPhotoActivity(context: Activity?, imageView: ImageView?, picUrl: String?) { 105 | 106 | val intent = Intent(context, DragPhotoActivity::class.java) 107 | 108 | intent.putExtra("picUrl", picUrl) 109 | intent.putExtra("height", imageView?.height) 110 | intent.putExtra("width", imageView?.width) 111 | context?.startActivity(intent) 112 | context?.overridePendingTransition(0, 0) 113 | } 114 | } -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 36 | 37 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 85 | 95 | 96 | 97 | 98 | 99 | 100 | 102 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 |