Skip to content
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.

Commit

Permalink
Fixed incorrect positioning of play button on 'now playing' screen
Browse files Browse the repository at this point in the history
- Fixed rendering issue caused by Firebase dependency in Snowfall view
  • Loading branch information
timusus committed Dec 2, 2018
1 parent 7db782e commit 0f4e98d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,21 @@ public class SnowfallView extends View {
final Handler snowHandler = new Handler();

/** Used to determine if we let it snow */
final FirebaseRemoteConfig remoteConfig;
@Nullable
private FirebaseRemoteConfig remoteConfig = null;

public SnowfallView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
snowPaint.setColor(Color.WHITE);
snowPaint.setStyle(Paint.Style.FILL);

remoteConfig = FirebaseRemoteConfig.getInstance();
remoteConfig.setDefaults(R.xml.remote_config_defaults);
remoteConfig.setConfigSettings(new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build());
if(!isInEditMode()) {
remoteConfig = FirebaseRemoteConfig.getInstance();
remoteConfig.setDefaults(R.xml.remote_config_defaults);
remoteConfig.setConfigSettings(new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(BuildConfig.DEBUG)
.build());
}
}

@Override
Expand Down Expand Up @@ -134,6 +137,9 @@ public void clear() {
}

private void fetchSnowConfig() {
if (isInEditMode()) {
return;
}
remoteConfig.fetch().addOnCompleteListener((Activity) getContext(), task -> {
if (task.isSuccessful()) {
remoteConfig.activateFetched();
Expand Down
21 changes: 10 additions & 11 deletions app/src/main/res/layout/fragment_player.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:tag=":aesthetic_ignore"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/prev"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text2"/>
app:layout_constraintTop_toTopOf="@+id/prev"/>

<com.simplecity.amp_library.ui.views.RepeatingImageButton
android:id="@+id/prev"
Expand All @@ -137,10 +136,10 @@
android:scaleType="centerCrop"
android:src="@drawable/ic_skip_previous_24dp"
android:tag=":aesthetic_ignore"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/play"
app:layout_constraintLeft_toRightOf="@+id/shuffle"
app:layout_constraintRight_toLeftOf="@+id/play"
app:layout_constraintTop_toBottomOf="@+id/text2"/>
app:layout_constraintTop_toTopOf="@+id/play"/>

<com.simplecity.amp_library.ui.views.RepeatingImageButton
android:id="@+id/next"
Expand All @@ -152,22 +151,21 @@
android:scaleType="centerCrop"
android:src="@drawable/ic_skip_next_24dp"
android:tag=":aesthetic_ignore"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/play"
app:layout_constraintLeft_toRightOf="@+id/play"
app:layout_constraintRight_toLeftOf="@+id/repeat"
app:layout_constraintTop_toBottomOf="@+id/text2"/>
app:layout_constraintTop_toTopOf="@+id/play"/>

<include
layout="@layout/repeat_button"
android:id="@+id/repeat"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:tag=":aesthetic_ignore"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/next"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text2"/>
app:layout_constraintTop_toTopOf="@+id/next"/>

<com.simplecity.amp_library.ui.views.PlayPauseView
android:id="@+id/play"
Expand Down Expand Up @@ -204,6 +202,7 @@
<com.simplecity.amp_library.ui.views.SnowfallView
android:id="@+id/let_it_snow"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
tools:visibility="gone"/>

</android.support.constraint.ConstraintLayout>

0 comments on commit 0f4e98d

Please sign in to comment.