Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 20190403 #3

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
30 changes: 5 additions & 25 deletions .idea/misc.xml

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

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

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

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# CoolWeather
This is kuku weather
更新时间 2019 7 31日 15:44 今天更新了项目图标 以及启动界面图片
处理了项目没有网络的时候最大支持网络获取时间为20秒
23 changes: 11 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
Expand All @@ -49,20 +49,21 @@ dependencies {
//Rxjava与RxAndroid
api 'io.reactivex.rxjava2:rxkotlin:2.2.0'
api 'io.reactivex.rxjava2:rxandroid:2.0.2'

// rxlifecycle2.0
api 'com.trello.rxlifecycle2:rxlifecycle-kotlin:2.2.2'
api 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.2'

//Retrofit2.0大集合
api "com.squareup.okhttp3:okhttp:${ok_http_version}"
api "com.squareup.retrofit2:retrofit:${retrofit_version}"
api "com.squareup.okhttp3:logging-interceptor:${ok_http_version}"
api "com.squareup.retrofit2:converter-gson:${retrofit_version}"
api "com.squareup.retrofit2:adapter-rxjava2:${retrofit_version}"
api "com.squareup.okhttp3:okhttp:$rootProject.ok_http_version"
api "com.squareup.retrofit2:retrofit:$rootProject.retrofit_version"
api "com.squareup.okhttp3:logging-interceptor:$rootProject.ok_http_version"
api "com.squareup.retrofit2:converter-gson:$rootProject.retrofit_version"
api "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofit_version"

//圆形头像
//Circle ImageView
api "de.hdodenhof:circleimageview:${circle_imageView_version}"
api "de.hdodenhof:circleimageview:$rootProject.circle_imageView_version"

//Glide图片加载
api 'com.github.bumptech.glide:glide:4.7.1'
Expand All @@ -79,13 +80,11 @@ dependencies {
//Banner
api 'com.youth.banner:banner:1.4.10' //最新版本

//状态栏
//状态栏 显示沉浸式的
api 'com.gyf.immersionbar:immersionbar:2.3.1'





//时间获取
api 'com.github.ArdWang:dateutil:1.0.1'


}
30 changes: 24 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.clw">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name=".common.MainApplication"
>
<activity android:name=".ui.activity.MainActivity">
tools:ignore="GoogleAppIndexingWarning">

<activity android:name=".ui.activity.WelcomeActivity"
android:screenOrientation="portrait"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.activity.PhotoViewActivity"/>
<activity android:name=".ui.activity.LeftMainActivity"/>
<activity android:name=".ui.activity.DemoActivity"/>
<activity android:name=".ui.activity.MainActivity"
android:screenOrientation="portrait"
/>
<activity android:name=".ui.activity.PhotoViewActivity"
android:screenOrientation="portrait"
/>
<activity android:name=".ui.activity.NewsViewActivity"
android:screenOrientation="portrait"
/>
<activity android:name=".ui.activity.LeftMainActivity"
android:screenOrientation="portrait"
/>
<activity android:name=".ui.activity.NewsConActivity"
android:screenOrientation="portrait"
/>
</application>

</manifest>
2 changes: 2 additions & 0 deletions app/src/main/assets/litepal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
Binary file removed app/src/main/gif/QQ20180824-111300.gif
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class NoSSLv3SocketFactory : SSLSocketFactory {
}
}

open inner class DelegateSSLSocket internal constructor(protected val delegate: SSLSocket) : SSLSocket() {
open inner class DelegateSSLSocket internal constructor(private val delegate: SSLSocket) : SSLSocket() {

override fun getSupportedCipherSuites(): Array<String> {
return delegate.supportedCipherSuites
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/clw/base/data/net/RetrofitFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class RetrofitFactory private constructor(){
"weather" -> HttpUrl.parse(BaseConstant.APP_WEATHER_SERVICE_ADDRE)
"gank"-> HttpUrl.parse(BaseConstant.APP_GANK_SERVICE_ADDRE)
"comic"-> HttpUrl.parse(BaseConstant.APP_SERVICE_ADDRE)
"news"-> HttpUrl.parse(BaseConstant.APP_NEWS_ADDRE)
"latest" -> HttpUrl.parse(BaseConstant.APP_ZHIHUNEWS_ADDRE)
else -> oldUrl
}

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/clw/base/rx/BaseObserver.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.clw.base.rx

import android.util.Log
import com.clw.base.presenter.view.BaseView
import io.reactivex.Observer
import io.reactivex.disposables.Disposable
Expand All @@ -14,7 +15,7 @@ open class BaseObserver<T>(private val baseView:BaseView):Observer<T> {
}

override fun onNext(t: T) {

Log.i("SUCCESS",t.toString())
}

override fun onError(e: Throwable) {
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/clw/base/ui/activity/BaseMvpActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ abstract class BaseMvpActivity<T:BasePresenter<*>>:BaseActivity(),BaseView {

lateinit var mPresenter: T

lateinit var progressLoading: ProgressLoading
private lateinit var progressLoading: ProgressLoading

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -31,12 +31,13 @@ abstract class BaseMvpActivity<T:BasePresenter<*>>:BaseActivity(),BaseView {

}

////最长时间只能为20秒
override fun showLoading() {

progressLoading.showLoading(20,true)
}

override fun hideLoading() {

progressLoading.hideLoading()
}

override fun onError(text: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class BaseRecyclerViewAdapter<T, VH : RecyclerView.ViewHolder>(var mCon
return dataList.size
}

/*
/**
ItemClick事件声明
*/
interface OnItemClickListener<in T> {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/clw/base/ui/fragment/BaseMvpFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class BaseMvpFragment<T: BasePresenter<*>> :BaseFragment(), BaseView{

lateinit var mPresenter: T

lateinit var progressLoading: ProgressLoading
private lateinit var progressLoading: ProgressLoading

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
init()
Expand All @@ -29,7 +29,7 @@ abstract class BaseMvpFragment<T: BasePresenter<*>> :BaseFragment(), BaseView{


override fun showLoading() {
progressLoading.showLoading()
progressLoading.showLoading(20,true)
}

override fun hideLoading() {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/clw/common/AppManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class AppManager private constructor(){
}

@SuppressLint("MissingPermission")
/*

/**
退出应用程序
*/
fun exitApp(context:Context){
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/com/clw/common/BaseConstant.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,18 @@ class BaseConstant {
const val APP_SERVICE_ADDRE = "http://192.168.1.164:8080/"
//const val APP_SERVICE_ADDRE = "http://192.168.0.101:8080/"

//新闻天气接口
const val APP_NEWS_ADDRE = "http://api01.bitspaceman.com:8000/"

//获取知乎新闻接口
const val APP_ZHIHUNEWS_ADDRE = "https://news-at.zhihu.com/"

//和风天气的Key
const val WEATHER_HEFENG_KEY = "c0d50dd43adb4a62aff5f3f728941082"

//新闻的Key
const val NEWS_KEY = "erXw8Wg6dREAERFoa7RVG9a0v95zx1DrCzyuuJ2RwHOOGFeqRpH7d3ryYjRZrxgD"


}
}
4 changes: 4 additions & 0 deletions app/src/main/java/com/clw/common/ProviderConstant.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ class ProviderConstant {
const val LEFT_SPACE = 2
const val LEFT_BACK = 3
const val LEFT_EXIT = 4

//夜间模式
const val DAY_THEME = "DAY_THEME"
const val NIGHT_THEME = "NIGHT_THEME"
}
}
2 changes: 0 additions & 2 deletions app/src/main/java/com/clw/data/api/ComicApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.clw.data.api

import com.clw.data.protocol.comic.banner.BannerResp
import com.clw.data.protocol.comic.daycomic.DayComicResp
import com.clw.data.protocol.comic.japancomic.JapanComic
import com.clw.data.protocol.comic.japancomic.JapanComicResp
import com.clw.data.protocol.comic.newcomic.NewComicResp
import com.clw.data.protocol.comic.recommend.RecommendResp
Expand All @@ -13,7 +12,6 @@ import retrofit2.http.Headers

interface ComicApi {


/**
* 获取动漫Banner的接口
*/
Expand Down
37 changes: 37 additions & 0 deletions app/src/main/java/com/clw/data/api/NewsApi.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.clw.data.api

import com.clw.data.protocol.news.LatestResp
import com.clw.data.protocol.news.NewsConResp
import com.clw.data.protocol.news.NewsResp
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Path
import retrofit2.http.QueryMap

interface NewsApi {
/**
* 获取新闻A接口
*/
@Headers("UrlName:news")
@GET("news/qihoo")
fun getNews(@QueryMap params:MutableMap<String,String>):Observable<NewsResp>


/**
* 获取最新的新闻接口
*/
@Headers("UrlName:latest")
@GET("api/4/news/latest")
fun getLatest():Observable<LatestResp>


/**
* 获取新闻内容接口
*/
@Headers("UrlName:latest")
@GET("api/4/news/{newsId}")
fun getNewsCon(@Path("newsId") newsId:Long):Observable<NewsConResp>


}
22 changes: 22 additions & 0 deletions app/src/main/java/com/clw/data/protocol/news/Data.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.clw.data.protocol.news

import android.os.Parcelable
import kotlinx.android.parcel.Parcelize


@Parcelize
data class Data(
val id:String,
val likeCount:String,
val url:String,
val posterScreenName:String,
val shareCount:String,
val content:String,
val imageUrls:MutableList<String>,
val posterId:String,
val tags:String,
val commentCount:String,
val publishDate:Long,
val publishDateStr:String,
val title:String
): Parcelable
7 changes: 7 additions & 0 deletions app/src/main/java/com/clw/data/protocol/news/LatestResp.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.clw.data.protocol.news

data class LatestResp(
val date:String,
val stories:MutableList<Stories>,
val top_stories:MutableList<TopStories>
)
13 changes: 13 additions & 0 deletions app/src/main/java/com/clw/data/protocol/news/NewsConResp.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.clw.data.protocol.news

data class NewsConResp(
val body:String,
val image_source:String,
val title:String,
val image:String,
val share_url:String,
val ga_prefix:String,
val images:MutableList<String>,
val type:Int,
val id:Long
)
Loading