This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onClick(View v) { | |
if (streamMusic != null) { | |
EditText t = (EditText)findViewById(R.id.entry); | |
String s = t.getText().toString(); | |
// send play/pause command | |
streamMusic.playPause(this, s); | |
} | |
else { | |
Log.d(APP, "service not bound yet."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// establish the connection | |
private void connectToService() { | |
try { | |
bindService(new Intent(this, StreamMusic.class), onService, BIND_AUTO_CREATE); | |
} | |
catch (Exception e) { | |
Log.e(APP, "error binding to service.", e); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="rawAudio.apk" | |
android:versionCode="1" | |
android:versionName="1.0"> | |
<application android:label="@string/app_name" | |
android:icon="@drawable/icon48x48" > | |
<activity android:name=".RawAudio" | |
android:label="@string/app_name"> | |
<intent-filter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package rawAudio.apk; | |
import java.io.IOException; | |
import android.app.ProgressDialog; | |
import android.app.Service; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.media.MediaPlayer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// called from the main activity | |
synchronized public void playPause(Context _c, String _s) { | |
if (mediaPlayer == null) { | |
// show progress dialog | |
pd = ProgressDialog.show(_c, "Raw Audio", "connecting to stream...", true, true); | |
// not playing -> load stream | |
STREAM = _s; | |
loadStream(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void loadStream() { | |
// run the stream in its own thread | |
Runnable r = new Runnable() { | |
public void run() { | |
try { | |
mediaPlayer = new MediaPlayer(); | |
mediaPlayer.setDataSource(STREAM); | |
mediaPlayer.prepare(); | |
mediaPlayer.start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a handler to dismiss the dialog once mp starts | |
private Handler handler = new Handler() { | |
@Override public void handleMessage(Message msg) { | |
pd.dismiss(); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! MapToggle(key, opt) | |
let cmd = ':set '.a:opt.'! \| set '.a:opt."?\<CR>" | |
exec 'nnoremap '.a:key.' '.cmd | |
exec 'inoremap '.a:key." \<C-O>".cmd | |
endfunction | |
command! -nargs=+ MapToggle call MapToggle(<f-args>) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MapToggle <F4> foldenable | |
MapToggle <F5> number | |
MapToggle <F6> spell | |
MapToggle <F7> paste | |
MapToggle <F8> hlsearch | |
MapToggle <F9> wrap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
fifo="$HOME/.mplayer_fifo" | |
command="$*" | |
echo $command > "$fifo" &>/dev/null |