We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 9bf7fd73 authored by Mike Sheldon's avatar Mike Sheldon

Begin to make it possible add custom stations to libre droid by switching to a...

Begin to make it possible add custom stations to libre droid by switching to a list view for tag stations (not yet fully functional)
Update Libre.fm branding to use Pablo's new logos
parent e465f70f
...@@ -23,42 +23,45 @@ public final class R { ...@@ -23,42 +23,45 @@ public final class R {
public static final int prev=0x7f020009; public static final int prev=0x7f020009;
public static final int quit=0x7f02000a; public static final int quit=0x7f02000a;
public static final int save=0x7f02000b; public static final int save=0x7f02000b;
public static final int tower=0x7f02000c;
} }
public static final class id { public static final class id {
public static final int ImageView01=0x7f050004; public static final int ImageView01=0x7f050004;
public static final int LinearLayout01=0x7f050000; public static final int LinearLayout01=0x7f050000;
public static final int ScrollView01=0x7f050001; public static final int ScrollView01=0x7f050002;
public static final int TableLayout01=0x7f05000e; public static final int ScrollView02=0x7f05000e;
public static final int TableLayout02=0x7f050013; public static final int ScrollView03=0x7f050013;
public static final int StationLayout=0x7f05000f;
public static final int TableLayout02=0x7f050014;
public static final int TableLayout03=0x7f050003; public static final int TableLayout03=0x7f050003;
public static final int TableRow01=0x7f050010; public static final int TableRow02=0x7f050019;
public static final int TableRow02=0x7f050011;
public static final int TableRow03=0x7f050012;
public static final int TableRow04=0x7f050018;
public static final int TextView01=0x7f05000f;
public static final int TextView02=0x7f050007; public static final int TextView02=0x7f050007;
public static final int TextView03=0x7f050009; public static final int TextView03=0x7f050009;
public static final int TextView04=0x7f05000d; public static final int TextView04=0x7f05000d;
public static final int TextView05=0x7f05000c; public static final int TextView05=0x7f05000c;
public static final int TextView06=0x7f050005; public static final int TextView06=0x7f050005;
public static final int TextView07=0x7f050006; public static final int TextView07=0x7f050006;
public static final int albumImage=0x7f050015; public static final int albumImage=0x7f050016;
public static final int artistText=0x7f050017; public static final int artistText=0x7f050018;
public static final int banButton=0x7f050019; public static final int banButton=0x7f05001a;
public static final int communityStationButton=0x7f050012;
public static final int loginButton=0x7f05000b; public static final int loginButton=0x7f05000b;
public static final int loveButton=0x7f05001e; public static final int loveButton=0x7f05001f;
public static final int nextButton=0x7f05001c; public static final int loveStationButton=0x7f050011;
public static final int nextButton=0x7f05001d;
public static final int passwordEntry=0x7f05000a; public static final int passwordEntry=0x7f05000a;
public static final int playPauseButton=0x7f05001b; public static final int playPauseButton=0x7f05001c;
public static final int prevButton=0x7f05001a; public static final int prevButton=0x7f05001b;
public static final int saveButton=0x7f05001d; public static final int saveButton=0x7f05001e;
public static final int stationNameText=0x7f050014; public static final int stationNameText=0x7f050015;
public static final int titleText=0x7f050016; public static final int tagStationButton=0x7f050010;
public static final int titleText=0x7f050017;
public static final int usernameEntry=0x7f050008; public static final int usernameEntry=0x7f050008;
public static final int viewAnimator=0x7f050002; public static final int viewAnimator=0x7f050001;
} }
public static final class layout { public static final class layout {
public static final int main=0x7f030000; public static final int list_item=0x7f030000;
public static final int main=0x7f030001;
} }
public static final class string { public static final class string {
public static final int app_name=0x7f040001; public static final int app_name=0x7f040001;
......
This diff is collapsed.
...@@ -47,6 +47,7 @@ import org.apache.http.message.BasicNameValuePair; ...@@ -47,6 +47,7 @@ import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.CoreProtocolPNames; import org.apache.http.params.CoreProtocolPNames;
import android.app.Activity; import android.app.Activity;
import android.app.ListActivity;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
...@@ -70,17 +71,21 @@ import android.view.MenuItem; ...@@ -70,17 +71,21 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.MenuItem.OnMenuItemClickListener; import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TableLayout; import android.widget.TableLayout;
import android.widget.TableRow; import android.widget.TableRow;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.widget.ViewAnimator; import android.widget.ViewAnimator;
public class LibreDroid extends Activity { public class LibreDroid extends ListActivity {
private LibreServiceConnection libreServiceConn; private LibreServiceConnection libreServiceConn;
private String username; private String username;
private String password; private String password;
...@@ -95,7 +100,7 @@ public class LibreDroid extends Activity { ...@@ -95,7 +100,7 @@ public class LibreDroid extends Activity {
this.registerReceiver(new MediaButtonReceiver(), new IntentFilter(Intent.ACTION_MEDIA_BUTTON)); this.registerReceiver(new MediaButtonReceiver(), new IntentFilter(Intent.ACTION_MEDIA_BUTTON));
this.registerReceiver(new UIUpdateReceiver(), new IntentFilter("LibreDroidNewSong")); this.registerReceiver(new UIUpdateReceiver(), new IntentFilter("LibreDroidNewSong"));
setContentView(R.layout.main); setContentView(R.layout.main);
// Load settings // Load settings
final SharedPreferences settings = getSharedPreferences("LibreDroid", MODE_PRIVATE); final SharedPreferences settings = getSharedPreferences("LibreDroid", MODE_PRIVATE);
username = settings.getString("Username", ""); username = settings.getString("Username", "");
...@@ -120,45 +125,33 @@ public class LibreDroid extends Activity { ...@@ -120,45 +125,33 @@ public class LibreDroid extends Activity {
// Setup buttons // Setup buttons
String radioButtons[] = { "Folk", "Rock", "Metal", "Classical", "Pop", String radioButtons[] = { "Folk", "Rock", "Metal", "Classical", "Pop",
"Punk", "Jazz", "Blues", "Rap", "Ambient" }; "Punk", "Jazz", "Blues", "Rap", "Ambient", "Add A Custom Station..." };
int i = 0; setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, radioButtons));
TableRow row = (TableRow) findViewById(R.id.TableRow01);
for (String buttonStr : radioButtons) { Button tagStation = (Button) findViewById(R.id.tagStationButton);
Button button = new Button(this); tagStation.setOnClickListener(new OnClickListener() {
button.setText(buttonStr); public void onClick(View v) {
button.setOnClickListener(new OnClickListener() { LibreDroid.this.nextPage();
public void onClick(View v) {
Button b = (Button) v;
LibreDroid.this.libreServiceConn.service.tuneStation("globaltags", b.getText().toString().toLowerCase());
LibreDroid.this.nextPage();
}
});
row.addView(button);
i++;
if (i == 5) {
row = (TableRow) findViewById(R.id.TableRow02);
} }
} });
TableLayout table = (TableLayout) findViewById(R.id.TableLayout01); Button loveStation = (Button) findViewById(R.id.loveStationButton);
Button loveStation = new Button(this);
loveStation.setText("Your Loved Tracks");
loveStation.setOnClickListener(new OnClickListener() { loveStation.setOnClickListener(new OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
LibreDroid.this.libreServiceConn.service.tuneStation("user", username + "/loved"); LibreDroid.this.libreServiceConn.service.tuneStation("user", username + "/loved");
LibreDroid.this.nextPage(); LibreDroid.this.nextPage();
LibreDroid.this.nextPage();
} }
}); });
table.addView(loveStation);
Button communityLoveStation = new Button(this); Button communityLoveStation = (Button) findViewById(R.id.communityStationButton);
communityLoveStation.setText("Community's Loved Tracks");
communityLoveStation.setOnClickListener(new OnClickListener() { communityLoveStation.setOnClickListener(new OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
LibreDroid.this.libreServiceConn.service.tuneStation("community", "loved"); LibreDroid.this.libreServiceConn.service.tuneStation("community", "loved");
LibreDroid.this.nextPage(); LibreDroid.this.nextPage();
LibreDroid.this.nextPage();
} }
}); });
table.addView(communityLoveStation);
final ImageButton nextButton = (ImageButton) findViewById(R.id.nextButton); final ImageButton nextButton = (ImageButton) findViewById(R.id.nextButton);
nextButton.setOnClickListener(new OnClickListener() { nextButton.setOnClickListener(new OnClickListener() {
...@@ -225,8 +218,12 @@ public class LibreDroid extends Activity { ...@@ -225,8 +218,12 @@ public class LibreDroid extends Activity {
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK)) { if ((keyCode == KeyEvent.KEYCODE_BACK)) {
if (this.libreServiceConn.service.getCurrentPage() > 0) { if (this.libreServiceConn.service.getCurrentPage() > 0) {
LibreDroid.this.libreServiceConn.service.stop(); if(this.libreServiceConn.service.getCurrentPage() == 3) {
// Back two pages if we're on the player page to get back to the main menu
this.prevPage();
}
this.prevPage(); this.prevPage();
LibreDroid.this.libreServiceConn.service.stop();
return true; return true;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment