-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
4,340 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,74 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:dist="http://schemas.android.com/apk/distribution" | ||
package="com.fmt.github"> | ||
xmlns:dist="http://schemas.android.com/apk/distribution" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.fmt.github"> | ||
|
||
<dist:module dist:instant="true" /> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> | ||
<uses-permission android:name="android.permission.READ_LOGS" /> | ||
|
||
<application | ||
android:name=".App" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/icon_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".WelcomeActivity" android:theme="@style/SplashTheme"> | ||
android:name=".App" | ||
android:allowBackup="true" | ||
android:icon="@mipmap/icon_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:networkSecurityConfig="@xml/network_security_config" | ||
android:theme="@style/AppTheme" | ||
tools:ignore="GoogleAppIndexingWarning"> | ||
<activity | ||
android:name=".WelcomeActivity" | ||
android:theme="@style/SplashTheme"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name=".user.activity.LoginActivity" | ||
android:screenOrientation="portrait" /> | ||
android:name=".user.activity.LoginActivity" | ||
android:screenOrientation="portrait" /> | ||
<activity | ||
android:name=".home.activity.HomeActivity" | ||
android:screenOrientation="portrait" | ||
android:theme="@style/ToolBarTheme" /> | ||
android:name=".home.activity.HomeActivity" | ||
android:screenOrientation="portrait" | ||
android:theme="@style/ToolBarTheme" /> | ||
|
||
<activity | ||
android:name=".home.activity.CommonSearchActivity" | ||
android:screenOrientation="portrait" /> | ||
android:name=".home.activity.CommonSearchActivity" | ||
android:screenOrientation="portrait" /> | ||
|
||
<activity | ||
android:name=".repos.activity.ReposDetailActivity" | ||
android:screenOrientation="portrait" /> | ||
android:name=".repos.activity.ReposDetailActivity" | ||
android:screenOrientation="portrait" /> | ||
<activity | ||
android:name=".user.activity.UserInfoActivity" | ||
android:screenOrientation="portrait" /> | ||
android:name=".user.activity.UserInfoActivity" | ||
android:screenOrientation="portrait" /> | ||
<activity | ||
android:name=".user.activity.AboutActivity" | ||
android:screenOrientation="portrait" /> | ||
android:name=".user.activity.AboutActivity" | ||
android:screenOrientation="portrait" /> | ||
<activity | ||
android:name=".user.activity.PhotoPreviewActivity" | ||
android:screenOrientation="portrait" | ||
android:theme="@style/FullScreenTheme" /> | ||
android:name=".user.activity.PhotoPreviewActivity" | ||
android:screenOrientation="portrait" | ||
android:theme="@style/FullScreenTheme" /> | ||
|
||
<!-- Android 7.0以上 照片、APK等下载保存路径--> | ||
<provider | ||
android:name="androidx.core.content.FileProvider" | ||
android:authorities="${applicationId}.provider" | ||
android:exported="false" | ||
android:grantUriPermissions="true"> | ||
<meta-data | ||
android:name="android.support.FILE_PROVIDER_PATHS" | ||
android:resource="@xml/file_paths" /> | ||
</provider> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.fmt.github | ||
|
||
import com.bumptech.glide.annotation.GlideModule | ||
import com.bumptech.glide.module.AppGlideModule | ||
|
||
@GlideModule | ||
class GlideModule : AppGlideModule() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.fmt.github.data.db | ||
|
||
import androidx.room.Room | ||
import com.fmt.github.AppContext | ||
|
||
private const val DB_NAME = "open_github_db" | ||
|
||
val room = Room.databaseBuilder(AppContext, AppDataBase::class.java, DB_NAME).build() | ||
|
||
val userDao = room.getUserDao() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.fmt.github.data.http | ||
|
||
import android.util.Log | ||
import com.fmt.github.BuildConfig | ||
import com.fmt.github.data.http.interceptor.AuthorizationInterceptor | ||
import com.fmt.github.home.api.DownloadApi | ||
import com.fmt.github.repos.api.ReposApi | ||
import com.fmt.github.user.api.UserApi | ||
import okhttp3.OkHttpClient | ||
import okhttp3.logging.HttpLoggingInterceptor | ||
import retrofit2.Retrofit | ||
import retrofit2.converter.gson.GsonConverterFactory | ||
import java.util.concurrent.TimeUnit | ||
|
||
private const val BASE_URL = "https://api.github.com/" | ||
private const val TIME_OUT = 60L | ||
private const val TAG = "fmt" | ||
|
||
val httpLoggingInterceptor = HttpLoggingInterceptor(object : HttpLoggingInterceptor.Logger { | ||
override fun log(message: String) { | ||
Log.e(TAG, message) | ||
} | ||
}).also { | ||
it.level = HttpLoggingInterceptor.Level.BODY | ||
} | ||
|
||
val okHttpClient = OkHttpClient.Builder() | ||
.addInterceptor(AuthorizationInterceptor()) | ||
.connectTimeout(TIME_OUT, TimeUnit.SECONDS) | ||
.writeTimeout(TIME_OUT, TimeUnit.SECONDS) | ||
.readTimeout(TIME_OUT, TimeUnit.SECONDS).also { | ||
if (BuildConfig.DEBUG) { | ||
it.addInterceptor(httpLoggingInterceptor) | ||
} | ||
}.build() | ||
|
||
val retrofit: Retrofit = Retrofit.Builder() | ||
.addConverterFactory(GsonConverterFactory.create()) | ||
.client(okHttpClient) | ||
.baseUrl(BASE_URL) | ||
.build() | ||
|
||
object ReposService : ReposApi by retrofit.create(ReposApi::class.java)//接口代理实现 | ||
|
||
object UserService : UserApi by retrofit.create(UserApi::class.java) | ||
|
||
object DownloadService : DownloadApi by retrofit.create(DownloadApi::class.java) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.