Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Mar 3, 2016
2 parents 85a9f8e + 8a4b7f9 commit ad24f24
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 23 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "org.y20k.transistor"
minSdkVersion 19
targetSdkVersion 23
versionCode 19
versionName "1.2.3 (Cygnet Committee)"
versionCode 20
versionName "1.2.4 (Cygnet Committee)"
}
buildTypes {
release {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="org.y20k.transistor"
android:versionCode="19"
android:versionName="1.2.3 (Cygnet Committee)">
android:versionCode="20"
android:versionName="1.2.4 (Cygnet Committee)">

<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="23" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public final class MainActivityFragment extends Fragment {
private static final String ACTION_PLAYBACK_STARTED = "org.y20k.transistor.action.PLAYBACK_STARTED";
private static final String ACTION_PLAYBACK_STOPPED = "org.y20k.transistor.action.PLAYBACK_STOPPED";
private static final String ACTION_IMAGE_CHANGE_REQUESTED = "org.y20k.transistor.action.IMAGE_CHANGE_REQUESTED";
private static final String EXTRA_STATION_POSITION = "STATION_POSITION";
private static final String LIST_STATE = "ListState";
private static final String STREAM_URI = "streamUri";
private static final String STATION_NAME = "stationName";
Expand Down Expand Up @@ -407,6 +408,11 @@ public void onReceive(Context context, Intent intent) {
@Override
public void onReceive(Context context, Intent intent) {
refreshStationList();
// if new station - scroll towards it
if (intent.hasExtra(EXTRA_STATION_POSITION)) {
int position = intent.getIntExtra(EXTRA_STATION_POSITION, 0);
mListView.smoothScrollToPosition(position);
}
}
};
IntentFilter collectionChangedIntentFilter = new IntentFilter(ACTION_COLLECTION_CHANGED);
Expand Down
80 changes: 67 additions & 13 deletions app/src/main/java/org/y20k/transistor/PlayerActivityFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,7 @@ public void onClick(View v) {
mPlaybackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

// playback stopped or new station - start playback
if (!mPlayback || mStationID != mStationIDCurrent) {
startPlayback();
}
// playback active - stop playback
else {
stopPlayback();
}

// save state of playback in settings store
savePlaybackState(mActivity);
handlePlaybackButtonClick ();
}
});

Expand Down Expand Up @@ -392,7 +381,72 @@ private void stopPlayback() {
}


/* handles timer menu click */
/* Handles tap on the big playback button */
private void handlePlaybackButtonClick() {
// playback stopped or new station - start playback
if (!mPlayback || mStationID != mStationIDCurrent) {
startPlayback();
}
// playback active - stop playback
else {
stopPlayback();
}

// save state of playback in settings store
savePlaybackState(mActivity);
}


/* WORK IN PROGRESS HERE: Handles tap on the big playback button */
private void handlePlaybackButtonClickPlus() {

// CASE 1:
// This Station IS NOT playing,
// Timer IS NOT running
// -> start playback
if (!mTimerRunning && (!mPlayback || mStationID != mStationIDCurrent)) {
// start playback
startPlayback();
}

// CASE 2:
// This Station IS NOT playing,
// Timer IS running
// -> stop timer & start playback
if (mTimerRunning && (!mPlayback || mStationID != mStationIDCurrent)) {
// stop timer
// TODO implement stopTimer

// start playback
startPlayback();
}

// CASE 3:
// This Station IS playing,
// Timer IS running
// -> stop timer & stop playback
if (mTimerRunning && (mPlayback && mStationID != mStationIDCurrent)) {
// stop timer
// TODO implement stopTimer

// stop playback
stopPlayback();
}

// CASE 4:
// This Station IS playing,
// Timer IS NOT running
if (mTimerRunning && (mPlayback && mStationID != mStationIDCurrent)) {
// stop playback
stopPlayback();
}

// save state of playback in settings store
savePlaybackState(mActivity);
}


/* WORK IN PROGRESS HERE: Handles tap timer icon in actionbar */
private void handleMenuTimerClick() {
long duration = 20000;

Expand Down
17 changes: 12 additions & 5 deletions app/src/main/java/org/y20k/transistor/helpers/StationFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public final class StationFetcher extends AsyncTask<Void, Void, Station> {

/* Keys */
private static final String ACTION_COLLECTION_CHANGED = "org.y20k.transistor.action.COLLECTION_CHANGED";

private static final String EXTRA_STATION_POSITION = "STATION_POSITION";

/* Main class variables */
private final Activity mActivity;
Expand Down Expand Up @@ -113,10 +113,17 @@ protected void onPostExecute(Station station) {
// add station to collection
stationAdded = mCollection.add(station);

// send local broadcast
Intent i = new Intent();
i.setAction(ACTION_COLLECTION_CHANGED);
LocalBroadcastManager.getInstance(mActivity.getApplication()).sendBroadcast(i);
if (stationAdded) {
// get position
int position = mCollection.getStations().indexOf(station);

// send local broadcast
Intent i = new Intent();
i.setAction(ACTION_COLLECTION_CHANGED);
i.putExtra(EXTRA_STATION_POSITION, position);
LocalBroadcastManager.getInstance(mActivity.getApplication()).sendBroadcast(i);
}


}

Expand Down
Binary file removed app/src/main/res/drawable-hdpi/ic_timer_black_24dp.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-mdpi/ic_timer_black_24dp.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/res/drawable-xhdpi/ic_timer_black_24dp.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/list_item_collection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
android:contentDescription="@string/descr_timer_indicator_started"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_timer_black_24dp"
android:src="@drawable/ic_timer_indicator_small_started_24dp"
android:visibility="gone" />

<ImageView
Expand Down

0 comments on commit ad24f24

Please sign in to comment.