-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
1 parent
42b072f
commit 1fd0951
Showing
6 changed files
with
140 additions
and
44 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
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,44 @@ | ||
package com.lizongying.mytv | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.DialogFragment | ||
import com.lizongying.mytv.databinding.DialogBinding | ||
|
||
|
||
class MyDialogFragment(private val versionName: String, private val channelReversal: Boolean) : | ||
DialogFragment() { | ||
|
||
private var _binding: DialogBinding? = null | ||
private val binding get() = _binding!! | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
_binding = DialogBinding.inflate(inflater, container, false) | ||
_binding?.version?.text = | ||
"当前版本: $versionName\n获取最新: https://github.com/lizongying/my-tv/releases/" | ||
|
||
val switchView = _binding?.switchView | ||
switchView?.isChecked = channelReversal | ||
switchView?.setOnCheckedChangeListener { _, isChecked -> | ||
(activity as MainActivity).saveChannelReversal(isChecked) | ||
} | ||
|
||
return binding.root | ||
} | ||
|
||
override fun onDestroyView() { | ||
super.onDestroyView() | ||
_binding = null | ||
} | ||
|
||
companion object { | ||
const val TAG = "MyDialogFragment" | ||
} | ||
} | ||
|
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,44 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:id="@+id/dialog" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
> | ||
<LinearLayout | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content"> | ||
<LinearLayout | ||
android:layout_width="300dp" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical" | ||
android:paddingTop="20dp" | ||
android:paddingLeft="7dp" | ||
android:paddingRight="7dp" | ||
android:background="#FF263238" | ||
> | ||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/app_name" | ||
android:textSize="16sp" /> | ||
<TextView | ||
android:id="@+id/version" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="10dp" | ||
android:layout_marginBottom="10dp" | ||
android:text="当前版本: $versionName\n获取最新: https://github.com/lizongying/my-tv/releases/" | ||
></TextView> | ||
<Switch | ||
android:id="@+id/switch_view" | ||
android:text="@string/title_channel_reversal" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" /> | ||
</LinearLayout> | ||
<ImageView | ||
android:layout_width="300dp" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/appreciate" | ||
android:background="@color/white" /> | ||
</LinearLayout> | ||
</FrameLayout> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<resources> | ||
<string name="app_name">我的电视</string> | ||
<string name="logo">logo</string> | ||
<string name="title_channel_reversal">频道反转</string> | ||
</resources> |
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