diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | app/src/main/assets/.gitignore | 2 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java | 18 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java | 23 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java | 30 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java | 27 | ||||
-rw-r--r-- | app/src/main/res/layout/queue_listitem.xml | 6 | ||||
-rw-r--r-- | app/src/main/res/menu/queue.xml | 6 | ||||
-rw-r--r-- | app/src/main/templates/about.html (renamed from app/src/main/assets/about.html) | 6 |
9 files changed, 99 insertions, 21 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7a4c8366e..97f8bbdad 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,7 +2,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.danoeh.antennapod" android:versionCode="51" - android:versionName="1.1.1"> + android:versionName="1.2"> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> diff --git a/app/src/main/assets/.gitignore b/app/src/main/assets/.gitignore new file mode 100644 index 000000000..328840cfc --- /dev/null +++ b/app/src/main/assets/.gitignore @@ -0,0 +1,2 @@ +# this file is generated automatically +about.html diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java index a256dc129..bba5a00a9 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/QueueListAdapter.java @@ -14,9 +14,9 @@ import android.widget.TextView; import com.squareup.picasso.Picasso; import de.danoeh.antennapod.R; -import de.danoeh.antennapod.core.feed.EventDistributor; import de.danoeh.antennapod.core.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.storage.DownloadRequester; import de.danoeh.antennapod.core.util.Converter; @@ -31,6 +31,8 @@ public class QueueListAdapter extends BaseAdapter { private final ActionButtonCallback actionButtonCallback; private final ActionButtonUtils actionButtonUtils; + private boolean locked; + public QueueListAdapter(Context context, ItemAccess itemAccess, ActionButtonCallback actionButtonCallback) { super(); @@ -38,6 +40,12 @@ public class QueueListAdapter extends BaseAdapter { this.itemAccess = itemAccess; this.actionButtonUtils = new ActionButtonUtils(context); this.actionButtonCallback = actionButtonCallback; + locked = UserPreferences.isQueueLocked(); + } + + public void setLocked(boolean locked) { + this.locked = locked; + notifyDataSetChanged(); } @Override @@ -67,6 +75,7 @@ public class QueueListAdapter extends BaseAdapter { .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.queue_listitem, parent, false); + holder.dragHandle = (ImageView) convertView.findViewById(R.id.drag_handle); holder.imageView = (ImageView) convertView.findViewById(R.id.imgvImage); holder.title = (TextView) convertView.findViewById(R.id.txtvTitle); holder.pubDate = (TextView) convertView.findViewById(R.id.txtvPubDate); @@ -83,6 +92,12 @@ public class QueueListAdapter extends BaseAdapter { holder = (Holder) convertView.getTag(); } + if(locked) { + holder.dragHandle.setVisibility(View.GONE); + } else { + holder.dragHandle.setVisibility(View.VISIBLE); + } + holder.title.setText(item.getTitle()); FeedMedia media = item.getMedia(); @@ -143,6 +158,7 @@ public class QueueListAdapter extends BaseAdapter { static class Holder { + ImageView dragHandle; ImageView imageView; TextView title; TextView pubDate; diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index f1ed6c656..4263fbfad 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -48,7 +48,6 @@ import de.danoeh.antennapod.core.util.QueueSorter; import de.danoeh.antennapod.core.util.gui.FeedItemUndoToken; import de.danoeh.antennapod.core.util.gui.UndoBarController; import de.danoeh.antennapod.menuhandler.MenuItemUtils; -import de.danoeh.antennapod.menuhandler.NavDrawerActivity; import de.greenrobot.event.EventBus; /** @@ -67,6 +66,8 @@ public class QueueFragment extends Fragment { private TextView txtvEmpty; private ProgressBar progLoading; + private MenuItem queueLock; + private UndoBarController<FeedItemUndoToken> undoBarController; private List<FeedItem> queue; @@ -221,6 +222,9 @@ public class QueueFragment extends Fragment { return false; } }); + + MenuItemUtils.refreshLockItem(getActivity(), menu, queueLock); + isUpdatingFeeds = MenuItemUtils.updateRefreshMenuItem(menu, R.id.refresh_item, updateRefreshMenuItemChecker); } } @@ -229,6 +233,17 @@ public class QueueFragment extends Fragment { public boolean onOptionsItemSelected(MenuItem item) { if (!super.onOptionsItemSelected(item)) { switch (item.getItemId()) { + case R.id.queue_lock: + boolean locked = !UserPreferences.isQueueLocked(); + if(locked) { + listView.setDragEnabled(false); + } else { + listView.setDragEnabled(true); + } + UserPreferences.setQueueLocked(locked); + getActivity().supportInvalidateOptionsMenu(); + listAdapter.setLocked(locked); + return true; case R.id.refresh_item: List<Feed> feeds = ((MainActivity) getActivity()).getFeeds(); if (feeds != null) { @@ -330,6 +345,12 @@ public class QueueFragment extends Fragment { progLoading = (ProgressBar) root.findViewById(R.id.progLoading); listView.setEmptyView(txtvEmpty); + if(UserPreferences.isQueueLocked()) { + listView.setDragEnabled(false); + } else { + listView.setDragEnabled(true); + } + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java index b78bfd01a..edefb7d46 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/MenuItemUtils.java @@ -1,11 +1,16 @@ package de.danoeh.antennapod.menuhandler; +import android.content.Context; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.os.Build; import android.support.v4.view.MenuItemCompat; import android.support.v7.widget.SearchView; import android.view.Menu; import android.view.MenuItem; import de.danoeh.antennapod.core.R; +import de.danoeh.antennapod.core.preferences.UserPreferences; /** * Utilities for menu items @@ -14,9 +19,32 @@ public class MenuItemUtils extends de.danoeh.antennapod.core.menuhandler.MenuIte public static MenuItem addSearchItem(Menu menu, SearchView searchView) { MenuItem item = menu.add(Menu.NONE, R.id.search_item, Menu.NONE, R.string.search_label); - MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); + MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW | MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); MenuItemCompat.setActionView(item, searchView); + + if(Build.VERSION.SDK_INT < 14) { + SearchView.SearchAutoComplete textField = (SearchView.SearchAutoComplete) searchView.findViewById(de.danoeh.antennapod.R.id.search_src_text); + if(UserPreferences.getTheme() == de.danoeh.antennapod.R.style.Theme_AntennaPod_Dark) { + textField.setTextColor(Resources.getSystem().getColor(android.R.color.white)); + } else { + textField.setTextColor(Resources.getSystem().getColor(android.R.color.black)); + } + } + return item; } + public static void refreshLockItem(Context context, Menu menu, MenuItem queueLock) { + queueLock = menu.findItem(de.danoeh.antennapod.R.id.queue_lock); + int[] lockIcons = new int[] { de.danoeh.antennapod.R.attr.ic_lock_open, de.danoeh.antennapod.R.attr.ic_lock_closed }; + TypedArray ta = context.obtainStyledAttributes(lockIcons); + if (UserPreferences.isQueueLocked()) { + queueLock.setTitle(de.danoeh.antennapod.R.string.unlock_queue); + queueLock.setIcon(ta.getDrawable(1)); + } else { + queueLock.setTitle(de.danoeh.antennapod.R.string.lock_queue); + queueLock.setIcon(ta.getDrawable(0)); + } + } + } diff --git a/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java b/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java index 1d9e8e412..0d00823d3 100644 --- a/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java +++ b/app/src/main/java/de/danoeh/antennapod/service/PlayerWidgetService.java @@ -52,19 +52,20 @@ public class PlayerWidgetService extends Service { public void onDestroy() { super.onDestroy(); Log.d(TAG, "Service is about to be destroyed"); - - Playable playable = playbackService.getPlayable(); - if(playable != null && playable instanceof FeedMedia) { - FeedMedia media = (FeedMedia) playable; - if(media.hasAlmostEnded()) { - Log.d(TAG, "smart mark as read"); - FeedItem item = media.getItem(); - DBWriter.markItemRead(this, item, true, false); - DBWriter.removeQueueItem(this, item, false); - DBWriter.addItemToPlaybackHistory(this, media); - if (UserPreferences.isAutoDelete()) { - Log.d(TAG, "Delete " + media.toString()); - DBWriter.deleteFeedMediaOfItem(this, media.getId()); + if (playbackService != null) { + Playable playable = playbackService.getPlayable(); + if (playable != null && playable instanceof FeedMedia) { + FeedMedia media = (FeedMedia) playable; + if (media.hasAlmostEnded()) { + Log.d(TAG, "smart mark as read"); + FeedItem item = media.getItem(); + DBWriter.markItemRead(this, item, true, false); + DBWriter.removeQueueItem(this, item, false); + DBWriter.addItemToPlaybackHistory(this, media); + if (UserPreferences.isAutoDelete()) { + Log.d(TAG, "Delete " + media.toString()); + DBWriter.deleteFeedMediaOfItem(this, media.getId()); + } } } } diff --git a/app/src/main/res/layout/queue_listitem.xml b/app/src/main/res/layout/queue_listitem.xml index bc5b951a2..39e9c72a5 100644 --- a/app/src/main/res/layout/queue_listitem.xml +++ b/app/src/main/res/layout/queue_listitem.xml @@ -1,17 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="@dimen/listitem_threeline_height" android:orientation="horizontal" + android:paddingLeft="16dp" tools:background="@android:color/darker_gray" > <ImageView android:id="@+id/drag_handle" android:layout_width="100dp" android:layout_height="match_parent" - android:layout_marginLeft="8dp" + android:layout_marginLeft="-8dp" android:layout_marginRight="-64dp" android:contentDescription="@string/drag_handle_content_description" android:scaleType="fitXY" diff --git a/app/src/main/res/menu/queue.xml b/app/src/main/res/menu/queue.xml index c7dd4d371..127a17f7d 100644 --- a/app/src/main/res/menu/queue.xml +++ b/app/src/main/res/menu/queue.xml @@ -4,6 +4,12 @@ xmlns:custom="http://schemas.android.com/apk/res-auto"> <item + android:id="@+id/queue_lock" + android:title="" + android:menuCategory="container" + custom:showAsAction="always" /> + + <item android:id="@+id/refresh_item" android:title="@string/refresh_label" android:menuCategory="container" diff --git a/app/src/main/assets/about.html b/app/src/main/templates/about.html index af7297564..3a48eeec1 100644 --- a/app/src/main/assets/about.html +++ b/app/src/main/templates/about.html @@ -41,9 +41,11 @@ <div id="header" align="center"> <img src="logo.png" alt="Logo" width="100px" height="100px"/> - <p>AntennaPod, Version 1.1</p> + <p>AntennaPod, Version @versionname@, Build @versioncode@</p> - <p>Copyright © 2014 Daniel Oeh</p> + <p>Created by Daniel Oeh</p> + + <p>Copyright © 2015 AntennaPod Contributors <a href="https://github.com/AntennaPod/AntennaPod/blob/master/CONTRIBUTORS">(View)</a></p> <p>Licensed under the MIT License <a href="LICENSE.html">(View)</a></p> </div> |