mirror of https://github.com/FongMi/TV.git
parent
c6f40e2536
commit
84576bb23f
@ -0,0 +1,34 @@ |
||||
package com.fongmi.android.tv.ui.activity; |
||||
|
||||
import android.os.Bundle; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.annotation.Nullable; |
||||
import androidx.fragment.app.Fragment; |
||||
import androidx.viewbinding.ViewBinding; |
||||
|
||||
public abstract class BaseFragment extends Fragment { |
||||
|
||||
protected abstract ViewBinding getBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup container); |
||||
|
||||
@Nullable |
||||
@Override |
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
||||
return getBinding(inflater, container).getRoot(); |
||||
} |
||||
|
||||
@Override |
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
||||
initView(); |
||||
initEvent(); |
||||
} |
||||
|
||||
protected void initView() { |
||||
} |
||||
|
||||
protected void initEvent() { |
||||
} |
||||
} |
||||
@ -0,0 +1,43 @@ |
||||
package com.fongmi.android.tv.ui.activity; |
||||
|
||||
import android.app.Activity; |
||||
import android.content.Intent; |
||||
|
||||
import androidx.navigation.fragment.NavHostFragment; |
||||
import androidx.navigation.ui.NavigationUI; |
||||
import androidx.viewbinding.ViewBinding; |
||||
|
||||
import com.fongmi.android.tv.R; |
||||
import com.fongmi.android.tv.databinding.ActivityMainBinding; |
||||
|
||||
public class MainActivity extends BaseActivity { |
||||
|
||||
private ActivityMainBinding mBinding; |
||||
|
||||
public static void start(Activity activity) { |
||||
activity.startActivity(new Intent(activity, MainActivity.class)); |
||||
activity.finish(); |
||||
} |
||||
|
||||
@Override |
||||
protected ViewBinding getBinding() { |
||||
return mBinding = ActivityMainBinding.inflate(getLayoutInflater()); |
||||
} |
||||
|
||||
@Override |
||||
protected void initView() { |
||||
|
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected void initEvent() { |
||||
} |
||||
|
||||
@Override |
||||
protected void onStart() { |
||||
super.onStart(); |
||||
NavHostFragment fragment = (NavHostFragment) getSupportFragmentManager().findFragmentById(R.id.container); |
||||
NavigationUI.setupWithNavController(mBinding.navigation, fragment.getNavController()); |
||||
} |
||||
} |
||||
@ -0,0 +1,21 @@ |
||||
package com.fongmi.android.tv.ui.fragment; |
||||
|
||||
import android.view.LayoutInflater; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.annotation.Nullable; |
||||
import androidx.viewbinding.ViewBinding; |
||||
|
||||
import com.fongmi.android.tv.databinding.FragmentHomeBinding; |
||||
import com.fongmi.android.tv.ui.activity.BaseFragment; |
||||
|
||||
public class HomeFragment extends BaseFragment { |
||||
|
||||
private FragmentHomeBinding mBinding; |
||||
|
||||
@Override |
||||
protected ViewBinding getBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup container) { |
||||
return mBinding = FragmentHomeBinding.inflate(inflater, container, false); |
||||
} |
||||
} |
||||
@ -0,0 +1,21 @@ |
||||
package com.fongmi.android.tv.ui.fragment; |
||||
|
||||
import android.view.LayoutInflater; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.annotation.Nullable; |
||||
import androidx.viewbinding.ViewBinding; |
||||
|
||||
import com.fongmi.android.tv.databinding.FragmentSettingBinding; |
||||
import com.fongmi.android.tv.ui.activity.BaseFragment; |
||||
|
||||
public class SettingFragment extends BaseFragment { |
||||
|
||||
private FragmentSettingBinding mBinding; |
||||
|
||||
@Override |
||||
protected ViewBinding getBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup container) { |
||||
return mBinding = FragmentSettingBinding.inflate(inflater, container, false); |
||||
} |
||||
} |
||||
@ -0,0 +1,21 @@ |
||||
package com.fongmi.android.tv.ui.fragment; |
||||
|
||||
import android.view.LayoutInflater; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.annotation.Nullable; |
||||
import androidx.viewbinding.ViewBinding; |
||||
|
||||
import com.fongmi.android.tv.databinding.FragmentVodBinding; |
||||
import com.fongmi.android.tv.ui.activity.BaseFragment; |
||||
|
||||
public class VodFragment extends BaseFragment { |
||||
|
||||
private FragmentVodBinding mBinding; |
||||
|
||||
@Override |
||||
protected ViewBinding getBinding(@NonNull LayoutInflater inflater, @Nullable ViewGroup container) { |
||||
return mBinding = FragmentVodBinding.inflate(inflater, container, false); |
||||
} |
||||
} |
||||
@ -0,0 +1,10 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="48dp" |
||||
android:height="48dp" |
||||
android:tint="?attr/colorControlNormal" |
||||
android:viewportWidth="48" |
||||
android:viewportHeight="48"> |
||||
<path |
||||
android:fillColor="@android:color/white" |
||||
android:pathData="M11,39H18.5V26.5H29.5V39H37V19.5L24,9.75L11,19.5ZM11,42Q9.75,42 8.875,41.125Q8,40.25 8,39V19.5Q8,18.8 8.325,18.15Q8.65,17.5 9.2,17.1L22.2,7.35Q22.6,7.05 23.05,6.9Q23.5,6.75 24,6.75Q24.5,6.75 24.95,6.9Q25.4,7.05 25.8,7.35L38.8,17.1Q39.35,17.5 39.675,18.15Q40,18.8 40,19.5V39Q40,40.25 39.125,41.125Q38.25,42 37,42H26.5V29.5H21.5V42ZM24,24.35Z" /> |
||||
</vector> |
||||
@ -0,0 +1,10 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="48dp" |
||||
android:height="48dp" |
||||
android:tint="?attr/colorControlNormal" |
||||
android:viewportWidth="48" |
||||
android:viewportHeight="48"> |
||||
<path |
||||
android:fillColor="@android:color/white" |
||||
android:pathData="M27.3,44H20.7Q20.15,44 19.725,43.65Q19.3,43.3 19.2,42.75L18.4,37.7Q17.45,37.35 16.4,36.75Q15.35,36.15 14.55,35.5L9.9,37.65Q9.35,37.9 8.8,37.725Q8.25,37.55 7.95,37L4.65,31.15Q4.35,30.65 4.5,30.1Q4.65,29.55 5.1,29.2L9.4,26.05Q9.3,25.6 9.275,25.025Q9.25,24.45 9.25,24Q9.25,23.55 9.275,22.975Q9.3,22.4 9.4,21.95L5.1,18.8Q4.65,18.45 4.5,17.9Q4.35,17.35 4.65,16.85L7.95,11Q8.25,10.45 8.8,10.275Q9.35,10.1 9.9,10.35L14.55,12.5Q15.35,11.85 16.4,11.25Q17.45,10.65 18.4,10.35L19.2,5.25Q19.3,4.7 19.725,4.35Q20.15,4 20.7,4H27.3Q27.85,4 28.275,4.35Q28.7,4.7 28.8,5.25L29.6,10.3Q30.55,10.65 31.625,11.225Q32.7,11.8 33.45,12.5L38.1,10.35Q38.65,10.1 39.2,10.275Q39.75,10.45 40.05,11L43.35,16.8Q43.65,17.3 43.525,17.875Q43.4,18.45 42.9,18.8L38.6,21.85Q38.7,22.35 38.725,22.925Q38.75,23.5 38.75,24Q38.75,24.5 38.725,25.05Q38.7,25.6 38.6,26.1L42.9,29.2Q43.35,29.55 43.5,30.1Q43.65,30.65 43.35,31.15L40.05,37Q39.75,37.55 39.2,37.725Q38.65,37.9 38.1,37.65L33.45,35.5Q32.65,36.15 31.625,36.775Q30.6,37.4 29.6,37.7L28.8,42.75Q28.7,43.3 28.275,43.65Q27.85,44 27.3,44ZM24,30.5Q26.7,30.5 28.6,28.6Q30.5,26.7 30.5,24Q30.5,21.3 28.6,19.4Q26.7,17.5 24,17.5Q21.3,17.5 19.4,19.4Q17.5,21.3 17.5,24Q17.5,26.7 19.4,28.6Q21.3,30.5 24,30.5ZM24,27.5Q22.55,27.5 21.525,26.475Q20.5,25.45 20.5,24Q20.5,22.55 21.525,21.525Q22.55,20.5 24,20.5Q25.45,20.5 26.475,21.525Q27.5,22.55 27.5,24Q27.5,25.45 26.475,26.475Q25.45,27.5 24,27.5ZM24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24Q24,24 24,24ZM21.8,41H26.2L26.9,35.4Q28.55,35 30.025,34.15Q31.5,33.3 32.7,32.1L38,34.4L40,30.8L35.3,27.35Q35.5,26.5 35.625,25.675Q35.75,24.85 35.75,24Q35.75,23.15 35.65,22.325Q35.55,21.5 35.3,20.65L40,17.2L38,13.6L32.7,15.9Q31.55,14.6 30.1,13.725Q28.65,12.85 26.9,12.6L26.2,7H21.8L21.1,12.6Q19.4,12.95 17.925,13.8Q16.45,14.65 15.3,15.9L10,13.6L8,17.2L12.7,20.65Q12.5,21.5 12.375,22.325Q12.25,23.15 12.25,24Q12.25,24.85 12.375,25.675Q12.5,26.5 12.7,27.35L8,30.8L10,34.4L15.3,32.1Q16.5,33.3 17.975,34.15Q19.45,35 21.1,35.4Z" /> |
||||
</vector> |
||||
@ -0,0 +1,10 @@ |
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:width="48dp" |
||||
android:height="48dp" |
||||
android:tint="?attr/colorControlNormal" |
||||
android:viewportWidth="48" |
||||
android:viewportHeight="48"> |
||||
<path |
||||
android:fillColor="@android:color/white" |
||||
android:pathData="M7,8 L10.7,15.6H17.2L13.5,8H17.95L21.65,15.6H28.15L24.45,8H28.9L32.6,15.6H39.1L35.4,8H41Q42.2,8 43.1,8.9Q44,9.8 44,11V37Q44,38.2 43.1,39.1Q42.2,40 41,40H7Q5.8,40 4.9,39.1Q4,38.2 4,37V11Q4,9.8 4.9,8.9Q5.8,8 7,8ZM7,18.6V37Q7,37 7,37Q7,37 7,37H41Q41,37 41,37Q41,37 41,37V18.6ZM7,18.6V37Q7,37 7,37Q7,37 7,37Q7,37 7,37Q7,37 7,37Z" /> |
||||
</vector> |
||||
@ -0,0 +1,25 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<androidx.fragment.app.FragmentContainerView |
||||
android:id="@+id/container" |
||||
android:name="androidx.navigation.fragment.NavHostFragment" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_above="@+id/navigation" |
||||
app:defaultNavHost="true" |
||||
app:navGraph="@navigation/nav_main" /> |
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView |
||||
android:id="@+id/navigation" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_alignParentBottom="true" |
||||
android:background="@color/white_90" |
||||
app:menu="@menu/menu_nav" /> |
||||
|
||||
</RelativeLayout> |
||||
@ -0,0 +1,6 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
</FrameLayout> |
||||
@ -0,0 +1,6 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
</FrameLayout> |
||||
@ -0,0 +1,6 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
</FrameLayout> |
||||
@ -0,0 +1,19 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
|
||||
<item |
||||
android:id="@+id/home" |
||||
android:icon="@drawable/ic_home" |
||||
android:title="@string/main_home" /> |
||||
|
||||
<item |
||||
android:id="@+id/vod" |
||||
android:icon="@drawable/ic_vod" |
||||
android:title="@string/main_vod" /> |
||||
|
||||
<item |
||||
android:id="@+id/setting" |
||||
android:icon="@drawable/ic_setting" |
||||
android:title="@string/main_setting" /> |
||||
|
||||
</menu> |
||||
@ -0,0 +1,22 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
android:id="@+id/nav_main" |
||||
app:startDestination="@id/home"> |
||||
|
||||
<fragment |
||||
android:id="@+id/home" |
||||
android:name="com.fongmi.android.tv.ui.fragment.HomeFragment" |
||||
android:label="@string/main_home" /> |
||||
|
||||
<fragment |
||||
android:id="@+id/vod" |
||||
android:name="com.fongmi.android.tv.ui.fragment.VodFragment" |
||||
android:label="@string/main_vod" /> |
||||
|
||||
<fragment |
||||
android:id="@+id/setting" |
||||
android:name="com.fongmi.android.tv.ui.fragment.SettingFragment" |
||||
android:label="@string/main_setting" /> |
||||
|
||||
</navigation> |
||||
@ -0,0 +1,8 @@ |
||||
<resources> |
||||
|
||||
<!-- Main --> |
||||
<string name="main_home">首页</string> |
||||
<string name="main_vod">片库</string> |
||||
<string name="main_setting">设定</string> |
||||
|
||||
</resources> |
||||
@ -0,0 +1,8 @@ |
||||
<resources> |
||||
|
||||
<!-- Main --> |
||||
<string name="main_home">首頁</string> |
||||
<string name="main_vod">片庫</string> |
||||
<string name="main_setting">設定</string> |
||||
|
||||
</resources> |
||||
@ -0,0 +1,8 @@ |
||||
<resources> |
||||
|
||||
<!-- Main --> |
||||
<string name="main_home">Home</string> |
||||
<string name="main_vod">Vod</string> |
||||
<string name="main_setting">Setting</string> |
||||
|
||||
</resources> |
||||
@ -0,0 +1,22 @@ |
||||
<resources> |
||||
|
||||
<style name="AppTheme" parent="BaseTheme" /> |
||||
|
||||
<style name="BaseTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar"> |
||||
<item name="colorPrimary">@color/blue_500</item> |
||||
<item name="colorPrimaryDark">@color/blue_700</item> |
||||
<item name="colorAccent">@color/blue_500</item> |
||||
<item name="android:windowAnimationStyle">@null</item> |
||||
<item name="android:windowBackground">@drawable/wallpaper_1</item> |
||||
<item name="android:windowFullscreen">true</item> |
||||
<item name="android:windowTranslucentStatus">true</item> |
||||
<item name="android:windowTranslucentNavigation">true</item> |
||||
</style> |
||||
|
||||
<style name="SplashTheme" parent="Theme.SplashScreen"> |
||||
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher_foreground</item> |
||||
<item name="windowSplashScreenBackground">@drawable/wallpaper_1</item> |
||||
<item name="postSplashScreenTheme">@style/AppTheme</item> |
||||
</style> |
||||
|
||||
</resources> |
||||
Loading…
Reference in new issue