diff --git a/app/build.gradle b/app/build.gradle
index 6259bb9b7..d5680749c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -51,6 +51,7 @@ android {
dependencies {
implementation project(':catvod')
implementation 'androidx.appcompat:appcompat:1.4.2'
+ implementation 'androidx.core:core-splashscreen:1.0.0'
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.room:room-runtime:2.4.3'
@@ -68,6 +69,8 @@ dependencies {
implementation 'org.nanohttpd:nanohttpd:2.3.1'
implementation('org.simpleframework:simple-xml:2.7.1') { exclude group: 'stax', module: 'stax-api' exclude group: 'xpp3', module: 'xpp3' }
leanbackImplementation 'androidx.leanback:leanback:1.2.0-alpha02'
+ mobileImplementation 'androidx.navigation:navigation-fragment:2.5.1'
+ mobileImplementation 'androidx.navigation:navigation-ui:2.5.1'
annotationProcessor 'androidx.room:room-compiler:2.4.3'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
}
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/leanback/res/values/styles.xml
similarity index 100%
rename from app/src/main/res/values/styles.xml
rename to app/src/leanback/res/values/styles.xml
diff --git a/app/src/main/java/com/fongmi/android/tv/ui/activity/BaseFragment.java b/app/src/main/java/com/fongmi/android/tv/ui/activity/BaseFragment.java
new file mode 100644
index 000000000..91b81bbe6
--- /dev/null
+++ b/app/src/main/java/com/fongmi/android/tv/ui/activity/BaseFragment.java
@@ -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() {
+ }
+}
diff --git a/app/src/main/res/layout/view_error.xml b/app/src/main/res/layout/view_error.xml
index eb2ea3371..565d4505a 100644
--- a/app/src/main/res/layout/view_error.xml
+++ b/app/src/main/res/layout/view_error.xml
@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:background="@drawable/shape_item_activated"
+ android:background="@color/black_50"
android:gravity="center"
android:orientation="vertical"
android:padding="@dimen/exo_styled_controls_padding">
diff --git a/app/src/mobile/AndroidManifest.xml b/app/src/mobile/AndroidManifest.xml
index d3bdfd2ef..e43f2e477 100644
--- a/app/src/mobile/AndroidManifest.xml
+++ b/app/src/mobile/AndroidManifest.xml
@@ -16,11 +16,18 @@
android:name=".ui.activity.SplashActivity"
android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"
android:exported="true"
- android:screenOrientation="fullSensor">
+ android:screenOrientation="fullSensor"
+ android:theme="@style/SplashTheme">
+
+
+
\ No newline at end of file
diff --git a/app/src/mobile/java/com/fongmi/android/tv/ui/activity/MainActivity.java b/app/src/mobile/java/com/fongmi/android/tv/ui/activity/MainActivity.java
new file mode 100644
index 000000000..f2ab75b51
--- /dev/null
+++ b/app/src/mobile/java/com/fongmi/android/tv/ui/activity/MainActivity.java
@@ -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());
+ }
+}
diff --git a/app/src/mobile/java/com/fongmi/android/tv/ui/activity/SplashActivity.java b/app/src/mobile/java/com/fongmi/android/tv/ui/activity/SplashActivity.java
index 3835bf3b3..ecd089b0f 100644
--- a/app/src/mobile/java/com/fongmi/android/tv/ui/activity/SplashActivity.java
+++ b/app/src/mobile/java/com/fongmi/android/tv/ui/activity/SplashActivity.java
@@ -3,13 +3,16 @@ package com.fongmi.android.tv.ui.activity;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.SuppressLint;
+import android.os.Bundle;
import android.view.View;
+import androidx.core.splashscreen.SplashScreen;
import androidx.viewbinding.ViewBinding;
-import com.fongmi.android.tv.ApiConfig;
+import com.fongmi.android.tv.api.ApiConfig;
import com.fongmi.android.tv.databinding.ActivitySplashBinding;
import com.fongmi.android.tv.net.Callback;
+import com.fongmi.android.tv.utils.Notify;
@SuppressLint("CustomSplashScreen")
public class SplashActivity extends BaseActivity {
@@ -21,6 +24,12 @@ public class SplashActivity extends BaseActivity {
return mBinding = ActivitySplashBinding.inflate(getLayoutInflater());
}
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ SplashScreen.installSplashScreen(this);
+ super.onCreate(savedInstanceState);
+ }
+
@Override
protected void initView() {
mBinding.title.animate().alpha(1).setDuration(2000).setListener(onAnimationEnd()).start();
@@ -41,12 +50,13 @@ public class SplashActivity extends BaseActivity {
ApiConfig.get().init().loadConfig(new Callback() {
@Override
public void success() {
-
+ MainActivity.start(getActivity());
}
@Override
public void error(int resId) {
-
+ MainActivity.start(getActivity());
+ Notify.show(resId);
}
});
}
diff --git a/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/HomeFragment.java b/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/HomeFragment.java
new file mode 100644
index 000000000..6af2937f8
--- /dev/null
+++ b/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/HomeFragment.java
@@ -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);
+ }
+}
diff --git a/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/SettingFragment.java b/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/SettingFragment.java
new file mode 100644
index 000000000..3e790765f
--- /dev/null
+++ b/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/SettingFragment.java
@@ -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);
+ }
+}
diff --git a/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/VodFragment.java b/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/VodFragment.java
new file mode 100644
index 000000000..18fbfe15e
--- /dev/null
+++ b/app/src/mobile/java/com/fongmi/android/tv/ui/fragment/VodFragment.java
@@ -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);
+ }
+}
diff --git a/app/src/mobile/res/drawable/ic_home.xml b/app/src/mobile/res/drawable/ic_home.xml
new file mode 100644
index 000000000..cc37b8746
--- /dev/null
+++ b/app/src/mobile/res/drawable/ic_home.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/mobile/res/drawable/ic_setting.xml b/app/src/mobile/res/drawable/ic_setting.xml
new file mode 100644
index 000000000..1fc14c7a8
--- /dev/null
+++ b/app/src/mobile/res/drawable/ic_setting.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/mobile/res/drawable/ic_vod.xml b/app/src/mobile/res/drawable/ic_vod.xml
new file mode 100644
index 000000000..6d443e599
--- /dev/null
+++ b/app/src/mobile/res/drawable/ic_vod.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/mobile/res/layout/activity_main.xml b/app/src/mobile/res/layout/activity_main.xml
new file mode 100644
index 000000000..4f7783a10
--- /dev/null
+++ b/app/src/mobile/res/layout/activity_main.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/mobile/res/layout/fragment_home.xml b/app/src/mobile/res/layout/fragment_home.xml
new file mode 100644
index 000000000..0f36c22be
--- /dev/null
+++ b/app/src/mobile/res/layout/fragment_home.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/mobile/res/layout/fragment_setting.xml b/app/src/mobile/res/layout/fragment_setting.xml
new file mode 100644
index 000000000..0f36c22be
--- /dev/null
+++ b/app/src/mobile/res/layout/fragment_setting.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/mobile/res/layout/fragment_vod.xml b/app/src/mobile/res/layout/fragment_vod.xml
new file mode 100644
index 000000000..0f36c22be
--- /dev/null
+++ b/app/src/mobile/res/layout/fragment_vod.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/mobile/res/menu/menu_nav.xml b/app/src/mobile/res/menu/menu_nav.xml
new file mode 100644
index 000000000..9392ad9af
--- /dev/null
+++ b/app/src/mobile/res/menu/menu_nav.xml
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/app/src/mobile/res/navigation/nav_main.xml b/app/src/mobile/res/navigation/nav_main.xml
new file mode 100644
index 000000000..e852df31d
--- /dev/null
+++ b/app/src/mobile/res/navigation/nav_main.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/mobile/res/values-zh-rCN/strings.xml b/app/src/mobile/res/values-zh-rCN/strings.xml
new file mode 100644
index 000000000..e1278033c
--- /dev/null
+++ b/app/src/mobile/res/values-zh-rCN/strings.xml
@@ -0,0 +1,8 @@
+
+
+
+ 首页
+ 片库
+ 设定
+
+
\ No newline at end of file
diff --git a/app/src/mobile/res/values-zh-rTW/strings.xml b/app/src/mobile/res/values-zh-rTW/strings.xml
new file mode 100644
index 000000000..464bad633
--- /dev/null
+++ b/app/src/mobile/res/values-zh-rTW/strings.xml
@@ -0,0 +1,8 @@
+
+
+
+ 首頁
+ 片庫
+ 設定
+
+
\ No newline at end of file
diff --git a/app/src/mobile/res/values/strings.xml b/app/src/mobile/res/values/strings.xml
new file mode 100644
index 000000000..5e7ee03e8
--- /dev/null
+++ b/app/src/mobile/res/values/strings.xml
@@ -0,0 +1,8 @@
+
+
+
+ Home
+ Vod
+ Setting
+
+
\ No newline at end of file
diff --git a/app/src/mobile/res/values/styles.xml b/app/src/mobile/res/values/styles.xml
new file mode 100644
index 000000000..3ac91d729
--- /dev/null
+++ b/app/src/mobile/res/values/styles.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+