Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
44099c0
Dark theme v1
dan0xii Sep 3, 2018
df15340
use style instead of theme attribute for secondary action buttons
AndyScherzinger Jan 21, 2019
cab2b12
use right colors for drawer menu item text and icons
AndyScherzinger Jan 21, 2019
1930e5d
findbugs: accesses list or array with constant index
AndyScherzinger Jan 21, 2019
c4b5d8f
use xml drawables for shared state icon including day/night state
AndyScherzinger Jan 21, 2019
34cef89
set background color for primary action buttons on upload and partici…
AndyScherzinger Jan 21, 2019
b0734f5
improve codacy score
AndyScherzinger Jan 23, 2019
9f7fa6b
DatePickerDialog theme and style.
dan0xii Jan 25, 2019
d1f1e6c
bump material lib to alpha03
AndyScherzinger Feb 7, 2019
66144bb
Corrects "Choose" button colour in FolderPickerActivity. Removes un-u…
dan0xii Feb 10, 2019
55d5f2f
remove unused theme getter from interface
AndyScherzinger Mar 26, 2019
f459cd2
"Activities" drawer selection background colour.
dan0xii Apr 6, 2019
5a4df84
bump com.google.android.material:material to alpha5
AndyScherzinger Apr 30, 2019
f53f246
rebase fixing plus proper theming of legacy login fields
AndyScherzinger Apr 30, 2019
eff6a5b
don't tint avatars within the drawer menu
AndyScherzinger Apr 30, 2019
01cfd0a
use proper color for storage location text
AndyScherzinger Apr 30, 2019
c43633e
Various improvements to dark theme
dan0xii May 5, 2019
dc0ca5c
use correct color after rebase
AndyScherzinger May 19, 2019
691ee27
use proper colors storage selector text
AndyScherzinger May 19, 2019
e54db7c
make toolbar menu use the proper day/night popup theme
AndyScherzinger May 19, 2019
21fb11d
bump material lib to alpha06
AndyScherzinger May 20, 2019
916580c
remove unused radio button preference code
AndyScherzinger May 20, 2019
4a808ab
bump material lib to alpha07
AndyScherzinger Jun 3, 2019
196e339
use day/night color
AndyScherzinger Jun 6, 2019
ff9795d
Bump material to alpha-08
AndyScherzinger Jul 23, 2019
0164256
make progress bar day/night aware
AndyScherzinger Jul 23, 2019
2d0f4e8
proper icon display for night theme for activities and notifications
AndyScherzinger Jul 23, 2019
a2963d9
icons with light background need to be keep with dark color
AndyScherzinger Jul 29, 2019
f6680a3
material design alpha09
AndyScherzinger Jul 31, 2019
9eb6fe8
bump to alpha10
AndyScherzinger Sep 13, 2019
8aaf29a
add dark/light theming for activities headline
AndyScherzinger Sep 13, 2019
f5aa60b
Fix activity foreground text colour for >=API21.
dan0xii Sep 20, 2019
25f58cd
bump material to 1.1.0-beta01
AndyScherzinger Oct 7, 2019
bf0779a
Update to Alert Dialogs in api 21 and upwards.
dan0xii Oct 27, 2019
27b8ed4
Dark theme v1
dan0xii Sep 3, 2018
55a32df
use style instead of theme attribute for secondary action buttons
AndyScherzinger Jan 21, 2019
3d60c83
use right colors for drawer menu item text and icons
AndyScherzinger Jan 21, 2019
790e3fa
findbugs: accesses list or array with constant index
AndyScherzinger Jan 21, 2019
913d827
use xml drawables for shared state icon including day/night state
AndyScherzinger Jan 21, 2019
562338c
set background color for primary action buttons on upload and partici…
AndyScherzinger Jan 21, 2019
30a5ec6
improve codacy score
AndyScherzinger Jan 23, 2019
c704978
DatePickerDialog theme and style.
dan0xii Jan 25, 2019
c6218a0
bump material lib to alpha03
AndyScherzinger Feb 7, 2019
8d0ff8f
Corrects "Choose" button colour in FolderPickerActivity. Removes un-u…
dan0xii Feb 10, 2019
b7e9d3f
remove unused theme getter from interface
AndyScherzinger Mar 26, 2019
689a0a2
"Activities" drawer selection background colour.
dan0xii Apr 6, 2019
dc4cbb7
bump com.google.android.material:material to alpha5
AndyScherzinger Apr 30, 2019
e32ec7a
rebase fixing plus proper theming of legacy login fields
AndyScherzinger Apr 30, 2019
8f8b67f
don't tint avatars within the drawer menu
AndyScherzinger Apr 30, 2019
6eb0744
use proper color for storage location text
AndyScherzinger Apr 30, 2019
6bb9a70
Various improvements to dark theme
dan0xii May 5, 2019
e14dc52
use correct color after rebase
AndyScherzinger May 19, 2019
1bdcceb
use proper colors storage selector text
AndyScherzinger May 19, 2019
5554585
make toolbar menu use the proper day/night popup theme
AndyScherzinger May 19, 2019
110ce5e
bump material lib to alpha06
AndyScherzinger May 20, 2019
9a88ee2
remove unused radio button preference code
AndyScherzinger May 20, 2019
cf839ea
bump material lib to alpha07
AndyScherzinger Jun 3, 2019
375fb97
use day/night color
AndyScherzinger Jun 6, 2019
1e3f86c
Bump material to alpha-08
AndyScherzinger Jul 23, 2019
44020dc
make progress bar day/night aware
AndyScherzinger Jul 23, 2019
cc2593c
proper icon display for night theme for activities and notifications
AndyScherzinger Jul 23, 2019
57db615
icons with light background need to be keep with dark color
AndyScherzinger Jul 29, 2019
284bbf3
material design alpha09
AndyScherzinger Jul 31, 2019
f5a1a9a
bump to alpha10
AndyScherzinger Sep 13, 2019
a518885
add dark/light theming for activities headline
AndyScherzinger Sep 13, 2019
1615130
Fix activity foreground text colour for >=API21.
dan0xii Sep 20, 2019
b5d1de3
bump material to 1.1.0-beta01
AndyScherzinger Oct 7, 2019
4ce4027
Update to Alert Dialogs in api 21 and upwards.
dan0xii Oct 27, 2019
853d7cd
Dark theme updates
dan0xii Oct 28, 2019
9a9e0e6
Merge branch 'dark_theme' of github.com:nextcloud/android into dark_t…
dan0xii Oct 28, 2019
48b4358
proper button theming for notification actions
AndyScherzinger Oct 28, 2019
2021da0
proper contacts backup button theming
AndyScherzinger Oct 28, 2019
48e1384
make circular checkIcon background day/night aware
AndyScherzinger Oct 28, 2019
ae2dcbe
align user info toolbar theming with main toolbar theming
AndyScherzinger Oct 28, 2019
3de5e8f
remove possible overdraws
AndyScherzinger Oct 28, 2019
c1aa005
changes due to code review
AndyScherzinger Oct 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ dependencies {
qaImplementation "com.github.nextcloud:android-library:$androidLibraryVersion"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.android.material:material:1.1.0-beta01'
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import android.accounts.AccountManager;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
Expand Down Expand Up @@ -81,7 +80,7 @@ protected void onCreate(Bundle savedInstanceState) {
setSlideshowSize(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);

Button loginButton = findViewById(R.id.login);
loginButton.setBackgroundColor(Color.WHITE);
loginButton.setBackgroundColor(getResources().getColor(R.color.login_btn_tint));
loginButton.setTextColor(getResources().getColor(R.color.primary));

loginButton.setOnClickListener(v -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ public interface AppPreferences {
*/
int getUploaderBehaviour();

boolean isDarkThemeEnabled();

/**
* Saves the uploader behavior which the user has set last.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public final class AppPreferencesImpl implements AppPreferences {
private static final String PREF__AUTO_UPLOAD_INIT = "autoUploadInit";
private static final String PREF__FOLDER_SORT_ORDER = "folder_sort_order";
private static final String PREF__FOLDER_LAYOUT = "folder_layout";
public static final String PREF__THEME = "darkTheme";

private static final String PREF__LOCK_TIMESTAMP = "lock_timestamp";
private static final String PREF__SHOW_MEDIA_SCAN_NOTIFICATIONS = "show_media_scan_notifications";
private static final String PREF__LOCK = SettingsActivity.PREFERENCE_LOCK;
Expand Down Expand Up @@ -340,6 +342,11 @@ public int getUploaderBehaviour() {
return preferences.getInt(AUTO_PREF__UPLOADER_BEHAVIOR, 1);
}

@Override
public boolean isDarkThemeEnabled() {
return preferences.getBoolean(PREF__THEME, false);
}

@Override
public void setUploaderBehaviour(int uploaderBehaviour) {
preferences.edit().putInt(AUTO_PREF__UPLOADER_BEHAVIOR, uploaderBehaviour).apply();
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/owncloud/android/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
import androidx.annotation.RequiresApi;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.core.util.Pair;
import androidx.multidex.MultiDexApplication;
import dagger.android.AndroidInjector;
Expand Down Expand Up @@ -242,6 +243,7 @@ protected void attachBaseContext(Context base) {
@SuppressFBWarnings("ST")
@Override
public void onCreate() {
setAppTheme(preferences.isDarkThemeEnabled());
super.onCreate();

insertConscrypt();
Expand Down Expand Up @@ -811,4 +813,12 @@ public AndroidInjector<Object> androidInjector() {
return dispatchingAndroidInjector;
}


public static void setAppTheme(Boolean darkTheme) {
if (darkTheme) {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
} else {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ private void initWebViewLogin(String baseURL, boolean showLegacyLogin, boolean u
new Handler().postDelayed(() -> DisplayUtils.createSnackbar(mLoginWebView,
R.string.fallback_weblogin_text,
Snackbar.LENGTH_INDEFINITE)
.setActionTextColor(getResources().getColor(R.color.white))
.setActionTextColor(getResources().getColor(R.color.themed_fg))
.setBackgroundTint(getResources().getColor(R.color.themed_bg))
.setTextColor(getResources().getColor(R.color.themed_fg))
.setAction(R.string.fallback_weblogin_back, v -> {
mLoginWebView.setVisibility(View.INVISIBLE);
webViewLoginMethod = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,8 @@ private static Bitmap handlePNG(Bitmap bitmap, int pxW, int pxH) {
Bitmap resultBitmap = Bitmap.createBitmap(pxW, pxH, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(resultBitmap);

c.drawColor(MainApp.getAppContext().getResources().getColor(R.color.background_color));
// TODO check based on https://github.com/nextcloud/android/pull/3459#discussion_r339935975
c.drawColor(MainApp.getAppContext().getResources().getColor(R.color.background_color_png));
c.drawBitmap(bitmap, 0, 0, null);

return resultBitmap;
Expand Down
38 changes: 0 additions & 38 deletions src/main/java/com/owncloud/android/ui/RadioButtonPreference.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import android.view.ViewGroup;
import android.widget.Switch;

import com.owncloud.android.R;
import com.owncloud.android.utils.ThemeUtils;

import androidx.annotation.RequiresApi;
Expand Down Expand Up @@ -76,12 +77,14 @@ private void findSwitch(ViewGroup viewGroup) {
if(thumbColorStateList == null && trackColorStateList == null) {
int color = ThemeUtils.primaryAccentColor(getContext());
int trackColor = Color.argb(77, Color.red(color), Color.green(color), Color.blue(color));
int trackColorUnchecked = getContext().getResources().getColor(R.color.switch_track_color_unchecked);
thumbColorStateList = new ColorStateList(
new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
new int[]{color, Color.WHITE});
trackColorStateList = new ColorStateList(
new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
new int[]{trackColor, Color.parseColor("#4D000000")});
new int[][]{new int[]{android.R.attr.state_checked},
new int[]{}},
new int[]{trackColor, trackColorUnchecked});
}

// setting the thumb color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ private View getHeaderViewForItem(int itemPosition, RecyclerView parent) {
int headerPosition = adapter.getHeaderPositionForItem(itemPosition);
int layoutId = adapter.getHeaderLayout(itemPosition);
View header = LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false);
header.setBackgroundColor(Color.WHITE);
adapter.bindHeaderData(header, headerPosition);
return header;
}
Expand Down
Loading