mirror of https://github.com/lizongying/my-tv.git
parent
fe92fa5853
commit
5aa08f51a1
Binary file not shown.
Binary file not shown.
@ -0,0 +1,53 @@ |
||||
package com.lizongying.mytv |
||||
|
||||
import android.os.Bundle |
||||
import android.view.LayoutInflater |
||||
import android.view.View |
||||
import android.view.ViewGroup |
||||
import androidx.core.view.marginLeft |
||||
import androidx.core.view.marginTop |
||||
import androidx.fragment.app.Fragment |
||||
import com.lizongying.mytv.databinding.ErrorBinding |
||||
|
||||
class ErrorFragment : Fragment() { |
||||
private var _binding: ErrorBinding? = null |
||||
private val binding get() = _binding!! |
||||
|
||||
override fun onCreateView( |
||||
inflater: LayoutInflater, container: ViewGroup?, |
||||
savedInstanceState: Bundle? |
||||
): View { |
||||
_binding = ErrorBinding.inflate(inflater, container, false) |
||||
|
||||
val application = requireActivity().applicationContext as MyTvApplication |
||||
|
||||
binding.logo.layoutParams.width = application.px2Px(binding.logo.layoutParams.width) |
||||
binding.logo.layoutParams.height = application.px2Px(binding.logo.layoutParams.height) |
||||
|
||||
val layoutParamsMain = binding.main.layoutParams as ViewGroup.MarginLayoutParams |
||||
layoutParamsMain.leftMargin = application.px2Px(binding.main.marginLeft) |
||||
binding.main.layoutParams = layoutParamsMain |
||||
|
||||
val layoutParams = binding.msg.layoutParams as ViewGroup.MarginLayoutParams |
||||
layoutParams.topMargin = application.px2Px(binding.msg.marginTop) |
||||
binding.msg.layoutParams = layoutParams |
||||
|
||||
binding.msg.textSize = application.px2PxFont(binding.msg.textSize) |
||||
|
||||
(activity as MainActivity).fragmentReady(TAG) |
||||
return binding.root |
||||
} |
||||
|
||||
fun show(msg: String) { |
||||
binding.msg.text = msg |
||||
} |
||||
|
||||
override fun onDestroyView() { |
||||
super.onDestroyView() |
||||
_binding = null |
||||
} |
||||
|
||||
companion object { |
||||
private const val TAG = "ErrorFragment" |
||||
} |
||||
} |
||||
@ -1,4 +1,4 @@ |
||||
package com.lizongying.mytv |
||||
package com.lizongying.mytv.api |
||||
|
||||
import android.content.Context |
||||
|
||||
@ -0,0 +1,23 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" |
||||
android:viewportWidth="50" |
||||
android:viewportHeight="50" |
||||
android:width="62.5dp" |
||||
android:height="62.5dp"> |
||||
<group |
||||
android:scaleX="0.1" |
||||
android:scaleY="-0.1" |
||||
android:translateY="50"> |
||||
<path |
||||
android:pathData="M205 377c-27 -27 -40 -33 -65 -29 -30 4 -70 -19 -70 -40 0 -5 -16 -24 -35 -42 -38 -36 -44 -66 -23 -111 22 -49 51 -55 248 -55l182 0 29 29c46 46 37 106 -20 136 -20 10 -31 25 -35 49 -4 22 -20 46 -42 65 -29 26 -43 31 -85 31 -44 0 -55 -4 -84 -33zm138 2c29 -13 57 -58 57 -93 0 -17 5 -26 15 -26 24 0 65 -46 65 -71 0 -13 -10 -33 -22 -46 -21 -22 -26 -23 -205 -23 -182 0 -184 0 -208 25 -33 32 -32 70 3 105 16 15 36 40 45 54 18 27 54 35 74 15 8 -8 16 -2 29 19 9 17 27 35 38 41 28 13 80 13 109 0z" |
||||
android:fillColor="#FFEEEEEE" /> |
||||
<path |
||||
android:pathData="M174 269c-10 -17 13 -36 27 -22 12 12 4 33 -11 33 -5 0 -12 -5 -16 -11z" |
||||
android:fillColor="#FFEEEEEE" /> |
||||
<path |
||||
android:pathData="M294 269c-10 -17 13 -36 27 -22 12 12 4 33 -11 33 -5 0 -12 -5 -16 -11z" |
||||
android:fillColor="#FFEEEEEE" /> |
||||
<path |
||||
android:pathData="M194 196c-32 -14 -50 -33 -41 -42 3 -3 20 4 38 15 43 26 75 26 118 0 34 -20 49 -20 36 1 -10 16 -69 40 -97 40 -13 -1 -37 -7 -54 -14z" |
||||
android:fillColor="#FFEEEEEE" /> |
||||
</group> |
||||
</vector> |
||||
@ -0,0 +1,30 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:id="@+id/error" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" > |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/main" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_gravity="center_horizontal" |
||||
android:gravity="center_vertical|center_horizontal" |
||||
android:orientation="vertical" > |
||||
|
||||
<ImageView |
||||
android:id="@+id/logo" |
||||
android:src="@drawable/sad_cloud" |
||||
android:layout_width="50dp" |
||||
android:layout_height="50dp" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/msg" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="8dp" |
||||
android:textColor="#FFEEEEEE" |
||||
android:text="Message" |
||||
android:textSize="20sp" /> |
||||
</LinearLayout> |
||||
</FrameLayout> |
||||
@ -1,4 +0,0 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<resources> |
||||
<color name="ic_launcher_background">#223239</color> |
||||
</resources> |
||||
@ -1,25 +1,3 @@ |
||||
<resources> |
||||
|
||||
<style name="CustomImageCardViewStyle" parent="Widget.Leanback.ImageCardViewStyle"> |
||||
<item name="cardType">infoUnder</item> |
||||
<item name="infoVisibility">always</item> |
||||
<!-- In order to keep backward compatibility we have to create an icon on right. --> |
||||
<item name="lbImageCardViewType">Title|Content|IconOnRight</item> |
||||
<!-- Deprecated. Use 'Widget.Leanback.ImageCardView.InfoAreaStyle' instead. --> |
||||
<item name="infoAreaBackground">@null</item> |
||||
</style> |
||||
|
||||
<style name="CustomImageCardViewImageStyle" parent="Widget.Leanback.ImageCardView.ImageStyle"> |
||||
<item name="android:layout_width">150dp</item> |
||||
<item name="android:layout_height">40dp</item> |
||||
<item name="android:adjustViewBounds">true</item> |
||||
<item name="android:contentDescription">@null</item> |
||||
<item name="android:scaleType">centerInside</item> |
||||
<item name="layout_viewType">main</item> |
||||
</style> |
||||
|
||||
<style name="CustomImageCardTheme" parent="Theme.Leanback"> |
||||
<item name="imageCardViewStyle">@style/CustomImageCardViewStyle</item> |
||||
<item name="imageCardViewImageStyle">@style/CustomImageCardViewImageStyle</item> |
||||
</style> |
||||
</resources> |
||||
@ -1,8 +1,5 @@ |
||||
<resources> |
||||
|
||||
<style name="Theme.MyTV" parent="@style/Theme.Leanback"> |
||||
<item name="browsePaddingStart">11dp</item> |
||||
<item name="browsePaddingEnd">11dp</item> |
||||
<item name="browseRowsMarginTop">54dp</item> |
||||
</style> |
||||
</resources> |
||||
Loading…
Reference in new issue