-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xieyy
committed
Sep 2, 2024
1 parent
7290a27
commit 365e24b
Showing
7 changed files
with
115 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 33 additions & 14 deletions
47
common_component/src/main/res/layout/dialog_common_edit.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,38 @@ | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<androidx.appcompat.widget.AppCompatEditText | ||
android:id="@+id/input_et" | ||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="48dp" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center_vertical" | ||
android:background="@drawable/background_dialog_edit" | ||
android:gravity="center_vertical" | ||
android:hint="" | ||
android:maxLines="1" | ||
android:paddingStart="20dp" | ||
android:paddingEnd="20dp" | ||
android:singleLine="true" | ||
android:textColor="@color/text_black" | ||
android:textColorHint="@color/text_gray" | ||
android:textSize="14sp" /> | ||
android:orientation="vertical"> | ||
|
||
<androidx.appcompat.widget.AppCompatEditText | ||
android:id="@+id/input_et" | ||
android:layout_width="match_parent" | ||
android:layout_height="48dp" | ||
android:background="@drawable/background_dialog_edit" | ||
android:gravity="center_vertical" | ||
android:hint="" | ||
android:maxLines="1" | ||
android:paddingStart="20dp" | ||
android:paddingEnd="20dp" | ||
android:singleLine="true" | ||
android:textColor="@color/text_black" | ||
android:textColorHint="@color/text_gray" | ||
android:textSize="14sp" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_input_tips" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="10dp" | ||
android:paddingStart="20dp" | ||
android:paddingEnd="20dp" | ||
android:textColor="@color/text_gray" | ||
android:textSize="12sp" | ||
tools:text="输入提示" /> | ||
|
||
</LinearLayout> | ||
|
||
</layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
local_component/src/main/java/com/xyoye/local_component/ui/weight/BiliBiliDanmuMenus.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.xyoye.local_component.ui.weight | ||
|
||
import android.view.Menu | ||
import android.view.MenuItem | ||
import com.xyoye.common_component.config.AppConfig | ||
import com.xyoye.common_component.weight.dialog.CommonEditDialog | ||
import com.xyoye.data_component.bean.EditBean | ||
import com.xyoye.local_component.R | ||
import com.xyoye.local_component.ui.activities.bilibili_danmu.BilibiliDanmuActivity | ||
|
||
/** | ||
* author: [email protected] | ||
* time : 2024/9/2 | ||
* desc : | ||
*/ | ||
class BiliBiliDanmuMenus private constructor( | ||
private val activity: BilibiliDanmuActivity | ||
) { | ||
|
||
companion object { | ||
fun inflater(activity: BilibiliDanmuActivity, menu: Menu): BiliBiliDanmuMenus { | ||
activity.menuInflater.inflate(R.menu.menu_bilibili_danmu, menu) | ||
return BiliBiliDanmuMenus(activity) | ||
} | ||
} | ||
|
||
fun onOptionsItemSelected(item: MenuItem) { | ||
if (item.itemId == R.id.item_modify_user_agent) { | ||
showModifyUserAgentDialog() | ||
return | ||
} | ||
} | ||
|
||
private fun showModifyUserAgentDialog() { | ||
CommonEditDialog( | ||
activity, | ||
EditBean( | ||
"修改User-Agent", | ||
"User-Agent不应为空", | ||
"请输入User-Agent", | ||
defaultText = AppConfig.getJsoupUserAgent(), | ||
inputTips = "使用【选取链接下载】时,会携带此User-Agent请求链接的网页内容" | ||
), | ||
) { | ||
AppConfig.putJsoupUserAgent(it) | ||
}.show() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
<item | ||
android:id="@+id/item_modify_user_agent" | ||
android:title="@string/action_modify_user_agent" | ||
app:showAsAction="never" /> | ||
</menu> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters