diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..1dc527e72a6822d9171abc9fb761699f89bf9192
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,30 @@
+image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest"
+
+stages:
+- build
+
+before_script:
+- if [ -d "/srv/userscripts" ]; then cp -R userscripts/* /srv/userscripts ; fi
+- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
+- eval $(ssh-agent -s)
+- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
+- mkdir -p ~/.ssh
+- chmod 700 ~/.ssh
+- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
+- chmod 644 ~/.ssh/known_hosts
+- export GRADLE_USER_HOME=$(pwd)/.gradle
+- chmod +x ./gradlew
+
+cache:
+ key: ${CI_PROJECT_ID}
+ paths:
+ - .gradle/
+
+build:
+ stage: build
+ script:
+ - git submodule update --recursive --init
+ - ./gradlew build -x test
+ artifacts:
+ paths:
+ - app/build/outputs/apk/
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000000000000000000000000000000000000..bcbdbb13f37884ca0e79c84f131d02e0303e6219
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+© e Foundation 2018-2019 - Author: Nihar Thakkar
+© ECORP SAS 2018-2019 - Author: Romain Hunault
\ No newline at end of file
diff --git a/README.md b/README.md
index c9bcdbd2bc7ef955afea47cb0626c35e3721d4a9..db30ed4891aa97faeabd1228799a8ae0d580b220 100644
--- a/README.md
+++ b/README.md
@@ -1,67 +1,21 @@
-# Nextcloud Notes for Android
-An android client for [Nextcloud Notes App](https://github.com/nextcloud/notes/).
+# Notes
+An android client for [Nextcloud Notes App](https://github.com/nextcloud/notes/)
+Notes is forked from [Nextcloud Notes](https://github.com/stefan-niedermann/nextcloud-notes)
-[![Android CI](https://github.com/stefan-niedermann/nextcloud-notes/workflows/Android%20CI/badge.svg)](https://github.com/stefan-niedermann/nextcloud-notes/actions)
-[![Codacy Badge](https://api.codacy.com/project/badge/Grade/9f784826834042e8b512d531cab84711)](https://www.codacy.com/manual/info_147/nextcloud-notes?utm_source=github.com&utm_medium=referral&utm_content=stefan-niedermann/nextcloud-notes&utm_campaign=Badge_Grade)
-[![GitHub issues](https://img.shields.io/github/issues/stefan-niedermann/nextcloud-notes.svg)](https://github.com/stefan-niedermann/nextcloud-notes/issues)
-[![GitHub stars](https://img.shields.io/github/stars/stefan-niedermann/nextcloud-notes.svg)](https://github.com/stefan-niedermann/nextcloud-notes/stargazers)
-[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
+## Authors
-## :arrow_forward: Access
+[Authors](https://gitlab.e.foundation/e/apps/Notes/-/blob/master/AUTHORS)
-[![Latest Release](https://img.shields.io/github/v/tag/stefan-niedermann/nextcloud-notes?label=latest+release&sort=semver)](https://github.com/stefan-niedermann/nextcloud-notes/tags)
-[![F-Droid Release](https://img.shields.io/f-droid/v/it.niedermann.owncloud.notes)](https://f-droid.org/de/packages/it.niedermann.owncloud.notes/)
+## Release Notes
-[](https://play.google.com/store/apps/details?id=it.niedermann.owncloud.notes)
-[](https://f-droid.org/repository/browse/?fdid=it.niedermann.owncloud.notes)
-[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K7HVLE6J7SXXA)
-[](https://liberapay.com/stefan-niedermann/donate)
+Check out the [Release Notes](https://gitlab.e.foundation/e/apps/Notes/-/releases) to find out what changed
+in each version of Notes.
-## :eyes: Screenshots
+## Privacy Policy
-| _ | _ | _ |
-| :--: | :--: | :--: |
-| ![Screenshot of list view](/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png) | ![Screenshot of edit mode](/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png) | ![Screenshot of preview](/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png) |
+[Privacy Policy](https://e.foundation/legal-notice-privacy)
+[Terms of service](https://e.foundation/legal-notice-privacy)
-## :rocket: Features
- * Multiple accounts
- * List, create, edit, share, search and delete notes
- * Share text and links as new note into the app
- * Toggling checkboxes in view mode
- * Mark notes as favorite
- * Bulk delete
- * In-note search
- * Single note widget and note list widget
- * Render Markdown (using [Markwon](https://noties.io/Markwon))
- * Translated in many languages on [Transifex](https://www.transifex.com/nextcloud/nextcloud/android-notes/)
- * Context based formatting ([#363](https://github.com/stefan-niedermann/nextcloud-notes/issues/363))
- * Password protection ([#354](https://github.com/stefan-niedermann/nextcloud-notes/issues/354))
+## License
-## :checkered_flag: Roadmap
- * We usually focus on [pinned issues](https://github.com/stefan-niedermann/nextcloud-notes/issues) in our issue tracker
- * Since this is an Open Source freetime project, there is no guarantee when and if and how we implement new features
-
-## :family: Join the team
- * Test the app with different devices
- * Report issues in the [issue tracker](https://github.com/stefan-niedermann/nextcloud-notes/issues)
- * [Pick a good first issue](https://github.com/stefan-niedermann/nextcloud-notes/labels/Good%20first%20issue) :notebook:
- * Create a [Pull Request](https://opensource.guide/how-to-contribute/#opening-a-pull-request)
- * Help translating this app on [Transifex](https://www.transifex.com/nextcloud/nextcloud/android-notes/) 🌎
- * Buy this app on [Google Play Store](https://play.google.com/store/apps/details?id=it.niedermann.owncloud.notes)
- * Send me a bottle of your favorite beer :beers: :wink:
-
-## :link: Requirements
- * [Nextcloud](https://nextcloud.com/) instance running
- * [Nextcloud Android](https://github.com/nextcloud/android) app installed (≥ 3.9.0)
- * [Nextcloud Notes](https://github.com/nextcloud/notes) app enabled
-
-## :notebook: License
-This project is licensed under the [GNU GENERAL PUBLIC LICENSE](/LICENSE).
+Notes is licensed under the [GNU General Public License v3.0](https://gitlab.e.foundation/e/apps/Notes/-/blob/master/LICENSE)
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 27ceced8b93c8a6eb7af207694804c92422b8fbb..615e4a095823fe760660d3052810953874e86566 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -11,8 +11,8 @@ android {
}
defaultConfig {
- applicationId "it.niedermann.owncloud.notes"
- minSdkVersion 23
+ applicationId "foundation.e.notes"
+ minSdkVersion 24
targetSdkVersion 33
versionCode 3007001
versionName "3.7.1"
@@ -39,30 +39,6 @@ android {
}
}
-
- flavorDimensions "version"
-
- productFlavors {
- fdroid {
- dimension "version"
- }
- dev {
- dimension "version"
- applicationIdSuffix ".dev"
- }
- play {
- dimension "version"
- }
- pfungstadt {
- dimension "version"
- applicationIdSuffix ".pfungstadt"
- }
- mdm {
- dimension "version"
- applicationIdSuffix ".mdm"
- }
- }
-
testOptions {
unitTests {
includeAndroidResources true
@@ -73,6 +49,7 @@ android {
disable 'MissingTranslation'
}
namespace 'it.niedermann.owncloud.notes'
+
}
dependencies {
@@ -124,4 +101,5 @@ dependencies {
testImplementation 'org.robolectric:robolectric:4.9'
implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation 'foundation.e:elib:0.0.1-alpha11'
}
diff --git a/app/src/dev/res/drawable/ic_launcher_foreground.xml b/app/src/dev/res/drawable/ic_launcher_foreground.xml
deleted file mode 100644
index 9cb8dccf26611d40250a33b9b508b8a75b5c3f95..0000000000000000000000000000000000000000
--- a/app/src/dev/res/drawable/ic_launcher_foreground.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/dev/res/xml/shortcuts.xml b/app/src/dev/res/xml/shortcuts.xml
deleted file mode 100644
index 086d61f8c69b694d991670b89de18ccb25309ec1..0000000000000000000000000000000000000000
--- a/app/src/dev/res/xml/shortcuts.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5b23bd71524a16e246156886e77b97416b34081b..490b5b2f040bf0a58be3395ffacbf0c1efa0809f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,6 +4,8 @@
+
+
@@ -15,7 +17,7 @@
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
- android:label="@string/app_name_long"
+ android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/AppTheme"
@@ -173,5 +175,11 @@
+
+
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
index c1e67d8b80be48e46b8a786bd79bc1f4245cdb57..7acab5295324858eba9533e4342049b7c84c34a1 100644
Binary files a/app/src/main/ic_launcher-web.png and b/app/src/main/ic_launcher-web.png differ
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/NotesApplication.java b/app/src/main/java/it/niedermann/owncloud/notes/NotesApplication.java
index e177f7c7c9ecada189cce84e6aa2f4498fe69d6d..0ef67609122a803c7f6a3b7139f5646aa0c7dc84 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/NotesApplication.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/NotesApplication.java
@@ -20,12 +20,10 @@ public class NotesApplication extends Application {
private static boolean lockedPreference = false;
private static boolean isLocked = true;
private static long lastInteraction = 0;
- private static String PREF_KEY_THEME;
private static boolean isGridViewEnabled = false;
@Override
public void onCreate() {
- PREF_KEY_THEME = getString(R.string.pref_key_theme);
setAppTheme(getAppTheme(getApplicationContext()));
final var prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
lockedPreference = prefs.getBoolean(getString(R.string.pref_key_lock), false);
@@ -46,14 +44,7 @@ public class NotesApplication extends Application {
}
public static DarkModeSetting getAppTheme(Context context) {
- final var prefs = PreferenceManager.getDefaultSharedPreferences(context);
- String mode;
- try {
- mode = prefs.getString(PREF_KEY_THEME, DarkModeSetting.SYSTEM_DEFAULT.name());
- } catch (ClassCastException e) {
- final boolean darkModeEnabled = prefs.getBoolean(PREF_KEY_THEME, false);
- mode = darkModeEnabled ? DarkModeSetting.DARK.name() : DarkModeSetting.LIGHT.name();
- }
+ String mode = DarkModeSetting.SYSTEM_DEFAULT.name();
return DarkModeSetting.valueOf(mode);
}
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/about/AboutActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/about/AboutActivity.java
index 5c5bf519f4baeada3e4285487fce1cebb9af3ca3..ed21d14e3f0a2eb03da9112451cb102a577ace2b 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/about/AboutActivity.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/about/AboutActivity.java
@@ -2,27 +2,13 @@ package it.niedermann.owncloud.notes.about;
import android.os.Bundle;
-import androidx.annotation.ColorInt;
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentActivity;
-import androidx.viewpager2.adapter.FragmentStateAdapter;
-
-import com.google.android.material.tabs.TabLayoutMediator;
-
-import it.niedermann.owncloud.notes.LockedActivity;
import it.niedermann.owncloud.notes.R;
-import it.niedermann.owncloud.notes.branding.BrandingUtil;
+import it.niedermann.owncloud.notes.branding.BrandedActivity;
import it.niedermann.owncloud.notes.databinding.ActivityAboutBinding;
-public class AboutActivity extends LockedActivity {
+public class AboutActivity extends BrandedActivity {
private ActivityAboutBinding binding;
- private final static int POS_CREDITS = 0;
- private final static int POS_CONTRIB = 1;
- private final static int POS_LICENSE = 2;
- private final static int TOTAL_COUNT = 3;
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -31,65 +17,12 @@ public class AboutActivity extends LockedActivity {
setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar);
- binding.pager.setAdapter(new TabsStateAdapter(this));
- // generate title based on given position
- new TabLayoutMediator(binding.tabs, binding.pager, (tab, position) -> {
- switch (position) {
- default: // Fall-through to credits tab
- case POS_CREDITS:
- tab.setText(R.string.about_credits_tab_title);
- break;
- case POS_CONTRIB:
- tab.setText(R.string.about_contribution_tab_title);
- break;
- case POS_LICENSE:
- tab.setText(R.string.about_license_tab_title);
- break;
- }
- }).attach();
+
+ getFragmentManager().beginTransaction().replace(binding.container.getId(), new AboutFragment()).commit();
}
@Override
public void applyBrand(int mainColor, int textColor) {
applyBrandToPrimaryToolbar(binding.appBar, binding.toolbar);
- @ColorInt int finalMainColor = BrandingUtil.getSecondaryForegroundColorDependingOnTheme(this, mainColor);
- binding.tabs.setSelectedTabIndicatorColor(finalMainColor);
- }
-
- private static class TabsStateAdapter extends FragmentStateAdapter {
-
- TabsStateAdapter(FragmentActivity fa) {
- super(fa);
- }
-
- @Override
- public int getItemCount() {
- return TOTAL_COUNT;
- }
-
- /**
- * return the right fragment for the given position
- */
- @NonNull
- @Override
- public Fragment createFragment(int position) {
- switch (position) {
- default: // Fall-through to credits tab
- case POS_CREDITS:
- return new AboutFragmentCreditsTab();
-
- case POS_CONTRIB:
- return new AboutFragmentContributingTab();
-
- case POS_LICENSE:
- return new AboutFragmentLicenseTab();
- }
- }
- }
-
- @Override
- public boolean onSupportNavigateUp() {
- finish(); // close this activity as oppose to navigating up
- return true;
}
}
\ No newline at end of file
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragment.java
new file mode 100644
index 0000000000000000000000000000000000000000..14ddf19c30f2c395b582b93b0a8b7a89bcf7fd49
--- /dev/null
+++ b/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragment.java
@@ -0,0 +1,24 @@
+package it.niedermann.owncloud.notes.about;
+
+import android.os.Bundle;
+import android.preference.PreferenceFragment;
+
+import androidx.annotation.Nullable;
+
+import it.niedermann.owncloud.notes.BuildConfig;
+import it.niedermann.owncloud.notes.R;
+
+public class AboutFragment extends PreferenceFragment {
+
+ private static final String BUILD_VERSION = "build_version";
+
+ @Override
+ public void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ addPreferencesFromResource(R.xml.about_preferences);
+
+ findPreference(BUILD_VERSION).setSummary(BuildConfig.VERSION_NAME);
+
+ }
+}
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragmentContributingTab.java b/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragmentContributingTab.java
deleted file mode 100644
index 90a9a3bce964ec120d941bb54c176f4965ee421e..0000000000000000000000000000000000000000
--- a/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragmentContributingTab.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package it.niedermann.owncloud.notes.about;
-
-import static it.niedermann.owncloud.notes.shared.util.SupportUtil.setTextWithURL;
-
-import android.os.Bundle;
-import android.text.method.LinkMovementMethod;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-
-import it.niedermann.owncloud.notes.R;
-import it.niedermann.owncloud.notes.databinding.FragmentAboutContributionTabBinding;
-import it.niedermann.owncloud.notes.shared.util.SupportUtil;
-
-public class AboutFragmentContributingTab extends Fragment {
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- final var binding = FragmentAboutContributionTabBinding.inflate(inflater, container, false);
- setTextWithURL(binding.aboutSource, getResources(), R.string.about_source, R.string.url_source, R.string.url_source);
- setTextWithURL(binding.aboutIssues, getResources(), R.string.about_issues, R.string.url_issues, R.string.url_issues);
- setTextWithURL(binding.aboutTranslate, getResources(), R.string.about_translate, R.string.url_translations, R.string.url_translations);
- return binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragmentCreditsTab.java b/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragmentCreditsTab.java
deleted file mode 100644
index 028bfa4e0a95e6e9534a725163a2f30fdcc18dea..0000000000000000000000000000000000000000
--- a/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragmentCreditsTab.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package it.niedermann.owncloud.notes.about;
-
-import static it.niedermann.owncloud.notes.shared.util.SupportUtil.setTextWithURL;
-import static it.niedermann.owncloud.notes.shared.util.SupportUtil.strong;
-import static it.niedermann.owncloud.notes.shared.util.SupportUtil.url;
-
-import android.os.Bundle;
-import android.text.method.LinkMovementMethod;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-
-import it.niedermann.owncloud.notes.BuildConfig;
-import it.niedermann.owncloud.notes.R;
-import it.niedermann.owncloud.notes.databinding.FragmentAboutCreditsTabBinding;
-
-public class AboutFragmentCreditsTab extends Fragment {
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- final var binding = FragmentAboutCreditsTabBinding.inflate(inflater, container, false);
- binding.aboutVersion.setText(getString(R.string.about_version, strong(BuildConfig.VERSION_NAME)));
- binding.aboutMaintainer.setText(url(getString(R.string.about_maintainer), getString(R.string.url_maintainer)));
- binding.aboutMaintainer.setMovementMethod(new LinkMovementMethod());
- setTextWithURL(binding.aboutTranslators, getResources(), R.string.about_translators_transifex, R.string.about_translators_transifex_label, R.string.url_translations);
- return binding.getRoot();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragmentLicenseTab.java b/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragmentLicenseTab.java
deleted file mode 100644
index 10cc02c74afe814326a97375c3cfa94b731a5deb..0000000000000000000000000000000000000000
--- a/app/src/main/java/it/niedermann/owncloud/notes/about/AboutFragmentLicenseTab.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package it.niedermann.owncloud.notes.about;
-
-import static it.niedermann.owncloud.notes.shared.util.SupportUtil.setTextWithURL;
-
-import android.content.Intent;
-import android.content.res.ColorStateList;
-import android.net.Uri;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.annotation.ColorInt;
-import androidx.annotation.NonNull;
-import androidx.core.graphics.drawable.DrawableCompat;
-
-import it.niedermann.android.util.ColorUtil;
-import it.niedermann.owncloud.notes.R;
-import it.niedermann.owncloud.notes.branding.BrandedFragment;
-import it.niedermann.owncloud.notes.branding.BrandingUtil;
-import it.niedermann.owncloud.notes.databinding.FragmentAboutLicenseTabBinding;
-
-public class AboutFragmentLicenseTab extends BrandedFragment {
-
- private FragmentAboutLicenseTabBinding binding;
-
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- binding = FragmentAboutLicenseTabBinding.inflate(inflater, container, false);
- setTextWithURL(binding.aboutIconsDisclaimerAppIcon, getResources(), R.string.about_icons_disclaimer_app_icon, R.string.about_app_icon_author_link_label, R.string.url_about_icon_author);
- setTextWithURL(binding.aboutIconsDisclaimerMdiIcons, getResources(), R.string.about_icons_disclaimer_mdi_icons, R.string.about_icons_disclaimer_mdi, R.string.url_about_icons_disclaimer_mdi);
- binding.aboutAppLicenseButton.setOnClickListener((v) -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.url_license)))));
- return binding.getRoot();
- }
-
- @Override
- public void applyBrand(int mainColor, int textColor) {
- @ColorInt final int finalMainColor = BrandingUtil.getSecondaryForegroundColorDependingOnTheme(requireContext(), mainColor);
- DrawableCompat.setTintList(binding.aboutAppLicenseButton.getBackground(), ColorStateList.valueOf(finalMainColor));
- binding.aboutAppLicenseButton.setTextColor(ColorUtil.INSTANCE.getForegroundColorForBackgroundColor(finalMainColor));
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedActivity.java
index e7cc6dfd8cf71cfe52a8d13407b0f51f53aec4c6..92d0d8972112e35a8661de0d66a074c36fd23ffd 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedActivity.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedActivity.java
@@ -50,19 +50,5 @@ public abstract class BrandedActivity extends AppCompatActivity implements Brand
}
public void applyBrandToPrimaryToolbar(@NonNull AppBarLayout appBarLayout, @NonNull Toolbar toolbar) {
- // FIXME Workaround for https://github.com/stefan-niedermann/nextcloud-notes/issues/889
- appBarLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.primary));
-
- final var overflowDrawable = toolbar.getOverflowIcon();
- if (overflowDrawable != null) {
- overflowDrawable.setColorFilter(colorAccent, PorterDuff.Mode.SRC_ATOP);
- toolbar.setOverflowIcon(overflowDrawable);
- }
-
- final var navigationDrawable = toolbar.getNavigationIcon();
- if (navigationDrawable != null) {
- navigationDrawable.setColorFilter(colorAccent, PorterDuff.Mode.SRC_ATOP);
- toolbar.setNavigationIcon(navigationDrawable);
- }
}
}
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedSwitchPreference.java b/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedSwitchPreference.java
index 07eb0c63c632e1988ddf8894eb0ccab30a90a4d5..c31ad1eeb8cbbf20d0f87f5522165b3e62b09e50 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedSwitchPreference.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/branding/BrandedSwitchPreference.java
@@ -2,8 +2,6 @@ package it.niedermann.owncloud.notes.branding;
import android.annotation.SuppressLint;
import android.content.Context;
-import android.content.res.ColorStateList;
-import android.graphics.Color;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
@@ -11,14 +9,9 @@ import android.widget.Switch;
import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;
-import androidx.core.graphics.drawable.DrawableCompat;
import androidx.preference.PreferenceViewHolder;
import androidx.preference.SwitchPreference;
-import it.niedermann.owncloud.notes.R;
-
-import static it.niedermann.owncloud.notes.branding.BrandingUtil.getSecondaryForegroundColorDependingOnTheme;
-
public class BrandedSwitchPreference extends SwitchPreference implements Branded {
@ColorInt
@@ -53,9 +46,6 @@ public class BrandedSwitchPreference extends SwitchPreference implements Branded
if (holder.itemView instanceof ViewGroup) {
switchView = findSwitchWidget(holder.itemView);
- if (mainColor != null && textColor != null) {
- applyBrand();
- }
}
}
@@ -64,22 +54,6 @@ public class BrandedSwitchPreference extends SwitchPreference implements Branded
this.mainColor = mainColor;
this.textColor = textColor;
// onBindViewHolder is called after applyBrand, therefore we have to store the given values and apply them later.
- applyBrand();
- }
-
- private void applyBrand() {
- if (switchView != null) {
- final int finalMainColor = getSecondaryForegroundColorDependingOnTheme(getContext(), mainColor);
- // int trackColor = Color.argb(77, Color.red(finalMainColor), Color.green(finalMainColor), Color.blue(finalMainColor));
- DrawableCompat.setTintList(switchView.getThumbDrawable(), new ColorStateList(
- new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
- new int[]{finalMainColor, getContext().getResources().getColor(R.color.fg_default_low)}
- ));
- DrawableCompat.setTintList(switchView.getTrackDrawable(), new ColorStateList(
- new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
- new int[]{finalMainColor, getContext().getResources().getColor(R.color.fg_default_low)}
- ));
- }
}
/**
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java
index b524e2fb2fe4a65d185bfc5442e2399f1c70c1ef..e7284a80ed11834c5a50297170fd020cbcef49a6 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/edit/BaseNoteFragment.java
@@ -201,7 +201,7 @@ public abstract class BaseNoteFragment extends BrandedFragment implements Catego
}
private void prepareFavoriteOption(MenuItem item) {
- item.setIcon(note.getFavorite() ? R.drawable.ic_star_white_24dp : R.drawable.ic_star_border_white_24dp);
+ item.setIcon(note.getFavorite() ? R.drawable.ic_star_accent_24dp : R.drawable.ic_star_border_accent_24dp);
item.setChecked(note.getFavorite());
tintMenuIcon(item, colorAccent);
}
@@ -252,7 +252,7 @@ public abstract class BaseNoteFragment extends BrandedFragment implements Catego
if (ShortcutManagerCompat.isRequestPinShortcutSupported(context)) {
final var pinShortcutInfo = new ShortcutInfoCompat.Builder(context, String.valueOf(note.getId()))
.setShortLabel(note.getTitle())
- .setIcon(IconCompat.createWithResource(context.getApplicationContext(), TRUE.equals(note.getFavorite()) ? R.drawable.ic_star_yellow_24dp : R.drawable.ic_star_grey_ccc_24dp))
+ .setIcon(IconCompat.createWithResource(context.getApplicationContext(), TRUE.equals(note.getFavorite()) ? R.drawable.ic_star_accent_24dp : R.drawable.ic_star_border_accent_24dp))
.setIntent(new Intent(getActivity(), EditNoteActivity.class).putExtra(EditNoteActivity.PARAM_NOTE_ID, note.getId()).setAction(ACTION_SHORTCUT))
.build();
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionActivity.java
index 0761b603647ec3d237c200200486aa4075782422..cb51d736bdef3ff12f91ea06d8a618b9a562f481 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionActivity.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionActivity.java
@@ -38,7 +38,7 @@ public class ExceptionActivity extends AppCompatActivity {
}
final var adapter = new TipsAdapter(this::startActivity);
- final String debugInfos = ExceptionUtil.INSTANCE.getDebugInfos(this, throwable, BuildConfig.FLAVOR);
+ final String debugInfos = ExceptionUtil.INSTANCE.getDebugInfos(this, throwable, "PROD");
binding.tips.setAdapter(adapter);
binding.tips.setNestedScrollingEnabled(false);
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionDialogFragment.java b/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionDialogFragment.java
index ca242a7fd1129ef5f6eb4d6e40d666f13b9d95e5..33a65173b2074d163c102f2668ef048f1daa5c2a 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionDialogFragment.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/exception/ExceptionDialogFragment.java
@@ -57,7 +57,7 @@ public class ExceptionDialogFragment extends AppCompatDialogFragment {
final var adapter = new TipsAdapter((actionIntent) -> requireActivity().startActivity(actionIntent));
- final String debugInfos = ExceptionUtil.INSTANCE.getDebugInfos(requireContext(), throwables, BuildConfig.FLAVOR);
+ final String debugInfos = ExceptionUtil.INSTANCE.getDebugInfos(requireContext(), throwables, "PROD");
binding.tips.setAdapter(adapter);
binding.stacktrace.setText(debugInfos);
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/main/MainActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/main/MainActivity.java
index 046f0e7d5ec12aa857161cd4d5998656743657dc..a42c836af4082199a729fc298866abc540e0ef68 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/main/MainActivity.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/main/MainActivity.java
@@ -34,7 +34,6 @@ import androidx.appcompat.widget.SearchView;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
-import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.splashscreen.SplashScreen;
import androidx.core.view.GravityCompat;
import androidx.lifecycle.Observer;
@@ -157,10 +156,6 @@ public class MainActivity extends LockedActivity implements NoteClickListener, A
gridView = isGridViewEnabled();
- if (!gridView || isDarkThemeActive(this)) {
- activityBinding.activityNotesListView.setBackgroundColor(ContextCompat.getColor(this, R.color.primary));
- }
-
setupToolbars();
setupNavigationList();
setupNotesList();
@@ -404,8 +399,15 @@ public class MainActivity extends LockedActivity implements NoteClickListener, A
final var toggle = new ActionBarDrawerToggle(this, binding.drawerLayout, activityBinding.homeToolbar, 0, 0);
binding.drawerLayout.addDrawerListener(toggle);
+ toggle.setHomeAsUpIndicator(R.drawable.ic_hamberger_24dp);
toggle.syncState();
+ if (binding.activityNotesListView.searchToolbar.getNavigationIcon() != null) {
+ binding.activityNotesListView.searchToolbar.getNavigationIcon().setTint(ContextCompat.getColor(this, R.color.e_primary_text_color));
+ }
+
+ toggle.setToolbarNavigationClickListener(view -> binding.drawerLayout.openDrawer(GravityCompat.START));
+
activityBinding.searchView.setOnCloseListener(() -> {
if (activityBinding.searchToolbar.getVisibility() == VISIBLE && TextUtils.isEmpty(activityBinding.searchView.getQuery())) {
updateToolbars(false);
@@ -602,7 +604,6 @@ public class MainActivity extends LockedActivity implements NoteClickListener, A
// TODO We assume, that the background of the spinner is always white
activityBinding.swiperefreshlayout.setColorSchemeColors(contrastRatioIsSufficient(Color.WHITE, mainColor) ? mainColor : Color.BLACK);
binding.appName.setTextColor(textColor);
- DrawableCompat.setTint(binding.logo.getDrawable(), textColor);
adapter.applyBrand(mainColor, textColor);
adapterCategories.applyBrand(mainColor, textColor);
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/main/MainViewModel.java b/app/src/main/java/it/niedermann/owncloud/notes/main/MainViewModel.java
index 4de6ebeced78dbff5d1edcefcf1f82f45fc69d10..15e3cb54d2dce734cdbf87bc6b34b2c1fe5ba49e 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/main/MainViewModel.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/main/MainViewModel.java
@@ -319,7 +319,7 @@ public class MainViewModel extends AndroidViewModel {
private static List fromCategoriesWithNotesCount(@NonNull Context context, @Nullable String expandedCategory, @NonNull List fromDatabase, int count, int favoritesCount) {
final var categories = convertToCategoryNavigationItem(context, fromDatabase);
final var itemRecent = new NavigationItem(ADAPTER_KEY_RECENT, context.getString(R.string.label_all_notes), count, R.drawable.ic_access_time_grey600_24dp, RECENT);
- final var itemFavorites = new NavigationItem(ADAPTER_KEY_STARRED, context.getString(R.string.label_favorites), favoritesCount, R.drawable.ic_star_yellow_24dp, FAVORITES);
+ final var itemFavorites = new NavigationItem(ADAPTER_KEY_STARRED, context.getString(R.string.label_favorites), favoritesCount, R.drawable.ic_star_grey_24dp, FAVORITES);
final var items = new ArrayList(fromDatabase.size() + 3);
items.add(itemRecent);
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java
index 609d1aeff4a9191cf3c64018c1bdb41d224ee413..499957069baaf8b0d54764cd3f69d66ccb43b5a8 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java
@@ -104,7 +104,7 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder {
}
protected void bindFavorite(@NonNull ImageView noteFavorite, boolean isFavorite) {
- noteFavorite.setImageResource(isFavorite ? R.drawable.ic_star_yellow_24dp : R.drawable.ic_star_grey_ccc_24dp);
+ noteFavorite.setImageResource(isFavorite ? R.drawable.ic_star_accent_24dp : R.drawable.ic_star_border_accent_24dp);
noteFavorite.setOnClickListener(view -> noteClickListener.onNoteFavoriteClick(getLayoutPosition(), view));
}
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/main/menu/MenuViewHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/main/menu/MenuViewHolder.java
index d5a2f60887ff54b5cdbeedc8bb7ecd00e7ffc9d1..dd05e971254c5119cca79c77b513429f6a8ff56a 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/main/menu/MenuViewHolder.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/main/menu/MenuViewHolder.java
@@ -24,7 +24,7 @@ public class MenuViewHolder extends RecyclerView.ViewHolder {
public void bind(@NonNull MenuItem menuItem, @NonNull Consumer