Skip to content

Commit

Permalink
Interface to communicate from settings to privacy feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
surinder-tsys committed May 25, 2023
1 parent daf6e8a commit 312027a
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/src/main/java/com/nmc/android/ui/PrivacySettingsInterface.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.nmc.android.ui

import android.content.Context

/**
* interface to open privacy settings activity from nmc/1921-settings branch
* for implementation look nmc/1878-privacy branch
* this class will have the declaration for it since it has the PrivacySettingsActivity.java in place
* since we don't have privacy settings functionality in this branch so to handle the redirection we have used interface
*/
interface PrivacySettingsInterface {
fun openPrivacySettingsActivity(context: Context)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.nmc.android.ui

import android.content.Context

/**
* interface impl to launch PrivacySettings Activity
* this class will have the implementation for it since it has the PrivacySettingsActivity in place
* calling of this method will be done from nmc/1921-settings
*/
class PrivacySettingsInterfaceImpl : PrivacySettingsInterface {
override fun openPrivacySettingsActivity(context: Context) {
PrivacySettingsActivity.openPrivacySettingsActivity(context, false)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
import com.nextcloud.client.preferences.AppPreferences;
import com.nextcloud.client.preferences.AppPreferencesImpl;
import com.nextcloud.client.preferences.DarkMode;
import com.nmc.android.ui.PrivacySettingsInterface;
import com.nmc.android.ui.PrivacySettingsInterfaceImpl;
import com.owncloud.android.BuildConfig;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
Expand Down Expand Up @@ -149,6 +151,16 @@ public class SettingsActivity extends PreferenceActivity
@Inject ClientFactory clientFactory;
@Inject ViewThemeUtils viewThemeUtils;

/**
* Things to note about both the branches.
* 1. nmc/1921-settings branch:
* --> interface won't be initialised
* --> calling of interface method will be done here
* 2. nmc/1878-privacy
* --> interface will be initialised
* --> calling of interface method won't be done here
*/
private PrivacySettingsInterface privacySettingsInterface;

@SuppressWarnings("deprecation")
@Override
Expand All @@ -159,6 +171,9 @@ public void onCreate(Bundle savedInstanceState) {
getDelegate().onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);

//NMC customization will be initialised in nmc/1878-privacy
privacySettingsInterface = new PrivacySettingsInterfaceImpl();

setupActionBar();

// Register context menu for list of preferences.
Expand Down

0 comments on commit 312027a

Please sign in to comment.