Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
B
Browser White
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
Browser White
Commits
0f1ded04
Commit
0f1ded04
authored
Sep 04, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
1a49e244
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
3 deletions
+33
-3
NewsBean.kt
app/src/main/java/com/base/browserwhite/bean/NewsBean.kt
+2
-1
NewsAdapter.kt
...ava/com/base/browserwhite/ui/activity/news/NewsAdapter.kt
+6
-1
WebBrowserActivity.kt
...browserwhite/ui/activity/webbrowser/WebBrowserActivity.kt
+3
-1
DialogViews.kt
...c/main/java/com/base/browserwhite/ui/views/DialogViews.kt
+8
-0
item_news_ad.xml
app/src/main/res/layout/item_news_ad.xml
+14
-0
yijoin.png
app/src/main/res/mipmap-xxhdpi/yijoin.png
+0
-0
No files found.
app/src/main/java/com/base/browserwhite/bean/NewsBean.kt
View file @
0f1ded04
...
@@ -11,7 +11,8 @@ class NewsBean(
...
@@ -11,7 +11,8 @@ class NewsBean(
val
type
:
Int
=
0
,
val
type
:
Int
=
0
,
val
linkPath
:
String
=
""
,
//网站链接
val
linkPath
:
String
=
""
,
//网站链接
)
{
)
{
var
uiType
:
Int
=
0
var
uiType
:
Int
=
0
//0新闻 1广告
}
}
// 栏目类别 0:最新 , 101 :政治, 301:体育 ,娱乐:501 ,
// 栏目类别 0:最新 , 101 :政治, 301:体育 ,娱乐:501 ,
...
...
app/src/main/java/com/base/browserwhite/ui/activity/news/NewsAdapter.kt
View file @
0f1ded04
...
@@ -27,9 +27,14 @@ class NewsAdapter(
...
@@ -27,9 +27,14 @@ class NewsAdapter(
inner
class
NewsViewHolder
(
view
:
View
)
:
ViewHolder
(
view
)
inner
class
NewsViewHolder
(
view
:
View
)
:
ViewHolder
(
view
)
override
fun
getItemViewType
(
position
:
Int
,
list
:
List
<
NewsBean
>):
Int
{
return
list
[
position
].
uiType
}
override
fun
onCreateViewHolder
(
context
:
Context
,
parent
:
ViewGroup
,
viewType
:
Int
):
NewsViewHolder
{
override
fun
onCreateViewHolder
(
context
:
Context
,
parent
:
ViewGroup
,
viewType
:
Int
):
NewsViewHolder
{
return
NewsViewHolder
(
R
.
layout
.
item_news
.
inflate
(
parent
))
var
layout
=
R
.
layout
.
item_news
if
(
viewType
==
1
)
layout
=
R
.
layout
.
item_news_ad
return
NewsViewHolder
(
layout
.
inflate
(
parent
))
}
}
override
fun
onBindViewHolder
(
holder
:
NewsViewHolder
,
position
:
Int
,
item
:
NewsBean
?)
{
override
fun
onBindViewHolder
(
holder
:
NewsViewHolder
,
position
:
Int
,
item
:
NewsBean
?)
{
...
...
app/src/main/java/com/base/browserwhite/ui/activity/webbrowser/WebBrowserActivity.kt
View file @
0f1ded04
...
@@ -246,12 +246,14 @@ class WebBrowserActivity : BaseActivity<ActivityWebBrowserBinding>() {
...
@@ -246,12 +246,14 @@ class WebBrowserActivity : BaseActivity<ActivityWebBrowserBinding>() {
}
}
}
}
binding
.
ivMore
.
setOnClickListener
{
binding
.
ivMore
.
setOnClickListener
{
val
json
=
getAddedBookmarkJson
(
currentFragment
?.
bookmarkBean
?.
url
?:
""
)
showWebBrowserMoreDialog
(
showWebBrowserMoreDialog
(
bookmarkAdded
=
json
!=
null
,
bookmarkAction
=
{
bookmarkAction
=
{
startActivity
(
Intent
(
this
,
BookmarkActivity
::
class
.
java
))
startActivity
(
Intent
(
this
,
BookmarkActivity
::
class
.
java
))
},
},
joinAction
=
{
joinAction
=
{
val
json
=
getAddedBookmarkJson
(
currentFragment
?.
bookmarkBean
?.
url
?:
""
)
if
(
json
==
null
)
{
if
(
json
==
null
)
{
currentFragment
?.
bookmarkBean
?.
let
{
SpBeanUtils
.
addSpBean
(
BOOKMARK_SP_KEY
,
it
)
}
currentFragment
?.
bookmarkBean
?.
let
{
SpBeanUtils
.
addSpBean
(
BOOKMARK_SP_KEY
,
it
)
}
val
dialog
=
showAddRootBookmarkDialog
{
val
dialog
=
showAddRootBookmarkDialog
{
...
...
app/src/main/java/com/base/browserwhite/ui/views/DialogViews.kt
View file @
0f1ded04
package
com.base.browserwhite.ui.views
package
com.base.browserwhite.ui.views
import
android.annotation.SuppressLint
import
android.app.AlertDialog
import
android.app.AlertDialog
import
android.content.Context
import
android.content.Context
import
android.content.Intent
import
android.content.Intent
...
@@ -328,7 +329,9 @@ object DialogViews {
...
@@ -328,7 +329,9 @@ object DialogViews {
}
}
@SuppressLint
(
"SetTextI18n"
)
fun
Context
.
showWebBrowserMoreDialog
(
fun
Context
.
showWebBrowserMoreDialog
(
bookmarkAdded
:
Boolean
=
false
,
bookmarkAction
:
(()
->
Unit
)?
=
null
,
//打开书签
bookmarkAction
:
(()
->
Unit
)?
=
null
,
//打开书签
joinAction
:
(()
->
Unit
)?
=
null
//加入书签
joinAction
:
(()
->
Unit
)?
=
null
//加入书签
)
{
)
{
...
@@ -346,6 +349,11 @@ object DialogViews {
...
@@ -346,6 +349,11 @@ object DialogViews {
//展开
//展开
behavior
.
state
=
BottomSheetBehavior
.
STATE_EXPANDED
behavior
.
state
=
BottomSheetBehavior
.
STATE_EXPANDED
if
(
bookmarkAdded
)
{
binding
.
ivJoinBookmark
.
setImageResource
(
R
.
mipmap
.
yijoin
)
binding
.
tvJoinBookmark
.
text
=
"Added to\nBookmarks"
}
binding
.
tvCancel
.
setOnClickListener
{
binding
.
tvCancel
.
setOnClickListener
{
dialog
.
dismiss
()
dialog
.
dismiss
()
}
}
...
...
app/src/main/res/layout/item_news_ad.xml
0 → 100644
View file @
0f1ded04
<?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=
"wrap_content"
android:layout_marginHorizontal=
"16dp"
android:layout_marginVertical=
"8dp"
android:orientation=
"vertical"
>
<include
layout=
"@layout/layout_admob_native_download"
/>
</FrameLayout>
\ No newline at end of file
app/src/main/res/mipmap-xxhdpi/yijoin.png
0 → 100644
View file @
0f1ded04
3.83 KB
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