Merge pull request #192 from xbao/feature/static_analysis_fixes

static analysis fixes
This commit is contained in:
Adrian Ulrich 2015-08-22 10:14:55 +02:00
commit 9cc91787c0
12 changed files with 34 additions and 84 deletions

View File

@ -23,6 +23,8 @@ THE SOFTWARE.
<ch.blinkenlights.android.vanilla.ActionBarControls
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="?android:attr/selectableItemBackground"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:clickable="true">
<ImageView
android:id="@+id/cover"

View File

@ -52,7 +52,6 @@ THE SOFTWARE.
/>
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"

View File

@ -38,6 +38,7 @@ THE SOFTWARE.
android:layout_gravity="bottom|left">
<LinearLayout
android:id="@+id/limiter_layout"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="fill_parent" />
</HorizontalScrollView>

View File

@ -1,70 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2010, 2011 Christopher Eby <kreed@kreed.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/controls"
android:background="@drawable/music_bottom_playback_bg"
android:layout_width="fill_parent"
android:layout_height="80dip">
<TextView
android:id="@+id/empty_queue"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/empty_queue"
android:visibility="gone" />
<ImageView
android:id="@+id/cover"
android:scaleType="fitCenter"
android:layout_width="80dip"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:contentDescription="@string/cover_art" />
<LinearLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:textSize="14sp"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/artist"
android:textSize="12sp"
android:singleLine="true"
android:ellipsize="marquee"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include layout="@layout/controls" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -22,6 +22,8 @@ THE SOFTWARE.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ch.blinkenlights.android.vanilla.LazyCoverView
android:id="@+id/cover"

View File

@ -175,7 +175,7 @@ public class CoverCache {
* Creates a new in-memory LRU cache
*
* @param context the application context
* @param int the lru cache size in bytes
* @param size the lru cache size in bytes
*/
public BitmapLruCache(Context context, int size) {
super(size);

View File

@ -644,7 +644,7 @@ public class FullPlaybackActivity extends PlaybackActivity
*/
private static final int MSG_UPDATE_POSITION = 17;
/**
* Calls {@link #seekToProgress()}.
* Calls {@link PlaybackService#seekToProgress(int)}.
*/
private static final int MSG_SEEK_TO_PROGRESS = 18;

View File

@ -191,7 +191,7 @@ public class LazyCoverView extends ImageView
* Updates the view with a cached bitmap
* A fallback image will be used on cache miss
*
* @param payload The cover message containing the cache key and view to use
* @param key The cover message containing the cache key and view to use
*/
public boolean drawFromCache(CoverCache.CoverKey key, boolean fadeIn) {
boolean cacheHit = true;

View File

@ -77,7 +77,6 @@ public class NewPlaylistDialog extends Dialog implements TextWatcher, View.OnCli
* disabled when the EditText contains this text.
* @param actionText A string resource describing the default positive
* action (e.g. "Create").
* @param intent An optional intent to store with the dialog.
*/
public NewPlaylistDialog(Context context, String initialText, int actionText, PlaylistTask playlistTask)
{

View File

@ -200,7 +200,7 @@ public class Playlist {
* Copy content from one playlist to another
*
* @param resolver A ContentResolver to use.
* @param sourceid The Media.Audio.Playlists id of the source playlist
* @param sourceId The Media.Audio.Playlists id of the source playlist
* @param destinationId The Media.Audio.Playlists id of the destination playlist
*/
private static void _copyToPlaylist(ContentResolver resolver, long sourceId, long destinationId) {

View File

@ -19,8 +19,9 @@ package ch.blinkenlights.android.vanilla;
import java.util.ArrayList;
import android.app.Activity;
import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.view.View;
@ -29,7 +30,6 @@ import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;
import com.mobeta.android.dslv.DragSortListView;
public class ShowQueueActivity extends PlaybackActivity
@ -41,7 +41,7 @@ public class ShowQueueActivity extends PlaybackActivity
private ShowQueueAdapter listAdapter;
private PlaybackService mService;
@Override
@Override
public void onCreate(Bundle savedInstanceState) {
ThemeHelper.setTheme(this, R.style.BackActionBar);
super.onCreate(savedInstanceState);
@ -84,7 +84,7 @@ public class ShowQueueActivity extends PlaybackActivity
/**
* Called after the user selected an action from the ActionBar
*
*
* @param item The selected menu item
*/
@Override
@ -208,12 +208,25 @@ public class ShowQueueActivity extends PlaybackActivity
listAdapter.add(mService.getSongByQueuePosition(i));
}
if (scroll == true)
mListView.setSelectionFromTop(spos, 0); /* scroll to currently playing song */
if(scroll)
scrollToCurrentSong(spos);
}
});
}
/**
* Scrolls to the current song<br/>
* We suppress the new api lint check as lint thinks
* {@link android.widget.AbsListView#setSelectionFromTop(int, int)} was only added in
* {@link Build.VERSION_CODES#JELLY_BEAN}, but it was actually added in API
* level 1<br/>
* <a href="https://developer.android.com/reference/android/widget/AbsListView.html#setSelectionFromTop%28int,%20int%29">
* Android reference: AbsListView.setSelectionFromTop()</a>
* @param currentSongPosition The position in {@link #mListView} of the current song
*/
@SuppressLint("NewApi")
private void scrollToCurrentSong(int currentSongPosition){
mListView.setSelectionFromTop(currentSongPosition, 0); /* scroll to currently playing song */
}
}

View File

@ -18,10 +18,13 @@
package ch.blinkenlights.android.vanilla;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.media.audiofx.AudioEffect;
import android.os.Build;
import java.io.IOException;
public class VanillaMediaPlayer extends MediaPlayer {
@ -74,6 +77,7 @@ public class VanillaMediaPlayer extends MediaPlayer {
/**
* Sets the next media player data source
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void setNextMediaPlayer(VanillaMediaPlayer next) {
super.setNextMediaPlayer(next);
mHasNextMediaPlayer = (next != null);