Skip to content

Commit

Permalink
Fix app bar colors when empty task fragment is shown in two pane mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabor Keszthelyi committed Nov 29, 2017
1 parent 4e93e60 commit e459b74
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
13 changes: 13 additions & 0 deletions opentasks/src/main/java/org/dmfs/tasks/EmptyTaskFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

package org.dmfs.tasks;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -39,4 +41,15 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
return inflater.inflate(R.layout.opentasks_fragment_empty_task, container, false);
}


@Override
public void onAttach(Activity activity)
{
super.onAttach(activity);
if (activity instanceof ViewTaskFragment.Callback)
{
((ViewTaskFragment.Callback) activity).updateColor(
ContextCompat.getColor(getContext(), R.color.primary));
}
}
}
7 changes: 4 additions & 3 deletions opentasks/src/main/java/org/dmfs/tasks/ViewTaskFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.support.annotation.ColorInt;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.AppBarLayout.OnOffsetChangedListener;
import android.support.design.widget.CoordinatorLayout;
Expand Down Expand Up @@ -175,23 +176,23 @@ public interface Callback
* @param data
* The task data that belongs to the {@link Uri}. This is purely an optimization and may be <code>null</code>.
*/
public void onEditTask(Uri taskUri, ContentSet data);
void onEditTask(Uri taskUri, ContentSet data);

/**
* This is called to inform the Activity that a task has been deleted.
*
* @param taskUri
* The {@link Uri} of the deleted task. Note that the Uri is likely to be invalid at the time of calling this method.
*/
public void onDelete(Uri taskUri);
void onDelete(Uri taskUri);

/**
* Notifies the listener about the list color of the current task.
*
* @param color
* The color.
*/
public void updateColor(int color);
void updateColor(@ColorInt int color);
}


Expand Down

0 comments on commit e459b74

Please sign in to comment.