diff --git a/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java b/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java
index a9e5f2923473c2a64d4387b8ab7d36d8f754a5d4..34b8f719895a3defe6992eb13068cddf89dfdaaf 100644
--- a/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java
+++ b/app/src/main/java/foundation/e/drive/widgets/EDriveWidget.java
@@ -26,6 +26,7 @@ import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.Uri;
+import android.os.Bundle;
import android.provider.Settings;
import android.view.View;
import android.widget.RemoteViews;
@@ -61,6 +62,9 @@ public class EDriveWidget extends AppWidgetProvider {
private final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.getDefault());
private RemoteViews views;
private Account account = null;
+ private static final String DARK_TEXT_KEY = "foundation.e.blisslauncher.WIDGET_OPTION_DARK_TEXT";
+ private static boolean isDarkText = false;
+
public static String dataForWeb(Long bytes) {
final String space = CommonUtils.humanReadableByteCountBin(bytes);
@@ -148,7 +152,12 @@ public class EDriveWidget extends AppWidgetProvider {
return;
}
- views = new RemoteViews(context.getPackageName(), R.layout.e_drive_widget_login);
+ if (isDarkText) {
+ views = new RemoteViews(context.getPackageName(), R.layout.e_drive_widget_login_light);
+ } else {
+ views = new RemoteViews(context.getPackageName(), R.layout.e_drive_widget_login);
+ }
+
Intent accountIntent = buildIntent("", "")
.setComponent(new ComponentName(ACCOUNT_MANAGER_PACKAGE_NAME,
GET_ACCOUNT_MANAGER_COMPONENT_NAME))
@@ -165,7 +174,11 @@ public class EDriveWidget extends AppWidgetProvider {
private void noInternetView(Context context) {
if (!isNetworkAvailable) {
- views = new RemoteViews(context.getPackageName(), R.layout.e_drive_widget_login);
+ if (isDarkText) {
+ views = new RemoteViews(context.getPackageName(), R.layout.e_drive_widget_login_light);
+ } else {
+ views = new RemoteViews(context.getPackageName(), R.layout.e_drive_widget_login);
+ }
views.setViewVisibility(R.id.button_container, View.GONE);
views.setTextViewText(R.id.summary, context.getString(R.string.no_internet_widget));
}
@@ -180,9 +193,11 @@ public class EDriveWidget extends AppWidgetProvider {
noAccountView(context);
return;
}
-
- views = new RemoteViews(context.getPackageName(), R.layout.e_drive_widget);
-
+ if (isDarkText) {
+ views = new RemoteViews(context.getPackageName(), R.layout.e_drive_widget_light);
+ } else {
+ views = new RemoteViews(context.getPackageName(), R.layout.e_drive_widget);
+ }
views.setTextViewText(R.id.email, email);
views.setTextViewText(R.id.name, accountManager.getUserData(account, ACCOUNT_DATA_NAME));
@@ -278,4 +293,11 @@ public class EDriveWidget extends AppWidgetProvider {
}
});
}
+
+ @Override
+ public void onAppWidgetOptionsChanged(Context context, AppWidgetManager appWidgetManager, int appWidgetId, Bundle newOptions) {
+ super.onAppWidgetOptionsChanged(context, appWidgetManager, appWidgetId, newOptions);
+ isDarkText = newOptions.getBoolean(DARK_TEXT_KEY);
+ updateAppWidget(context);
+ }
}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/button_background_light.xml b/app/src/main/res/drawable/button_background_light.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6a146ee343311301cbef4a7ef95b95d943f9c572
--- /dev/null
+++ b/app/src/main/res/drawable/button_background_light.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/e_drive_widget_light.xml b/app/src/main/res/layout/e_drive_widget_light.xml
new file mode 100644
index 0000000000000000000000000000000000000000..50e854bd712719de1a139fcb942232bca8488442
--- /dev/null
+++ b/app/src/main/res/layout/e_drive_widget_light.xml
@@ -0,0 +1,166 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/e_drive_widget_login_light.xml b/app/src/main/res/layout/e_drive_widget_login_light.xml
new file mode 100644
index 0000000000000000000000000000000000000000..23c0da80c0e21a08419ee5003b634fbf3b6a967b
--- /dev/null
+++ b/app/src/main/res/layout/e_drive_widget_login_light.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 1b3b3f986e3c53310d05537e1ebf34d5b0bfab88..bae92f3d16fbd1bf7502cef23e88cdccb146cf91 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -20,4 +20,7 @@
#DEFFFFFF
#61FFFFFF
#5DB2FF
+
+ #61000000
+ #99000000
\ No newline at end of file