add logout button and use default album art in more locations
This commit is contained in:
parent
8e091c99a6
commit
9a20e51bcc
9 changed files with 38 additions and 10 deletions
|
|
@ -51,6 +51,7 @@ public class AlbumCoverPagerAdapter extends CustomFragmentStatePagerAdapter {
|
||||||
if (currentColorReceiver != null && currentColorReceiverPosition == position) {
|
if (currentColorReceiver != null && currentColorReceiverPosition == position) {
|
||||||
receiveColor(currentColorReceiver, currentColorReceiverPosition);
|
receiveColor(currentColorReceiver, currentColorReceiverPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import com.bumptech.glide.Glide;
|
||||||
import com.kabouzeid.appthemehelper.ThemeStore;
|
import com.kabouzeid.appthemehelper.ThemeStore;
|
||||||
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
||||||
import com.kabouzeid.appthemehelper.util.NavigationViewUtil;
|
import com.kabouzeid.appthemehelper.util.NavigationViewUtil;
|
||||||
|
import com.kabouzeid.gramophone.App;
|
||||||
import com.kabouzeid.gramophone.R;
|
import com.kabouzeid.gramophone.R;
|
||||||
import com.kabouzeid.gramophone.glide.CustomGlideRequest;
|
import com.kabouzeid.gramophone.glide.CustomGlideRequest;
|
||||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||||
|
|
@ -35,7 +36,14 @@ import com.kabouzeid.gramophone.util.MusicUtil;
|
||||||
import com.kabouzeid.gramophone.util.QueryUtil;
|
import com.kabouzeid.gramophone.util.QueryUtil;
|
||||||
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
||||||
|
|
||||||
|
import org.jellyfin.apiclient.interaction.EmptyResponse;
|
||||||
|
import org.jellyfin.apiclient.interaction.VolleyHttpClient;
|
||||||
|
import org.jellyfin.apiclient.interaction.http.IAsyncHttpClient;
|
||||||
|
import org.jellyfin.apiclient.logging.AndroidLogger;
|
||||||
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
||||||
|
import org.jellyfin.apiclient.model.logging.ILogger;
|
||||||
|
import org.jellyfin.apiclient.model.serialization.GsonJsonSerializer;
|
||||||
|
import org.jellyfin.apiclient.model.serialization.IJsonSerializer;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -89,7 +97,9 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
||||||
menu.add(R.id.navigation_drawer_menu_category_other, R.id.nav_settings, menu.size(), R.string.action_settings);
|
menu.add(R.id.navigation_drawer_menu_category_other, R.id.nav_settings, menu.size(), R.string.action_settings);
|
||||||
menu.getItem(menu.size() - 1).setIcon(R.drawable.ic_settings_white_24dp);
|
menu.getItem(menu.size() - 1).setIcon(R.drawable.ic_settings_white_24dp);
|
||||||
menu.add(R.id.navigation_drawer_menu_category_other, R.id.nav_about, menu.size(), R.string.action_about);
|
menu.add(R.id.navigation_drawer_menu_category_other, R.id.nav_about, menu.size(), R.string.action_about);
|
||||||
menu.getItem(menu.size() - 1).setIcon(R.drawable.ic_help_white_24dp);
|
menu.getItem(menu.size() - 1).setIcon(R.drawable.ic_info_outline_white_24dp);
|
||||||
|
menu.add(R.id.navigation_drawer_menu_category_other, R.id.nav_logout, menu.size(), R.string.logout);
|
||||||
|
menu.getItem(menu.size() - 1).setIcon(R.drawable.ic_exit_to_app_white_48dp);
|
||||||
|
|
||||||
setUpDrawerLayout();
|
setUpDrawerLayout();
|
||||||
|
|
||||||
|
|
@ -135,6 +145,15 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
||||||
case R.id.nav_about:
|
case R.id.nav_about:
|
||||||
new Handler().postDelayed(() -> startActivity(new Intent(MainActivity.this, AboutActivity.class)), 200);
|
new Handler().postDelayed(() -> startActivity(new Intent(MainActivity.this, AboutActivity.class)), 200);
|
||||||
break;
|
break;
|
||||||
|
case R.id.nav_logout:
|
||||||
|
IJsonSerializer jsonSerializer = new GsonJsonSerializer();
|
||||||
|
ILogger logger = new AndroidLogger(TAG);
|
||||||
|
IAsyncHttpClient httpClient = new VolleyHttpClient(logger, this);
|
||||||
|
|
||||||
|
App.getConnectionManager(this, jsonSerializer, logger, httpClient).Logout(new EmptyResponse());
|
||||||
|
Intent intent = new Intent(this, LoginActivity.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
this.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// only run the following code when a new library has been selected
|
// only run the following code when a new library has been selected
|
||||||
|
|
@ -182,6 +201,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
||||||
|
|
||||||
((TextView) navigationDrawerHeader.findViewById(R.id.title)).setText(song.title);
|
((TextView) navigationDrawerHeader.findViewById(R.id.title)).setText(song.title);
|
||||||
((TextView) navigationDrawerHeader.findViewById(R.id.text)).setText(MusicUtil.getSongInfoString(song));
|
((TextView) navigationDrawerHeader.findViewById(R.id.text)).setText(MusicUtil.getSongInfoString(song));
|
||||||
|
|
||||||
CustomGlideRequest.Builder.from(Glide.with(this), song.albumId)
|
CustomGlideRequest.Builder.from(Glide.with(this), song.albumId)
|
||||||
.build()
|
.build()
|
||||||
.into(((ImageView) navigationDrawerHeader.findViewById(R.id.image)));
|
.into(((ImageView) navigationDrawerHeader.findViewById(R.id.image)));
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
playerFragment = (AbsPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.player_fragment_container);
|
playerFragment = (AbsPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.player_fragment_container);
|
||||||
miniPlayerFragment = (MiniPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.mini_player_fragment);
|
miniPlayerFragment = (MiniPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.mini_player_fragment);
|
||||||
|
|
||||||
//noinspection ConstantConditions
|
// noinspection ConstantConditions
|
||||||
miniPlayerFragment.getView().setOnClickListener(v -> expandPanel());
|
miniPlayerFragment.getView().setOnClickListener(v -> expandPanel());
|
||||||
|
|
||||||
slidingUpPanelLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
slidingUpPanelLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
|
@ -95,6 +95,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
slidingUpPanelLayout.addPanelSlideListener(this);
|
slidingUpPanelLayout.addPanelSlideListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -228,6 +229,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
||||||
collapsePanel();
|
collapsePanel();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ public abstract class AbsLibraryPagerRecyclerViewCustomGridSizeFragment<A extend
|
||||||
if (getGridSize() > getMaxGridSizeForList()) {
|
if (getGridSize() > getMaxGridSizeForList()) {
|
||||||
return R.layout.item_grid;
|
return R.layout.item_grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
return R.layout.item_list;
|
return R.layout.item_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/player_album_art_frame"
|
android:id="@+id/player_album_art_frame"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
@ -11,13 +12,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
|
app:srcCompat="@drawable/default_album_art"
|
||||||
tools:ignore="ContentDescription,UnusedAttribute" />
|
tools:ignore="ContentDescription,UnusedAttribute" />
|
||||||
|
|
||||||
<!--<ImageView-->
|
|
||||||
<!--android:id="@+id/player_image_background"-->
|
|
||||||
<!--android:layout_width="match_parent"-->
|
|
||||||
<!--android:layout_height="match_parent"-->
|
|
||||||
<!--android:scaleType="centerCrop"-->
|
|
||||||
<!--tools:ignore="ContentDescription,UnusedAttribute" />-->
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_margin="2dp"
|
android:layout_margin="2dp"
|
||||||
android:foreground="?rectSelectorStrong">
|
android:foreground="?rectSelectorStrong">
|
||||||
|
|
||||||
|
|
@ -23,6 +24,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
|
app:srcCompat="@drawable/default_album_art"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
</com.kabouzeid.gramophone.views.WidthFitSquareLayout>
|
</com.kabouzeid.gramophone.views.WidthFitSquareLayout>
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
|
app:srcCompat="@drawable/default_album_art"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,14 @@
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_about"
|
android:id="@+id/nav_about"
|
||||||
android:icon="@drawable/ic_help_white_24dp"
|
android:icon="@drawable/ic_info_outline_white_24dp"
|
||||||
android:title="@string/action_about" />
|
android:title="@string/action_about" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/nav_logout"
|
||||||
|
android:icon="@drawable/ic_exit_to_app_white_48dp"
|
||||||
|
android:title="@string/logout" />
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,7 @@
|
||||||
<string name="app_widget_small_name">Phonograph - Small</string>
|
<string name="app_widget_small_name">Phonograph - Small</string>
|
||||||
<string name="app_widget_card_name">Phonograph - Card</string>
|
<string name="app_widget_card_name">Phonograph - Card</string>
|
||||||
<string name="login">Login</string>
|
<string name="login">Login</string>
|
||||||
|
<string name="logout">Logout</string>
|
||||||
<string name="username">Username</string>
|
<string name="username">Username</string>
|
||||||
<string name="password">Password</string>
|
<string name="password">Password</string>
|
||||||
<string name="server">Server</string>
|
<string name="server">Server</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue