Some improvements

This commit is contained in:
Thomas 2020-10-03 11:24:26 +02:00
parent a8b17ce0b2
commit c50a587250
9 changed files with 27 additions and 9 deletions

View File

@ -1,6 +1,7 @@
<resources>
<string name="app_name" translatable="false">TubeAcad</string>
<string name="title_home">Locale</string>
<string name="title_local">Locale</string>
<string name="title_discover">Découvrir</string>
<string name="title_notifications">Notifications</string>
<string name="title_instances">Instances</string>

View File

@ -1,6 +1,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="app_name" translatable="false">Tubelab</string>
<string name="title_home">Home</string>
<string name="title_local">Local</string>
<string name="title_discover">Discover</string>
<string name="title_notifications">Notifications</string>
<string name="title_recently_added">Recently added</string>

View File

@ -120,7 +120,7 @@ public class MainActivity extends AppCompatActivity {
//When the user is authenticated, the subscription entry will be added and the local one removed.
if (Helper.isLoggedIn(MainActivity.this)) {
appBarConfiguration = new AppBarConfiguration.Builder(
R.id.navigation_discover, R.id.navigation_subscription, R.id.navigation_trending, R.id.navigation_most_liked, R.id.navigation_recently_added)
R.id.navigation_discover, R.id.navigation_subscription, R.id.navigation_trending, R.id.navigation_local, R.id.navigation_recently_added)
.build();
} else {
appBarConfiguration = new AppBarConfiguration.Builder(
@ -189,6 +189,7 @@ public class MainActivity extends AppCompatActivity {
MenuItem myVideosItem = menu.findItem(R.id.action_myvideos);
MenuItem playslistItem = menu.findItem(R.id.action_playlist);
MenuItem historyItem = menu.findItem(R.id.action_history);
MenuItem mostLikedItem = menu.findItem(R.id.action_most_liked);
MenuItem settingsItem = menu.findItem(R.id.action_settings);
if (Helper.isLoggedIn(MainActivity.this)) {
instanceItem.setVisible(false);
@ -197,6 +198,7 @@ public class MainActivity extends AppCompatActivity {
playslistItem.setVisible(true);
historyItem.setVisible(true);
settingsItem.setVisible(false);
mostLikedItem.setVisible(true);
} else {
instanceItem.setVisible(true);
uploadItem.setVisible(false);
@ -204,6 +206,7 @@ public class MainActivity extends AppCompatActivity {
playslistItem.setVisible(false);
historyItem.setVisible(false);
settingsItem.setVisible(true);
mostLikedItem.setVisible(false);
}
return true;
}
@ -248,6 +251,13 @@ public class MainActivity extends AppCompatActivity {
intent.putExtras(bundle);
startActivity(intent);
return true;
} else if (item.getItemId() == R.id.action_most_liked) {
Intent intent = new Intent(MainActivity.this, MyVideosActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("type", TimelineVM.TimelineType.MOST_LIKED);
intent.putExtras(bundle);
startActivity(intent);
return true;
} else if (item.getItemId() == R.id.action_playlist) {
Intent intent = new Intent(MainActivity.this, AllPlaylistsActivity.class);
startActivity(intent);

View File

@ -47,6 +47,8 @@ public class MyVideosActivity extends AppCompatActivity {
setTitle(R.string.subscriptions);
} else if (type == TimelineVM.TimelineType.HISTORY) {
setTitle(R.string.my_history);
} else if (type == TimelineVM.TimelineType.MOST_LIKED) {
setTitle(R.string.title_most_liked);
}
if (savedInstanceState == null) {

View File

@ -184,7 +184,6 @@ public class VideoData {
boolean streamService = sharedpreferences.getInt(Helper.SET_VIDEO_MODE, Helper.VIDEO_MODE_NORMAL) == Helper.VIDEO_MODE_STREAMING;
if (resolution != null) {
for (File file : files) {
if (file.getResolutions().getLabel().compareTo(resolution) == 0) {
if (streamService) {
return file.getMagnetUri();

View File

@ -710,7 +710,7 @@ public class Helper {
if( files.size() < 3) {
return files.get(files.size() -1);
}else{
int middle = files.size()/2;
int middle = files.size()/2 -1;
return files.get(middle);
}
}

View File

@ -17,9 +17,9 @@
android:title="@string/title_trending" />
<item
android:id="@+id/navigation_most_liked"
android:icon="@drawable/ic_baseline_thumb_up_24"
android:title="@string/title_most_liked" />
android:id="@+id/navigation_local"
android:icon="@drawable/ic_home_black_24dp"
android:title="@string/title_local" />
<item
android:id="@+id/navigation_recently_added"

View File

@ -40,6 +40,11 @@
android:icon="@drawable/ic_baseline_history_24"
android:title="@string/my_history"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_most_liked"
android:icon="@drawable/ic_baseline_thumb_up_24"
android:title="@string/title_most_liked"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_settings"
android:icon="@drawable/ic_baseline_settings_24"

View File

@ -37,13 +37,13 @@
</fragment>
<fragment
android:id="@+id/navigation_most_liked"
android:id="@+id/navigation_local"
android:name="app.fedilab.fedilabtube.fragment.DisplayVideosFragment"
android:label="@string/title_most_liked"
android:label="@string/title_local"
tools:layout="@layout/fragment_video">
<argument
android:name="type"
android:defaultValue="MOST_LIKED"
android:defaultValue="LOCAL"
app:argType="app.fedilab.fedilabtube.viewmodel.TimelineVM$TimelineType" />
</fragment>