mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-02 18:31:40 +00:00
Removed Jellyfin dependencies
This commit is contained in:
parent
737eaa1822
commit
9495fbd83d
16 changed files with 62 additions and 310 deletions
|
|
@ -3,9 +3,7 @@ package com.cappielloantonio.play.ui.activity;
|
|||
import android.content.IntentFilter;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
|
@ -14,25 +12,18 @@ import androidx.navigation.NavController;
|
|||
import androidx.navigation.fragment.NavHostFragment;
|
||||
import androidx.navigation.ui.NavigationUI;
|
||||
|
||||
import com.cappielloantonio.play.App;
|
||||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.broadcast.receiver.ConnectivityStatusBroadcastReceiver;
|
||||
import com.cappielloantonio.play.databinding.ActivityMainBinding;
|
||||
import com.cappielloantonio.play.service.MusicPlayerRemote;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.service.MusicPlayerRemote;
|
||||
import com.cappielloantonio.play.ui.activity.base.BaseActivity;
|
||||
import com.cappielloantonio.play.ui.fragment.PlayerBottomSheetFragment;
|
||||
import com.cappielloantonio.play.util.PreferenceUtil;
|
||||
import com.cappielloantonio.play.util.SyncUtil;
|
||||
import com.cappielloantonio.play.viewmodel.MainViewModel;
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
|
||||
import org.jellyfin.apiclient.interaction.EmptyResponse;
|
||||
import org.jellyfin.apiclient.interaction.Response;
|
||||
import org.jellyfin.apiclient.model.session.ClientCapabilities;
|
||||
import org.jellyfin.apiclient.model.system.SystemInfo;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MainActivity extends BaseActivity {
|
||||
|
|
@ -78,35 +69,12 @@ public class MainActivity extends BaseActivity {
|
|||
initNavigation();
|
||||
|
||||
if (PreferenceUtil.getInstance(this).getToken() != null) {
|
||||
checkPreviousSession();
|
||||
goFromLogin();
|
||||
} else {
|
||||
goToLogin();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPreviousSession() {
|
||||
App.getApiClientInstance(getApplicationContext()).ChangeServerLocation(PreferenceUtil.getInstance(this).getServer());
|
||||
App.getApiClientInstance(getApplicationContext()).SetAuthenticationInfo(PreferenceUtil.getInstance(this).getToken(), PreferenceUtil.getInstance(this).getUser());
|
||||
App.getApiClientInstance(getApplicationContext()).GetSystemInfoAsync(new Response<SystemInfo>() {
|
||||
@Override
|
||||
public void onResponse(SystemInfo result) {
|
||||
ClientCapabilities clientCapabilities = new ClientCapabilities();
|
||||
clientCapabilities.setSupportsMediaControl(true);
|
||||
clientCapabilities.setSupportsPersistentIdentifier(true);
|
||||
|
||||
App.getApiClientInstance(getApplicationContext()).ensureWebSocket();
|
||||
App.getApiClientInstance(getApplicationContext()).ReportCapabilities(clientCapabilities, new EmptyResponse());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
Toast.makeText(getApplicationContext(), exception.getMessage(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// BOTTOM SHEET/NAVIGATION
|
||||
private void initBottomSheet() {
|
||||
bottomSheetBehavior = BottomSheetBehavior.from(findViewById(R.id.player_bottom_sheet));
|
||||
|
|
@ -176,7 +144,8 @@ public class MainActivity extends BaseActivity {
|
|||
case BottomSheetBehavior.STATE_COLLAPSED:
|
||||
case BottomSheetBehavior.STATE_SETTLING:
|
||||
PlayerBottomSheetFragment playerBottomSheetFragment = (PlayerBottomSheetFragment) getSupportFragmentManager().findFragmentByTag("PlayerBottomSheet");
|
||||
if (playerBottomSheetFragment != null) playerBottomSheetFragment.scrollOnTop();
|
||||
if (playerBottomSheetFragment != null)
|
||||
playerBottomSheetFragment.scrollOnTop();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -186,8 +155,7 @@ public class MainActivity extends BaseActivity {
|
|||
PlayerBottomSheetFragment playerBottomSheetFragment = (PlayerBottomSheetFragment) getSupportFragmentManager().findFragmentByTag("PlayerBottomSheet");
|
||||
if (playerBottomSheetFragment == null) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
float condensedSlideOffset = Math.max(0.0f, Math.min(0.2f, slideOffset - 0.2f)) / 0.2f;
|
||||
playerBottomSheetFragment.getPlayerHeader().setAlpha(1 - condensedSlideOffset);
|
||||
playerBottomSheetFragment.getPlayerHeader().setVisibility(condensedSlideOffset > 0.99 ? View.GONE : View.VISIBLE);
|
||||
|
|
@ -217,8 +185,7 @@ public class MainActivity extends BaseActivity {
|
|||
|
||||
if (Objects.requireNonNull(navController.getCurrentDestination()).getId() == R.id.landingFragment) {
|
||||
navController.navigate(R.id.action_landingFragment_to_homeFragment);
|
||||
}
|
||||
else if (Objects.requireNonNull(navController.getCurrentDestination()).getId() == R.id.loginFragment) {
|
||||
} else if (Objects.requireNonNull(navController.getCurrentDestination()).getId() == R.id.loginFragment) {
|
||||
navController.navigate(R.id.action_loginFragment_to_homeFragment);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue