Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
A
appzxhy
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
appzxhy
Commits
61e604e9
Commit
61e604e9
authored
Dec 19, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...首页
parent
6552196a
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
213 additions
and
13 deletions
+213
-13
build.gradle.kts
app/build.gradle.kts
+6
-4
google-services.json
app/google-services.json
+29
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+9
-0
MainActivity.kt
app/src/main/java/com/base/appzxhy/MainActivity.kt
+79
-0
HomeTabUIBean.kt
app/src/main/java/com/base/appzxhy/bean/HomeTabUIBean.kt
+6
-0
activity_main.xml
app/src/main/res/layout/activity_main.xml
+41
-9
item_home_tab.xml
app/src/main/res/layout/item_home_tab.xml
+27
-0
nav_graph.xml
app/src/main/res/navigation/nav_graph.xml
+6
-0
strings.xml
app/src/main/res/values/strings.xml
+2
-0
build.gradle.kts
build.gradle.kts
+3
-0
libs.versions.toml
gradle/libs.versions.toml
+5
-0
No files found.
app/build.gradle.kts
View file @
61e604e9
plugins
{
alias
(
libs
.
plugins
.
android
.
application
)
alias
(
libs
.
plugins
.
kotlin
.
android
)
id
(
"com.google.gms.google-services"
)
id
(
"com.google.firebase.crashlytics"
)
}
android
{
...
...
@@ -45,6 +47,8 @@ dependencies {
implementation
(
libs
.
material
)
implementation
(
libs
.
androidx
.
activity
)
implementation
(
libs
.
androidx
.
constraintlayout
)
implementation
(
libs
.
androidx
.
navigation
.
fragment
.
ktx
)
implementation
(
libs
.
androidx
.
navigation
.
ui
.
ktx
)
testImplementation
(
libs
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
espresso
.
core
)
...
...
@@ -52,11 +56,9 @@ dependencies {
// 语种切换框架:https://github.com/getActivity/MultiLanguages
implementation
(
"com.github.getActivity:MultiLanguages:9.3"
)
// 沉浸式状态栏,基础依赖包,必须要依赖
api
(
libs
.
immersionbar
)
api
(
libs
.
immersionbar
)
// 沉浸式状态栏kotlin扩展(可选)
api
(
libs
.
immersionbar
.
ktx
)
api
(
libs
.
immersionbar
.
ktx
)
//solar 归因
...
...
app/google-services.json
0 → 100644
View file @
61e604e9
{
"project_info"
:
{
"project_number"
:
"755421476297"
,
"project_id"
:
"comtooladvancedcleaner"
,
"storage_bucket"
:
"comtooladvancedcleaner.firebasestorage.app"
},
"client"
:
[
{
"client_info"
:
{
"mobilesdk_app_id"
:
"1:755421476297:android:c66d8129d83b17e8af6418"
,
"android_client_info"
:
{
"package_name"
:
"com.base.appzxhy"
}
},
"oauth_client"
:
[],
"api_key"
:
[
{
"current_key"
:
"AIzaSyAhCB4trMZPymkWCNl_m-bFGPpASG6bsQI"
}
],
"services"
:
{
"appinvite_service"
:
{
"other_platform_oauth_client"
:
[]
}
}
}
],
"configuration_version"
:
"1"
}
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
61e604e9
...
...
@@ -22,6 +22,15 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<meta-data
android:name=
"com.google.android.gms.ads.APPLICATION_ID"
android:value=
"ca-app-pub-3940256099942544~3347511713"
/>
<meta-data
android:name=
"com.facebook.sdk.ApplicationId"
android:value=
"@string/facebook_app_id"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/com/base/appzxhy/MainActivity.kt
View file @
61e604e9
package
com.base.appzxhy
import
android.graphics.Color
import
android.view.LayoutInflater
import
android.widget.TextView
import
androidx.navigation.NavController
import
androidx.navigation.fragment.NavHostFragment
import
com.base.appzxhy.base.BaseActivity
import
com.base.appzxhy.bean.HomeTabUIBean
import
com.base.appzxhy.databinding.ActivityMainBinding
import
com.base.appzxhy.databinding.ItemHomeTabBinding
import
com.base.appzxhy.utils.LogEx
import
com.google.android.material.tabs.TabLayout
import
com.google.android.material.tabs.TabLayout.OnTabSelectedListener
class
MainActivity
:
BaseActivity
<
ActivityMainBinding
>(
ActivityMainBinding
::
inflate
)
{
private
lateinit
var
navController
:
NavController
private
val
homeTabs
by
lazy
{
arrayOf
(
HomeTabUIBean
(
R
.
mipmap
.
ic_launcher
,
getString
(
R
.
string
.
home
)),
)
}
override
fun
initView
()
{
super
.
initView
()
navController
=
(
supportFragmentManager
.
findFragmentById
(
R
.
id
.
fragment_container
)
as
NavHostFragment
).
navController
}
private
fun
initTab
()
{
homeTabs
.
forEachIndexed
{
index
,
homeTab
->
val
tab
=
binding
.
tabLayout
.
newTab
()
val
view
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
item_home_tab
,
null
)
val
tabBinding
=
ItemHomeTabBinding
.
bind
(
view
)
tabBinding
.
ivIcon
.
setImageResource
(
homeTab
.
icon
)
tabBinding
.
tvTab
.
text
=
homeTab
.
tab
// tabBinding.tvTab.setTextColor(ContextCompat.getColor(this, R.color.color_tab_home))
tab
.
customView
=
tabBinding
.
root
tab
.
id
=
index
binding
.
tabLayout
.
addTab
(
tab
)
}
binding
.
tabLayout
.
addOnTabSelectedListener
(
object
:
OnTabSelectedListener
{
override
fun
onTabSelected
(
tab
:
TabLayout
.
Tab
?)
{
tab
?.
setSelected
()
}
override
fun
onTabUnselected
(
tab
:
TabLayout
.
Tab
?)
{
tab
?.
setUnselected
()
}
override
fun
onTabReselected
(
tab
:
TabLayout
.
Tab
?)
{
}
})
val
defaultTab
=
binding
.
tabLayout
.
getTabAt
(
0
)
defaultTab
?.
select
()
defaultTab
?.
setSelected
()
}
private
fun
naviFragment
(
id
:
Int
)
{
when
(
id
)
{
0
->
{
}
1
->
{
}
2
->
{
}
}
}
fun
TabLayout
.
Tab
.
setUnselected
()
{
val
textView
=
customView
?.
findViewById
<
TextView
>(
R
.
id
.
tv_tab
)
LogEx
.
logDebug
(
TAG
,
"setUnselected ${textView?.text}"
)
textView
?.
setTextColor
(
Color
.
parseColor
(
"#838383"
))
}
fun
TabLayout
.
Tab
.
setSelected
()
{
val
textView
=
customView
?.
findViewById
<
TextView
>(
R
.
id
.
tv_tab
)
LogEx
.
logDebug
(
TAG
,
"setSelected ${textView?.text}"
)
textView
?.
setTextColor
(
Color
.
parseColor
(
"#FF0000"
))
naviFragment
(
this
.
id
)
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/bean/HomeTabUIBean.kt
0 → 100644
View file @
61e604e9
package
com.base.appzxhy.bean
data class
HomeTabUIBean
(
val
icon
:
Int
,
val
tab
:
String
)
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
61e604e9
...
...
@@ -4,16 +4,48 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/main"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".MainActivity"
>
android:layout_height=
"match_parent"
>
<TextView
android:layout_width=
"wrap_content"
<androidx.fragment.app.FragmentContainerView
android:id=
"@+id/fragment_container"
android:name=
"androidx.navigation.fragment.NavHostFragment"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
app:layout_constraintBottom_toTopOf=
"@id/fl_tab"
app:layout_constraintTop_toTopOf=
"parent"
app:navGraph=
"@navigation/nav_graph"
/>
<FrameLayout
android:id=
"@+id/fl_tab"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"Hello World!"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
android:layout_marginBottom=
"60dp"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<com.google.android.material.tabs.TabLayout
android:id=
"@+id/tab_layout"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
app:tabIndicatorHeight=
"0dp"
app:tabMaxWidth=
"200dp"
app:tabMinWidth=
"100dp"
app:tabMode=
"fixed"
app:tabRippleColor=
"@android:color/transparent"
tools:ignore=
"SpeakableTextPresentCheck"
/>
</FrameLayout>
<FrameLayout
android:id=
"@+id/fl_banner"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/item_home_tab.xml
0 → 100644
View file @
61e604e9
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
tools:ignore=
"UseCompoundDrawables"
>
<ImageView
android:id=
"@+id/iv_icon"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"12dp"
tools:ignore=
"ContentDescription"
tools:src=
"@mipmap/ic_launcher"
/>
<TextView
android:id=
"@+id/tv_tab"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"5dp"
android:textColor=
"#838383"
android:textSize=
"13sp"
/>
</LinearLayout>
\ No newline at end of file
app/src/main/res/navigation/nav_graph.xml
0 → 100644
View file @
61e604e9
<?xml version="1.0" encoding="utf-8"?>
<navigation
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/nav_graph"
>
</navigation>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
61e604e9
<resources>
<string
name=
"app_name"
>
LocalWeatherWhite
</string>
<string
name=
"facebook_app_id"
>
1324546913856392
</string>
<string
name=
"home"
>
Home
</string>
</resources>
\ No newline at end of file
build.gradle.kts
View file @
61e604e9
...
...
@@ -2,4 +2,7 @@
plugins
{
alias
(
libs
.
plugins
.
android
.
application
)
apply
false
alias
(
libs
.
plugins
.
kotlin
.
android
)
apply
false
id
(
"com.google.gms.google-services"
)
version
"4.4.1"
apply
false
id
(
"com.google.firebase.crashlytics"
)
version
"3.0.2"
apply
false
}
\ No newline at end of file
gradle/libs.versions.toml
View file @
61e604e9
...
...
@@ -9,6 +9,8 @@ appcompat = "1.6.1"
material
=
"1.10.0"
activity
=
"1.8.0"
constraintlayout
=
"2.1.4"
navigationFragmentKtx
=
"2.6.0"
navigationUiKtx
=
"2.6.0"
immersionbar
=
"3.2.2"
...
...
@@ -23,6 +25,9 @@ androidx-activity = { group = "androidx.activity", name = "activity", version.re
androidx-constraintlayout
=
{
group
=
"androidx.constraintlayout"
,
name
=
"constraintlayout"
,
version.ref
=
"constraintlayout"
}
immersionbar
=
{
module
=
"com.geyifeng.immersionbar:immersionbar"
,
version.ref
=
"immersionbar"
}
immersionbar-ktx
=
{
module
=
"com.geyifeng.immersionbar:immersionbar-ktx"
,
version.ref
=
"immersionbar"
}
androidx-navigation-fragment-ktx
=
{
group
=
"androidx.navigation"
,
name
=
"navigation-fragment-ktx"
,
version.ref
=
"navigationFragmentKtx"
}
androidx-navigation-ui-ktx
=
{
group
=
"androidx.navigation"
,
name
=
"navigation-ui-ktx"
,
version.ref
=
"navigationUiKtx"
}
[plugins]
android-application
=
{
id
=
"com.android.application"
,
version.ref
=
"agp"
}
...
...
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