Commit 5505d89c authored by wanglei's avatar wanglei

init

parent 29941ea8
...@@ -47,6 +47,10 @@ dependencies { ...@@ -47,6 +47,10 @@ dependencies {
androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core) androidTestImplementation(libs.androidx.espresso.core)
//第三方UI
implementation("io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.4")
implementation("io.github.youth5201314:banner:2.2.3")
//google地图 //google地图
implementation(libs.play.services.maps) implementation(libs.play.services.maps)
} }
\ No newline at end of file
...@@ -13,15 +13,7 @@ ...@@ -13,15 +13,7 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.LocationShareWhite" android:theme="@style/Theme.LocationShareWhite"
tools:targetApi="34"> tools:targetApi="34">
<activity
android:name=".ui.main.LocationShareActivity"
android:exported="false" />
<activity
android:name=".ui.main.LocationCodeActivity"
android:exported="false" />
<activity
android:name=".ui.locationmap.LocationMapActivity"
android:exported="false" />
<meta-data <meta-data
android:name="com.google.android.geo.API_KEY" android:name="com.google.android.geo.API_KEY"
...@@ -38,8 +30,41 @@ ...@@ -38,8 +30,41 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity"
android:name=".ui.main.MainActivity" android:name=".ui.main.MainActivity"
android:exported="false" /> android:exported="false" />
<activity
android:name=".ui.howuse.HowUseActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.main.LocationShareActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.main.LocationCodeActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.locationmap.LocationMapActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.howuse.HowUseShareActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
</application> </application>
</manifest> </manifest>
\ No newline at end of file
package com.base.locationsharewhite.bean
data class BannerBean(
val image: Int
) {
}
\ No newline at end of file
...@@ -12,4 +12,14 @@ object ConstObject { ...@@ -12,4 +12,14 @@ object ConstObject {
field = value field = value
AppPreferences.getInstance().put("ifAgreePrivacy", value, true) AppPreferences.getInstance().put("ifAgreePrivacy", value, true)
} }
var myLocationCode = ""
get() {
return AppPreferences.getInstance().getString("myLocationCode", field)
}
set(value) {
field = value
AppPreferences.getInstance().put("myLocationCode", value, true)
}
} }
\ No newline at end of file
package com.base.locationsharewhite.ui.howuse
import android.content.Intent
import android.graphics.Color
import androidx.activity.addCallback
import androidx.core.view.updatePadding
import com.base.locationsharewhite.databinding.ActivityHowUseBinding
import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.utils.BarUtils
class HowUseActivity : BaseActivity<ActivityHowUseBinding>() {
override val binding: ActivityHowUseBinding by lazy {
ActivityHowUseBinding.inflate(layoutInflater)
}
override fun initView() {
BarUtils.setStatusBarLightMode(this, true)
BarUtils.setStatusBarColor(this, Color.WHITE)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
}
override fun initListener() {
super.initListener()
onBackPressedDispatcher.addCallback {
finishToMain()
}
binding.flFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
binding.flShareLocation.setOnClickListener {
startActivity(Intent(this, HowUseShareActivity::class.java))
}
}
}
\ No newline at end of file
package com.base.locationsharewhite.ui.howuse
import android.graphics.Color
import androidx.core.view.updatePadding
import androidx.viewpager2.widget.MarginPageTransformer
import com.base.locationsharewhite.R
import com.base.locationsharewhite.bean.BannerBean
import com.base.locationsharewhite.databinding.ActivityHowUseShareBinding
import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.utils.BarUtils
import com.youth.banner.util.BannerUtils
class HowUseShareActivity : BaseActivity<ActivityHowUseShareBinding>() {
override val binding: ActivityHowUseShareBinding by lazy {
ActivityHowUseShareBinding.inflate(layoutInflater)
}
private lateinit var adapter: ImageBannerAdapter
override fun initView() {
BarUtils.setStatusBarLightMode(this, true)
BarUtils.setStatusBarColor(this, Color.WHITE)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
initBanner()
}
private fun initBanner() {
adapter = ImageBannerAdapter(
listOf(
BannerBean(R.mipmap.how_share_tu1),
BannerBean(R.mipmap.how_share_tu2)
)
)
binding.banner.setAdapter(adapter)
binding.banner.isAutoLoop(false)
binding.banner.addBannerLifecycleObserver(this)
binding.banner.setIndicator(binding.indicator, false)
binding.banner.setPageTransformer(MarginPageTransformer(BannerUtils.dp2px(10f)))
binding.indicator.indicatorConfig.height = resources.getDimensionPixelSize(R.dimen.dp_5)
binding.indicator.indicatorConfig.selectedWidth = resources.getDimensionPixelSize(R.dimen.dp_25)
binding.indicator.indicatorConfig.normalWidth = resources.getDimensionPixelSize(R.dimen.dp_5)
}
fun step1ui() {
binding.tvStep.text = resources.getString(R.string.how_share_location_step_1)
binding.banner
}
fun step2ui() {
binding.tvStep.text = resources.getString(R.string.how_share_location_step_2)
}
}
\ No newline at end of file
package com.base.locationsharewhite.ui.howuse
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.base.locationsharewhite.R
import com.base.locationsharewhite.bean.BannerBean
import com.base.locationsharewhite.databinding.ItemBannerImageBinding
import com.base.locationsharewhite.ui.views.XmlEx.inflate
import com.youth.banner.adapter.BannerAdapter
class ImageBannerAdapter(dataList: List<BannerBean>) : BannerAdapter<BannerBean, ImageBannerAdapter.BannerViewHolder>(dataList) {
inner class BannerViewHolder(view: View) : RecyclerView.ViewHolder(view) {
}
override fun onCreateHolder(parent: ViewGroup, viewType: Int): BannerViewHolder {
return BannerViewHolder(R.layout.item_banner_image.inflate(parent))
}
override fun onBindView(holder: BannerViewHolder, data: BannerBean?, position: Int, size: Int) {
data ?: return
val binding = ItemBannerImageBinding.bind(holder.itemView)
binding.iv.setImageResource(data.image)
}
}
\ No newline at end of file
package com.base.locationsharewhite.ui.main package com.base.locationsharewhite.ui.main
import android.graphics.Color
import androidx.activity.addCallback import androidx.activity.addCallback
import androidx.core.view.updatePadding
import com.base.locationsharewhite.databinding.ActivityLocationShareBinding import com.base.locationsharewhite.databinding.ActivityLocationShareBinding
import com.base.locationsharewhite.helper.BaseActivity import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.utils.BarUtils
class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() { class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
...@@ -12,6 +15,15 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() { ...@@ -12,6 +15,15 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
override fun initView() { override fun initView() {
BarUtils.setStatusBarLightMode(this, true)
BarUtils.setStatusBarColor(this, Color.WHITE)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
}
override fun initListener() {
super.initListener()
onBackPressedDispatcher.addCallback { onBackPressedDispatcher.addCallback {
finishToMain() finishToMain()
} }
......
...@@ -5,6 +5,7 @@ import android.graphics.Color ...@@ -5,6 +5,7 @@ import android.graphics.Color
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import com.base.locationsharewhite.databinding.ActivityMainBinding import com.base.locationsharewhite.databinding.ActivityMainBinding
import com.base.locationsharewhite.helper.BaseActivity import com.base.locationsharewhite.helper.BaseActivity
import com.base.locationsharewhite.ui.howuse.HowUseActivity
import com.base.locationsharewhite.ui.locationmap.LocationMapActivity import com.base.locationsharewhite.ui.locationmap.LocationMapActivity
import com.base.locationsharewhite.utils.BarUtils import com.base.locationsharewhite.utils.BarUtils
...@@ -32,5 +33,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() { ...@@ -32,5 +33,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
binding.flShareMyLocation.setOnClickListener { binding.flShareMyLocation.setOnClickListener {
startActivity(Intent(this, LocationShareActivity::class.java)) startActivity(Intent(this, LocationShareActivity::class.java))
} }
binding.flHowUse.setOnClickListener {
startActivity(Intent(this, HowUseActivity::class.java))
}
} }
} }
\ No newline at end of file
package com.base.locationsharewhite.ui.views
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
object XmlEx {
fun Int.inflate(parent: ViewGroup, attachToRoot: Boolean = false): View {
return LayoutInflater.from(parent.context).inflate(this, parent, attachToRoot)
}
fun Int.inflate(context: Context, attachToRoot: Boolean = false): View {
return LayoutInflater.from(context).inflate(this, null, attachToRoot)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#3C93E2" />
<corners android:radius="2.5dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".ui.howuse.HowUseActivity">
<FrameLayout
android:id="@+id/fl_fanhui"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:padding="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/lv_fanhui"
tools:ignore="ContentDescription" />
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/how_to_use"
android:textColor="#001725"
android:textSize="22sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/fl_fanhui"
app:layout_constraintStart_toEndOf="@id/fl_fanhui"
app:layout_constraintTop_toTopOf="@id/fl_fanhui" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/fl_fanhui">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="66dp"
android:text="@string/what_do_you_want_to_do"
android:textColor="#001D29"
android:textSize="20sp" />
<FrameLayout
android:id="@+id/fl_share_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginTop="48dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="111dp"
android:layout_gravity="bottom"
android:background="@drawable/bg_3c93e2_10">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="24dp"
android:text="@string/share_my_nlocation"
android:textColor="@color/white"
android:textSize="22sp" />
</FrameLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="8dp"
android:layout_marginBottom="8dp"
android:src="@mipmap/share_how"
tools:ignore="ContentDescription" />
</FrameLayout>
<FrameLayout
android:id="@+id/fl_view_location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginTop="20dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="111dp"
android:layout_gravity="bottom"
android:background="@drawable/bg_03b988_10">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_marginStart="18dp"
android:layout_marginEnd="24dp"
android:text="@string/view_others_nlocation"
android:textColor="@color/white"
android:textSize="22sp" />
</FrameLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="8dp"
android:layout_marginBottom="8dp"
android:src="@mipmap/viewothers_how"
tools:ignore="ContentDescription" />
</FrameLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:banner="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".ui.howuse.HowUseShareActivity">
<FrameLayout
android:id="@+id/fl_fanhui"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:padding="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/lan_fanhui"
tools:ignore="ContentDescription" />
</FrameLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/how_to_use"
android:textColor="#001725"
android:textSize="22sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@id/fl_fanhui"
app:layout_constraintStart_toEndOf="@id/fl_fanhui"
app:layout_constraintTop_toTopOf="@id/fl_fanhui" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/fl_fanhui">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:text="@string/how_to_share_my_location"
android:textColor="#001D29"
android:textSize="20sp" />
<TextView
android:id="@+id/tv_step_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="14dp"
android:text="@string/just_2_steps"
android:textColor="#4D6068"
android:textSize="18sp" />
<TextView
android:id="@+id/tv_step"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="36dp"
android:gravity="center"
android:textColor="#7BB2E1"
tools:text="@string/how_share_location_step_2" />
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_margin="15dp"
app:banner_infinite_loop="false"
banner:banner_indicator_normal_color="#C5C5C5"
banner:banner_indicator_selected_color="#3C93E2"
banner:banner_radius="5dp" />
<com.youth.banner.indicator.RectangleIndicator
android:id="@+id/indicator"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_gravity="center_horizontal"
banner:banner_indicator_height="10dp"
banner:banner_indicator_radius="2.5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginHorizontal="18dp"
android:gravity="center"
android:text="@string/more_two_use"
android:textColor="#00101D"
android:textSize="13sp" />
<TextView
android:id="@+id/tv_btn"
android:layout_width="345dp"
android:layout_height="50dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:background="@drawable/bg_3c93e2_10"
android:gravity="center"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
tools:text="Next" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
android:id="@+id/main" android:id="@+id/main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"
tools:context=".ui.main.LocationCodeActivity"> tools:context=".ui.main.LocationCodeActivity">
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
android:id="@+id/main" android:id="@+id/main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"
tools:context=".ui.main.LocationCodeActivity"> tools:context=".ui.main.LocationCodeActivity">
...@@ -88,7 +89,7 @@ ...@@ -88,7 +89,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end" android:layout_gravity="end"
android:layout_margin="8dp" android:layout_margin="8dp"
android:src="@mipmap/weizhimaicon" android:src="@mipmap/fuzhi"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
</FrameLayout> </FrameLayout>
......
...@@ -174,6 +174,7 @@ ...@@ -174,6 +174,7 @@
app:layout_constraintTop_toBottomOf="@id/ll_2"> app:layout_constraintTop_toBottomOf="@id/ll_2">
<FrameLayout <FrameLayout
android:id="@+id/fl_how_use"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp" android:layout_marginHorizontal="8dp"
......
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/iv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
tools:ignore="ContentDescription">
</ImageView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="dp_375">375dp</dimen> <dimen name="dp_375">375dp</dimen>
<dimen name="dp_25">25dp</dimen>
<dimen name="dp_5">5dp</dimen>
<dimen name="dp_10">10dp</dimen>
</resources> </resources>
\ No newline at end of file
...@@ -19,4 +19,12 @@ ...@@ -19,4 +19,12 @@
<string name="location_code_share_tips">Ask your friend to send you the location code.\nThenpaste your friend\'s location code below and\nclick theshare button to share your location.\n</string> <string name="location_code_share_tips">Ask your friend to send you the location code.\nThenpaste your friend\'s location code below and\nclick theshare button to share your location.\n</string>
<string name="enter_others_location_code">Enter others\nlocation code</string> <string name="enter_others_location_code">Enter others\nlocation code</string>
<string name="share_my_location_da">SHARE MY LOCATION</string> <string name="share_my_location_da">SHARE MY LOCATION</string>
<string name="what_do_you_want_to_do">What do you want to do?</string>
<string name="share_my_nlocation">SHARE MY\nLOCATION</string>
<string name="view_others_nlocation">VIEW OTHERS\nLOCATION</string>
<string name="how_to_share_my_location">How to share my location?</string>
<string name="just_2_steps">Just 2 steps</string>
<string name="how_share_location_step_1">1. Ask Your Friend To Send You The Location Code.</string>
<string name="how_share_location_step_2">2. Then paste your friend\'s location code below and click the share button to share your location.</string>
<string name="more_two_use">Reminder: Two or more people need to download the ap simultaneously to use it</string>
</resources> </resources>
\ No newline at end of file
...@@ -16,6 +16,7 @@ dependencyResolutionManagement { ...@@ -16,6 +16,7 @@ dependencyResolutionManagement {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
maven(uri("https://s01.oss.sonatype.org/content/groups/public"))
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment