Prepare empty home screen for bottom navigation (#7594)
This commit is contained in:
parent
fa10cb491d
commit
c8847bf76f
app/src/main
ui/i18n/src/main/res/values
@ -20,6 +20,7 @@ import de.danoeh.antennapod.event.FeedUpdateRunningEvent;
|
||||
import de.danoeh.antennapod.model.feed.FeedItemFilter;
|
||||
import de.danoeh.antennapod.net.download.serviceinterface.FeedUpdateManager;
|
||||
import de.danoeh.antennapod.storage.database.DBReader;
|
||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.ui.echo.EchoConfig;
|
||||
import de.danoeh.antennapod.ui.screen.SearchFragment;
|
||||
import de.danoeh.antennapod.ui.screen.home.sections.DownloadsSection;
|
||||
@ -166,12 +167,16 @@ public class HomeFragment extends Fragment implements Toolbar.OnMenuItemClickLis
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(numEpisodes -> {
|
||||
viewBinding.welcomeContainer.setVisibility(numEpisodes == 0 ? View.VISIBLE : View.GONE);
|
||||
viewBinding.homeContainer.setVisibility(numEpisodes == 0 ? View.GONE : View.VISIBLE);
|
||||
viewBinding.swipeRefresh.setVisibility(numEpisodes == 0 ? View.GONE : View.VISIBLE);
|
||||
if (numEpisodes == 0) {
|
||||
boolean hasEpisodes = numEpisodes != 0;
|
||||
viewBinding.welcomeContainer.setVisibility(hasEpisodes ? View.GONE : View.VISIBLE);
|
||||
viewBinding.homeContainer.setVisibility(hasEpisodes ? View.VISIBLE : View.GONE);
|
||||
viewBinding.swipeRefresh.setVisibility(hasEpisodes ? View.VISIBLE : View.GONE);
|
||||
if (!hasEpisodes) {
|
||||
viewBinding.homeScrollView.setScrollY(0);
|
||||
}
|
||||
boolean bottomNav = UserPreferences.isBottomNavigationEnabled();
|
||||
viewBinding.arrowBottomIcon.setVisibility(bottomNav ? View.VISIBLE : View.GONE);
|
||||
viewBinding.arrowSidebarIcon.setVisibility(bottomNav ? View.GONE : View.VISIBLE);
|
||||
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
}
|
||||
|
||||
|
@ -21,35 +21,55 @@
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/welcomeContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:paddingHorizontal="32dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/arrowSidebarIcon"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_gravity="start"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_curved_arrow" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/arrowBottomIcon"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_gravity="start"
|
||||
android:scaleX="-1"
|
||||
android:scaleY="-1"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_curved_arrow" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="48dp"
|
||||
app:srcCompat="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/titleLabel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/home_welcome_title"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/icon"
|
||||
android:textAlignment="center"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="20sp" />
|
||||
@ -58,12 +78,13 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/home_welcome_text"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@+id/titleLabel"
|
||||
android:textAlignment="center"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefresh"
|
||||
|
@ -64,7 +64,7 @@
|
||||
<string name="home_new_empty_text">New episodes will show up here. You can then decide whether you are interested in them.</string>
|
||||
<string name="home_downloads_empty_text">You can download any episode to listen to it offline.</string>
|
||||
<string name="home_welcome_title">Welcome to AntennaPod!</string>
|
||||
<string name="home_welcome_text">You are not subscribed to any podcasts yet. Open the side menu to add a podcast.</string>
|
||||
<string name="home_welcome_text">You are not subscribed to any podcasts yet. Open the menu to add a podcast.</string>
|
||||
<string name="notification_permission_denied">You denied the permission.</string>
|
||||
<string name="configure_home">Configure Home Screen</string>
|
||||
<string name="section_hidden">Hidden</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user