Skip to content

Commit

Permalink
Google Play 0.5-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
indywidualny committed Mar 20, 2016
1 parent d9b2d7f commit 4bf0364
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 35 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.indywidualni.centrumfm"
minSdkVersion 15
targetSdkVersion 23
versionCode 4
versionName "0.4alpha"
versionCode 5
versionName "0.5beta"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,17 @@ public void onPanelSlide(View panel, float slideOffset) {
public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState
previousState, SlidingUpPanelLayout.PanelState newState) {
if (newState == SlidingUpPanelLayout.PanelState.EXPANDED) {
fab.hide();
ScrollAwareFABBehavior.setDisableBehaviourPermanently(true);
fab.hide();

playerSetConnectionType();
startPlayerUpdater();
} else if (newState == SlidingUpPanelLayout.PanelState.COLLAPSED) {
fab.show();
ScrollAwareFABBehavior.setDisableBehaviourPermanently(false);
fab.show();

if (mBound) {
if (mBound)
mService.stopPlayer();
}

stopPlayerUpdater();
}
Expand Down Expand Up @@ -179,9 +178,8 @@ public void onCustomTabsDisconnected() {
@Override
protected void onStart() {
super.onStart();
customTabActivityHelper.bindCustomTabsService(this);

bindStreamService();
customTabActivityHelper.bindCustomTabsService(this);
}

@Override
Expand Down Expand Up @@ -338,8 +336,10 @@ public void onResponse(Call<List<RDS>> call, Response<List<RDS>> response) {
updateTitle(response.body());
} else {
// error response, no access to resource?
toolbar.setTitle(getString(R.string.toolbar_default_title));
toolbar.setSubtitle(null);
if (toolbar != null) {
toolbar.setTitle(getString(R.string.toolbar_default_title));
toolbar.setSubtitle(null);
}

tracker.send(new HitBuilders.EventBuilder()
.setCategory("Error response")
Expand All @@ -352,13 +352,18 @@ public void onResponse(Call<List<RDS>> call, Response<List<RDS>> response) {
@Override
public void onFailure(Call<List<RDS>> call, Throwable t) {
Log.e(TAG, "getRDS: " + t.getLocalizedMessage());
toolbar.setTitle(getString(R.string.toolbar_default_title));
toolbar.setSubtitle(null);
if (toolbar != null) {
toolbar.setTitle(getString(R.string.toolbar_default_title));
toolbar.setSubtitle(null);
}
}
});
}

private void updateTitle(List<RDS> items){
if (toolbar == null)
return;

RDS now = items.get(0);
RDS soon = items.get(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@ protected List<Object> doInBackground(Void... arg0) {
}
@Override
protected void onPostExecute(List<Object> result) {
FavouriteAdapter adapter = new FavouriteAdapter(result);
adapter.setHasStableIds(true);
mRecyclerView.setEmptyView(view.findViewById(R.id.empty_view));
mRecyclerView.setAdapter(adapter);
try {
FavouriteAdapter adapter = new FavouriteAdapter(result);
adapter.setHasStableIds(true);
mRecyclerView.setEmptyView(view.findViewById(R.id.empty_view));
mRecyclerView.setAdapter(adapter);
} catch (NullPointerException e) {
// fragment was destroyed while AsyncTask was running
e.printStackTrace();
}
}
}.execute();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,23 @@ protected Void doInBackground(Void... arg0) {
}
@Override
protected void onPostExecute(Void arg) {
// set the right adapter now
mRecyclerView.setAdapter(new NewsAdapter(rssItems, getActivity()));

// now go online and update items
if (Connectivity.isConnected(getActivity())) {
mSwipeRefreshLayout.post(new Runnable() {
@Override
public void run() {
mSwipeRefreshLayout.setRefreshing(true);
}
});
getRSS();
try {
// set the right adapter now
mRecyclerView.setAdapter(new NewsAdapter(rssItems, getActivity()));

// now go online and update items
if (Connectivity.isConnected(getActivity())) {
mSwipeRefreshLayout.post(new Runnable() {
@Override
public void run() {
mSwipeRefreshLayout.setRefreshing(true);
}
});
getRSS();
}
} catch (NullPointerException e) {
// fragment was destroyed while AsyncTask was running
e.printStackTrace();
}
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
Expand Down Expand Up @@ -141,7 +146,8 @@ protected void onPostExecute(List<Channel.Item> result) {
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
} else {
// error response, no access to resource?
mSwipeRefreshLayout.setRefreshing(false);
if (mSwipeRefreshLayout != null)
mSwipeRefreshLayout.setRefreshing(false);

tracker.send(new HitBuilders.EventBuilder()
.setCategory("Error response")
Expand All @@ -154,7 +160,8 @@ protected void onPostExecute(List<Channel.Item> result) {
@Override
public void onFailure(Call<RSS> call, Throwable t) {
Log.e(TAG, "getRSS: " + t.getLocalizedMessage());
mSwipeRefreshLayout.setRefreshing(false);
if (mSwipeRefreshLayout != null)
mSwipeRefreshLayout.setRefreshing(false);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@ public void onResponse(Call<Server> call, Response<Server> response) {
Log.v(TAG, "getServerStatus: response " + response.code());

if (response.isSuccess()) {
status.setSummary(String.format(getString(R.string.indywidualni_server_ok),
response.body().getVersion()));
if (status != null)
status.setSummary(String.format(getString(R.string.indywidualni_server_ok),
response.body().getVersion()));
} else {
// error response, no access to resource?
status.setSummary(String.format(getString(R.string.indywidualni_server_not_ok),
response.code()));
if (status != null)
status.setSummary(String.format(getString(R.string.indywidualni_server_not_ok),
response.code()));

tracker.send(new HitBuilders.EventBuilder()
.setCategory("Error response")
Expand All @@ -137,7 +139,8 @@ public void onResponse(Call<Server> call, Response<Server> response) {
@Override
public void onFailure(Call<Server> call, Throwable t) {
Log.e(TAG, "getServerStatus: " + t.getLocalizedMessage());
status.setSummary(getString(R.string.indywidualni_server_failure));
if (status != null)
status.setSummary(getString(R.string.indywidualni_server_failure));
}
});
}
Expand Down

0 comments on commit 4bf0364

Please sign in to comment.