Fixed collapsed notification not getting colored.

This commit is contained in:
Karim Abou Zeid 2015-06-22 12:33:39 +02:00
commit 4017815711
3 changed files with 26 additions and 3 deletions

View file

@ -242,6 +242,7 @@ public class PlayingNotificationHelper {
}
private void setBackgroundColor(int color) {
notificationLayout.setInt(R.id.root, "setBackgroundColor", color);
notificationLayoutExpanded.setInt(R.id.root, "setBackgroundColor", color);
}

View file

@ -11,20 +11,38 @@ import java.io.ObjectOutputStream;
/**
* @author Karim Abou Zeid (kabouzeid)
* <p/>
* A simple helper class for Android to read and write
* any serializeable object to the internal storage
*/
public final class InternalStorageUtil {
/**
* @param context a valid {@link Context}
* @param key the filename
* @param object any {@link java.io.Serializable} object which will be written to the internal storage
*/
public static synchronized void writeObject(final Context context, final String key, final Object object) throws IOException {
String tempFileName = "TEMP_" + key;
// First write the object to a file with ".tmp" postfix,
// so when an error occurs, we do not overwrite the original
// file (if exists) with a corrupted file.
String tempFileName = key + ".tmp";
FileOutputStream fos;
fos = context.openFileOutput(tempFileName, Context.MODE_PRIVATE);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(object);
oos.close();
fos.close();
// after writing was successful we overwrite the original
// file (if exists) with the new file
renameAppFile(context, tempFileName, key);
}
/**
* @param context a valid {@link Context}
* @param originalFileName the original filename
* @param newFileName the new filename
*/
public static synchronized void renameAppFile(final Context context, String originalFileName, String newFileName) {
File originalFile = context.getFileStreamPath(originalFileName);
File newFile = new File(originalFile.getParent(), newFileName);
@ -35,6 +53,10 @@ public final class InternalStorageUtil {
originalFile.renameTo(newFile);
}
/**
* @param context a valid {@link Context}
* @param key the filename
*/
public static synchronized Object readObject(final Context context, String key) throws IOException,
ClassNotFoundException {
FileInputStream fis = context.openFileInput(key);