Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_fiveworld
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_fiveworld
Commits
c60209a8
Commit
c60209a8
authored
Jul 02, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页搭建已完成
parent
522dad58
Changes
38
Show whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
709 additions
and
51 deletions
+709
-51
MainActivity.kt
app/src/main/java/com/mints/goodnews/main/MainActivity.kt
+112
-4
HomeFragment.kt
...rc/main/java/com/mints/goodnews/main/home/HomeFragment.kt
+24
-0
HomeViewModel.kt
...c/main/java/com/mints/goodnews/main/home/HomeViewModel.kt
+10
-0
MyFragment.kt
app/src/main/java/com/mints/goodnews/main/my/MyFragment.kt
+21
-0
MyViewModel.kt
app/src/main/java/com/mints/goodnews/main/my/MyViewModel.kt
+10
-0
SquareFragment.kt
...ain/java/com/mints/goodnews/main/square/SquareFragment.kt
+21
-0
SquareViewModel.kt
...in/java/com/mints/goodnews/main/square/SquareViewModel.kt
+10
-0
TakePhotoFragment.kt
...a/com/mints/goodnews/main/take_photo/TakePhotoFragment.kt
+19
-0
TakePhotoViewModel.kt
.../com/mints/goodnews/main/take_photo/TakePhotoViewModel.kt
+10
-0
TakeFragment.kt
...rc/main/java/com/mints/goodnews/main/task/TakeFragment.kt
+21
-0
TakeViewModel.kt
...c/main/java/com/mints/goodnews/main/task/TakeViewModel.kt
+10
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+78
-0
fragment_home.xml
app/src/main/res/layout/fragment_home.xml
+22
-0
fragment_my.xml
app/src/main/res/layout/fragment_my.xml
+21
-0
fragment_square.xml
app/src/main/res/layout/fragment_square.xml
+22
-0
fragment_take.xml
app/src/main/res/layout/fragment_take.xml
+22
-0
fragment_take_photo.xml
app/src/main/res/layout/fragment_take_photo.xml
+21
-0
build.gradle
library_base/build.gradle
+3
-0
ImageLoader.java
...ry_base/src/main/java/com/fry/base/utils/ImageLoader.java
+70
-46
bottom_selector.xml
library_base/src/main/res/color/bottom_selector.xml
+5
-0
menu_main.xml
library_base/src/main/res/drawable/menu_main.xml
+7
-0
menu_my.xml
library_base/src/main/res/drawable/menu_my.xml
+7
-0
menu_square.xml
library_base/src/main/res/drawable/menu_square.xml
+7
-0
menu_task.xml
library_base/src/main/res/drawable/menu_task.xml
+7
-0
menu_navigation.xml
library_base/src/main/res/menu/menu_navigation.xml
+28
-0
bg_tab_takephone.png
library_base/src/main/res/mipmap-xxhdpi/bg_tab_takephone.png
+0
-0
ic_eye_tokephone.gif
library_base/src/main/res/mipmap-xxhdpi/ic_eye_tokephone.gif
+0
-0
ic_hint.png
library_base/src/main/res/mipmap-xxhdpi/ic_hint.png
+0
-0
ic_tab_main_enable.png
...ry_base/src/main/res/mipmap-xxhdpi/ic_tab_main_enable.png
+0
-0
ic_tab_main_none.png
library_base/src/main/res/mipmap-xxhdpi/ic_tab_main_none.png
+0
-0
ic_tab_my_enable.png
library_base/src/main/res/mipmap-xxhdpi/ic_tab_my_enable.png
+0
-0
ic_tab_my_none.png
library_base/src/main/res/mipmap-xxhdpi/ic_tab_my_none.png
+0
-0
ic_tab_square_enable.png
..._base/src/main/res/mipmap-xxhdpi/ic_tab_square_enable.png
+0
-0
ic_tab_square_none.png
...ry_base/src/main/res/mipmap-xxhdpi/ic_tab_square_none.png
+0
-0
ic_tab_task_enable.png
...ry_base/src/main/res/mipmap-xxhdpi/ic_tab_task_enable.png
+0
-0
ic_tab_task_none.png
library_base/src/main/res/mipmap-xxhdpi/ic_tab_task_none.png
+0
-0
colors.xml
library_base/src/main/res/values/colors.xml
+75
-1
strings.xml
library_base/src/main/res/values/strings.xml
+46
-0
No files found.
app/src/main/java/com/mints/goodnews/main/MainActivity.kt
View file @
c60209a8
package
com.mints.goodnews.main
import
android.app.Activity
import
android.os.Bundle
import
android.view.View
import
android.view.ViewGroup
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.FragmentActivity
import
androidx.viewpager2.adapter.FragmentStateAdapter
import
androidx.viewpager2.widget.ViewPager2
import
com.bumptech.glide.Glide
import
com.fry.base.base.BaseActivity
import
com.fry.base.utils.ImageLoader
import
com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
import
com.mints.goodnews.BR
import
com.mints.goodnews.R
import
com.mints.goodnews.databinding.ActivityMainBinding
import
com.mints.goodnews.main.home.HomeFragment
import
com.mints.goodnews.main.my.MyFragment
import
com.mints.goodnews.main.square.SquareFragment
import
com.mints.goodnews.main.take_photo.TakePhotoFragment
import
com.mints.goodnews.main.task.TakeFragment
import
me.goldze.mvvmhabit.utils.KLog
import
me.goldze.mvvmhabit.utils.RxUtils
class
MainActivity
:
BaseActivity
<
ActivityMainBinding
,
MainViewModel
>()
{
class
MainActivity
:
BaseActivity
<
ActivityMainBinding
,
MainViewModel
>()
{
override
fun
initContentView
(
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
activity_main
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
initData
()
{
super
.
initData
()
//初始化底部Button
//初始化viewpager2
binding
.
mainViewpager
.
initMain
(
this
)
//初始化 bottomBarF
binding
.
mainBottom
.
init
{
when
(
it
)
{
R
.
id
.
menu_home
->
binding
.
mainViewpager
.
setCurrentItem
(
0
,
false
)
R
.
id
.
menu_square
->
binding
.
mainViewpager
.
setCurrentItem
(
1
,
false
)
R
.
id
.
menu_empty
->
binding
.
mainViewpager
.
setCurrentItem
(
2
,
false
)
R
.
id
.
menu_task
->
binding
.
mainViewpager
.
setCurrentItem
(
3
,
false
)
R
.
id
.
menu_my
->
{
binding
.
mainViewpager
.
setCurrentItem
(
4
,
false
)
// stopAnim()
}
}
}
//加载本地GIF动图
ImageLoader
.
ImageBuilder
.
with
(
this
)
.
setDrawable
(
R
.
mipmap
.
ic_eye_tokephone
)
.
setTargetView
(
binding
.
ivTakephoto
).
start
()
binding
.
mainBottom
.
interceptLongClick
(
R
.
id
.
menu_home
,
R
.
id
.
menu_square
,
R
.
id
.
menu_empty
,
R
.
id
.
menu_task
,
R
.
id
.
menu_my
)
}
}
private
fun
BottomNavigationViewEx
.
init
(
navigationItemSelectedAction
:
(
Int
)
->
Unit
):
BottomNavigationViewEx
{
enableAnimation
(
true
)
enableShiftingMode
(
false
)
enableItemShiftingMode
(
true
)
setTextSize
(
12F
)
setOnNavigationItemSelectedListener
{
navigationItemSelectedAction
.
invoke
(
it
.
itemId
)
true
}
return
this
}
private
fun
ViewPager2
.
initMain
(
activity
:
FragmentActivity
):
ViewPager2
{
//是否可滑动
this
.
isUserInputEnabled
=
false
this
.
offscreenPageLimit
=
5
//设置适配器
adapter
=
object
:
FragmentStateAdapter
(
activity
)
{
override
fun
createFragment
(
position
:
Int
):
Fragment
{
return
when
(
position
)
{
0
->
{
//首页
HomeFragment
()
}
1
->
{
//广场
SquareFragment
()
}
2
->
{
//拍照
TakePhotoFragment
()
}
3
->
{
//任务中心
TakeFragment
()
}
4
->
{
//个人中心
MyFragment
()
}
else
->
{
//首页
HomeFragment
()
}
}
}
override
fun
getItemCount
()
=
5
}
return
this
}
/**
* 拦截BottomNavigation长按事件 防止长按时出现Toast ---- 追求完美的大屌群友提的bug
* @receiver BottomNavigationViewEx
* @param ids IntArray
*/
private
fun
BottomNavigationViewEx
.
interceptLongClick
(
vararg
ids
:
Int
)
{
val
bottomNavigationMenuView
:
ViewGroup
=
(
this
.
getChildAt
(
0
)
as
ViewGroup
)
for
(
index
in
ids
.
indices
)
{
bottomNavigationMenuView
.
getChildAt
(
index
).
findViewById
<
View
>(
ids
[
index
])
.
setOnLongClickListener
{
true
}
}
}
app/src/main/java/com/mints/goodnews/main/home/HomeFragment.kt
0 → 100644
View file @
c60209a8
package
com.mints.goodnews.main.home
import
android.app.Activity
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
com.fry.base.base.BaseFragment
import
com.mints.goodnews.BR
import
com.mints.goodnews.R
import
com.mints.goodnews.databinding.ActivityMainBinding
import
com.mints.goodnews.databinding.FragmentHomeBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
* 首页页面
*/
class
HomeFragment
:
BaseFragment
<
FragmentHomeBinding
,
HomeViewModel
>()
{
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
fragment_home
override
fun
initVariableId
()
=
BR
.
viewModel
}
\ No newline at end of file
app/src/main/java/com/mints/goodnews/main/home/HomeViewModel.kt
0 → 100644
View file @
c60209a8
package
com.mints.goodnews.main.home
import
android.app.Application
import
me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class
HomeViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
}
\ No newline at end of file
app/src/main/java/com/mints/goodnews/main/my/MyFragment.kt
0 → 100644
View file @
c60209a8
package
com.mints.goodnews.main.my
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
com.fry.base.base.BaseFragment
import
com.mints.goodnews.BR
import
com.mints.goodnews.R
import
com.mints.goodnews.databinding.FragmentMyBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
* 个人中心页面
*/
class
MyFragment
:
BaseFragment
<
FragmentMyBinding
,
MyViewModel
>()
{
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
fragment_my
override
fun
initVariableId
()
=
BR
.
viewModel
}
app/src/main/java/com/mints/goodnews/main/my/MyViewModel.kt
0 → 100644
View file @
c60209a8
package
com.mints.goodnews.main.my
import
android.app.Application
import
me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class
MyViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
}
\ No newline at end of file
app/src/main/java/com/mints/goodnews/main/square/SquareFragment.kt
0 → 100644
View file @
c60209a8
package
com.mints.goodnews.main.square
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
com.fry.base.base.BaseFragment
import
com.mints.goodnews.BR
import
com.mints.goodnews.R
import
com.mints.goodnews.databinding.FragmentSquareBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
* 广场页面
*/
class
SquareFragment
:
BaseFragment
<
FragmentSquareBinding
,
SquareViewModel
>()
{
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?)=
R
.
layout
.
fragment_square
override
fun
initVariableId
()=
BR
.
viewModel
}
\ No newline at end of file
app/src/main/java/com/mints/goodnews/main/square/SquareViewModel.kt
0 → 100644
View file @
c60209a8
package
com.mints.goodnews.main.square
import
android.app.Application
import
me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class
SquareViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
}
\ No newline at end of file
app/src/main/java/com/mints/goodnews/main/take_photo/TakePhotoFragment.kt
0 → 100644
View file @
c60209a8
package
com.mints.goodnews.main.take_photo
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
com.fry.base.base.BaseFragment
import
com.mints.goodnews.BR
import
com.mints.goodnews.R
import
com.mints.goodnews.databinding.FragmentTakePhotoBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class
TakePhotoFragment
:
BaseFragment
<
FragmentTakePhotoBinding
,
TakePhotoViewModel
>()
{
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?)=
R
.
layout
.
fragment_take_photo
override
fun
initVariableId
()
=
BR
.
viewModel
}
\ No newline at end of file
app/src/main/java/com/mints/goodnews/main/take_photo/TakePhotoViewModel.kt
0 → 100644
View file @
c60209a8
package
com.mints.goodnews.main.take_photo
import
android.app.Application
import
me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class
TakePhotoViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
}
\ No newline at end of file
app/src/main/java/com/mints/goodnews/main/task/TakeFragment.kt
0 → 100644
View file @
c60209a8
package
com.mints.goodnews.main.task
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
com.fry.base.base.BaseFragment
import
com.mints.goodnews.BR
import
com.mints.goodnews.R
import
com.mints.goodnews.databinding.FragmentTakeBinding
/**
* Created by 冯瑞雨 on 2021/7/2.
* 任务中心页面
*/
class
TakeFragment
:
BaseFragment
<
FragmentTakeBinding
,
TakeViewModel
>()
{
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?)
=
R
.
layout
.
fragment_take
override
fun
initVariableId
()=
BR
.
viewModel
}
\ No newline at end of file
app/src/main/java/com/mints/goodnews/main/task/TakeViewModel.kt
0 → 100644
View file @
c60209a8
package
com.mints.goodnews.main.task
import
android.app.Application
import
me.goldze.mvvmhabit.base.BaseViewModel
/**
* Created by 冯瑞雨 on 2021/7/2.
*/
class
TakeViewModel
(
application
:
Application
):
BaseViewModel
(
application
)
{
}
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
c60209a8
...
...
@@ -11,5 +11,83 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".main.MainActivity"
>
<androidx.viewpager2.widget.ViewPager2
android:id=
"@+id/mainViewpager"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
app:layout_constraintBottom_toTopOf=
"@+id/flMainBootom"
app:layout_constraintTop_toTopOf=
"parent"
/>
<FrameLayout
android:id=
"@+id/flMainBootom"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"parent"
tools:ignore=
"MissingConstraints"
>
<com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
android:id=
"@+id/mainBottom"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/color_F9F9F9"
app:itemIconSize=
"20dp"
app:itemTextColor=
"@color/bottom_selector"
app:menu=
"@menu/menu_navigation"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/flTakephoto"
android:layout_width=
"68dp"
android:layout_height=
"68dp"
android:layout_marginBottom=
"20dp"
android:background=
"@mipmap/bg_tab_takephone"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
>
<ImageView
android:id=
"@+id/ivTakephoto"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:layout_gravity=
"center"
android:scaleType=
"fitXY"
/>
</FrameLayout>
<TextView
android:id=
"@+id/tv_num"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"60dp"
android:background=
"@mipmap/ic_hint"
android:gravity=
"center"
android:paddingStart=
"18dp"
android:paddingTop=
"2dp"
android:paddingEnd=
"10dp"
android:paddingBottom=
"10dp"
android:text=
"30次"
android:textColor=
"@color/white"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintCircle=
"@+id/flTakephoto"
app:layout_constraintCircleAngle=
"65"
app:layout_constraintCircleRadius=
"60dp"
tools:ignore=
"MissingConstraints"
/>
<TextView
android:id=
"@+id/tv_just"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"50dp"
android:background=
"@mipmap/ic_hint"
android:gravity=
"center"
android:paddingStart=
"12dp"
android:paddingTop=
"2dp"
android:paddingEnd=
"6dp"
android:paddingBottom=
"6dp"
android:text=
"领金币"
android:textColor=
"@color/white"
android:textSize=
"10sp"
android:visibility=
"visible"
app:layout_constraintBottom_toBottomOf=
"@id/flMainBootom"
app:layout_constraintRight_toRightOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
app/src/main/res/layout/fragment_home.xml
0 → 100644
View file @
c60209a8
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"ViewModel"
type=
"com.mints.goodnews.main.home.HomeViewModel"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
android:text=
"首页"
android:textColor=
"@color/black"
android:textSize=
"39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/fragment_my.xml
0 → 100644
View file @
c60209a8
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"ViewModel"
type=
"com.mints.goodnews.main.my.MyViewModel"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
android:text=
"个人中心"
android:textColor=
"@color/black"
android:textSize=
"39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/fragment_square.xml
0 → 100644
View file @
c60209a8
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"ViewModel"
type=
"com.mints.goodnews.main.square.SquareViewModel"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
android:text=
"广场"
android:textColor=
"@color/black"
android:textSize=
"39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/fragment_take.xml
0 → 100644
View file @
c60209a8
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"ViewModel"
type=
"com.mints.goodnews.main.task.TakeViewModel"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
android:text=
"任务中心"
android:textColor=
"@color/black"
android:textSize=
"39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
app/src/main/res/layout/fragment_take_photo.xml
0 → 100644
View file @
c60209a8
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"ViewModel"
type=
"com.mints.goodnews.main.take_photo.TakePhotoViewModel"
/>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
android:text=
"拍照"
android:textColor=
"@color/black"
android:textSize=
"39dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
library_base/build.gradle
View file @
c60209a8
...
...
@@ -63,4 +63,7 @@ dependencies {
// 依赖协程核心库
api
rootProject
.
ext
.
kotlin
[
"coroutine"
]
api
rootProject
.
ext
.
kotlin
[
"coroutine-android"
]
//底部bottomBar
api
'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
}
library_base/src/main/java/com/fry/base/utils/ImageLoader.java
View file @
c60209a8
package
com
.
fry
.
base
.
utils
;
import
android.app.Activity
;
import
androidx.fragment.app.Fragment
;
import
android.content.Context
;
import
android.graphics.drawable.Drawable
;
import
android.widget.ImageView
;
import
com.bumptech.glide.Glide
;
...
...
@@ -27,30 +29,32 @@ import me.goldze.mvvmhabit.utils.CornerTransform;
public
class
ImageLoader
{
private
ImageBuilder
builder
;
private
ImageLoader
(
ImageBuilder
builder
){
private
ImageLoader
(
ImageBuilder
builder
)
{
this
.
builder
=
builder
;
}
private
void
load
(){
if
(
builder
==
null
){
private
void
load
()
{
if
(
builder
==
null
)
{
throw
new
RuntimeException
(
"you need create ImageLoader with ImageBuilder"
);
}
RequestOptions
options
=
new
RequestOptions
();
Transformation
tormation
=
null
;
if
(
builder
.
scaleType
!=
null
)
{
if
(
builder
.
scaleType
!=
null
)
{
builder
.
targetView
.
setScaleType
(
builder
.
scaleType
);
}
if
(
ImageView
.
ScaleType
.
CENTER_CROP
==
builder
.
getScaleType
()
&&
builder
.
getCornerDp
()
>
0
)
{
CornerTransform
cornerTransform
=
new
CornerTransform
(
builder
.
getTargetView
().
getContext
(),
AppUtils
.
dp2Px
(
builder
.
getTargetView
().
getContext
(),
builder
.
getCornerDp
()));
cornerTransform
.
setExceptCorner
(!
builder
.
startTopCorner
,
!
builder
.
endTopCorner
,!
builder
.
startBottomCorner
,
!
builder
.
endBottomCorner
);
tormation
=
new
MultiTransformation
<>(
new
CenterCrop
(),
cornerTransform
);
}
else
{
if
(
builder
.
getCornerDp
()
>
0
)
{
CornerTransform
cornerTransform
=
new
CornerTransform
(
builder
.
getTargetView
().
getContext
(),
AppUtils
.
dp2Px
(
builder
.
getTargetView
().
getContext
(),
builder
.
getCornerDp
()));
cornerTransform
.
setExceptCorner
(!
builder
.
startTopCorner
,
!
builder
.
endTopCorner
,!
builder
.
startBottomCorner
,
!
builder
.
endBottomCorner
);
if
(
ImageView
.
ScaleType
.
FIT_CENTER
==
builder
.
getScaleType
())
{
tormation
=
new
MultiTransformation
<>(
new
FitCenter
(),
cornerTransform
);
}
else
{
if
(
ImageView
.
ScaleType
.
CENTER_CROP
==
builder
.
getScaleType
()
&&
builder
.
getCornerDp
()
>
0
)
{
CornerTransform
cornerTransform
=
new
CornerTransform
(
builder
.
getTargetView
().
getContext
(),
AppUtils
.
dp2Px
(
builder
.
getTargetView
().
getContext
(),
builder
.
getCornerDp
()));
cornerTransform
.
setExceptCorner
(!
builder
.
startTopCorner
,
!
builder
.
endTopCorner
,
!
builder
.
startBottomCorner
,
!
builder
.
endBottomCorner
);
tormation
=
new
MultiTransformation
<>(
new
CenterCrop
(),
cornerTransform
);
}
else
{
if
(
builder
.
getCornerDp
()
>
0
)
{
CornerTransform
cornerTransform
=
new
CornerTransform
(
builder
.
getTargetView
().
getContext
(),
AppUtils
.
dp2Px
(
builder
.
getTargetView
().
getContext
(),
builder
.
getCornerDp
()));
cornerTransform
.
setExceptCorner
(!
builder
.
startTopCorner
,
!
builder
.
endTopCorner
,
!
builder
.
startBottomCorner
,
!
builder
.
endBottomCorner
);
if
(
ImageView
.
ScaleType
.
FIT_CENTER
==
builder
.
getScaleType
())
{
tormation
=
new
MultiTransformation
<>(
new
FitCenter
(),
cornerTransform
);
}
else
{
tormation
=
new
MultiTransformation
<>(
cornerTransform
);
}
...
...
@@ -59,30 +63,43 @@ public class ImageLoader {
options
=
options
.
placeholder
(
builder
.
getPlaceHolder
()
>=
0
?
builder
.
getPlaceHolder
()
:
R
.
mipmap
.
empty_placeholder_small
);
RequestManager
requestManager
;
if
(
builder
.
fragment
!=
null
)
{
if
(
builder
.
fragment
!=
null
)
{
requestManager
=
Glide
.
with
(
builder
.
fragment
);
}
else
if
(
builder
.
activity
!=
null
)
{
}
else
if
(
builder
.
activity
!=
null
)
{
requestManager
=
Glide
.
with
(
builder
.
activity
);
}
else
if
(
builder
.
context
!=
null
)
{
}
else
if
(
builder
.
context
!=
null
)
{
requestManager
=
Glide
.
with
(
builder
.
context
);
}
else
{
}
else
{
requestManager
=
Glide
.
with
(
this
.
builder
.
getTargetView
().
getContext
());
}
RequestBuilder
requestBuilder
=
requestManager
RequestBuilder
requestBuilder
;
//加载网络的
if
(
this
.
builder
.
url
!=
null
&&
!
this
.
builder
.
url
.
equals
(
""
)){
requestBuilder
=
requestManager
.
load
(
this
.
builder
.
getUrl
())
.
error
(
builder
.
errorHolder
)
.
addListener
(
this
.
builder
.
requestListener
)
.
apply
(
options
);
if
(
tormation
!=
null
){
}
else
{
//加载本地的
requestBuilder
=
requestManager
.
load
(
this
.
builder
.
getDrawable
())
.
error
(
builder
.
errorHolder
)
.
addListener
(
this
.
builder
.
requestListener
)
.
apply
(
options
);
}
if
(
tormation
!=
null
)
{
requestBuilder
.
transform
(
tormation
);
}
requestBuilder
.
into
(
builder
.
getTargetView
());
}
public
static
class
ImageBuilder
{
public
static
class
ImageBuilder
{
//加载网络的
private
String
url
;
//加载本地的
private
int
drawable
;
private
Fragment
fragment
;
private
Activity
activity
;
private
Context
context
;
...
...
@@ -101,22 +118,25 @@ public class ImageLoader {
private
boolean
endTopCorner
=
true
;
private
boolean
endBottomCorner
=
true
;
public
static
ImageBuilder
with
(
Fragment
fragment
){
public
static
ImageBuilder
with
(
Fragment
fragment
)
{
ImageBuilder
builder
=
new
ImageBuilder
();
builder
.
fragment
=
fragment
;
return
builder
;
}
public
static
ImageBuilder
with
(
Activity
activity
){
public
static
ImageBuilder
with
(
Activity
activity
)
{
ImageBuilder
builder
=
new
ImageBuilder
();
builder
.
activity
=
activity
;
return
builder
;
}
public
static
ImageBuilder
with
(
Context
context
){
public
static
ImageBuilder
with
(
Context
context
)
{
ImageBuilder
builder
=
new
ImageBuilder
();
builder
.
context
=
context
;
return
builder
;
}
public
static
ImageBuilder
with
(){
public
static
ImageBuilder
with
()
{
return
new
ImageBuilder
();
}
...
...
@@ -133,16 +153,19 @@ public class ImageLoader {
return
url
;
}
public
ImageBuilder
setUrl
(
String
url
)
{
//后端要求,不返回协议头,自己添加
if
(
url
!=
null
&&
!
url
.
startsWith
(
"http"
)){
url
=
String
.
format
(
"https:%s"
,
url
);
}
if
(
limitWidth
>
0
){
this
.
url
=
String
.
format
(
"%s?x-oss-process=image/resize,w_%s"
,
url
,
limitWidth
);
}
else
{
this
.
url
=
url
;
return
this
;
}
public
int
getDrawable
()
{
return
drawable
;
}
public
ImageBuilder
setDrawable
(
int
drawable
)
{
this
.
drawable
=
drawable
;
return
this
;
}
...
...
@@ -182,10 +205,11 @@ public class ImageLoader {
return
this
;
}
public
ImageView
.
ScaleType
getScaleType
(){
public
ImageView
.
ScaleType
getScaleType
()
{
return
scaleType
;
}
public
ImageBuilder
setScaleType
(
ImageView
.
ScaleType
scaleType
){
public
ImageBuilder
setScaleType
(
ImageView
.
ScaleType
scaleType
)
{
this
.
scaleType
=
scaleType
;
return
this
;
}
...
...
@@ -235,7 +259,7 @@ public class ImageLoader {
return
this
;
}
public
void
start
(){
public
void
start
()
{
new
ImageLoader
(
this
).
load
();
}
}
...
...
library_base/src/main/res/color/bottom_selector.xml
0 → 100644
View file @
c60209a8
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:color=
"@color/main_color"
android:state_checked=
"true"
/>
<item
android:color=
"@color/main_color"
android:state_pressed=
"true"
/>
<item
android:color=
"@color/main_blue_color"
/>
</selector>
\ No newline at end of file
library_base/src/main/res/drawable/menu_main.xml
0 → 100644
View file @
c60209a8
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@mipmap/ic_tab_main_enable"
android:state_selected=
"true"
/>
<item
android:drawable=
"@mipmap/ic_tab_main_none"
/>
</selector>
\ No newline at end of file
library_base/src/main/res/drawable/menu_my.xml
0 → 100644
View file @
c60209a8
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@mipmap/ic_tab_my_enable"
android:state_selected=
"true"
/>
<item
android:drawable=
"@mipmap/ic_tab_my_none"
/>
</selector>
\ No newline at end of file
library_base/src/main/res/drawable/menu_square.xml
0 → 100644
View file @
c60209a8
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@mipmap/ic_tab_square_enable"
android:state_selected=
"true"
/>
<item
android:drawable=
"@mipmap/ic_tab_square_none"
/>
</selector>
\ No newline at end of file
library_base/src/main/res/drawable/menu_task.xml
0 → 100644
View file @
c60209a8
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@mipmap/ic_tab_task_enable"
android:state_selected=
"true"
/>
<item
android:drawable=
"@mipmap/ic_tab_task_none"
/>
</selector>
\ No newline at end of file
library_base/src/main/res/menu/menu_navigation.xml
0 → 100644
View file @
c60209a8
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@+id/menu_home"
android:checked=
"true"
android:icon=
"@drawable/menu_main"
android:title=
"@string/bottom_name_home"
/>
<item
android:id=
"@+id/menu_square"
android:icon=
"@drawable/menu_square"
android:title=
"@string/bottom_name_square"
/>
<item
android:id=
"@+id/menu_empty"
android:title=
"@string/bottom_name_takephoto"
/>
<item
android:id=
"@+id/menu_task"
android:icon=
"@drawable/menu_task"
android:title=
"@string/bottom_name_task"
/>
<item
android:id=
"@+id/menu_my"
android:icon=
"@drawable/menu_my"
android:title=
"@string/bottom_name_my"
/>
</menu>
\ No newline at end of file
library_base/src/main/res/mipmap-xxhdpi/bg_tab_takephone.png
0 → 100644
View file @
c60209a8
3.04 KB
library_base/src/main/res/mipmap-xxhdpi/ic_eye_tokephone.gif
0 → 100644
View file @
c60209a8
48.7 KB
library_base/src/main/res/mipmap-xxhdpi/ic_hint.png
0 → 100644
View file @
c60209a8
1.3 KB
library_base/src/main/res/mipmap-xxhdpi/ic_tab_main_enable.png
0 → 100644
View file @
c60209a8
1.74 KB
library_base/src/main/res/mipmap-xxhdpi/ic_tab_main_none.png
0 → 100644
View file @
c60209a8
1.77 KB
library_base/src/main/res/mipmap-xxhdpi/ic_tab_my_enable.png
0 → 100644
View file @
c60209a8
1.53 KB
library_base/src/main/res/mipmap-xxhdpi/ic_tab_my_none.png
0 → 100644
View file @
c60209a8
2.69 KB
library_base/src/main/res/mipmap-xxhdpi/ic_tab_square_enable.png
0 → 100644
View file @
c60209a8
948 Bytes
library_base/src/main/res/mipmap-xxhdpi/ic_tab_square_none.png
0 → 100644
View file @
c60209a8
1.22 KB
library_base/src/main/res/mipmap-xxhdpi/ic_tab_task_enable.png
0 → 100644
View file @
c60209a8
1007 Bytes
library_base/src/main/res/mipmap-xxhdpi/ic_tab_task_none.png
0 → 100644
View file @
c60209a8
1.1 KB
library_base/src/main/res/values/colors.xml
View file @
c60209a8
...
...
@@ -2,6 +2,10 @@
<resources>
<color
name=
"colorPrimary"
>
#ffffffff
</color>
<color
name=
"colorPrimaryDark"
>
#ffffffff
</color>
<color
name=
"main_color"
>
#FB673E
</color>
<color
name=
"main_blue_color"
>
#536792
</color>
<color
name=
"colorAccent"
>
#FF4081
</color>
<color
name=
"textColor"
>
#222222
</color>
<color
name=
"textColorHint"
>
#888888
</color>
...
...
@@ -9,5 +13,75 @@
<color
name=
"viewLineColor"
>
#EEEEEE
</color>
<color
name=
"black"
>
#000000
</color>
<color
name=
"translucent"
>
#00000000
</color>
<color
name=
"main_color"
>
#B88855
</color>
<color
name=
"transparent"
>
#00000000
</color>
<color
name=
"trans20"
>
#20000000
</color>
<color
name=
"trans30"
>
#30000000
</color>
<color
name=
"trans40"
>
#40000000
</color>
<color
name=
"color_E6E6E6"
>
#E6E6E6
</color>
<color
name=
"color_E6E2E2"
>
#E6E2E2
</color>
<color
name=
"color_121B32"
>
#121B32
</color>
<color
name=
"color_FF9837"
>
#FF9837
</color>
<color
name=
"color_50FF9837"
>
#50FF9837
</color>
<color
name=
"color_3D5AFE"
>
#3D5AFE
</color>
<color
name=
"color_cb4a39"
>
#cb4a39
</color>
<color
name=
"color_0000FF"
>
#0000FF
</color>
<color
name=
"color_ccc"
>
#cccccc
</color>
<color
name=
"color_AAA"
>
#AAAAAA
</color>
<color
name=
"color_0000"
>
#00000000
</color>
<color
name=
"color_20000000"
>
#20000000
</color>
<color
name=
"color_60000000"
>
#60000000
</color>
<color
name=
"color_50000000"
>
#50000000
</color>
<color
name=
"color_2B3238"
>
#2B3238
</color>
<color
name=
"color_002444"
>
#002444
</color>
<color
name=
"color_600c224b"
>
#600c224b
</color>
<color
name=
"color_fcf16e"
>
#fcf16e
</color>
<color
name=
"color_F18542"
>
#F18542
</color>
<color
name=
"color_FEEBC8"
>
#FEEBC8
</color>
<color
name=
"color_63A0B9"
>
#63A0B9
</color>
<color
name=
"color_7EE2FF"
>
#7EE2FF
</color>
<color
name=
"color_255186"
>
#255186
</color>
<color
name=
"color_A7BCFE"
>
#A7BCFE
</color>
<color
name=
"color_666"
>
#666666
</color>
<color
name=
"color_454A69"
>
#454A69
</color>
<color
name=
"color_333"
>
#333333
</color>
<color
name=
"color_4BB93F"
>
#4BB93F
</color>
<color
name=
"color_556A97"
>
#556A97
</color>
<color
name=
"color_FEB63D"
>
#FEB63D
</color>
<color
name=
"color_FF5E5E"
>
#FF5E5E
</color>
<color
name=
"color_172B54"
>
#172B54
</color>
<color
name=
"color_707A8D"
>
#707A8D
</color>
<color
name=
"color_F9F9F9"
>
#F9F9F9
</color>
<color
name=
"color_63677E"
>
#63677E
</color>
<color
name=
"color_BEC2CC"
>
#BEC2CC
</color>
<color
name=
"color_50E8E8E8"
>
#50E8E8E8
</color>
<color
name=
"color_FF2326"
>
#FF2326
</color>
<color
name=
"color_93B7D9"
>
#93B7D9
</color>
<color
name=
"color_F9FAFB"
>
#F9FAFB
</color>
<color
name=
"color_F8F8F8"
>
#F8F8F8
</color>
<color
name=
"color_343C4F"
>
#343C4F
</color>
<color
name=
"color_FB560C"
>
#FB560C
</color>
<color
name=
"color_EBB20D"
>
#EBB20D
</color>
<color
name=
"color_999"
>
#999999
</color>
<color
name=
"color_555"
>
#555555
</color>
<color
name=
"color_F5F"
>
#F5F5F5
</color>
<color
name=
"color_F8F"
>
#F8F8F8
</color>
<color
name=
"color_D81B60"
>
#D81B60
</color>
<color
name=
"color_00895B"
>
#00895B
</color>
<color
name=
"color_8F6D21"
>
#8F6D21
</color>
<color
name=
"color_FFDD0C"
>
#FFDD0C
</color>
<color
name=
"color_CF7E7E"
>
#CF7E7E
</color>
<color
name=
"color_FF4A4A"
>
#FF4A4A
</color>
<color
name=
"color_AF6F36"
>
#AF6F36
</color>
<color
name=
"color_912C36"
>
#912C36
</color>
<color
name=
"color_E72C2B"
>
#E72C2B
</color>
<color
name=
"color_FFC7C7"
>
#FFC7C7
</color>
<color
name=
"color_FF7C00"
>
#FF7C00
</color>
<color
name=
"color_FAF6E8"
>
#FAF6E8
</color>
<color
name=
"color_F3E7C5"
>
#F3E7C5
</color>
<color
name=
"color_E1B867"
>
#E1B867
</color>
<color
name=
"color_FCCCAC"
>
#FCCCAC
</color>
<color
name=
"color_994B23"
>
#994B23
</color>
<color
name=
"color_F28335"
>
#F28335
</color>
</resources>
\ No newline at end of file
library_base/src/main/res/values/strings.xml
View file @
c60209a8
...
...
@@ -3,4 +3,50 @@
<string
name=
"rmb_tag"
>
¥
</string>
<string
name=
"rmb_tag_normal_format"
>
¥%s
</string>
<string
name=
"ask"
>
\?
</string>
<string
name=
"bottom_name_home"
>
首页
</string>
<string
name=
"bottom_name_square"
>
广场
</string>
<string
name=
"bottom_name_takephoto"
>
拍照
</string>
<string
name=
"bottom_name_task"
>
任务中心
</string>
<string
name=
"bottom_name_my"
>
个人中心
</string>
<string
name=
"app_sign"
>
5932d26a
</string>
<string
name=
"dot"
>
--
</string>
<string
name=
"str_logout"
>
退出登录
</string>
<string
name=
"str_hot_style"
>
热门特效
</string>
<string
name=
"str_agree_register"
>
注册协议
</string>
<string
name=
"str_agree_privacy"
>
隐私协议
</string>
<string
name=
"str_copyright"
>
Copyright © 2021 Inc..
</string>
<string
name=
"str_wx_login"
>
微信登录
</string>
<string
name=
"str_other_login"
>
其他登录方式
</string>
<string
name=
"str_immediately_login"
>
立即登录
</string>
<string
name=
"str_bind_mobile"
>
绑定手机号
</string>
<string
name=
"str_sms_code_1"
>
验证码:
</string>
<string
name=
"str_phone_num_1"
>
手机号:
</string>
<string
name=
"str_input_phone"
>
请输入手机号
</string>
<string
name=
"str_input_sms"
>
请输入验证码
</string>
<string
name=
"str_send_sms"
>
发送验证码
</string>
<string
name=
"str_login_tint"
>
你需要先用微信登录,在【个人中心】-【设置】中绑定手机号码,才能使用手机号登录
</string>
<string
name=
"str_invite_friend_get_bonus"
>
邀请好友 奖励现金
</string>
<string
name=
"str_invite_friend"
>
邀请亲友
</string>
<string
name=
"str_detail_1"
>
<![CDATA[详情 >]]>
</string>
<string
name=
"str_withdrawal"
>
提现
</string>
<string
name=
"str_coin_detail"
>
明细
</string>
<string
name=
"str_platform_bonus"
>
平台分红
</string>
<string
name=
"str_no_login"
>
未登录
</string>
<string
name=
"str_feedback"
>
请留下您的批评、表扬或者建议,我们会虚心听取, 认真改正。(请保持在5-150字内)
</string>
<string
name=
"str_submit"
>
提交
</string>
<string
name=
"str_immediately_use"
>
立即体验
</string>
<string
name=
"str_wechat"
>
微信
</string>
<string
name=
"str_jd_loan"
>
京东金融
</string>
<string
name=
"str_style_contrast"
>
效果对比
</string>
<string
name=
"str_plat_earning"
>
分红收益
</string>
<string
name=
"register_name"
>
用户注册协议
</string>
<string
name=
"privacy_name"
>
用户隐私协议
</string>
<string
name=
"strategy_name"
>
平台攻略
</string>
<string
name=
"str_cancel"
>
取消
</string>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment