Commit 251c0733 authored by wanglei's avatar wanglei

...

parent 44e0def0
package com.base.browserwhite.ui.activity.about
import androidx.lifecycle.lifecycleScope
import android.annotation.SuppressLint
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import androidx.activity.addCallback
import androidx.core.view.updatePadding
import com.base.browserwhite.BuildConfig
import com.base.browserwhite.R
import com.base.browserwhite.databinding.ActivityAboutBinding
import com.base.browserwhite.help.ConfigHelper
import com.base.browserwhite.ui.activity.BaseActivity
import com.base.browserwhite.utils.BarUtils
class AboutActivity : BaseActivity<ActivityAboutBinding>() {
......@@ -10,9 +19,33 @@ class AboutActivity : BaseActivity<ActivityAboutBinding>() {
ActivityAboutBinding.inflate(layoutInflater)
}
@SuppressLint("SetTextI18n")
override fun initView() {
lifecycleScope
BarUtils.setStatusBarLightMode(this, true)
BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
// binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
binding.tvAppName.text = resources.getString(R.string.app_name)
binding.tvVersion.text = "v" + BuildConfig.VERSION_NAME
}
override fun initListener() {
super.initListener()
onBackPressedDispatcher.addCallback {
finishToMain()
}
binding.flFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
binding.tvPrivacy.setOnClickListener {
val intent = Intent(
Intent.ACTION_VIEW,
Uri.parse(ConfigHelper.privacyPolicy)
)
startActivity(intent)
}
}
}
\ No newline at end of file
package com.base.browserwhite.ui.activity.bookmark
import android.annotation.SuppressLint
import android.content.Intent
import androidx.core.view.isVisible
import com.base.browserwhite.bean.BookmarkBean
import com.base.browserwhite.databinding.FragmentBookmarkBinding
import com.base.browserwhite.ui.activity.webbrowser.WebBrowserActivity
import com.base.browserwhite.ui.fragment.BaseFragment
import com.base.browserwhite.ui.views.BookmarkDialog.showBookmarkMoreDialog
import com.base.browserwhite.ui.views.DialogViews.showDeleteTipDialog
import com.base.browserwhite.utils.SpBeanUtils
import com.google.gson.Gson
class BookmarkFragment : BaseFragment<FragmentBookmarkBinding>() {
override val binding: FragmentBookmarkBinding by lazy {
FragmentBookmarkBinding.inflate(layoutInflater)
}
lateinit var bookmarkAdapter: BookmarkAdapter
private val bookmarkList = arrayListOf<BookmarkBean>()
@SuppressLint("NotifyDataSetChanged")
override fun setView() {
bookmarkAdapter = BookmarkAdapter()
binding.rv.adapter = bookmarkAdapter
bookmarkAdapter.changeFolderAction = { folderId ->
val list = bookmarkList.filter { it.folderId == folderId }
binding.llEmpty.isVisible = list.isEmpty()
bookmarkAdapter.submitList(list)
}
bookmarkAdapter.moreAction = { view, bean ->
requireContext().showBookmarkMoreDialog(
view,
bean.isFolder,
//新开
openNewTab = {
startActivity(Intent(requireContext(), WebBrowserActivity::class.java).apply {
putExtra("url", bean.url)
})
},
//删除
deleteAction = {
if (bean.isFolder) {//书签目录
val desc = "Delete folder [${bean.name}] and the bookmarks in the folder?"
requireContext().showDeleteTipDialog(desc) {
//删除书签目录
SpBeanUtils.deleteSpBeanCondition(SpBeanUtils.BOOKMARK_SP_KEY, bean.id)
bookmarkList.remove(bean)
bookmarkAdapter.remove(bean)
//删除目录下书签
val subBeanList = bookmarkList.filter { it.folder == bean.name }
subBeanList.forEach { subBean ->
SpBeanUtils.deleteSpBeanCondition(SpBeanUtils.BOOKMARK_SP_KEY, subBean.id)
bookmarkList.remove(subBean)
//删除书签导航
SpBeanUtils.deleteSpBeanCondition(SpBeanUtils.BOOKMARK_NAV_SP_KEY, bean.id)
}
}
} else {//书签直接删除
SpBeanUtils.deleteSpBeanCondition(SpBeanUtils.BOOKMARK_SP_KEY, bean.id)
bookmarkList.remove(bean)
bookmarkAdapter.remove(bean)
//删除书签导航
SpBeanUtils.deleteSpBeanCondition(SpBeanUtils.BOOKMARK_NAV_SP_KEY, bean.id)
}
},
//编辑
editAction = {
BookmarkFolderEditActivity.editFolder = bean
val launcher = (requireActivity() as BookmarkActivity).launcher
launcher.launch(Intent(Intent(requireContext(), BookmarkFolderEditActivity::class.java)))
},
//添加导航
addNavAction = {
SpBeanUtils.addSpBean(SpBeanUtils.BOOKMARK_NAV_SP_KEY, bean)
},
//选择
selectAction = {
(requireActivity() as BookmarkActivity).selectUI()
}
)
}
initData()
}
private fun initData() {
bookmarkList.clear()
val list = SpBeanUtils.getSpBeanList(SpBeanUtils.BOOKMARK_SP_KEY)
val gson = Gson()
val items = list.map { gson.fromJson(it, BookmarkBean::class.java) }
bookmarkList.addAll(items)
bookmarkAdapter.currentFolderId = 0
bookmarkAdapter.submitList(bookmarkList.filter { it.folderId == bookmarkAdapter.currentFolderId })
binding.llEmpty.isVisible = items.isEmpty()
}
}
\ No newline at end of file
package com.base.browserwhite.ui.activity.bookmark
import com.base.browserwhite.bean.HistoryBean
import com.base.browserwhite.databinding.FragmentHistoryBinding
import com.base.browserwhite.ui.fragment.BaseFragment
import com.base.browserwhite.utils.KotlinExt.toFormatTime
import com.base.browserwhite.utils.SpBeanUtils
import com.google.gson.Gson
class HistoryFragment : BaseFragment<FragmentHistoryBinding>() {
private lateinit var historyAdapter: HistoryAdapter
private val historyList = arrayListOf<HistoryBean>()
override val binding: FragmentHistoryBinding by lazy {
FragmentHistoryBinding.inflate(layoutInflater)
}
override fun setView() {
historyAdapter = HistoryAdapter()
binding.rv.adapter = historyAdapter
initData()
}
private fun initData() {
historyList.clear()
val list = SpBeanUtils.getSpBeanList(SpBeanUtils.HISTORY_SP_KEY)
val gson = Gson()
val item = list.map { gson.fromJson(it, HistoryBean::class.java) }
val time = ""
item.sortedBy { it.time }.forEach {
if (time != it.time.toFormatTime()) {
it.showTime = true
}
historyList.add(it)
}
}
}
\ No newline at end of file
package com.base.browserwhite.ui.activity.feedback
import android.annotation.SuppressLint
import android.graphics.Color
import androidx.core.view.updatePadding
import androidx.core.widget.addTextChangedListener
import com.base.browserwhite.databinding.ActivityFeedbackBinding
import com.base.browserwhite.ui.activity.BaseActivity
import com.base.browserwhite.utils.BarUtils
......@@ -19,5 +21,23 @@ class FeedbackActivity : BaseActivity<ActivityFeedbackBinding>() {
BarUtils.setStatusBarColor(this, Color.WHITE)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
}
@SuppressLint("SetTextI18n")
override fun initListener() {
super.initListener()
binding.edit.addTextChangedListener {
binding.tvNumber.text = "${it?.toString()?.length ?: 0}/500"
binding.tvSubmit.isEnabled = !it.isNullOrEmpty()
}
binding.editEmail.addTextChangedListener {
binding.tvSubmit.isEnabled = !it.isNullOrEmpty()
}
binding.fl1.setOnClickListener {
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#0571ED" />
<corners android:radius="18dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bg_f3f4f6_18" android:state_enabled="false" />
<item android:drawable="@drawable/bg_0571ed_18" android:state_enabled="true" />
</selector>
\ No newline at end of file
......@@ -9,14 +9,15 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="385dp"
android:background="@mipmap/aboutbg"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start"
android:layout_marginVertical="10dp"
android:layout_gravity="start"
android:layout_marginVertical="45dp"
android:layout_marginStart="10dp">
<FrameLayout
......@@ -44,7 +45,55 @@
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="160dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@mipmap/alogo"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/tv_app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="35dp"
android:textColor="@color/black"
android:textSize="22sp"
tools:text="Al Browser&amp;Privacy" />
<TextView
android:id="@+id/tv_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:textColor="#666666"
android:textSize="15sp"
tools:text="v1.0.0" />
</LinearLayout>
</FrameLayout>
<TextView
android:id="@+id/tv_privacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:text="Privacy Policy"
android:textColor="#0571ed"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="HardcodedText" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -111,60 +111,31 @@
android:src="@mipmap/tianjia_bookmark"
android:textColor="#AEAEB0"
android:textSize="16sp"
android:visibility="gone"
tools:ignore="ContentDescription,HardcodedText" />
<ImageView
android:id="@+id/iv_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="20dp"
android:gravity="center"
android:src="@mipmap/h_del_history"
android:textColor="#AEAEB0"
android:textSize="16sp"
android:visibility="gone"
tools:ignore="ContentDescription,HardcodedText" />
</FrameLayout>
<SearchView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginHorizontal="15dp"
android:layout_marginTop="6dp"
android:background="@drawable/bg_eef1f6_15"
android:queryHint="Search" />
<FrameLayout
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginVertical="10dp"
android:layout_weight="1"
tools:ignore="UselessLeaf">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_bookmark" />
<LinearLayout
android:id="@+id/ll_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@mipmap/nobookmark"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:text="NO Bookmark"
android:textColor="#828282"
tools:ignore="HardcodedText" />
</LinearLayout>
</FrameLayout>
android:layout_weight="1" />
<FrameLayout
android:id="@+id/fl_operation"
......
......@@ -48,12 +48,12 @@
</LinearLayout>
<TextView
android:id="@+id/iv_delete"
android:id="@+id/tv_submit"
android:layout_width="90dp"
android:layout_height="35dp"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="16dp"
android:background="@drawable/bg_f3f4f6_18"
android:background="@drawable/bg_border_selector_save"
android:enabled="false"
android:gravity="center"
android:src="@drawable/bg_delete_download"
......@@ -89,10 +89,12 @@
android:background="@null"
android:gravity="top"
android:hint="Write down your question"
android:maxLength="500"
tools:ignore="Autofill,HardcodedText,TextFields" />
<TextView
android:id="@+id/tv_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
......@@ -156,6 +158,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -163,6 +171,7 @@
android:src="@mipmap/taijian_feedback"
tools:ignore="ContentDescription" />
</FrameLayout>
<FrameLayout
......@@ -176,6 +185,12 @@
app:layout_constraintStart_toEndOf="@+id/fl_1"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -196,6 +211,12 @@
app:layout_constraintStart_toEndOf="@id/fl_2"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="ContentDescription" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -35,7 +35,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:layout_marginEnd="16dp"
android:src="@mipmap/w_guanbi"
android:src="@mipmap/s_guanbi_sqrc"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
......
......@@ -342,7 +342,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_feedback"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:visibility="gone">
<FrameLayout
android:id="@+id/fl_feedback"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ui.activity.bookmark.BookmarkFragment">
<SearchView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginHorizontal="15dp"
android:layout_marginTop="6dp"
android:background="@drawable/bg_eef1f6_15"
android:queryHint="Search" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginVertical="10dp"
android:layout_weight="1"
tools:ignore="UselessLeaf">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_bookmark" />
<LinearLayout
android:id="@+id/ll_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:visibility="gone"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@mipmap/nobookmark"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="16dp"
android:text="NO Bookmark"
android:textColor="#828282"
tools:ignore="HardcodedText" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.activity.bookmark.HistoryFragment">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_bookmark_history" />
</FrameLayout>
\ No newline at end of file
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