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) {
|
||||
receiveColor(currentColorReceiver, currentColorReceiverPosition);
|
||||
}
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.bumptech.glide.Glide;
|
|||
import com.kabouzeid.appthemehelper.ThemeStore;
|
||||
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
||||
import com.kabouzeid.appthemehelper.util.NavigationViewUtil;
|
||||
import com.kabouzeid.gramophone.App;
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.glide.CustomGlideRequest;
|
||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||
|
|
@ -35,7 +36,14 @@ import com.kabouzeid.gramophone.util.MusicUtil;
|
|||
import com.kabouzeid.gramophone.util.QueryUtil;
|
||||
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.logging.ILogger;
|
||||
import org.jellyfin.apiclient.model.serialization.GsonJsonSerializer;
|
||||
import org.jellyfin.apiclient.model.serialization.IJsonSerializer;
|
||||
|
||||
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.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.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();
|
||||
|
||||
|
|
@ -135,6 +145,15 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
|||
case R.id.nav_about:
|
||||
new Handler().postDelayed(() -> startActivity(new Intent(MainActivity.this, AboutActivity.class)), 200);
|
||||
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
|
||||
|
|
@ -182,6 +201,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
|||
|
||||
((TextView) navigationDrawerHeader.findViewById(R.id.title)).setText(song.title);
|
||||
((TextView) navigationDrawerHeader.findViewById(R.id.text)).setText(MusicUtil.getSongInfoString(song));
|
||||
|
||||
CustomGlideRequest.Builder.from(Glide.with(this), song.albumId)
|
||||
.build()
|
||||
.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);
|
||||
miniPlayerFragment = (MiniPlayerFragment) getSupportFragmentManager().findFragmentById(R.id.mini_player_fragment);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
// noinspection ConstantConditions
|
||||
miniPlayerFragment.getView().setOnClickListener(v -> expandPanel());
|
||||
|
||||
slidingUpPanelLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
|
|
@ -95,6 +95,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
slidingUpPanelLayout.addPanelSlideListener(this);
|
||||
}
|
||||
|
||||
|
|
@ -228,6 +229,7 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
collapsePanel();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ public abstract class AbsLibraryPagerRecyclerViewCustomGridSizeFragment<A extend
|
|||
if (getGridSize() > getMaxGridSizeForList()) {
|
||||
return R.layout.item_grid;
|
||||
}
|
||||
|
||||
return R.layout.item_list;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout 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:id="@+id/player_album_art_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
@ -11,13 +12,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/default_album_art"
|
||||
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>
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_margin="2dp"
|
||||
android:foreground="?rectSelectorStrong">
|
||||
|
||||
|
|
@ -23,6 +24,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/default_album_art"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</com.kabouzeid.gramophone.views.WidthFitSquareLayout>
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
android:layout_height="40dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"
|
||||
app:srcCompat="@drawable/default_album_art"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -16,9 +16,14 @@
|
|||
|
||||
<item
|
||||
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" />
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_logout"
|
||||
android:icon="@drawable/ic_exit_to_app_white_48dp"
|
||||
android:title="@string/logout" />
|
||||
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@
|
|||
<string name="app_widget_small_name">Phonograph - Small</string>
|
||||
<string name="app_widget_card_name">Phonograph - Card</string>
|
||||
<string name="login">Login</string>
|
||||
<string name="logout">Logout</string>
|
||||
<string name="username">Username</string>
|
||||
<string name="password">Password</string>
|
||||
<string name="server">Server</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue