- Moved account to top menu

- Added overview placeholder (to be implemented later)
- Refactored keys
This commit is contained in:
Stefan Schueller 2019-01-27 16:53:55 +01:00
parent 359a795efe
commit f4e0c51a0d
11 changed files with 122 additions and 37 deletions

View File

@ -2,8 +2,10 @@
Android PeerTube Client
</h1>
<p align="center">
[![Latest release](https://img.shields.io/github/release/sschueller/peertube-android.svg)](https://github.com/sschueller/peertube-android/releases/latest)
[![F-Droid](https://img.shields.io/f-droid/v/net.schueller.peertube.svg)](https://f-droid.org/de/packages/net.schueller.peertube/)
</p>
<h4 align="center">
</h4>

View File

@ -26,18 +26,22 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.preference.PreferenceManager;
import android.provider.SearchRecentSuggestions;
import androidx.annotation.NonNull;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import androidx.core.app.ActivityCompat;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.os.Bundle;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
@ -45,8 +49,10 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.iconics.IconicsDrawable;
import net.schueller.peertube.R;
import net.schueller.peertube.adapter.VideoAdapter;
import net.schueller.peertube.helper.APIUrlHelper;
@ -119,6 +125,9 @@ public class VideoListActivity extends CommonActivity {
menu.findItem(R.id.action_settings).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_cog).actionBar());
menu.findItem(R.id.action_account).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_user_circle).actionBar());
MenuItem searchMenuItem = menu.findItem(R.id.action_search);
searchMenuItem.setIcon(
@ -178,10 +187,19 @@ public class VideoListActivity extends CommonActivity {
return false;
case R.id.action_settings:
// Toast.makeText(this, "Login Selected", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, SettingsActivity.class);
this.startActivity(intent);
Intent intentSettings = new Intent(this, SettingsActivity.class);
this.startActivity(intentSettings);
return true;
case R.id.action_account:
if (!Session.getInstance().isLoggedIn()) {
Intent intentLogin = new Intent(this, LoginActivity.class);
this.startActivity(intentLogin);
} else {
Intent intentMe = new Intent(this, MeActivity.class);
this.startActivity(intentMe);
}
return false;
default:
break;
}
@ -350,23 +368,24 @@ public class VideoListActivity extends CommonActivity {
// Add Icon font
Menu navMenu = navigation.getMenu();
navMenu.findItem(R.id.navigation_home).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_home));
navMenu.findItem(R.id.navigation_overview).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_globe));
navMenu.findItem(R.id.navigation_trending).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_fire));
navMenu.findItem(R.id.navigation_recent).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_plus_circle));
navMenu.findItem(R.id.navigation_local).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_home));
navMenu.findItem(R.id.navigation_subscriptions).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_folder));
navMenu.findItem(R.id.navigation_account).setIcon(
new IconicsDrawable(this, FontAwesome.Icon.faw_user_circle));
// navMenu.findItem(R.id.navigation_account).setIcon(
// new IconicsDrawable(this, FontAwesome.Icon.faw_user_circle));
// Click Listener
navigation.setOnNavigationItemSelectedListener(menuItem -> {
switch (menuItem.getItemId()) {
case R.id.navigation_home:
//Log.v(TAG, "navigation_home");
case R.id.navigation_overview:
// TODO
if (!isLoading) {
sort = "-createdAt";
currentStart = 0;
@ -387,6 +406,16 @@ public class VideoListActivity extends CommonActivity {
loadVideos(currentStart, count, sort, filter);
}
return true;
case R.id.navigation_recent:
if (!isLoading) {
sort = "-createdAt";
currentStart = 0;
filter = null;
subscriptions = false;
loadVideos(currentStart, count, sort, filter);
}
return true;
case R.id.navigation_local:
//Log.v(TAG, "navigation_trending");
@ -420,23 +449,63 @@ public class VideoListActivity extends CommonActivity {
}
case R.id.navigation_account:
//Log.v(TAG, "navigation_account");
//Toast.makeText(VideoListActivity.this, "Account Not Implemented", Toast.LENGTH_SHORT).show();
if (!Session.getInstance().isLoggedIn()) {
Intent intent = new Intent(this, LoginActivity.class);
this.startActivity(intent);
} else {
Intent intent = new Intent(this, MeActivity.class);
this.startActivity(intent);
}
return false;
// case R.id.navigation_account:
// //Log.v(TAG, "navigation_account");
// //Toast.makeText(VideoListActivity.this, "Account Not Implemented", Toast.LENGTH_SHORT).show();
//
// if (!Session.getInstance().isLoggedIn()) {
// Intent intent = new Intent(this, LoginActivity.class);
// this.startActivity(intent);
// } else {
// Intent intent = new Intent(this, MeActivity.class);
// this.startActivity(intent);
// }
//
// return false;
}
return false;
});
// TODO: on double click jump to top and reload
// navigation.setOnNavigationItemReselectedListener(menuItemReselected -> {
// switch (menuItemReselected.getItemId()) {
// case R.id.navigation_home:
// if (!isLoading) {
// sort = "-createdAt";
// currentStart = 0;
// filter = null;
// subscriptions = false;
// loadVideos(currentStart, count, sort, filter);
// }
// case R.id.navigation_trending:
// if (!isLoading) {
// sort = "-trending";
// currentStart = 0;
// filter = null;
// subscriptions = false;
// loadVideos(currentStart, count, sort, filter);
// }
// case R.id.navigation_local:
// if (!isLoading) {
// sort = "-publishedAt";
// filter = "local";
// currentStart = 0;
// subscriptions = false;
// loadVideos(currentStart, count, sort, filter);
// }
// case R.id.navigation_subscriptions:
// if (Session.getInstance().isLoggedIn()) {
// if (!isLoading) {
// sort = "-publishedAt";
// filter = null;
// currentStart = 0;
// subscriptions = true;
// loadVideos(currentStart, count, sort, filter);
// }
// }
// }
// });
}
}

View File

@ -3,8 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/navigation_home"
android:title="@string/bottom_nav_title_home"
android:id="@+id/navigation_overview"
android:title="@string/bottom_nav_title_overview"
app:showAsAction="always|withText" />
<item
@ -12,6 +12,11 @@
android:title="@string/bottom_nav_title_trending"
app:showAsAction="always|withText"/>
<item
android:id="@+id/navigation_recent"
android:title="@string/bottom_nav_title_recent"
app:showAsAction="ifRoom|withText" />
<item
android:id="@+id/navigation_local"
android:title="@string/bottom_nav_title_local"
@ -22,9 +27,9 @@
android:title="@string/bottom_nav_title_subscriptions"
app:showAsAction="ifRoom|withText"/>
<item
android:id="@+id/navigation_account"
android:title="@string/bottom_nav_title_account"
app:showAsAction="ifRoom|withText"/>
<!--<item-->
<!--android:id="@+id/navigation_account"-->
<!--android:title="@string/bottom_nav_title_account"-->
<!--app:showAsAction="ifRoom|withText"/>-->
</menu>

View File

@ -19,4 +19,11 @@
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_account"
android:orderInCategory="300"
android:title="@string/action_bar_title_account"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Caption"
app:showAsAction="ifRoom" />
</menu>

View File

@ -22,7 +22,7 @@
<string name="action_bar_title_settings">الإعدادات</string>
<!-- Bottom navigation bar -->
<string name="bottom_nav_title_home">الرئيسية</string>
<string name="bottom_nav_title_overview">الرئيسية</string>
<string name="bottom_nav_title_trending">المتصدرة</string>
<string name="bottom_nav_title_subscriptions">الإشتراكات</string>
<string name="bottom_nav_title_account">الحساب</string>

View File

@ -25,7 +25,7 @@
<string name="action_bar_title_logout">" লগআউট"</string>
<!-- Bottom navigation bar -->
<string name="bottom_nav_title_home">হোম</string>
<string name="bottom_nav_title_overview">হোম</string>
<string name="bottom_nav_title_trending">"Trending"</string>
<string name="bottom_nav_title_subscriptions">Subscriptions</string>
<string name="bottom_nav_title_account">একাউন্ট</string>

View File

@ -23,7 +23,7 @@
<string name="action_bar_title_settings">Paramètres</string>
<!-- Bottom navigation bar -->
<string name="bottom_nav_title_home">Accueil</string>
<string name="bottom_nav_title_overview">Accueil</string>
<string name="bottom_nav_title_trending">Tendances</string>
<string name="bottom_nav_title_subscriptions">Abonnements</string>
<string name="bottom_nav_title_account">Compte</string>

View File

@ -21,7 +21,7 @@
<string name="action_bar_title_logout">Выйти</string>
<!-- Bottom navigation bar -->
<string name="bottom_nav_title_home">Домашняя</string>
<string name="bottom_nav_title_overview">Домашняя</string>
<string name="bottom_nav_title_trending">Популярные</string>
<string name="bottom_nav_title_subscriptions">Подписки</string>
<string name="bottom_nav_title_account">Аккаунт</string>

View File

@ -24,7 +24,7 @@
<string name="action_bar_title_logout">Çıkış yap</string>
<!-- Bottom navigation bar -->
<string name="bottom_nav_title_home">Ev</string>
<string name="bottom_nav_title_overview">Ev</string>
<string name="bottom_nav_title_trending">Eğilimler</string>
<string name="bottom_nav_title_subscriptions">Abonelikler</string>
<string name="bottom_nav_title_account">Hesap</string>

View File

@ -6,7 +6,7 @@
<string name="prompt_server">服务</string>
<string name="title_activity_settings">设置</string>
<string name="action_bar_title_search">搜索</string>
<string name="bottom_nav_title_home">主页</string>
<string name="bottom_nav_title_overview">主页</string>
<string name="bottom_nav_title_trending">趋势</string>
<string name="bottom_nav_title_subscriptions">订阅</string>
<string name="bottom_nav_title_account">帐号</string>

View File

@ -23,11 +23,15 @@
<string name="action_bar_title_search">Search</string>
<string name="action_bar_title_settings">Settings</string>
<string name="action_bar_title_logout">Logout</string>
<string name="action_bar_title_account">Account</string>
<!-- Bottom navigation bar -->
<string name="bottom_nav_title_home">Home</string>
<string name="bottom_nav_title_overview">Overview</string>
<string name="bottom_nav_title_trending">Trending</string>
<string name="bottom_nav_title_recent">Recent</string>
<string name="bottom_nav_title_local">Local</string>
<string name="bottom_nav_title_subscriptions">Subscriptions</string>
<string name="bottom_nav_title_account">Account</string>
<!-- Strings related to Settings -->
@ -300,7 +304,6 @@
<string name="pref_title_background_play">Background Playback</string>
<string name="pref_description_background_play">If enabled, continues to play video in background.</string>
<string name="bottom_nav_title_local">Local</string>
<string name="title_activity_account">Account</string>
<string name="menu_video_more_report">Report</string>
@ -342,5 +345,4 @@
<string name="video_rating_like" translatable="false">like</string>
<string name="video_rating_dislike" translatable="false">dislike</string>
</resources>