Compare commits
4 commits
1dde72d2c6
...
49e79b723f
Author | SHA1 | Date | |
---|---|---|---|
49e79b723f | |||
b09c81568b | |||
d877db3b98 | |||
ca0e77a645 |
4 changed files with 32 additions and 8 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
bin/
|
|
@ -2,12 +2,12 @@
|
|||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.arkiwi.app"
|
||||
android:versionCode="3"
|
||||
android:versionName="CRUSCA" >
|
||||
android:versionCode="4"
|
||||
android:versionName="MAIS" >
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
android:targetSdkVersion="10"
|
||||
android:maxSdkVersion="18"
|
||||
android:maxSdkVersion="25"
|
||||
/>
|
||||
<!-- check per la rete -->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#4a4a4a">
|
||||
android:background="#4a4a4a"
|
||||
android:keepScreenOn="true">
|
||||
|
||||
<!-- Player Header -->
|
||||
<LinearLayout
|
||||
|
@ -183,4 +184,4 @@
|
|||
android:layout_marginLeft="5dp"
|
||||
android:background="@null"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -18,6 +18,7 @@ import android.os.Bundle;
|
|||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
@ -40,6 +41,8 @@ public class MusicPlayerActivity extends Activity implements OnCompletionListene
|
|||
// Media Player
|
||||
private MediaPlayer mp;
|
||||
// Handler to update UI timer, progress bar etc,.
|
||||
private WindowManager.LayoutParams layout;
|
||||
|
||||
private Handler mHandler = new Handler();
|
||||
private SongsManager songManager;
|
||||
private Utilities utils;
|
||||
|
@ -54,6 +57,9 @@ public class MusicPlayerActivity extends Activity implements OnCompletionListene
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.pl_player);
|
||||
|
||||
layout = getWindow().getAttributes();
|
||||
|
||||
Log.d(LOG_TAG, "onCreate()");
|
||||
// All player buttons
|
||||
btnPlay = (ImageButton) findViewById(R.id.btnPlay);
|
||||
|
@ -265,6 +271,9 @@ public class MusicPlayerActivity extends Activity implements OnCompletionListene
|
|||
|
||||
@Override
|
||||
public void onClick(View arg0) {
|
||||
layout.screenBrightness = -1;
|
||||
getWindow().setAttributes(layout);
|
||||
|
||||
Intent i = new Intent(getApplicationContext(), PlayListActivity.class);
|
||||
startActivityForResult(i, 100);
|
||||
}
|
||||
|
@ -275,6 +284,7 @@ public class MusicPlayerActivity extends Activity implements OnCompletionListene
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
resumeSong();
|
||||
}
|
||||
|
||||
|
@ -292,6 +302,9 @@ public class MusicPlayerActivity extends Activity implements OnCompletionListene
|
|||
} else {
|
||||
playng=true;
|
||||
}
|
||||
|
||||
layout.screenBrightness = 0.1f;
|
||||
getWindow().setAttributes(layout);
|
||||
}
|
||||
|
||||
return playng;
|
||||
|
@ -306,10 +319,10 @@ public class MusicPlayerActivity extends Activity implements OnCompletionListene
|
|||
int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if(resultCode == 100){
|
||||
currentSongIndex = data.getExtras().getInt("songIndex");
|
||||
currentSongIndex = data.getExtras().getInt("songIndex");
|
||||
Log.d(LOG_TAG, "onActivityResult(), dalla playlist "+currentSongIndex);
|
||||
// play selected song
|
||||
playSong(currentSongIndex);
|
||||
// play selected song
|
||||
playSong(currentSongIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -322,6 +335,10 @@ public class MusicPlayerActivity extends Activity implements OnCompletionListene
|
|||
// Play song
|
||||
try {
|
||||
Log.d(LOG_TAG, "playSong() "+songIndex);
|
||||
|
||||
layout.screenBrightness = 0.1f;
|
||||
getWindow().setAttributes(layout);
|
||||
|
||||
mp.reset();
|
||||
mp.setDataSource(songsList.get(songIndex).get("songPath"));
|
||||
mp.prepare();
|
||||
|
@ -448,6 +465,9 @@ public class MusicPlayerActivity extends Activity implements OnCompletionListene
|
|||
if(mp != null) {
|
||||
if(mp.isPlaying()){
|
||||
mp.pause();
|
||||
|
||||
layout.screenBrightness = -1;
|
||||
getWindow().setAttributes(layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -456,6 +476,8 @@ public class MusicPlayerActivity extends Activity implements OnCompletionListene
|
|||
public void onDestroy(){
|
||||
Log.d(LOG_TAG, "onDestroy()");
|
||||
super.onDestroy();
|
||||
layout.screenBrightness = -1;
|
||||
getWindow().setAttributes(layout);
|
||||
if(mp != null) {
|
||||
mHandler.removeCallbacks(mUpdateTimeTask);
|
||||
mp.release();
|
||||
|
|
Loading…
Reference in a new issue