mirror of https://github.com/nextcloud/android
Add is client branded functions
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
325dc8620a
commit
2d8840b49c
|
@ -30,7 +30,6 @@ import android.content.RestrictionsManager;
|
|||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
@ -381,6 +380,14 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
|||
}
|
||||
});
|
||||
|
||||
public static boolean isClientBranded() {
|
||||
return getAppContext().getResources().getBoolean(R.bool.is_branded_client);
|
||||
}
|
||||
|
||||
public static boolean isClientBrandedOrBrandedPlus() {
|
||||
return isClientBrandedPlus() || isClientBranded();
|
||||
}
|
||||
|
||||
public static boolean isClientBrandedPlus() {
|
||||
return (getAppContext().getResources().getBoolean(R.bool.is_branded_plus_client));
|
||||
}
|
||||
|
|
|
@ -286,10 +286,9 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
|
||||
public void updateHeader() {
|
||||
int primaryColor = themeColorUtils.unchangedPrimaryColor(getAccount(), this);
|
||||
boolean isClientBranded = getResources().getBoolean(R.bool.is_branded_client);
|
||||
|
||||
if (getAccount() != null &&
|
||||
getCapabilities().getServerBackground() != null && !isClientBranded) {
|
||||
getCapabilities().getServerBackground() != null && !MainApp.isClientBrandedOrBrandedPlus()) {
|
||||
|
||||
OCCapability capability = getCapabilities();
|
||||
String logo = capability.getServerLogo();
|
||||
|
@ -340,7 +339,7 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
|
||||
// hide ecosystem apps according to user preference or in branded client
|
||||
LinearLayout banner = mNavigationViewHeader.findViewById(R.id.drawer_ecosystem_apps);
|
||||
boolean shouldHideTopBanner = isClientBranded || !preferences.isShowEcosystemApps();
|
||||
boolean shouldHideTopBanner = MainApp.isClientBrandedOrBrandedPlus() || !preferences.isShowEcosystemApps();
|
||||
|
||||
if (shouldHideTopBanner) {
|
||||
hideTopBanner(banner);
|
||||
|
|
|
@ -594,7 +594,7 @@ public class SettingsActivity extends PreferenceActivity
|
|||
boolean fPassCodeEnabled = getResources().getBoolean(R.bool.passcode_enabled);
|
||||
boolean fDeviceCredentialsEnabled = getResources().getBoolean(R.bool.device_credentials_enabled);
|
||||
boolean fShowHiddenFilesEnabled = getResources().getBoolean(R.bool.show_hidden_files_enabled);
|
||||
boolean fShowEcosystemAppsEnabled = !getResources().getBoolean(R.bool.is_branded_client);
|
||||
boolean fShowEcosystemAppsEnabled = !MainApp.isClientBrandedOrBrandedPlus();
|
||||
boolean fSyncedFolderLightEnabled = getResources().getBoolean(R.bool.syncedFolder_light);
|
||||
boolean fShowMediaScanNotifications = preferences.isShowMediaScanNotifications();
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ import com.nextcloud.common.NextcloudClient
|
|||
import com.nextcloud.ui.fileactions.FileActionsBottomSheet.Companion.newInstance
|
||||
import com.nextcloud.ui.fileactions.FileActionsBottomSheet.ResultListener
|
||||
import com.nextcloud.utils.extensions.getParcelableArgument
|
||||
import com.owncloud.android.MainApp
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.databinding.ActivityPreviewMediaBinding
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
|
@ -272,7 +273,7 @@ class PreviewMediaActivity :
|
|||
private fun genericThumbnail(): Drawable? {
|
||||
val result = AppCompatResources.getDrawable(this, R.drawable.logo)
|
||||
result?.let {
|
||||
if (!resources.getBoolean(R.bool.is_branded_client)) {
|
||||
if (!MainApp.isClientBrandedOrBrandedPlus()) {
|
||||
DrawableCompat.setTint(it, resources.getColor(R.color.primary, this.theme))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.nextcloud.client.network.ClientFactory;
|
|||
import com.nextcloud.common.NextcloudClient;
|
||||
import com.nextcloud.ui.fileactions.FileActionsBottomSheet;
|
||||
import com.nextcloud.utils.extensions.BundleExtensionsKt;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.databinding.FragmentPreviewMediaBinding;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
|
@ -293,7 +294,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene
|
|||
private void setGenericThumbnail() {
|
||||
Drawable logo = AppCompatResources.getDrawable(requireContext(), R.drawable.logo);
|
||||
if (logo != null) {
|
||||
if (!getResources().getBoolean(R.bool.is_branded_client)) {
|
||||
if (!MainApp.isClientBrandedOrBrandedPlus()) {
|
||||
// only colour logo of non-branded client
|
||||
DrawableCompat.setTint(logo, getResources().getColor(R.color.primary, requireContext().getTheme()));
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.content.res.Resources;
|
|||
import android.view.Menu;
|
||||
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.lib.resources.status.OCCapability;
|
||||
|
||||
|
@ -49,7 +50,7 @@ public final class DrawerMenuUtil {
|
|||
}
|
||||
|
||||
public static void filterAssistantMenuItem(Menu menu, @Nullable OCCapability capability, Resources resources) {
|
||||
if (resources.getBoolean(R.bool.is_branded_client)) {
|
||||
if (MainApp.isClientBrandedOrBrandedPlus()) {
|
||||
if (capability != null && capability.getAssistant().isFalse()) {
|
||||
removeMenuItem(menu, R.id.nav_assistant);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue