Update folder ui

pull/594/head
jhengazuki 3 months ago
parent 3522b9bc74
commit 848ac91347
  1. 22
      app/src/mobile/java/com/fongmi/android/tv/ui/activity/FolderActivity.java
  2. 1
      app/src/mobile/java/com/fongmi/android/tv/ui/custom/FragmentStateManager.java
  3. 31
      app/src/mobile/res/layout/activity_folder.xml
  4. 8
      app/src/mobile/res/layout/fragment_type.xml

@ -3,7 +3,11 @@ package com.fongmi.android.tv.ui.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.viewbinding.ViewBinding;
import com.fongmi.android.tv.R;
@ -40,11 +44,17 @@ public class FolderActivity extends BaseActivity {
return mBinding = ActivityFolderBinding.inflate(getLayoutInflater());
}
@Override
public void setSupportActionBar(@Nullable Toolbar toolbar) {
super.setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
protected void initView(Bundle savedInstanceState) {
Result result = getResult();
Class type = result.getTypes().get(0);
mBinding.text.setText(type.getTypeName());
setSupportActionBar(mBinding.toolbar);
Class type = getResult().getTypes().get(0);
setTitle(type.getTypeName());
getSupportFragmentManager().beginTransaction().replace(R.id.container, TypeFragment.newInstance(getKey(), type.getTypeId(), type.getStyle(), new HashMap<>(), "1".equals(type.getTypeFlag())), "0").commitAllowingStateLoss();
}
@ -52,6 +62,12 @@ public class FolderActivity extends BaseActivity {
return (TypeFragment) getSupportFragmentManager().findFragmentByTag("0");
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) onBackInvoked();
return super.onOptionsItemSelected(item);
}
@Override
protected void onBackInvoked() {
if (getFragment().canBack()) super.onBackInvoked();

@ -27,6 +27,7 @@ public abstract class FragmentStateManager {
else ft.show(fragment);
Fragment current = fm.getPrimaryNavigationFragment();
if (current != null) ft.hide(current);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.setPrimaryNavigationFragment(fragment);
ft.setReorderingAllowed(true);
ft.commitNowAllowingStateLoss();

@ -1,25 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="12dp"
android:background="@drawable/selector_item_round"
android:gravity="center"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="14sp"
tools:text="電影" />
android:background="@color/transparent"
android:elevation="0dp"
app:elevation="0dp"
app:liftOnScrollColor="@color/transparent">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:navigationIconTint="@android:color/white"
app:titleTextColor="@android:color/white" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/container"

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/swipeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -13,10 +14,13 @@
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="-12dp"
android:layout_marginTop="-8dp"
android:clipChildren="false"
android:clipToPadding="false"
android:padding="8dp" />
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:paddingBottom="8dp"
tools:listitem="@layout/adapter_vod_rect" />
</com.fongmi.android.tv.ui.custom.ProgressLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
Loading…
Cancel
Save