Skip to content

Commit

Permalink
Code refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed May 17, 2023
1 parent 6d3909e commit ea36419
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 169 deletions.
20 changes: 9 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,6 @@
android:name=".ui.preview.PreviewImageActivity"
android:exported="false"
android:theme="@style/Theme.ownCloud.Overlay" />

<activity
android:name="com.nmc.android.ui.PrivacySettingsActivity"
android:exported="false"
android:windowSoftInputMode="stateAlwaysHidden" />

<activity
android:name="com.nmc.android.ui.LoginPrivacySettingsActivity"
android:exported="false"
android:windowSoftInputMode="stateAlwaysHidden" />

<service
android:name=".authentication.AccountAuthenticatorService"
android:exported="false">
Expand Down Expand Up @@ -497,6 +486,15 @@
android:name=".ui.preview.PreviewBitmapActivity"
android:exported="false"
android:theme="@style/Theme.ownCloud.OverlayGrey" />
<activity
android:name="com.nmc.android.ui.PrivacySettingsActivity"
android:exported="false"
android:windowSoftInputMode="stateAlwaysHidden" />

<activity
android:name="com.nmc.android.ui.LoginPrivacySettingsActivity"
android:exported="false"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.nextcloud.client.documentscan.DocumentScanActivity"
android:exported="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.nextcloud.client.preferences.DarkMode;
import com.nmc.android.ui.PrivacySettingsActivity;
import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
Expand Down Expand Up @@ -186,11 +185,7 @@ public void onCreate(Bundle savedInstanceState) {
setupMoreCategory();

// About
// Not required in NMC
//setupAboutCategory(appVersion);

// Data Privacy
setupDataPrivacyCategory();
setupAboutCategory(appVersion);

// Dev
setupDevCategory(preferenceScreen);
Expand Down Expand Up @@ -326,83 +321,6 @@ private void setupAboutCategory(String appVersion) {
}
}

/**
* NMC customization
*/
private void setupDataPrivacyCategory() {
PreferenceCategory preferenceCategoryAbout = (PreferenceCategory) findPreference("data_protection");
viewThemeUtils.files.themePreferenceCategory(preferenceCategoryAbout);

//privacy settings
Preference privacySettingPreference = findPreference("privacy_settings");
if (privacySettingPreference != null) {
// privacySettingPreference.setTitle(ThemeUtils.getColoredTitle(getString(R.string.privacy_settings),
// accentColor));
privacySettingPreference.setOnPreferenceClickListener(preference -> {
PrivacySettingsActivity.openPrivacySettingsActivity(this, false);
return true;
});
}

// privacy policy
Preference privacyPolicyPreference = findPreference("privacy_policy");

if (privacyPolicyPreference != null) {
//privacyPolicyPreference.setTitle(ThemeUtils.getColoredTitle(getString(R.string.privacy_policy),
// accentColor));
if (URLUtil.isValidUrl(getString(R.string.privacy_url))) {
privacyPolicyPreference.setOnPreferenceClickListener(preference -> {
try {
Uri privacyUrl = Uri.parse(getString(R.string.privacy_url));
String mimeType = MimeTypeUtil.getBestMimeTypeByFilename(privacyUrl.getLastPathSegment());

Intent intent;
if ("application/pdf".equals(mimeType)) {
intent = new Intent(Intent.ACTION_VIEW, privacyUrl);
DisplayUtils.startIntentIfAppAvailable(intent, this, R.string.no_pdf_app_available);
} else {
intent = new Intent(getApplicationContext(), ExternalSiteWebView.class);
intent.putExtra(ExternalSiteWebView.EXTRA_TITLE,
getResources().getString(R.string.privacy_policy));
intent.putExtra(ExternalSiteWebView.EXTRA_URL, privacyUrl.toString());
intent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
intent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
}

startActivity(intent);
} catch (Exception e) {
Log_OC.e(TAG, "Could not parse privacy policy url");
preferenceCategoryAbout.removePreference(privacyPolicyPreference);
}
return true;
});
} else {
preferenceCategoryAbout.removePreference(privacyPolicyPreference);
}
}

// source code
Preference sourcecodePreference = findPreference("sourcecode");
if (sourcecodePreference != null) {
// sourcecodePreference.setTitle(ThemeUtils.getColoredTitle(getString(R.string.prefs_open_source),
// accentColor));
if (URLUtil.isValidUrl(getString(R.string.sourcecode_url))) {
sourcecodePreference.setOnPreferenceClickListener(preference -> {
Intent intent = new Intent(getApplicationContext(), ExternalSiteWebView.class);
intent.putExtra(ExternalSiteWebView.EXTRA_TITLE,
getResources().getString(R.string.prefs_open_source));
intent.putExtra(ExternalSiteWebView.EXTRA_URL, getResources().getString(R.string.sourcecode_url));
intent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
intent.putExtra(ExternalSiteWebView.EXTRA_MENU_ITEM_ID, -1);
startActivity(intent);
return true;
});
} else {
preferenceCategoryAbout.removePreference(sourcecodePreference);
}
}
}

private void setupMoreCategory() {
final PreferenceCategory preferenceCategoryMore = (PreferenceCategory) findPreference("more");
viewThemeUtils.files.themePreferenceCategory(preferenceCategoryMore);
Expand Down
12 changes: 8 additions & 4 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,6 @@
<string name="prefs_value_theme_system">Systemvorgaben verwenden</string>

<!-- strings for privacy policy and setting start -->
<string name="prefs_category_data_privacy">Datenschutz</string>
<string name="privacy_settings">Datenschutz</string>
<string name="privacy_policy">Datenschutzbestimmungen</string>
<string name="prefs_open_source">Verwendete OpenSource Software</string>
<string name="privacy_settings_intro_text">Zur Optimierung unserer App erfassen wir anonymisierte Daten. Hierzu nutzen wir Software Lösungen verschiedener Partner. Wir möchten Ihnen volle Transparenz und Entscheidungsgewalt über die Verarbeitung und Erfassung Ihrer anonymisierten Nutzungsdaten geben. Ihre Einstellungen können Sie auch später jederzeit in den Einstellungen unter Datenschutz ändern. Bitte beachten Sie jedoch, dass die Datenerfassungen einen erheblichen Beitrag zur Optimierung dieser App leisten und Sie diese Optimierungen durch die Unterbindung der Datenübermittlung verhindern.</string>
<string name="required_data_collection">Erfoderliche Datenerfassung</string>
<string name="data_collection_info">Die Erfassung dieser Daten ist notwendig, um wesentliche Funktionen der App nutzen zu können.</string>
Expand Down Expand Up @@ -879,6 +875,14 @@
<string name="uploader_error_title_file_cannot_be_uploaded">Diese Datei kann nicht hochgeladen werden</string>
<string name="uploader_error_title_no_file_to_upload">Keine Datei zum Hochladen</string>
<string name="uploader_info_dirname">Ordnername</string>
<string name="prefs_category_account_info">Kontoinformationen</string>
<string name="prefs_category_data_privacy">Datenschutz</string>
<string name="privacy_settings">Datenschutz</string>
<string name="privacy_policy">Datenschutzbestimmungen</string>
<string name="prefs_open_source">Verwendete OpenSource Software</string>
<string name="prefs_category_info">Info</string>
<string name="prefs_category_service">Bedienung</string>
<string name="prefs_keys_exist_summary">Die Ende-zu-Ende Verschlüsselung wurde bereits auf einem anderen Gerät eingerichtet. Bitte geben Sie Ihre Passphrase ein, damit die Dateien synchronisiert und entschlüsselt werden.</string>
<string name="uploader_top_message">Hochladeordner auswählen</string>
<string name="uploader_upload_failed_content_single">Konnte %1$s nicht hochladen</string>
<string name="uploader_upload_failed_credentials_error">Hochladen fehlgeschlagen, bitte erneut anmelden</string>
Expand Down
77 changes: 66 additions & 11 deletions app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<color name="text_color_inverse">#000000</color>
<color name="disabled_text">#ff6F6F6F</color>
<color name="secondary_text_color">#A5A5A5</color>
<color name="divider_color">@color/grey_70</color>
<color name="list_divider_background">#222222</color>

<!-- Colors -->
Expand All @@ -35,16 +34,6 @@
<color name="nc_grey">#222222</color>
<color name="icon_on_nc_grey">#ffffff</color>

<!-- Switch Compat Colors -->
<color name="switch_thumb_checked_disabled">@color/grey_70</color>
<color name="switch_track_checked_disabled">@color/grey_60</color>
<color name="switch_thumb_unchecked_disabled">@color/grey_70</color>
<color name="switch_track_unchecked_disabled">@color/grey_60</color>

<!-- Checkbox Colors -->
<color name="checkbox_checked_disabled">@color/grey_70</color>
<color name="checkbox_unchecked_disabled">@color/grey_70</color>

<!-- Multiselect backgrounds -->
<color name="action_mode_background">@color/appbar</color>
<color name="selected_item_background">#373535</color>
Expand All @@ -59,4 +48,70 @@
<!-- App bar -->
<color name="appbar">#1E1E1E</color>
<color name="fontAppbar">@android:color/white</color>

<!-- NMC Colors -->
<color name="icon_color">#FFFFFF</color>
<color name="sort_text_color">@color/grey_30</color>
<color name="list_icon_color">@color/grey_30</color>
<color name="warning_icon_color">#CCCCCC</color>
<color name="divider_color">@color/grey_70</color>
<color name="spinner_bg_color">@color/grey_80</color>
<color name="refresh_layout_bg_color">#2D2D2D</color>
<color name="primary_button_disabled_color">@color/grey_70</color>
<color name="toolbar_divider_color">@color/grey_70</color>

<!-- Snackbar Colors -->
<color name="snackbar_bg_color">@color/grey_80</color>
<color name="snackbar_txt_color">@color/grey_0</color>

<!-- Alert Dialog Colors -->
<color name="alert_bg_color">@color/grey_80</color>
<color name="alert_txt_color">@color/grey_0</color>

<!-- NavigationView colors -->
<color name="nav_selected_bg_color">@color/grey_60</color>
<color name="nav_txt_unselected_color">@color/grey_0</color>
<color name="nav_txt_selected_color">@color/grey_0</color>
<color name="nav_icon_unselected_color">@color/grey_30</color>
<color name="nav_icon_selected_color">#FFFFFF</color>
<color name="nav_divider_color">@color/grey_30</color>
<color name="nav_bg_color">@color/grey_80</color>
<color name="drawer_quota_txt_color">#FFFFFF</color>

<!-- Bottom Sheet Colors -->
<color name="bottom_sheet_bg_color">@color/grey_80</color>
<color name="bottom_sheet_icon_color">@color/grey_30</color>
<color name="bottom_sheet_txt_color">@color/grey_0</color>

<!-- Popup Menu Colors -->
<color name="popup_menu_bg">@color/grey_80</color>
<color name="popup_menu_txt_color">@color/grey_0</color>
<color name="overflow_bg_color">@color/grey_80</color>

<!-- Switch Compat Colors -->
<color name="switch_thumb_checked_disabled">@color/grey_70</color>
<color name="switch_track_checked_disabled">@color/grey_60</color>
<color name="switch_thumb_unchecked_disabled">@color/grey_70</color>
<color name="switch_track_unchecked_disabled">@color/grey_60</color>

<!-- Checkbox Colors -->
<color name="checkbox_checked_disabled">@color/grey_70</color>
<color name="checkbox_unchecked_disabled">@color/grey_70</color>

<!-- Share Colors -->
<color name="share_title_txt_color">#FFFFFF</color>
<color name="share_subtitle_txt_color">@color/grey_30</color>
<color name="share_info_txt_color">@color/grey_0</color>
<color name="share_search_border_color">@color/grey_0</color>
<color name="share_btn_txt_color">@color/grey_0</color>
<color name="share_list_item_txt_color">@color/grey_0</color>
<color name="share_disabled_txt_color">@color/grey_60</color>
<color name="share_txt_color">@color/grey_0</color>
<color name="share_et_divider">#FFFFFF</color>

<!-- Scan Colors -->
<color name="scan_doc_bg_color">#121212</color>
<color name="scan_text_color">@color/grey_0</color>
<color name="scan_edit_bottom_color">@color/grey_80</color>
<color name="scan_count_bg_color">@color/grey_80</color>
</resources>
91 changes: 79 additions & 12 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,11 @@
<color name="dark_background_text_color">#EEEEEE</color>
<color name="transparent">#00000000</color>
<color name="secondary_text_color">#666666</color>
<color name="divider_color">@color/grey_30</color>
<color name="highlight_textColor_Warning">#e53935</color>

<!-- Colors -->
<color name="standard_grey">#757575</color>
<color name="actionbar_shadow">#222222</color>
<color name="dark_grey">#101010</color>
<color name="grey_0">#F2F2F2</color>
<color name="grey_10">#E5E5E5</color>
<color name="grey_30">#B2B2B2</color>
<color name="grey_60">#666666</color>
<color name="grey_70">#4C4C4C</color>
<color name="grey_80">#333333</color>
<color name="grey_200">#EEEEEE</color>
<color name="grey_400">#BDBDBD</color>
<color name="grey_600">#666666</color>
Expand Down Expand Up @@ -85,6 +77,62 @@
<color name="bg_fallback_highlight">#616161</color>
<color name="drawer_active_item_background">#80000000</color>

<!-- App bar -->
<color name="appbar">@android:color/white</color>
<color name="fontAppbar">#666666</color>
<color name="fontSecondaryAppbar">#A5A5A5</color>

<!-- NMC Colors -->
<color name="icon_color">#191919</color>
<color name="sort_text_color">@color/primary</color>
<color name="list_icon_color">#191919</color>
<color name="warning_icon_color">#191919</color>
<color name="divider_color">@color/grey_30</color>
<color name="spinner_bg_color">@android:color/white</color>
<color name="refresh_layout_bg_color">#FFFFFF</color>
<color name="primary_button_disabled_color">@color/grey_0</color>
<color name="toolbar_divider_color">#CCCCCC</color>
<color name="et_highlight_color">#77c4ff</color>
<color name="white_trans_70">#B3FFFFFF</color>
<color name="progress_bar_background">@color/grey_10</color>

<!-- Grey Colors -->
<color name="dark_grey">#101010</color>
<color name="grey_0">#F2F2F2</color>
<color name="grey_10">#E5E5E5</color>
<color name="grey_30">#B2B2B2</color>
<color name="grey_60">#666666</color>
<color name="grey_70">#4C4C4C</color>
<color name="grey_80">#333333</color>

<!-- Snackbar Colors -->
<color name="snackbar_bg_color">@color/design_snackbar_background_color</color>
<color name="snackbar_txt_color">@color/white</color>

<!-- Alert Dialog Colors -->
<color name="alert_bg_color">#FFFFFF</color>
<color name="alert_txt_color">#191919</color>

<!-- NavigationView colors -->
<color name="nav_selected_bg_color">@color/grey_0</color>
<color name="nav_txt_unselected_color">#191919</color>
<color name="nav_txt_selected_color">@color/primary</color>
<color name="nav_icon_unselected_color">#191919</color>
<color name="nav_icon_selected_color">@color/primary</color>
<color name="nav_divider_color">@color/grey_30</color>
<color name="nav_bg_color">@color/white</color>
<color name="drawer_quota_txt_color">#191919</color>

<!-- Bottom Sheet Colors -->
<color name="bottom_sheet_bg_color">#FFFFFF</color>
<color name="bottom_sheet_icon_color">#191919</color>
<color name="bottom_sheet_txt_color">#191919</color>

<!-- Popup Menu Colors -->
<color name="popup_menu_bg">#FFFFFF</color>
<color name="popup_menu_txt_color">#191919</color>
<color name="overflow_bg_color">#FFFFFF</color>

<!-- Switch Compat Colors -->
<color name="switch_thumb_checked_enabled">@color/primary</color>
<color name="switch_track_checked_enabled">#F399C7</color>
Expand All @@ -101,8 +149,27 @@
<color name="checkbox_checked_disabled">@color/grey_30</color>
<color name="checkbox_unchecked_disabled">#CCCCCC</color>

<!-- App bar -->
<color name="appbar">@android:color/white</color>
<color name="fontAppbar">#666666</color>
<color name="fontSecondaryAppbar">#A5A5A5</color>
<!-- Share Colors -->
<color name="share_title_txt_color">#191919</color>
<color name="share_subtitle_txt_color">@color/grey_30</color>
<color name="share_info_txt_color">#191919</color>
<color name="share_search_border_color">#191919</color>
<color name="share_btn_txt_color">#191919</color>
<color name="share_list_item_txt_color">#191919</color>
<color name="share_disabled_txt_color">@color/grey_30</color>
<color name="share_txt_color">#191919</color>
<color name="share_et_divider">#000000</color>
<color name="share_warning_txt_color">#191919</color>
<color name="sharing_warning_bg_color">#F6E5EB</color>
<color name="sharing_warning_border_color">#C16F81</color>
<color name="share_color">#0D39DF</color>
<color name="shared_with_me_color">#0099ff</color>

<!-- Scan Colors -->
<color name="scan_doc_bg_color">@color/grey_0</color>
<color name="scan_text_color">#191919</color>
<color name="scan_edit_bottom_color">@color/grey_0</color>
<color name="scan_count_bg_color">@color/grey_30</color>
<color name="neptune">#77b6bb</color>
<color name="neptune_50">#5077b6bb</color>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
<dimen name="notification_row_item_height">145dp</dimen>
<dimen name="button_stroke_width">1dp</dimen>
<dimen name="txt_size_13sp">13sp</dimen>
</resources>
</resources>
Loading

0 comments on commit ea36419

Please sign in to comment.