Added Gmail label colors

This commit is contained in:
M66B
2021-11-12 19:38:59 +01:00
parent 3feb093f1f
commit dd40f0634f
4 changed files with 73 additions and 6 deletions

View File

@@ -21,6 +21,7 @@ package eu.faircode.email;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteConstraintException;
import android.graphics.Color;
import android.os.Bundle;
@@ -44,6 +45,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.Group;
import androidx.lifecycle.Lifecycle;
import androidx.preference.PreferenceManager;
import com.google.android.material.snackbar.Snackbar;
@@ -658,8 +660,19 @@ public class FragmentFolder extends FragmentBase {
ask.setArguments(aargs);
ask.setTargetFragment(FragmentFolder.this, REQUEST_SAVE_CHANGES);
ask.show(getParentFragmentManager(), "folder:save");
} else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
} else if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
String name = args.getString("name");
Integer color = args.getInt("color");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
String key = "label.color." + name;
if (color == Color.TRANSPARENT)
prefs.edit().remove(key).apply();
else
prefs.edit().putInt(key, color).apply();
getParentFragmentManager().popBackStack();
}
}
@Override