Skip to content
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.

Commit

Permalink
Merge branch 'dev' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
timusus committed Dec 10, 2017
2 parents 898e39e + f0167da commit de4e6e4
Show file tree
Hide file tree
Showing 51 changed files with 883 additions and 908 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ deploy:
condition: $TRAVIS_TAG =~ beta || $TRAVIS_TAG =~ alpha || $TRAVIS_TAG =~ release

# Play Store beta release
- provider: script
script: ./gradlew publishApkFreeRelease publishApkPaidRelease
skip_cleanup: true
on:
repo: timusus/Shuttle
tags: true
condition: $TRAVIS_TAG =~ beta
#- provider: script
# script: ./gradlew publishApkFreeRelease publishApkPaidRelease
# skip_cleanup: true
# on:
# repo: timusus/Shuttle
# tags: true
# condition: $TRAVIS_TAG =~ beta

# Slack build notifications
notifications:
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/assets/web/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
</head>

<body>
<h4>2.0.0-beta21</h4>
<ul>
<li>Fixed a crash when adding to whitelist/blacklist</li>
<li>Reinstated the 'upgrade to Shuttle+' dialog in various places in the free version</li>
<li>Added some logging to track down some pesky crashes</li>
</ul>
<h4>2.0.0-beta20</h4>
<ul>
<li>Fixed a crash when pressing ChromeCast button (finally!)</li>
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/assets/web/info_dark.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
</head>

<body>
<h4>2.0.0-beta21</h4>
<ul>
<li>Fixed a crash when adding to whitelist/blacklist</li>
<li>Reinstated the 'upgrade to Shuttle+' dialog in various places in the free version</li>
<li>Added some logging to track down some pesky crashes</li>
</ul>
<h4>2.0.0-beta20</h4>
<ul>
<li>Fixed a crash when pressing ChromeCast button (finally!)</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ public class CategoryItem {

public int sortOrder;

public boolean isEnabled;
public boolean isChecked;

private CategoryItem(@Type int type, SharedPreferences sharedPreferences) {
this.type = type;
isEnabled = sharedPreferences.getBoolean(getEnabledKey(), isEnabledByDefault());
isChecked = sharedPreferences.getBoolean(getEnabledKey(), isEnabledByDefault());
sortOrder = sharedPreferences.getInt(getSortKey(), 0);
}

Expand All @@ -57,7 +57,7 @@ public static List<CategoryItem> getCategoryItems(SharedPreferences sharedPrefer
}

public void savePrefs(SharedPreferences.Editor editor) {
editor.putBoolean(getEnabledKey(), isEnabled);
editor.putBoolean(getEnabledKey(), isChecked);
editor.putInt(getSortKey(), sortOrder);
editor.apply();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
import com.simplecity.amp_library.model.Album;
import com.simplecity.amp_library.model.AlbumArtist;
import com.simplecity.amp_library.tagger.TaggerDialog;
import com.simplecity.amp_library.ui.adapters.LoggingViewModelAdapter;
import com.simplecity.amp_library.ui.detail.AlbumDetailFragment;
import com.simplecity.amp_library.ui.detail.ArtistDetailFragment;
import com.simplecity.amp_library.ui.detail.BaseDetailFragment;
import com.simplecity.amp_library.ui.dialog.UpgradeDialog;
import com.simplecity.amp_library.ui.fragments.BaseFragment;
import com.simplecity.amp_library.ui.modelviews.EmptyView;
import com.simplecity.amp_library.ui.modelviews.LoadingView;
Expand Down Expand Up @@ -105,7 +107,7 @@ public void onCreate(Bundle savedInstanceState) {
emptyView = new EmptyView(R.string.empty_search);
emptyView.setHeight(ResourceUtils.toPixels(96));

adapter = new ViewModelAdapter();
adapter = new LoggingViewModelAdapter("SearchFragment");
}

@Nullable
Expand Down Expand Up @@ -254,6 +256,11 @@ public void goToAlbum(Album album, View transitionView) {
searchView.getHandler().postDelayed(() -> pushDetailFragment(AlbumDetailFragment.newInstance(album, transitionName), transitionView), 50);
}

@Override
public void showUpgradeDialog() {
UpgradeDialog.getUpgradeDialog(getActivity()).show();
}

void pushDetailFragment(BaseDetailFragment detailFragment, @Nullable View transitionView) {

List<Pair<View, String>> transitions = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.simplecity.amp_library.utils.MusicUtils;
import com.simplecity.amp_library.utils.Operators;
import com.simplecity.amp_library.utils.SettingsManager;
import com.simplecity.amp_library.utils.ShuttleUtils;
import com.simplecity.amp_library.utils.StringUtils;
import com.simplecityapps.recycler_adapter.model.ViewModel;

Expand Down Expand Up @@ -184,12 +185,21 @@ public boolean onAlbumArtistLongClick(int position, AlbumArtistView albumArtistV
public void onAlbumArtistOverflowClicked(View v, AlbumArtist albumArtist) {
PopupMenu menu = new PopupMenu(v.getContext(), v);
menu.inflate(R.menu.menu_artist);
menu.setOnMenuItemClickListener(MenuUtils.getAlbumArtistClickListener(v.getContext(), albumArtist, taggerDialog -> {
SearchView searchView = getView();
if (searchView != null) {
searchView.showTaggerDialog(taggerDialog);
}
}));
menu.setOnMenuItemClickListener(MenuUtils.getAlbumArtistClickListener(
v.getContext(),
albumArtist,
taggerDialog -> {
SearchView searchView = getView();
if (searchView != null) {
searchView.showTaggerDialog(taggerDialog);
}
},
() -> {
SearchView searchView = getView();
if (searchView != null) {
searchView.showUpgradeDialog();
}
}));
menu.show();
}

Expand All @@ -210,12 +220,22 @@ public boolean onAlbumLongClick(int position, AlbumView albumView) {
public void onAlbumOverflowClicked(View v, Album album) {
PopupMenu menu = new PopupMenu(v.getContext(), v);
MenuUtils.setupAlbumMenu(menu);
menu.setOnMenuItemClickListener(MenuUtils.getAlbumMenuClickListener(v.getContext(), album, taggerDialog -> {
SearchView searchView = getView();
if (searchView != null) {
searchView.showTaggerDialog(taggerDialog);
}
}));
menu.setOnMenuItemClickListener(MenuUtils.getAlbumMenuClickListener(
v.getContext(),
album,
taggerDialog -> {
SearchView searchView = getView();
if (searchView != null) {
searchView.showTaggerDialog(taggerDialog);
}
},
() -> {
SearchView searchView = getView();
if (searchView != null) {
searchView.showUpgradeDialog();
}
}
));
menu.show();
}

Expand Down Expand Up @@ -471,13 +491,20 @@ public boolean onSongLongClick(int position, SongView songView) {
public void onSongOverflowClick(int position, View v, Song song) {
PopupMenu menu = new PopupMenu(v.getContext(), v);
MenuUtils.setupSongMenu(menu, false);
menu.setOnMenuItemClickListener(MenuUtils.getSongMenuClickListener(v.getContext(), song,
menu.setOnMenuItemClickListener(MenuUtils.getSongMenuClickListener(
v.getContext(),
song,
taggerDialog -> {
SearchView searchView = getView();
if (searchView != null) {
searchView.showTaggerDialog(taggerDialog);
if (!ShuttleUtils.isUpgraded()) {
searchView.showUpgradeDialog();
} else {
searchView.showTaggerDialog(taggerDialog);
}
}
}, null, null));
},
null, null));
menu.show();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ public interface SearchView {
void goToArtist(AlbumArtist albumArtist, View transitionView);

void goToAlbum(Album album, View transitionView);

void showUpgradeDialog();
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,39 @@
import com.google.android.libraries.cast.companionlibrary.cast.callbacks.VideoCastConsumer;
import com.google.android.libraries.cast.companionlibrary.cast.callbacks.VideoCastConsumerImpl;
import com.simplecity.amp_library.ShuttleApplication;
import com.simplecity.amp_library.utils.ShuttleUtils;

public abstract class BaseCastActivity extends BaseActivity {

private static final String TAG = "BaseCastActivity";

public VideoCastManager castManager;
private VideoCastConsumer castConsumer;
@NonNull
public VideoCastManager castManager = VideoCastManager.getInstance();

@NonNull
private VideoCastConsumer castConsumer = new VideoCastConsumerImpl() {
@Override
public void onConnectionSuspended(int cause) {
Log.d(TAG, "onConnectionSuspended() was called with cause: " + cause);
//Todo: Show toast
}

@Override
public void onConnectivityRecovered() {
//Todo: Show toast
}
};

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

if (ShuttleUtils.isUpgraded()) {
castManager = VideoCastManager.getInstance();
}

castConsumer = new VideoCastConsumerImpl() {
@Override
public void onConnectionSuspended(int cause) {
Log.d(TAG, "onConnectionSuspended() was called with cause: " + cause);
//Todo: Show toast
}

@Override
public void onConnectivityRecovered() {
//Todo: Show toast
}
};

if (castManager != null) {
castManager.reconnectSessionIfPossible();
}
castManager.reconnectSessionIfPossible();
}

@Override
protected void onPause() {

if (castManager != null) {
castManager.removeVideoCastConsumer(castConsumer);
}
castManager.removeVideoCastConsumer(castConsumer);

super.onPause();
}
Expand All @@ -58,19 +50,14 @@ protected void onPause() {
public void onResume() {
super.onResume();

if (ShuttleUtils.isUpgraded()) {
castManager = VideoCastManager.getInstance();
castManager.addVideoCastConsumer(castConsumer);
}
castManager = VideoCastManager.getInstance();
castManager.addVideoCastConsumer(castConsumer);
}

@Override
public boolean dispatchKeyEvent(@NonNull KeyEvent event) {
if (castManager != null) {
return castManager.onDispatchVolumeKeyEvent(event, ShuttleApplication.VOLUME_INCREMENT)
|| super.dispatchKeyEvent(event);
}
return super.dispatchKeyEvent(event);
return castManager.onDispatchVolumeKeyEvent(event, ShuttleApplication.VOLUME_INCREMENT)
|| super.dispatchKeyEvent(event);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.simplecity.amp_library.ui.adapters;

import android.support.annotation.Nullable;
import android.util.Log;

import com.crashlytics.android.Crashlytics;
import com.simplecityapps.recycler_adapter.adapter.CompletionListUpdateCallback;
import com.simplecityapps.recycler_adapter.adapter.ViewModelAdapter;
import com.simplecityapps.recycler_adapter.model.ViewModel;

import java.util.List;

import io.reactivex.disposables.Disposable;

public class LoggingViewModelAdapter extends ViewModelAdapter {

private static final String TAG = "LoggingVMAdapter";

private String tag;

public LoggingViewModelAdapter(String tag) {
this.tag = tag;
}

@Nullable
@Override
public synchronized Disposable setItems(List<ViewModel> items, @Nullable CompletionListUpdateCallback callback) {

Crashlytics.log(Log.DEBUG, TAG, String.format("setItems called for: '%s'", tag));

return super.setItems(items, new CompletionListUpdateCallback() {

@Override
public void onComplete() {

Crashlytics.log(Log.DEBUG, TAG, String.format("setItems complete for: '%s'. Dispatching updates.", tag));

if (callback != null) {
callback.onComplete();
}
}

@Override
public void onInserted(int position, int count) {
if (callback != null) {
callback.onInserted(position, count);
}
}

@Override
public void onRemoved(int position, int count) {
if (callback != null) {
callback.onRemoved(position, count);
}
}

@Override
public void onMoved(int fromPosition, int toPosition) {
if (callback != null) {
callback.onMoved(fromPosition, toPosition);
}
}

@Override
public void onChanged(int position, int count, Object payload) {
if (callback != null) {
callback.onChanged(position, count, payload);
}
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
import android.support.annotation.NonNull;

import com.simplecity.amp_library.ui.modelviews.SectionedView;
import com.simplecityapps.recycler_adapter.adapter.ViewModelAdapter;
import com.simplecityapps.recycler_adapter.model.ViewModel;
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;


public class SectionedAdapter extends ViewModelAdapter implements FastScrollRecyclerView.SectionedAdapter {
public class SectionedAdapter extends LoggingViewModelAdapter implements FastScrollRecyclerView.SectionedAdapter {

public SectionedAdapter(String tag) {
super(tag);
}

@NonNull
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,9 @@ protected void setupToolbarMenu(Toolbar toolbar) {
protected String screenName() {
return "AlbumDetailFragment";
}

@Override
public void showUpgradeDialog(MaterialDialog upgradeDialog) {
upgradeDialog.show();
}
}
Loading

0 comments on commit de4e6e4

Please sign in to comment.