/*
* Copyright (C) 2009 Teleca Poland Sp. z o.o. <android@teleca.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.teleca.jamendo.activity;
import java.util.List;
import org.json.JSONException;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.gesture.GestureOverlayView;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.TextUtils.TruncateAt;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.RatingBar;
import android.widget.SlidingDrawer;
import android.widget.TextView;
import android.widget.Toast;
import com.teleca.jamendo.JamendoApplication;
import com.teleca.jamendo.R;
import com.teleca.jamendo.api.Album;
import com.teleca.jamendo.api.JamendoGet2Api;
import com.teleca.jamendo.api.License;
import com.teleca.jamendo.api.Playlist;
import com.teleca.jamendo.api.PlaylistEntry;
import com.teleca.jamendo.api.PlaylistRemote;
import com.teleca.jamendo.api.Track;
import com.teleca.jamendo.api.WSError;
import com.teleca.jamendo.api.Playlist.PlaylistPlaybackMode;
import com.teleca.jamendo.api.impl.JamendoGet2ApiImpl;
import com.teleca.jamendo.dialog.AddToPlaylistDialog;
import com.teleca.jamendo.dialog.LoadingDialog;
import com.teleca.jamendo.dialog.LyricsDialog;
import com.teleca.jamendo.dialog.PlayerAlbumLoadingDialog;
import com.teleca.jamendo.dialog.PlaylistRemoteLoadingDialog;
import com.teleca.jamendo.media.PlayerEngine;
import com.teleca.jamendo.media.PlayerEngineListener;
import com.teleca.jamendo.util.Helper;
import com.teleca.jamendo.util.OnSeekToListenerImp;
import com.teleca.jamendo.util.SeekToMode;
import com.teleca.jamendo.widget.ReflectableLayout;
import com.teleca.jamendo.widget.ReflectiveSurface;
import com.teleca.jamendo.widget.RemoteImageView;
/**
* Central part of the UI. Touching cover fades in 4-way media buttons.
* 4-way media buttons fade out after certain amount of time. Other parts
* of layout are progress bar, total play time, played time, song title,
* artist name and jamendo slider.<br><br>
*
* License information is implemented overlaying CreativeCommons logo over
* the album picture. Information about type of license is retrieved concurrently
* to track bufferring.
*
* @author Lukasz Wisniewski
*/
public class PlayerActivity extends Activity {
private PlayerEngine getPlayerEngine(){
return JamendoApplication.getInstance().getPlayerEngineInterface();
};
private Playlist mPlaylist;
private Album mCurrentAlbum;
// XML layout
private TextView mArtistTextView;
private TextView mSongTextView;
private TextView mCurrentTimeTextView;
private TextView mTotalTimeTextView;
private RatingBar mRatingBar;
private ProgressBar mProgressBar;
private ImageButton mPlayImageButton;
private ImageButton mNextImageButton;
private ImageButton mPrevImageButton;
private ImageButton mStopImageButton;
private ImageButton mShuffleImageButton;
private ImageButton mRepeatImageButton;
private RemoteImageView mCoverImageView;
private RemoteImageView mLicenseImageView;
private GestureOverlayView mGesturesOverlayView;
private Animation mFadeInAnimation;
private Animation mFadeOutAnimation;
private ReflectableLayout mReflectableLayout;
private ReflectiveSurface mReflectiveSurface;
private String mBetterRes;
private SlidingDrawer mSlidingDrawer;
private LoadingDialog mUriLoadingDialog;
SeekToMode seekToMode;
Handler mHandlerOfFadeOutAnimation;
Runnable mRunnableOfFadeOutAnimation;
/**
* Launch this Activity from the outside, with defined playlist
*
* @param c context from which Activity should be started
* @param a playlist to be played
*/
public static void launch(Context c, Playlist playlist){
Intent intent = new Intent(c, PlayerActivity.class);
intent.putExtra("playlist", playlist);
/*
* For example, consider a task consisting of the activities:
* A, B, C, D. If D calls startActivity() with an Intent that
* resolves to the component of activity B, then C and D will
* be finished and B receive the given Intent, resulting in
* the stack now being: A, B.
*/
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP );
c.startActivity(intent);
}
/**
* Launch this Activity from the outside, with defined playlist on a remote server
*
* @param c
* @param playlistRemote
*/
public static void launch(Activity c, PlaylistRemote playlistRemote){
Intent intent = new Intent(c, PlayerActivity.class);
new PlaylistRemoteLoadingDialog(c, R.string.loading_playlist, R.string.loading_playlist_fail, intent).execute(playlistRemote);
}
/**
* Launch this Activity from the outside with the given album
*
* @param c Activity from which PlayerActivity should be started
* @param album an album to be played
*/
public static void launch(Activity c, Album album){
new PlayerAlbumLoadingDialog(c, R.string.album_loading, R.string.album_fail).execute(album);
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(JamendoApplication.TAG, "PlayerActivity.onCreate");
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.player);
// XML binding
mBetterRes = getResources().getString(R.string.better_res);
mArtistTextView = (TextView)findViewById(R.id.ArtistTextView);
mSongTextView = (TextView)findViewById(R.id.SongTextView);
//AutoScrolling of long song titles
mSongTextView.setEllipsize(TruncateAt.MARQUEE);
mSongTextView.setHorizontallyScrolling(true);
mSongTextView.setSelected(true);
mCurrentTimeTextView = (TextView)findViewById(R.id.CurrentTimeTextView);
mTotalTimeTextView = (TextView)findViewById(R.id.TotalTimeTextView);
mRatingBar = (RatingBar) findViewById(R.id.TrackRowRatingBar);
mCoverImageView = (RemoteImageView)findViewById(R.id.CoverImageView);
mCoverImageView.setOnClickListener(mCoverOnClickListener);
mCoverImageView.setDefaultImage(R.drawable.no_cd_300);
mProgressBar = (ProgressBar)findViewById(R.id.ProgressBar);
mReflectableLayout = (ReflectableLayout)findViewById(R.id.ReflectableLayout);
mReflectiveSurface = (ReflectiveSurface)findViewById(R.id.ReflectiveSurface);
if(mReflectableLayout != null && mReflectiveSurface != null){
mReflectableLayout.setReflectiveSurface(mReflectiveSurface);
mReflectiveSurface.setReflectableLayout(mReflectableLayout);
}
handleIntent();
//used for Fade Out Animation handle control
mHandlerOfFadeOutAnimation = new Handler();
mRunnableOfFadeOutAnimation =new Runnable(){
public void run() {
if ( mFadeInAnimation.hasEnded() )
mPlayImageButton.startAnimation(mFadeOutAnimation);
}
没有合适的资源?快使用搜索试试~ 我知道了~
小程序 在线音乐播放器完整项目.rar
共292个文件
java:113个
png:95个
xml:68个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 17 浏览量
2023-02-03
11:53:18
上传
评论
收藏 2.77MB RAR 举报
温馨提示
免责声明:资料部分来源于合法的互联网渠道收集和整理,部分自己学习积累成果,供大家学习参考与交流。收取的费用仅用于收集和整理资料耗费时间的酬劳。 本人尊重原创作者或出版方,资料版权归原作者或出版方所有,本人不对所涉及的版权问题或内容负法律责任。如有侵权,请举报或通知本人删除。
资源推荐
资源详情
资源评论
收起资源包目录
小程序 在线音乐播放器完整项目.rar (292个子文件)
droidshare.tar.bz2 4.06MB
com_weibo_android.tar.bz2 1.32MB
proguard.cfg 1KB
.classpath 273B
gestures 2KB
.gitignore 27B
PlayerActivity.java 28KB
JamendoGet2ApiImpl.java 15KB
RemoteImageView.java 13KB
HomeActivity.java 13KB
BrowsePlaylistActivity.java 13KB
PlayerEngineImpl.java 11KB
AlbumActivity.java 10KB
PlayerService.java 10KB
SearchActivity.java 10KB
DatabaseImpl.java 9KB
JamendoApplication.java 9KB
RadioActivity.java 9KB
Playlist.java 8KB
PlaylistActivity.java 8KB
JamendoGet2Api.java 8KB
DownloadActivity.java 8KB
DownloadDatabaseImpl.java 7KB
ArtistActivity.java 7KB
DownloadTask.java 6KB
DownloadManagerImpl.java 5KB
DownloadService.java 4KB
AddToPlaylistDialog.java 4KB
Caller.java 4KB
ReviewAdapter.java 4KB
SeparatedListAdapter.java 4KB
Helper.java 4KB
PlaylistAdapter.java 3KB
DownloadProviderDbImpl.java 3KB
DownloadJob.java 3KB
AboutDialog.java 3KB
IntentDistributorActivity.java 3KB
LoadingDialog.java 3KB
LyricsDialog.java 3KB
DownloadJobAdapter.java 3KB
Track.java 3KB
AlbumLoadingDialog.java 3KB
SplashscreenActivity.java 3KB
TrackDatabaseBuilder.java 3KB
Review.java 3KB
AlbumAdapter.java 3KB
SettingsActivity.java 2KB
RadioAdapter.java 2KB
OnSeekToListenerImp.java 2KB
DrawableAccessor.java 2KB
Artist.java 2KB
AlbumBar.java 2KB
MediaScannerNotifier.java 2KB
Database.java 2KB
PlayerEngine.java 2KB
XMLUtil.java 2KB
PurpleAdapter.java 2KB
StarredAlbumsActivity.java 2KB
DownloadManager.java 2KB
ArtistLoadingDialog.java 2KB
AlbumDatabaseBuilder.java 2KB
DownloadJobBuilder.java 2KB
PlayerAlbumLoadingDialog.java 2KB
Album.java 2KB
RSSFunctions.java 2KB
ArrayListAdapter.java 2KB
DownloadDatabase.java 2KB
PlaylistRemoteAdapter.java 2KB
FailureBar.java 2KB
GesturesHandler.java 2KB
PlaylistRemoteLoadingDialog.java 2KB
AlbumGridAdapter.java 2KB
StarredAlbumLoading.java 2KB
ReflectiveSurface.java 2KB
PlayerEngineListener.java 2KB
ReflectableLayout.java 2KB
ImageAdapter.java 2KB
DownloadHelper.java 2KB
RadioDatabaseBuilder.java 2KB
PurpleEntry.java 2KB
ProgressBar.java 2KB
ReviewBuilder.java 2KB
AlbumBuilder.java 1KB
TrackBuilder.java 1KB
RequestCache.java 1KB
PlaylistRemote.java 1KB
ArtistBar.java 1KB
ArtistBuilder.java 1KB
Radio.java 1KB
DownloadProvider.java 1KB
PlaylistFunctions.java 1KB
ArtistFunctions.java 1KB
RadioFunctions.java 1KB
DatabaseBuilder.java 1KB
TutorialDialog.java 1KB
ReviewFunctions.java 1KB
PlaylistBuilder.java 1KB
RadioBuilder.java 1KB
PlaylistEntry.java 1KB
AlbumFunctions.java 1KB
共 292 条
- 1
- 2
- 3
资源评论
大富大贵7
- 粉丝: 389
- 资源: 8868
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功