reduce calls to loader classes for backend changes
This commit is contained in:
parent
593a9a545a
commit
9923a4c1e0
36 changed files with 7 additions and 463 deletions
|
|
@ -1,211 +0,0 @@
|
|||
package com.kabouzeid.gramophone.adapter;
|
||||
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.signature.MediaStoreSignature;
|
||||
import com.kabouzeid.appthemehelper.util.ATHUtil;
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.adapter.base.AbsMultiSelectAdapter;
|
||||
import com.kabouzeid.gramophone.adapter.base.MediaEntryViewHolder;
|
||||
import com.kabouzeid.gramophone.glide.audiocover.AudioFileCover;
|
||||
import com.kabouzeid.gramophone.interfaces.CabHolder;
|
||||
import com.kabouzeid.gramophone.util.ImageUtil;
|
||||
import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SongFileAdapter extends AbsMultiSelectAdapter<SongFileAdapter.ViewHolder, File> implements FastScrollRecyclerView.SectionedAdapter {
|
||||
|
||||
private static final int FILE = 0;
|
||||
private static final int FOLDER = 1;
|
||||
|
||||
private final AppCompatActivity activity;
|
||||
private List<File> dataSet;
|
||||
private final int itemLayoutRes;
|
||||
@Nullable
|
||||
private final Callbacks callbacks;
|
||||
|
||||
public SongFileAdapter(@NonNull AppCompatActivity activity, @NonNull List<File> songFiles, @LayoutRes int itemLayoutRes, @Nullable Callbacks callback, @Nullable CabHolder cabHolder) {
|
||||
super(activity, cabHolder, R.menu.menu_media_selection);
|
||||
this.activity = activity;
|
||||
this.dataSet = songFiles;
|
||||
this.itemLayoutRes = itemLayoutRes;
|
||||
this.callbacks = callback;
|
||||
setHasStableIds(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return dataSet.get(position).isDirectory() ? FOLDER : FILE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return dataSet.get(position).hashCode();
|
||||
}
|
||||
|
||||
public void swapDataSet(@NonNull List<File> songFiles) {
|
||||
this.dataSet = songFiles;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new ViewHolder(LayoutInflater.from(activity).inflate(itemLayoutRes, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int index) {
|
||||
final File file = dataSet.get(index);
|
||||
|
||||
holder.itemView.setActivated(isChecked(file));
|
||||
|
||||
if (holder.getAdapterPosition() == getItemCount() - 1) {
|
||||
if (holder.shortSeparator != null) {
|
||||
holder.shortSeparator.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
if (holder.shortSeparator != null) {
|
||||
holder.shortSeparator.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (holder.title != null) {
|
||||
holder.title.setText(getFileTitle(file));
|
||||
}
|
||||
if (holder.text != null) {
|
||||
if (holder.getItemViewType() == FILE) {
|
||||
holder.text.setText(getFileText(file));
|
||||
} else {
|
||||
holder.text.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (holder.image != null) {
|
||||
loadFileImage(file, holder);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getFileTitle(File file) {
|
||||
return file.getName();
|
||||
}
|
||||
|
||||
protected String getFileText(File file) {
|
||||
return file.isDirectory() ? null : readableFileSize(file.length());
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
protected void loadFileImage(File file, final ViewHolder holder) {
|
||||
final int iconColor = ATHUtil.resolveColor(activity, R.attr.iconColor);
|
||||
if (file.isDirectory()) {
|
||||
holder.image.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
|
||||
holder.image.setImageResource(R.drawable.ic_folder_white_24dp);
|
||||
} else {
|
||||
Drawable error = ImageUtil.getTintedVectorDrawable(activity, R.drawable.ic_file_music_white_24dp, iconColor);
|
||||
Glide.with(activity)
|
||||
.load(new AudioFileCover(file.getPath()))
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.error(error)
|
||||
.placeholder(error)
|
||||
.animate(android.R.anim.fade_in)
|
||||
.signature(new MediaStoreSignature("", file.lastModified(), 0))
|
||||
.into(holder.image);
|
||||
}
|
||||
}
|
||||
|
||||
public static String readableFileSize(long size) {
|
||||
if (size <= 0) return size + " B";
|
||||
final String[] units = new String[]{"B", "KB", "MB", "GB", "TB"};
|
||||
int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
|
||||
return new DecimalFormat("#,##0.##").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataSet.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected File getIdentifier(int position) {
|
||||
return dataSet.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getName(File object) {
|
||||
return getFileTitle(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMultipleItemAction(MenuItem menuItem, List<File> selection) {
|
||||
if (callbacks == null) return;
|
||||
callbacks.onMultipleItemAction(menuItem, selection);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getSectionName(int position) {
|
||||
return String.valueOf(dataSet.get(position).getName().charAt(0)).toUpperCase();
|
||||
}
|
||||
|
||||
public class ViewHolder extends MediaEntryViewHolder {
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
if (menu != null && callbacks != null) {
|
||||
menu.setOnClickListener(v -> {
|
||||
int position = getAdapterPosition();
|
||||
if (isPositionInRange(position)) {
|
||||
callbacks.onFileMenuClicked(dataSet.get(position), v);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int position = getAdapterPosition();
|
||||
if (isPositionInRange(position)) {
|
||||
if (isInQuickSelectMode()) {
|
||||
toggleChecked(position);
|
||||
} else {
|
||||
if (callbacks != null) {
|
||||
callbacks.onFileSelected(dataSet.get(position));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
int position = getAdapterPosition();
|
||||
return isPositionInRange(position) && toggleChecked(position);
|
||||
}
|
||||
|
||||
private boolean isPositionInRange(int position) {
|
||||
return position >= 0 && position < dataSet.size();
|
||||
}
|
||||
}
|
||||
|
||||
public interface Callbacks {
|
||||
void onFileSelected(File file);
|
||||
|
||||
void onFileMenuClicked(File file, View view);
|
||||
|
||||
void onMultipleItemAction(MenuItem item, List<File> files);
|
||||
}
|
||||
}
|
||||
|
|
@ -18,18 +18,19 @@ import java.util.List;
|
|||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public abstract class AbsMultiSelectAdapter<VH extends RecyclerView.ViewHolder, I> extends RecyclerView.Adapter<VH> implements MaterialCab.Callback {
|
||||
@Nullable
|
||||
private final Context context;
|
||||
private final CabHolder cabHolder;
|
||||
private int menuRes;
|
||||
|
||||
private MaterialCab cab;
|
||||
private List<I> checked;
|
||||
private int menuRes;
|
||||
private final Context context;
|
||||
|
||||
public AbsMultiSelectAdapter(Context context, @Nullable CabHolder cabHolder, @MenuRes int menuRes) {
|
||||
this.cabHolder = cabHolder;
|
||||
checked = new ArrayList<>();
|
||||
this.menuRes = menuRes;
|
||||
this.context = context;
|
||||
this.cabHolder = cabHolder;
|
||||
this.menuRes = menuRes;
|
||||
|
||||
this.checked = new ArrayList<>();
|
||||
}
|
||||
|
||||
protected void setMultiSelectMenuRes(@MenuRes int menuRes) {
|
||||
|
|
|
|||
|
|
@ -1,93 +0,0 @@
|
|||
package com.kabouzeid.gramophone.helper;
|
||||
|
||||
import android.app.SearchManager;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.kabouzeid.gramophone.loader.SongLoader;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class SearchQueryHelper {
|
||||
private static final String TITLE_SELECTION = "lower(" + MediaStore.Audio.AudioColumns.TITLE + ") = ?";
|
||||
private static final String ALBUM_SELECTION = "lower(" + MediaStore.Audio.AudioColumns.ALBUM + ") = ?";
|
||||
private static final String ARTIST_SELECTION = "lower(" + MediaStore.Audio.AudioColumns.ARTIST + ") = ?";
|
||||
private static final String AND = " AND ";
|
||||
|
||||
@NonNull
|
||||
public static List<Song> getSongs(@NonNull final Context context, @NonNull final Bundle extras) {
|
||||
final String query = extras.getString(SearchManager.QUERY, null);
|
||||
final String artistName = extras.getString(MediaStore.EXTRA_MEDIA_ARTIST, null);
|
||||
final String albumName = extras.getString(MediaStore.EXTRA_MEDIA_ALBUM, null);
|
||||
final String titleName = extras.getString(MediaStore.EXTRA_MEDIA_TITLE, null);
|
||||
|
||||
List<Song> songs = new ArrayList<>();
|
||||
|
||||
if (artistName != null && albumName != null && titleName != null) {
|
||||
songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ARTIST_SELECTION + AND + ALBUM_SELECTION + AND + TITLE_SELECTION, new String[]{artistName.toLowerCase().trim(), albumName.toLowerCase().trim(), titleName.toLowerCase().trim()}));
|
||||
}
|
||||
if (!songs.isEmpty()) {
|
||||
return songs;
|
||||
}
|
||||
|
||||
if (artistName != null && titleName != null) {
|
||||
songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ARTIST_SELECTION + AND + TITLE_SELECTION, new String[]{artistName.toLowerCase().trim(), titleName.toLowerCase().trim()}));
|
||||
}
|
||||
if (!songs.isEmpty()) {
|
||||
return songs;
|
||||
}
|
||||
|
||||
if (albumName != null && titleName != null) {
|
||||
songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ALBUM_SELECTION + AND + TITLE_SELECTION, new String[]{albumName.toLowerCase().trim(), titleName.toLowerCase().trim()}));
|
||||
}
|
||||
if (!songs.isEmpty()) {
|
||||
return songs;
|
||||
}
|
||||
|
||||
if (artistName != null) {
|
||||
songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ARTIST_SELECTION, new String[]{artistName.toLowerCase().trim()}));
|
||||
}
|
||||
if (!songs.isEmpty()) {
|
||||
return songs;
|
||||
}
|
||||
|
||||
if (albumName != null) {
|
||||
songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ALBUM_SELECTION, new String[]{albumName.toLowerCase().trim()}));
|
||||
}
|
||||
if (!songs.isEmpty()) {
|
||||
return songs;
|
||||
}
|
||||
|
||||
if (titleName != null) {
|
||||
songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, TITLE_SELECTION, new String[]{titleName.toLowerCase().trim()}));
|
||||
}
|
||||
if (!songs.isEmpty()) {
|
||||
return songs;
|
||||
}
|
||||
|
||||
|
||||
songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ARTIST_SELECTION, new String[]{query.toLowerCase().trim()}));
|
||||
if (!songs.isEmpty()) {
|
||||
return songs;
|
||||
}
|
||||
|
||||
songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, ALBUM_SELECTION, new String[]{query.toLowerCase().trim()}));
|
||||
if (!songs.isEmpty()) {
|
||||
return songs;
|
||||
}
|
||||
|
||||
songs = SongLoader.getSongs(SongLoader.makeSongCursor(context, TITLE_SELECTION, new String[]{query.toLowerCase().trim()}));
|
||||
if (!songs.isEmpty()) {
|
||||
return songs;
|
||||
}
|
||||
|
||||
return SongLoader.getSongs(context, query);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,17 +2,14 @@ package com.kabouzeid.gramophone.ui.activities;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.MediaStore;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.google.android.material.navigation.NavigationView;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
|
@ -24,25 +21,16 @@ 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.SongGlideRequest;
|
||||
import com.kabouzeid.gramophone.helper.MusicPlayerRemote;
|
||||
import com.kabouzeid.gramophone.helper.SearchQueryHelper;
|
||||
import com.kabouzeid.gramophone.loader.AlbumLoader;
|
||||
import com.kabouzeid.gramophone.loader.ArtistLoader;
|
||||
import com.kabouzeid.gramophone.loader.PlaylistSongLoader;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
import com.kabouzeid.gramophone.service.MusicService;
|
||||
import com.kabouzeid.gramophone.ui.activities.base.AbsSlidingMusicPanelActivity;
|
||||
import com.kabouzeid.gramophone.ui.fragments.mainactivity.library.LibraryFragment;
|
||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||
|
||||
import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
|
|
@ -102,7 +90,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
|||
NavigationViewUtil.setItemIconColors(navigationView, ATHUtil.resolveColor(this, R.attr.iconColor, ThemeStore.textColorSecondary(this)), accentColor);
|
||||
NavigationViewUtil.setItemTextColors(navigationView, ThemeStore.textColorPrimary(this), accentColor);
|
||||
|
||||
checkSetUpPro();
|
||||
navigationView.setNavigationItemSelectedListener(menuItem -> {
|
||||
drawerLayout.closeDrawers();
|
||||
switch (menuItem.getItemId()) {
|
||||
|
|
@ -110,9 +97,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
|||
navigationView.setCheckedItem(R.id.nav_library);
|
||||
setCurrentFragment(LibraryFragment.newInstance());
|
||||
break;
|
||||
case R.id.buy_pro:
|
||||
new Handler().postDelayed(() -> startActivity(new Intent(MainActivity.this, PurchaseActivity.class)), 200);
|
||||
break;
|
||||
case R.id.nav_settings:
|
||||
new Handler().postDelayed(() -> startActivity(new Intent(MainActivity.this, SettingsActivity.class)), 200);
|
||||
break;
|
||||
|
|
@ -124,16 +108,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
|||
});
|
||||
}
|
||||
|
||||
private void checkSetUpPro() {
|
||||
if (App.isProVersion()) {
|
||||
setUpPro();
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpPro() {
|
||||
navigationView.getMenu().removeGroup(R.id.navigation_drawer_menu_category_buy_pro);
|
||||
}
|
||||
|
||||
private void setUpDrawerLayout() {
|
||||
setUpNavigationView();
|
||||
}
|
||||
|
|
@ -174,7 +148,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
|||
public void onServiceConnected() {
|
||||
super.onServiceConnected();
|
||||
updateNavigationDrawerHeader();
|
||||
handlePlaybackIntent(getIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -199,71 +172,6 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
|||
return super.handleBackPress() || (currentFragment != null && currentFragment.handleBackPress());
|
||||
}
|
||||
|
||||
private void handlePlaybackIntent(@Nullable Intent intent) {
|
||||
if (intent == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Uri uri = intent.getData();
|
||||
String mimeType = intent.getType();
|
||||
boolean handled = false;
|
||||
|
||||
if (intent.getAction() != null && intent.getAction().equals(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH)) {
|
||||
final List<Song> songs = SearchQueryHelper.getSongs(this, intent.getExtras());
|
||||
if (MusicPlayerRemote.getShuffleMode() == MusicService.SHUFFLE_MODE_SHUFFLE) {
|
||||
MusicPlayerRemote.openAndShuffleQueue(songs, true);
|
||||
} else {
|
||||
MusicPlayerRemote.openQueue(songs, 0, true);
|
||||
}
|
||||
handled = true;
|
||||
}
|
||||
|
||||
if (uri != null && uri.toString().length() > 0) {
|
||||
MusicPlayerRemote.playFromUri(uri);
|
||||
handled = true;
|
||||
} else if (MediaStore.Audio.Playlists.CONTENT_TYPE.equals(mimeType)) {
|
||||
final int id = (int) parseIdFromIntent(intent, "playlistId", "playlist");
|
||||
if (id >= 0) {
|
||||
int position = intent.getIntExtra("position", 0);
|
||||
List<Song> songs = new ArrayList<>(PlaylistSongLoader.getPlaylistSongList(this, id));
|
||||
MusicPlayerRemote.openQueue(songs, position, true);
|
||||
handled = true;
|
||||
}
|
||||
} else if (MediaStore.Audio.Albums.CONTENT_TYPE.equals(mimeType)) {
|
||||
final int id = (int) parseIdFromIntent(intent, "albumId", "album");
|
||||
if (id >= 0) {
|
||||
int position = intent.getIntExtra("position", 0);
|
||||
MusicPlayerRemote.openQueue(AlbumLoader.getAlbum(this, id).songs, position, true);
|
||||
handled = true;
|
||||
}
|
||||
} else if (MediaStore.Audio.Artists.CONTENT_TYPE.equals(mimeType)) {
|
||||
final int id = (int) parseIdFromIntent(intent, "artistId", "artist");
|
||||
if (id >= 0) {
|
||||
int position = intent.getIntExtra("position", 0);
|
||||
MusicPlayerRemote.openQueue(ArtistLoader.getArtist(this, id).getSongs(), position, true);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
if (handled) {
|
||||
setIntent(new Intent());
|
||||
}
|
||||
}
|
||||
|
||||
private long parseIdFromIntent(@NonNull Intent intent, String longKey, String stringKey) {
|
||||
long id = intent.getLongExtra(longKey, -1);
|
||||
if (id < 0) {
|
||||
String idString = intent.getStringExtra(stringKey);
|
||||
if (idString != null) {
|
||||
try {
|
||||
id = Long.parseLong(idString);
|
||||
} catch (NumberFormatException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPanelExpanded(View view) {
|
||||
super.onPanelExpanded(view);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class PurchaseActivity extends AbsBaseActivity implements BillingProcesso
|
|||
setSupportActionBar(toolbar);
|
||||
//noinspection ConstantConditions
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setTitle(getString(R.string.buy_pro));
|
||||
getSupportActionBar().setTitle(getString(R.string.app_name));
|
||||
|
||||
restoreButton.setEnabled(false);
|
||||
purchaseButton.setEnabled(false);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
|
@ -19,9 +18,6 @@ import com.kabouzeid.appthemehelper.ThemeStore;
|
|||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.adapter.SearchAdapter;
|
||||
import com.kabouzeid.gramophone.interfaces.LoaderIds;
|
||||
import com.kabouzeid.gramophone.loader.AlbumLoader;
|
||||
import com.kabouzeid.gramophone.loader.ArtistLoader;
|
||||
import com.kabouzeid.gramophone.loader.SongLoader;
|
||||
import com.kabouzeid.gramophone.misc.WrappedAsyncTaskLoader;
|
||||
import com.kabouzeid.gramophone.ui.activities.base.AbsMusicServiceActivity;
|
||||
import com.kabouzeid.gramophone.util.Util;
|
||||
|
|
@ -192,25 +188,6 @@ public class SearchActivity extends AbsMusicServiceActivity implements SearchVie
|
|||
@Override
|
||||
public List<Object> loadInBackground() {
|
||||
List<Object> results = new ArrayList<>();
|
||||
if (!TextUtils.isEmpty(query)) {
|
||||
List songs = SongLoader.getSongs(getContext(), query.trim());
|
||||
if (!songs.isEmpty()) {
|
||||
results.add(getContext().getResources().getString(R.string.songs));
|
||||
results.addAll(songs);
|
||||
}
|
||||
|
||||
List artists = ArtistLoader.getArtists(getContext(), query.trim());
|
||||
if (!artists.isEmpty()) {
|
||||
results.add(getContext().getResources().getString(R.string.artists));
|
||||
results.addAll(artists);
|
||||
}
|
||||
|
||||
List albums = AlbumLoader.getAlbums(getContext(), query.trim());
|
||||
if (!albums.isEmpty()) {
|
||||
results.add(getContext().getResources().getString(R.string.albums));
|
||||
results.addAll(albums);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,13 +23,4 @@
|
|||
android:title="@string/action_about" />
|
||||
</group>
|
||||
|
||||
<group
|
||||
android:id="@+id/navigation_drawer_menu_category_buy_pro"
|
||||
android:checkableBehavior="none">
|
||||
<item
|
||||
android:id="@+id/buy_pro"
|
||||
android:icon="@drawable/ic_local_play_white_24dp"
|
||||
android:title="@string/buy_pro" />
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">تم رفض الصلاحيات.</string>
|
||||
<string name="permission_external_storage_denied">تم رفض صلاحية الوصول إلى الذاكرة الخارجية.</string>
|
||||
<string name="support_development">دعم التطوير</string>
|
||||
<string name="buy_pro">شراء Phonograph Pro</string>
|
||||
<string name="thank_you">شكراً لك!</string>
|
||||
<string name="restored_previous_purchase_please_restart">تمت استعادة عملية الشراء السابقة. يرجى إعادة تشغيل التطبيق للاستفادة من جميع المميزات.</string>
|
||||
<string name="version">الإصدار</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">"Oprávnění zamítnuta. "</string>
|
||||
<string name="permission_external_storage_denied">"Přístup k otevření externího úložiště zamítnut. "</string>
|
||||
<string name="support_development">Podpořte vývoj</string>
|
||||
<string name="buy_pro">Zakoupit Phonograph Pro</string>
|
||||
<string name="thank_you">"Díky! "</string>
|
||||
<string name="restored_previous_purchase_please_restart">Předchozí nákup byl obnoven. Restartujte aplikaci pro využití všech funkcí.</string>
|
||||
<string name="version">Verze</string>
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@
|
|||
<string name="permissions_denied">Berechtigungen verweigert.</string>
|
||||
<string name="permission_external_storage_denied">Die Berechtigung für den Zugriff auf den externen Speicher wurde verweigert.</string>
|
||||
<string name="support_development">Unterstütze die Entwicklung</string>
|
||||
<string name="buy_pro">Phonograph Pro kaufen</string>
|
||||
<string name="thank_you">Vielen Dank!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Vorheriger Kauf wiederhergestellt. Bitte starte die App neu, um alle Features nutzen zu können.</string>
|
||||
<string name="version">Version</string>
|
||||
|
|
|
|||
|
|
@ -163,7 +163,6 @@
|
|||
<string name="permissions_denied">Permissions denied.</string>
|
||||
<string name="permission_external_storage_denied">Permission to access external storage denied.</string>
|
||||
<string name="support_development">Support development</string>
|
||||
<string name="buy_pro">Buy Phonograph Pro</string>
|
||||
<string name="thank_you">Thank you!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Restored previous purchase. Please restart the app to make use of all features.</string>
|
||||
<string name="version">Version</string>
|
||||
|
|
|
|||
|
|
@ -169,7 +169,6 @@
|
|||
<string name="permissions_denied">Permissions denied.</string>
|
||||
<string name="permission_external_storage_denied">Permission to access external storage denied.</string>
|
||||
<string name="support_development">Support development</string>
|
||||
<string name="buy_pro">Buy Phonograph Pro</string>
|
||||
<string name="thank_you">Thank you!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Restored previous purchase. Please restart the app to make use of all features.</string>
|
||||
<string name="version">Version</string>
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@
|
|||
<string name="permissions_denied">Permisos denegados.</string>
|
||||
<string name="permission_external_storage_denied">Permiso para acceder al almacenamiento externo denegado.</string>
|
||||
<string name="support_development">Apoyar desarrollo</string>
|
||||
<string name="buy_pro">Comprar Phonograph Pro</string>
|
||||
<string name="thank_you">¡Gracias!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Restablecida la última compra. Por favor, reinicie la aplicación para utilizar todas las características.</string>
|
||||
<string name="version">Versión</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">Permisos denegados.</string>
|
||||
<string name="permission_external_storage_denied">Permiso para acceder al almacenamiento externo denegado.</string>
|
||||
<string name="support_development">Apoyar el desarrollo</string>
|
||||
<string name="buy_pro">Comprar Phonograph Pro</string>
|
||||
<string name="thank_you">¡Gracias!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Compra previa restaurada. Por favor reinicie la aplicación para hacer uso de todas las características.</string>
|
||||
<string name="version">Versión</string>
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@
|
|||
<string name="permissions_denied">Sinulla ei ole oikeuksia tähän.</string>
|
||||
<string name="permission_external_storage_denied">Oikeus päästä muistikortille evätty.</string>
|
||||
<string name="support_development">Tue kehitystä</string>
|
||||
<string name="buy_pro">Osta Phonograph Pro</string>
|
||||
<string name="thank_you">Kiitos!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Palautettiin aiempi ostos. Ole hyvä ja käynnistä sovellus uudelleen saadaksesi hyödyn uusista ominaisuuksista.</string>
|
||||
<string name="version">Versio</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">Autorisation refusée.</string>
|
||||
<string name="permission_external_storage_denied">Accès au stockage externe refusé.</string>
|
||||
<string name="support_development">Faire un don</string>
|
||||
<string name="buy_pro">Achetez Phonograph Pro</string>
|
||||
<string name="thank_you">Merci !</string>
|
||||
<string name="restored_previous_purchase_please_restart">Achats précédents restaurés. Veuillez redémarrer l\'application pour débloquer toutes les fonctionnalités</string>
|
||||
<string name="version">Version</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">הרשאות נדחו.</string>
|
||||
<string name="permission_external_storage_denied">הרשאה לגישה לאחסון החיצוני נדחתה.</string>
|
||||
<string name="support_development">תמיכה בפיתוח</string>
|
||||
<string name="buy_pro">קנה את Phonograph Pro</string>
|
||||
<string name="thank_you">תודה לכם!</string>
|
||||
<string name="restored_previous_purchase_please_restart">רכישה קודמת שוחזרה. אנא הפעל מחדש את האפליקציה כדי שתוכל להשתמש באפשרויות החדשות.</string>
|
||||
<string name="version">גרסה</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">Pristup odbijen.</string>
|
||||
<string name="permission_external_storage_denied">Dopuštenje za pristup vanjskoj pohrani je odbijeno.</string>
|
||||
<string name="support_development">Podrži razvoj</string>
|
||||
<string name="buy_pro">Kupi Phonograph Pro</string>
|
||||
<string name="thank_you">Hvala vam!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Prošle kupnje su vraćene. Molimo ponovno pokrenite aplikaciju kako bi omogućili nove značajke.</string>
|
||||
<string name="version">Verzija</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">Jogosultságok megtagadva.</string>
|
||||
<string name="permission_external_storage_denied">Hozzáférés megtagadva a külső tárhelyhez.</string>
|
||||
<string name="support_development">Fejlesztés támogatás</string>
|
||||
<string name="buy_pro">Vásárolja med a Phonograph Pro(t)</string>
|
||||
<string name="thank_you">Köszönöm!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Az előző vásárlás helyreállítása. Kérjük, indítsa újra az alkalmazást az összes funkció használatához.</string>
|
||||
<string name="version">Verzió</string>
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@
|
|||
<string name="permissions_denied">Izin ditolak</string>
|
||||
<string name="permission_external_storage_denied">Izin untuk akses ke memori eksternal ditolak.</string>
|
||||
<string name="support_development">Dukung pengembangan</string>
|
||||
<string name="buy_pro">Beli Phonographo Pro</string>
|
||||
<string name="thank_you">Terima kasih!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Mengembalikan pembelian sebelumnya. Mohon buka kembali aplikasi untuk memakai semua fitur.</string>
|
||||
<string name="version">Versi</string>
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@
|
|||
<string name="permissions_denied">Izin ditolak</string>
|
||||
<string name="permission_external_storage_denied">Izin untuk akses ke memori eksternal ditolak.</string>
|
||||
<string name="support_development">Dukung pengembangan</string>
|
||||
<string name="buy_pro">Beli Phonographo Pro</string>
|
||||
<string name="thank_you">Terima kasih!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Mengembalikan pembelian sebelumnya. Mohon buka kembali aplikasi untuk memakai semua fitur.</string>
|
||||
<string name="version">Versi</string>
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@
|
|||
<string name="permissions_denied">Permesso negato.</string>
|
||||
<string name="permission_external_storage_denied">Permesso per accedere alla memoria esterna negato.</string>
|
||||
<string name="support_development">Supporta lo sviluppo</string>
|
||||
<string name="buy_pro">Acquista Phonograph Pro</string>
|
||||
<string name="thank_you">Grazie!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Ripristinato l\'acquisto precedente. Riavvia l\'app per utilizzare tutte le funzionalità.</string>
|
||||
<string name="version">Versione</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">הרשאות נדחו.</string>
|
||||
<string name="permission_external_storage_denied">הרשאה לגישה לאחסון החיצוני נדחתה.</string>
|
||||
<string name="support_development">תמיכה בפיתוח</string>
|
||||
<string name="buy_pro">קנה את Phonograph Pro</string>
|
||||
<string name="thank_you">תודה לכם!</string>
|
||||
<string name="restored_previous_purchase_please_restart">רכישה קודמת שוחזרה. אנא הפעל מחדש את האפליקציה כדי שתוכל להשתמש באפשרויות החדשות.</string>
|
||||
<string name="version">גרסה</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">権限が拒否されました</string>
|
||||
<string name="permission_external_storage_denied">内部ストレージへのアクセス権限が拒否されました</string>
|
||||
<string name="support_development">開発を支援</string>
|
||||
<string name="buy_pro">Phonograph Proを購入する</string>
|
||||
<string name="thank_you">ありがとう!</string>
|
||||
<string name="restored_previous_purchase_please_restart">過去の購入を復元しました。すべての機能を使用するには、アプリを再起動してください。</string>
|
||||
<string name="version">バージョン</string>
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@
|
|||
<string name="permissions_denied">권한이 거부되었습니다.</string>
|
||||
<string name="permission_external_storage_denied">외부 저장소 접근 권한이 거부되었습니다.</string>
|
||||
<string name="support_development">개발 지원</string>
|
||||
<string name="buy_pro">프로 구매하기</string>
|
||||
<string name="thank_you">감사합니다!</string>
|
||||
<string name="restored_previous_purchase_please_restart">구매를 복원했습니다. 모든 기능을 사용하시려면 앱을 다시 시작해 주세요.</string>
|
||||
<string name="version">버전</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">Machtiging geweigerd.</string>
|
||||
<string name="permission_external_storage_denied">Toegang tot externe opslag geweigerd.</string>
|
||||
<string name="support_development">Ondersteun ontwikkeling</string>
|
||||
<string name="buy_pro">Phonograph Pro kopen</string>
|
||||
<string name="thank_you">Dankjewel!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Verleden aankoop hersteld. Gelieve de app te herstarten om alle functies te benutten.</string>
|
||||
<string name="version">Versie</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">Odmówiono zezwolenia</string>
|
||||
<string name="permission_external_storage_denied">Pozwolenie na dostęp do pamięci zewnętrznej odrzucone</string>
|
||||
<string name="support_development">Wspomóż rozwój</string>
|
||||
<string name="buy_pro">Kup wersję Pro</string>
|
||||
<string name="thank_you">Dziękuję!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Przywrócono poprzedni zakup. Zrestartuj aplikację aby użyć wszystkich funkcji.</string>
|
||||
<string name="version">Wersja</string>
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@
|
|||
<string name="permissions_denied">Permissões negadas.</string>
|
||||
<string name="permission_external_storage_denied">Permissão para acessar armazenamento externo negado.</string>
|
||||
<string name="support_development">Apoiar o desenvolvimento</string>
|
||||
<string name="buy_pro">Habilitar versão Pro do Phonograph</string>
|
||||
<string name="thank_you">Obrigado!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Restituídas compras anteriores. Por favor, reinicie o aplicativo pra usufruir dos novos recursos.</string>
|
||||
<string name="version">Versão</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">Permisiune refuzată.</string>
|
||||
<string name="permission_external_storage_denied">Permisiunea de a accesa stocarea externă a fost respinsă.</string>
|
||||
<string name="support_development">Susţineţi dezvoltarea</string>
|
||||
<string name="buy_pro">Cumpăraţi Phonograph Pro</string>
|
||||
<string name="thank_you">Mulţumesc!</string>
|
||||
<string name="restored_previous_purchase_please_restart">A fost restaurată achiziția anterioară. Reporniți aplicația pentru a utiliza toate funcțiile.</string>
|
||||
<string name="version">Versiune</string>
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@
|
|||
<string name="permissions_denied">В разрешениях отказано.</string>
|
||||
<string name="permission_external_storage_denied">В разрешении на доступ к внешнему хранилищу отказано.</string>
|
||||
<string name="support_development">Поддержать разработку</string>
|
||||
<string name="buy_pro">Купить Phonograph Pro</string>
|
||||
<string name="thank_you">Спасибо!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Восстановлена предыдущая покупка. Пожалуйста, перезагрузите приложение, чтобы использовать все функции.</string>
|
||||
<string name="version">Версия</string>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,6 @@
|
|||
<string name="permissions_denied">İzinler reddedildi.</string>
|
||||
<string name="permission_external_storage_denied">Harici depolamaya erişim izin reddedildi.</string>
|
||||
<string name="support_development">Geliştirmeyi destekleyin</string>
|
||||
<string name="buy_pro">Phonograph Pro\'yu Satın Alın</string>
|
||||
<string name="thank_you">Teşekkürler!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Önceki satın alma geri yüklendi. Tüm özellikleri kullanabilmek için lütfen uygulamayı tekrar başlatın.</string>
|
||||
<string name="version">Sürüm</string>
|
||||
|
|
|
|||
|
|
@ -169,7 +169,6 @@
|
|||
<string name="permissions_denied">У доступі відмовлено.</string>
|
||||
<string name="permission_external_storage_denied">Дозвіл на доступ до зовнішньої пам\'яті відмовлено.</string>
|
||||
<string name="support_development">Підтримати розробника</string>
|
||||
<string name="buy_pro">Придбайте Phonograph Pro</string>
|
||||
<string name="thank_you">Щиро дякую!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Відновлено попередню покупку. Перезапустіть додаток, щоб скористатися всіма функціями.</string>
|
||||
<string name="version">Версія</string>
|
||||
|
|
|
|||
|
|
@ -162,7 +162,6 @@
|
|||
<string name="permissions_denied">Quyền hạn bị từ chối.</string>
|
||||
<string name="permission_external_storage_denied">Quyền truy cập lưu trữ bên ngoài bị từ chối.</string>
|
||||
<string name="support_development">Hỗ trợ phát triển</string>
|
||||
<string name="buy_pro">Mua Phonograph Pro</string>
|
||||
<string name="thank_you">Cảm ơn!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Khôi phục mua trước đó. Vui lòng khởi động lại ứng dụng để sử dụng tất cả các tính năng.</string>
|
||||
<string name="version">Phiên bản</string>
|
||||
|
|
|
|||
|
|
@ -172,7 +172,6 @@
|
|||
<string name="permissions_denied">未能获取权限。</string>
|
||||
<string name="permission_external_storage_denied">访问外部存储权限被拒绝。</string>
|
||||
<string name="support_development">支持开发者</string>
|
||||
<string name="buy_pro">购买 Phonograph Pro</string>
|
||||
<string name="thank_you">非常感谢您!</string>
|
||||
<string name="restored_previous_purchase_please_restart">已恢复购买状态。请重启应用以使用所有功能。</string>
|
||||
<string name="version">版本</string>
|
||||
|
|
|
|||
|
|
@ -175,7 +175,6 @@
|
|||
<string name="permissions_denied">存取被拒</string>
|
||||
<string name="permission_external_storage_denied">無法取得存取外部儲存空間的權限。</string>
|
||||
<string name="support_development">支援開發</string>
|
||||
<string name="buy_pro">購買 Phonograph Pro</string>
|
||||
<string name="thank_you">感謝您!</string>
|
||||
<string name="restored_previous_purchase_please_restart">恢復購買成功。請重啟應用以使用完整功能。</string>
|
||||
<string name="version">版本</string>
|
||||
|
|
|
|||
|
|
@ -184,7 +184,6 @@
|
|||
<string name="permissions_denied">Permissions denied.</string>
|
||||
<string name="permission_external_storage_denied">Permission to access external storage denied.</string>
|
||||
<string name="support_development">Support development</string>
|
||||
<string name="buy_pro">Buy Phonograph Pro</string>
|
||||
<string name="thank_you">Thank you!</string>
|
||||
<string name="restored_previous_purchase_please_restart">Restored previous purchase. Please restart the app to make use of all features.</string>
|
||||
<string name="version">Version</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue