mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 21:55:48 +03:00
colors colors colors
This commit is contained in:
parent
9bdaf17b81
commit
8fae712a50
19 changed files with 258 additions and 71 deletions
|
@ -46,6 +46,7 @@ import com.owncloud.android.operations.RefreshFolderOperation;
|
|||
import com.owncloud.android.operations.UpdateOCVersionOperation;
|
||||
import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity;
|
||||
import com.owncloud.android.utils.DataHolderUtil;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
||||
import org.apache.jackrabbit.webdav.DavException;
|
||||
|
||||
|
@ -507,7 +508,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
|
|||
private NotificationCompat.Builder createNotificationBuilder() {
|
||||
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getContext());
|
||||
notificationBuilder.setSmallIcon(R.drawable.notification_icon).setAutoCancel(true);
|
||||
notificationBuilder.setColor(getContext().getResources().getColor(R.color.primary));
|
||||
notificationBuilder.setColor(DisplayUtils.primaryColor());
|
||||
return notificationBuilder;
|
||||
}
|
||||
|
||||
|
|
|
@ -915,7 +915,17 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
|
|||
|
||||
MenuItem item = mNavigationView.getMenu().findItem(menuItemId);
|
||||
item.setChecked(true);
|
||||
item.setIcon(DisplayUtils.tintDrawable(item.getIcon(), DisplayUtils.primaryColor()));
|
||||
|
||||
// reset all tinted icons
|
||||
for (int i = 0; i < mNavigationView.getMenu().size(); i++) {
|
||||
MenuItem menuItem = mNavigationView.getMenu().getItem(i);
|
||||
if (menuItem.getIcon() != null) {
|
||||
menuItem.getIcon().clearColorFilter();
|
||||
}
|
||||
}
|
||||
|
||||
DisplayUtils.tintDrawable(item.getIcon(), DisplayUtils.primaryColor());
|
||||
|
||||
String colorHex = DisplayUtils.colorToHexString(DisplayUtils.primaryColor());
|
||||
item.setTitle(Html.fromHtml("<font color='" + colorHex + "'>" + item.getTitle() + "</font>"));
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.Resources.NotFoundException;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -367,6 +368,7 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
|
|||
mCancelBtn = (Button) findViewById(R.id.folder_picker_btn_cancel);
|
||||
mCancelBtn.setOnClickListener(this);
|
||||
mChooseBtn = (Button) findViewById(R.id.folder_picker_btn_choose);
|
||||
mChooseBtn.getBackground().setColorFilter(DisplayUtils.primaryColor(), PorterDuff.Mode.SRC_ATOP);
|
||||
mChooseBtn.setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
|
|||
import com.owncloud.android.ui.fragment.TaskRetainerFragment;
|
||||
import com.owncloud.android.ui.helpers.UriUploader;
|
||||
import com.owncloud.android.utils.DataHolderUtil;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.ErrorMessageAdapter;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
|
||||
|
@ -294,7 +295,7 @@ public class ReceiveExternalFilesActivity extends FileActivity
|
|||
|
||||
mTintedCheck = DrawableCompat.wrap(ContextCompat.getDrawable(parent,
|
||||
R.drawable.ic_account_circle_white_18dp));
|
||||
int tint = ContextCompat.getColor(parent, R.color.primary);
|
||||
int tint = DisplayUtils.primaryColor();
|
||||
DrawableCompat.setTint(mTintedCheck, tint);
|
||||
|
||||
mAccountListAdapter = new AccountListAdapter(parent, getAccountListItems(parent), mTintedCheck);
|
||||
|
|
|
@ -23,6 +23,7 @@ package com.owncloud.android.ui.activity;
|
|||
import android.accounts.Account;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
@ -31,6 +32,7 @@ import android.support.v4.app.Fragment;
|
|||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -51,6 +53,7 @@ import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
|
|||
import com.owncloud.android.ui.fragment.ExtendedListFragment;
|
||||
import com.owncloud.android.ui.fragment.LocalFileListFragment;
|
||||
import com.owncloud.android.utils.AnalyticsUtils;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -133,7 +136,8 @@ public class UploadFilesActivity extends FileActivity implements
|
|||
// Set input controllers
|
||||
mCancelBtn = (Button) findViewById(R.id.upload_files_btn_cancel);
|
||||
mCancelBtn.setOnClickListener(this);
|
||||
mUploadBtn = (Button) findViewById(R.id.upload_files_btn_upload);
|
||||
mUploadBtn = (AppCompatButton) findViewById(R.id.upload_files_btn_upload);
|
||||
mUploadBtn.getBackground().setColorFilter(DisplayUtils.primaryAccentColor(), PorterDuff.Mode.SRC_ATOP);
|
||||
mUploadBtn.setOnClickListener(this);
|
||||
|
||||
int localBehaviour = PreferenceManager.getUploaderBehaviour(this);
|
||||
|
@ -353,7 +357,7 @@ public class UploadFilesActivity extends FileActivity implements
|
|||
if(checked) {
|
||||
selectAll.setIcon(R.drawable.ic_select_none);
|
||||
} else {
|
||||
selectAll.setIcon(R.drawable.ic_select_all);
|
||||
selectAll.setIcon(DisplayUtils.tintDrawable(R.drawable.ic_select_all, DisplayUtils.primaryColor()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
|
|||
private UploadGroup[] mUploadGroups = null;
|
||||
|
||||
interface Refresh {
|
||||
public void refresh();
|
||||
void refresh();
|
||||
}
|
||||
|
||||
abstract class UploadGroup implements Refresh {
|
||||
|
@ -713,6 +713,7 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
|
|||
TextView tv = (TextView) convertView.findViewById(R.id.uploadListGroupName);
|
||||
tv.setText(String.format(mParentActivity.getString(R.string.uploads_view_group_header),
|
||||
group.getGroupName(), group.getGroupItemCount()));
|
||||
tv.setTextColor(DisplayUtils.primaryAccentColor());
|
||||
return convertView;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.owncloud.android.ui.dialog;
|
|||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
@ -36,6 +37,7 @@ import com.owncloud.android.R;
|
|||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.resources.files.FileUtils;
|
||||
import com.owncloud.android.ui.activity.ComponentsGetter;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
||||
/**
|
||||
* Dialog to input the name for a new folder to create.
|
||||
|
@ -65,9 +67,22 @@ public class CreateFolderDialogFragment
|
|||
return frag;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int color = DisplayUtils.primaryAccentColor();
|
||||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
int accentColor = DisplayUtils.primaryAccentColor();
|
||||
mParentFolder = getArguments().getParcelable(ARG_PARENT_FOLDER);
|
||||
|
||||
// Inflate the layout for the dialog
|
||||
|
@ -78,13 +93,15 @@ public class CreateFolderDialogFragment
|
|||
EditText inputText = ((EditText)v.findViewById(R.id.user_input));
|
||||
inputText.setText("");
|
||||
inputText.requestFocus();
|
||||
|
||||
inputText.getBackground().setColorFilter(accentColor, PorterDuff.Mode.SRC_ATOP);
|
||||
|
||||
// Build the dialog
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setView(v)
|
||||
.setPositiveButton(R.string.common_ok, this)
|
||||
.setNegativeButton(R.string.common_cancel, this)
|
||||
.setTitle(R.string.uploader_info_dirname);
|
||||
.setTitle(DisplayUtils.getColoredTitle(getResources().getString(R.string.uploader_info_dirname),
|
||||
accentColor));
|
||||
Dialog d = builder.create();
|
||||
d.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
return d;
|
||||
|
|
|
@ -23,6 +23,7 @@ package com.owncloud.android.ui.dialog;
|
|||
|
||||
import android.app.DatePickerDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.text.format.DateUtils;
|
||||
|
@ -30,6 +31,7 @@ import android.widget.DatePicker;
|
|||
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.ui.activity.FileActivity;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
|
@ -69,6 +71,17 @@ public class ExpirationDatePickerDialogFragment
|
|||
return dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int accentColor = DisplayUtils.primaryAccentColor();
|
||||
|
||||
DatePickerDialog dialog = (DatePickerDialog) getDialog();
|
||||
dialog.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(accentColor);
|
||||
dialog.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(accentColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.view.KeyEvent;
|
|||
import android.widget.ProgressBar;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
||||
|
||||
public class IndeterminateProgressDialog extends DialogFragment {
|
||||
|
@ -67,7 +68,7 @@ public class IndeterminateProgressDialog extends DialogFragment {
|
|||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
ProgressBar v = (ProgressBar) progressDialog.findViewById(android.R.id.progress);
|
||||
v.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.color_accent),
|
||||
v.getIndeterminateDrawable().setColorFilter(DisplayUtils.primaryAccentColor(),
|
||||
android.graphics.PorterDuff.Mode.MULTIPLY);
|
||||
|
||||
}
|
||||
|
@ -87,10 +88,7 @@ public class IndeterminateProgressDialog extends DialogFragment {
|
|||
public boolean onKey(DialogInterface dialog, int keyCode,
|
||||
KeyEvent event) {
|
||||
|
||||
if( keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return keyCode == KeyEvent.KEYCODE_BACK;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@ import android.widget.ProgressBar;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
||||
public class LoadingDialog extends DialogFragment {
|
||||
|
||||
|
@ -62,7 +63,7 @@ public class LoadingDialog extends DialogFragment {
|
|||
// set progress wheel color
|
||||
ProgressBar progressBar = (ProgressBar) v.findViewById(R.id.loadingBar);
|
||||
progressBar.getIndeterminateDrawable().setColorFilter(
|
||||
getResources().getColor(R.color.color_accent), PorterDuff.Mode.SRC_IN);
|
||||
DisplayUtils.primaryAccentColor(), PorterDuff.Mode.SRC_IN);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ package com.owncloud.android.ui.dialog;
|
|||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
@ -42,6 +43,7 @@ import com.owncloud.android.R;
|
|||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.resources.files.FileUtils;
|
||||
import com.owncloud.android.ui.activity.ComponentsGetter;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -71,8 +73,21 @@ public class RenameFileDialogFragment
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int color = DisplayUtils.primaryAccentColor();
|
||||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(color);
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
int accentColor = DisplayUtils.primaryAccentColor();
|
||||
mTargetFile = getArguments().getParcelable(ARG_TARGET_FILE);
|
||||
|
||||
// Inflate the layout for the dialog
|
||||
|
@ -92,13 +107,15 @@ public class RenameFileDialogFragment
|
|||
Math.max(selectionStart, selectionEnd));
|
||||
}
|
||||
inputText.requestFocus();
|
||||
inputText.getBackground().setColorFilter(accentColor, PorterDuff.Mode.SRC_ATOP);
|
||||
|
||||
// Build the dialog
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setView(v)
|
||||
.setPositiveButton(R.string.common_ok, this)
|
||||
.setNegativeButton(R.string.common_cancel, this)
|
||||
.setTitle(R.string.rename_dialog_title);
|
||||
.setTitle(DisplayUtils.getColoredTitle(getResources().getString(R.string.rename_dialog_title),
|
||||
accentColor));
|
||||
Dialog d = builder.create();
|
||||
d.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
return d;
|
||||
|
|
|
@ -20,6 +20,7 @@ package com.owncloud.android.ui.dialog;
|
|||
|
||||
import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
@ -33,6 +34,7 @@ import android.widget.Toast;
|
|||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.ui.activity.FileActivity;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
||||
/**
|
||||
* Dialog to input the password for sharing a file/folder.
|
||||
|
@ -46,6 +48,15 @@ public class SharePasswordDialogFragment extends DialogFragment
|
|||
private static final String ARG_FILE = "FILE";
|
||||
private static final String ARG_CREATE_SHARE = "CREATE_SHARE";
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
AlertDialog alertDialog = (AlertDialog) getDialog();
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(DisplayUtils.primaryAccentColor());
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(DisplayUtils.primaryAccentColor());
|
||||
}
|
||||
|
||||
public static final String PASSWORD_FRAGMENT = "PASSWORD_FRAGMENT";
|
||||
|
||||
private OCFile mFile;
|
||||
|
@ -80,6 +91,7 @@ public class SharePasswordDialogFragment extends DialogFragment
|
|||
|
||||
// Setup layout
|
||||
EditText inputText = ((EditText)v.findViewById(R.id.share_password));
|
||||
inputText.getBackground().setColorFilter(DisplayUtils.primaryAccentColor(), PorterDuff.Mode.SRC_ATOP);
|
||||
inputText.setText("");
|
||||
inputText.requestFocus();
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.graphics.Typeface;
|
|||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -70,6 +71,7 @@ public class SortingOrderDialogFragment extends DialogFragment {
|
|||
|
||||
private int mSortOrder;
|
||||
private boolean mSortAscending;
|
||||
private AppCompatButton mCancel;
|
||||
|
||||
public static SortingOrderDialogFragment newInstance(int sortOrder, boolean ascending) {
|
||||
SortingOrderDialogFragment dialogFragment = new SortingOrderDialogFragment();
|
||||
|
@ -121,6 +123,8 @@ public class SortingOrderDialogFragment extends DialogFragment {
|
|||
mSortByModificationDateDescendingButton = (ImageButton) view.findViewById(R.id.sortByModificationDateDescending);
|
||||
mSortBySizeAscendingButton = (ImageButton) view.findViewById(R.id.sortBySizeAscending);
|
||||
mSortBySizeDescendingButton = (ImageButton) view.findViewById(R.id.sortBySizeDescending);
|
||||
mCancel = (AppCompatButton) view.findViewById(R.id.cancel);
|
||||
mCancel.setTextColor(DisplayUtils.primaryAccentColor());
|
||||
|
||||
mSortByNameAscendingText = (TextView) view.findViewById(R.id.sortByNameAZText);
|
||||
mSortByNameDescendingText = (TextView) view.findViewById(R.id.sortByNameZAText);
|
||||
|
@ -196,7 +200,7 @@ public class SortingOrderDialogFragment extends DialogFragment {
|
|||
* @param textView the text view, the text color to be set
|
||||
*/
|
||||
private void colorActiveSortingIconAndText(ImageButton imageButton, TextView textView) {
|
||||
int color = getResources().getColor(R.color.color_accent);
|
||||
int color = DisplayUtils.primaryAccentColor();
|
||||
DisplayUtils.colorImageButton(imageButton, color);
|
||||
textView.setTextColor(color);
|
||||
textView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
|
@ -208,7 +212,7 @@ public class SortingOrderDialogFragment extends DialogFragment {
|
|||
* @param view the parent view
|
||||
*/
|
||||
private void setupListeners(View view) {
|
||||
view.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
|
||||
mCancel.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
|
|
|
@ -29,13 +29,14 @@ import android.os.Bundle;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.AppCompatButton;
|
||||
import android.support.v7.widget.AppCompatCheckBox;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
|
@ -58,14 +59,16 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
|
|||
|
||||
protected View mView = null;
|
||||
private SwitchCompat mEnabledSwitch;
|
||||
private CheckBox mUploadOnWifiCheckbox;
|
||||
private CheckBox mUploadOnChargingCheckbox;
|
||||
private CheckBox mUploadUseSubfoldersCheckbox;
|
||||
private AppCompatCheckBox mUploadOnWifiCheckbox;
|
||||
private AppCompatCheckBox mUploadOnChargingCheckbox;
|
||||
private AppCompatCheckBox mUploadUseSubfoldersCheckbox;
|
||||
private TextView mUploadBehaviorSummary;
|
||||
private TextView mLocalFolderPath;
|
||||
private TextView mRemoteFolderSummary;
|
||||
|
||||
private SyncedFolderParcelable mSyncedFolder;
|
||||
private AppCompatButton mCancel;
|
||||
private AppCompatButton mSave;
|
||||
|
||||
public static SyncedFolderPreferencesDialogFragment newInstance(SyncedFolderDisplayItem syncedFolder, int section) {
|
||||
SyncedFolderPreferencesDialogFragment dialogFragment = new SyncedFolderPreferencesDialogFragment();
|
||||
|
@ -91,6 +94,16 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
|
||||
int accentColor = DisplayUtils.primaryAccentColor();
|
||||
|
||||
// getDialog().getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(accentColor);
|
||||
// dialog.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(accentColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -122,19 +135,35 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
|
|||
* @param view the parent view
|
||||
*/
|
||||
private void setupDialogElements(View view) {
|
||||
int accentColor = DisplayUtils.primaryAccentColor();
|
||||
|
||||
// find/saves UI elements
|
||||
mEnabledSwitch = (SwitchCompat) view.findViewById(R.id.sync_enabled);
|
||||
DisplayUtils.tintSwitch(mEnabledSwitch, accentColor);
|
||||
|
||||
mLocalFolderPath = (TextView) view.findViewById(R.id.folder_sync_settings_local_folder_path);
|
||||
|
||||
mRemoteFolderSummary = (TextView) view.findViewById(R.id.remote_folder_summary);
|
||||
|
||||
mUploadOnWifiCheckbox = (CheckBox) view.findViewById(R.id.setting_instant_upload_on_wifi_checkbox);
|
||||
mUploadOnChargingCheckbox = (CheckBox) view.findViewById(R.id.setting_instant_upload_on_charging_checkbox);
|
||||
mUploadUseSubfoldersCheckbox = (CheckBox) view.findViewById(R.id
|
||||
.setting_instant_upload_path_use_subfolders_checkbox);
|
||||
mUploadOnWifiCheckbox = (AppCompatCheckBox) view.findViewById(R.id.setting_instant_upload_on_wifi_checkbox);
|
||||
DisplayUtils.tintCheckbox(mUploadOnWifiCheckbox, accentColor);
|
||||
|
||||
mUploadOnChargingCheckbox = (AppCompatCheckBox) view.findViewById(
|
||||
R.id.setting_instant_upload_on_charging_checkbox);
|
||||
DisplayUtils.tintCheckbox(mUploadOnChargingCheckbox, accentColor);
|
||||
|
||||
mUploadUseSubfoldersCheckbox = (AppCompatCheckBox) view.findViewById(
|
||||
R.id.setting_instant_upload_path_use_subfolders_checkbox);
|
||||
DisplayUtils.tintCheckbox(mUploadUseSubfoldersCheckbox, accentColor);
|
||||
|
||||
mUploadBehaviorSummary = (TextView) view.findViewById(R.id.setting_instant_behaviour_summary);
|
||||
|
||||
mCancel = (AppCompatButton) view.findViewById(R.id.cancel);
|
||||
mCancel.setTextColor(accentColor);
|
||||
|
||||
mSave = (AppCompatButton) view.findViewById(R.id.save);
|
||||
mSave.setTextColor(accentColor);
|
||||
|
||||
// Set values
|
||||
setEnabled(mSyncedFolder.getEnabled());
|
||||
mLocalFolderPath.setText(
|
||||
|
@ -182,8 +211,8 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
|
|||
* @param view the parent view
|
||||
*/
|
||||
private void setupListeners(View view) {
|
||||
view.findViewById(R.id.save).setOnClickListener(new OnSyncedFolderSaveClickListener());
|
||||
view.findViewById(R.id.cancel).setOnClickListener(new OnSyncedFolderCancelClickListener());
|
||||
mSave.setOnClickListener(new OnSyncedFolderSaveClickListener());
|
||||
mCancel.setOnClickListener(new OnSyncedFolderCancelClickListener());
|
||||
|
||||
view.findViewById(R.id.setting_instant_upload_on_wifi_container).setOnClickListener(
|
||||
new OnClickListener() {
|
||||
|
@ -234,7 +263,9 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setTitle(R.string.prefs_instant_behaviour_dialogTitle)
|
||||
builder.setTitle(DisplayUtils.getColoredTitle(
|
||||
getResources().getString(R.string.prefs_instant_behaviour_dialogTitle),
|
||||
DisplayUtils.primaryAccentColor()))
|
||||
.setSingleChoiceItems(getResources().getTextArray(R.array.pref_behaviour_entries),
|
||||
mSyncedFolder.getUploadActionInteger(),
|
||||
new
|
||||
|
@ -248,7 +279,9 @@ public class SyncedFolderPreferencesDialogFragment extends DialogFragment {
|
|||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builder.create().show();
|
||||
Dialog dialog = builder.create();
|
||||
dialog.show();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -22,8 +22,10 @@
|
|||
package com.owncloud.android.ui.fragment;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.AppCompatCheckBox;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -44,6 +46,7 @@ import com.owncloud.android.lib.resources.shares.ShareType;
|
|||
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
|
||||
import com.owncloud.android.ui.activity.FileActivity;
|
||||
import com.owncloud.android.utils.AnalyticsUtils;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
||||
public class EditShareFragment extends Fragment {
|
||||
|
||||
|
@ -132,6 +135,9 @@ public class EditShareFragment extends Fragment {
|
|||
((TextView)view.findViewById(R.id.editShareTitle)).setText(
|
||||
getResources().getString(R.string.share_with_edit_title, mShare.getSharedWithDisplayName()));
|
||||
|
||||
View headerDivider = view.findViewById(R.id.share_header_divider);
|
||||
headerDivider.getBackground().setColorFilter(DisplayUtils.primaryAccentColor(), PorterDuff.Mode.SRC_ATOP);
|
||||
|
||||
// Setup layout
|
||||
refreshUiFromState(view);
|
||||
|
||||
|
@ -154,35 +160,42 @@ public class EditShareFragment extends Fragment {
|
|||
boolean isNotReshareableFederatedSupported = (serverVersion != null &&
|
||||
serverVersion.isNotReshareableFederatedSupported());
|
||||
|
||||
CompoundButton compound = (CompoundButton) editShareView.findViewById(R.id.canShareSwitch);
|
||||
int accentColor = DisplayUtils.primaryAccentColor();
|
||||
|
||||
SwitchCompat shareSwitch = (SwitchCompat) editShareView.findViewById(R.id.canShareSwitch);
|
||||
DisplayUtils.tintSwitch(shareSwitch, accentColor);
|
||||
|
||||
if (isFederated) {
|
||||
compound.setVisibility(View.INVISIBLE);
|
||||
shareSwitch.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
compound.setChecked((sharePermissions & OCShare.SHARE_PERMISSION_FLAG) > 0);
|
||||
shareSwitch.setChecked((sharePermissions & OCShare.SHARE_PERMISSION_FLAG) > 0);
|
||||
|
||||
compound = (CompoundButton) editShareView.findViewById(R.id.canEditSwitch);
|
||||
SwitchCompat switchCompat = (SwitchCompat) editShareView.findViewById(R.id.canEditSwitch);
|
||||
DisplayUtils.tintSwitch(switchCompat, accentColor);
|
||||
int anyUpdatePermission = OCShare.CREATE_PERMISSION_FLAG | OCShare.UPDATE_PERMISSION_FLAG |
|
||||
OCShare.DELETE_PERMISSION_FLAG;
|
||||
boolean canEdit = (sharePermissions & anyUpdatePermission) > 0;
|
||||
compound.setChecked(canEdit);
|
||||
switchCompat.setChecked(canEdit);
|
||||
|
||||
boolean areEditOptionsAvailable = !isFederated || isNotReshareableFederatedSupported;
|
||||
|
||||
if (mFile.isFolder() && areEditOptionsAvailable) {
|
||||
/// TODO change areEditOptionsAvailable in order to delete !isFederated
|
||||
// from checking when iOS is ready
|
||||
compound = (CompoundButton) editShareView.findViewById(R.id.canEditCreateCheckBox);
|
||||
compound.setChecked((sharePermissions & OCShare.CREATE_PERMISSION_FLAG) > 0);
|
||||
compound.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
|
||||
AppCompatCheckBox checkBox = (AppCompatCheckBox) editShareView.findViewById(R.id.canEditCreateCheckBox);
|
||||
checkBox.setChecked((sharePermissions & OCShare.CREATE_PERMISSION_FLAG) > 0);
|
||||
checkBox.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
|
||||
DisplayUtils.tintCheckbox(checkBox, accentColor);
|
||||
|
||||
compound = (CompoundButton) editShareView.findViewById(R.id.canEditChangeCheckBox);
|
||||
compound.setChecked((sharePermissions & OCShare.UPDATE_PERMISSION_FLAG) > 0);
|
||||
compound.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
|
||||
checkBox = (AppCompatCheckBox) editShareView.findViewById(R.id.canEditChangeCheckBox);
|
||||
checkBox.setChecked((sharePermissions & OCShare.UPDATE_PERMISSION_FLAG) > 0);
|
||||
checkBox.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
|
||||
DisplayUtils.tintCheckbox(checkBox, accentColor);
|
||||
|
||||
compound = (CompoundButton) editShareView.findViewById(R.id.canEditDeleteCheckBox);
|
||||
compound.setChecked((sharePermissions & OCShare.DELETE_PERMISSION_FLAG) > 0);
|
||||
compound.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
|
||||
checkBox = (AppCompatCheckBox) editShareView.findViewById(R.id.canEditDeleteCheckBox);
|
||||
checkBox.setChecked((sharePermissions & OCShare.DELETE_PERMISSION_FLAG) > 0);
|
||||
checkBox.setVisibility((canEdit) ? View.VISIBLE : View.GONE);
|
||||
DisplayUtils.tintCheckbox(checkBox, accentColor);
|
||||
}
|
||||
|
||||
setPermissionsListening(editShareView, true);
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.accounts.Account;
|
|||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.Snackbar;
|
||||
|
@ -191,6 +192,8 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|||
Bundle savedInstanceState) {
|
||||
Log_OC.d(TAG, "onCreateView");
|
||||
|
||||
int accentColor = DisplayUtils.primaryAccentColor();
|
||||
|
||||
// Inflate the layout for this fragment
|
||||
View view = inflater.inflate(R.layout.share_file_layout, container, false);
|
||||
|
||||
|
@ -207,6 +210,10 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|||
}
|
||||
}
|
||||
|
||||
// Title
|
||||
TextView title = (TextView) view.findViewById(R.id.shareWithUsersSectionTitle);
|
||||
title.setTextColor(accentColor);
|
||||
|
||||
// Name
|
||||
TextView fileNameHeader = (TextView) view.findViewById(R.id.shareFileName);
|
||||
fileNameHeader.setText(getResources().getString(R.string.share_file, mFile.getFileName()));
|
||||
|
@ -220,8 +227,8 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|||
}
|
||||
|
||||
// Add User Button
|
||||
Button addUserGroupButton = (Button)
|
||||
view.findViewById(R.id.addUserButton);
|
||||
Button addUserGroupButton = (Button) view.findViewById(R.id.addUserButton);
|
||||
addUserGroupButton.getBackground().setColorFilter(accentColor, PorterDuff.Mode.SRC_ATOP);
|
||||
addUserGroupButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
@ -267,6 +274,7 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|||
private void initShareViaLinkListener(View shareView) {
|
||||
mOnShareViaLinkSwitchCheckedChangeListener = new OnShareViaLinkListener();
|
||||
SwitchCompat shareViaLinkSwitch = (SwitchCompat) shareView.findViewById(R.id.shareViaLinkSectionSwitch);
|
||||
DisplayUtils.tintSwitch(shareViaLinkSwitch, DisplayUtils.primaryAccentColor());
|
||||
shareViaLinkSwitch.setOnCheckedChangeListener(mOnShareViaLinkSwitchCheckedChangeListener);
|
||||
}
|
||||
|
||||
|
@ -327,8 +335,10 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|||
private void initExpirationListener(View shareView) {
|
||||
mOnExpirationDateInteractionListener = new OnExpirationDateInteractionListener();
|
||||
|
||||
((SwitchCompat) shareView.findViewById(R.id.shareViaLinkExpirationSwitch)).
|
||||
setOnCheckedChangeListener(mOnExpirationDateInteractionListener);
|
||||
SwitchCompat expirationSwitch = (SwitchCompat) shareView.findViewById(R.id.shareViaLinkExpirationSwitch);
|
||||
expirationSwitch.setOnCheckedChangeListener(mOnExpirationDateInteractionListener);
|
||||
|
||||
DisplayUtils.tintSwitch(expirationSwitch, DisplayUtils.primaryAccentColor());
|
||||
|
||||
shareView.findViewById(R.id.shareViaLinkExpirationLabel).
|
||||
setOnClickListener(mOnExpirationDateInteractionListener);
|
||||
|
@ -357,8 +367,7 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|||
return;
|
||||
}
|
||||
if (isChecked) {
|
||||
ExpirationDatePickerDialogFragment dialog =
|
||||
ExpirationDatePickerDialogFragment.newInstance(mFile, -1);
|
||||
ExpirationDatePickerDialogFragment dialog = ExpirationDatePickerDialogFragment.newInstance(mFile, -1);
|
||||
dialog.show(
|
||||
getActivity().getSupportFragmentManager(),
|
||||
ExpirationDatePickerDialogFragment.DATE_PICKER_DIALOG
|
||||
|
@ -406,8 +415,9 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|||
private void initPasswordListener(View shareView) {
|
||||
mOnPasswordInteractionListener = new OnPasswordInteractionListener();
|
||||
|
||||
((SwitchCompat) shareView.findViewById(R.id.shareViaLinkPasswordSwitch)).
|
||||
setOnCheckedChangeListener(mOnPasswordInteractionListener);
|
||||
SwitchCompat passwordSwitch = (SwitchCompat) shareView.findViewById(R.id.shareViaLinkPasswordSwitch);
|
||||
passwordSwitch.setOnCheckedChangeListener(mOnPasswordInteractionListener);
|
||||
DisplayUtils.tintSwitch(passwordSwitch, DisplayUtils.primaryAccentColor());
|
||||
|
||||
shareView.findViewById(R.id.shareViaLinkPasswordLabel).setOnClickListener(mOnPasswordInteractionListener);
|
||||
|
||||
|
@ -430,7 +440,7 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton switchView, boolean isChecked) {
|
||||
if (!isResumed()) {
|
||||
// very important, setCheched(...) is called automatically during
|
||||
// very important, setChecked(...) is called automatically during
|
||||
// Fragment recreation on device rotations
|
||||
return;
|
||||
}
|
||||
|
@ -470,9 +480,9 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|||
private void initEditPermissionListener(View shareView) {
|
||||
mOnEditPermissionInteractionListener = new OnEditPermissionInteractionListener();
|
||||
|
||||
((SwitchCompat) shareView.findViewById(R.id.shareViaLinkEditPermissionSwitch)).
|
||||
setOnCheckedChangeListener(mOnEditPermissionInteractionListener);
|
||||
|
||||
SwitchCompat permissionSwitch = (SwitchCompat) shareView.findViewById(R.id.shareViaLinkEditPermissionSwitch);
|
||||
permissionSwitch.setOnCheckedChangeListener(mOnEditPermissionInteractionListener);
|
||||
DisplayUtils.tintSwitch(permissionSwitch, DisplayUtils.primaryAccentColor());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -484,8 +494,9 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|||
private void initHideFileListingListener(View shareView) {
|
||||
mOnHideFileListingPermissionInteractionListener = new OnHideFileListingPermissionInteractionListener();
|
||||
|
||||
((SwitchCompat) shareView.findViewById(R.id.shareViaLinkFileListingPermissionSwitch)).
|
||||
setOnCheckedChangeListener(mOnHideFileListingPermissionInteractionListener);
|
||||
SwitchCompat permissionSwitch = (SwitchCompat) shareView.findViewById(R.id.shareViaLinkFileListingPermissionSwitch);
|
||||
permissionSwitch.setOnCheckedChangeListener(mOnHideFileListingPermissionInteractionListener);
|
||||
DisplayUtils.tintSwitch(permissionSwitch, DisplayUtils.primaryAccentColor());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -729,6 +740,7 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|||
|
||||
// GetLink button
|
||||
AppCompatButton getLinkButton = getGetLinkButton();
|
||||
getLinkButton.getBackground().setColorFilter(DisplayUtils.primaryAccentColor(), PorterDuff.Mode.DST_ATOP);
|
||||
getLinkButton.setVisibility(View.VISIBLE);
|
||||
getLinkButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -26,7 +26,7 @@ import android.os.HandlerThread;
|
|||
import android.os.Process;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class NotificationUtils {
|
|||
*/
|
||||
public static NotificationCompat.Builder newNotificationBuilder(Context context) {
|
||||
return new NotificationCompat.Builder(context).
|
||||
setColor(context.getResources().getColor(R.color.primary));
|
||||
setColor(DisplayUtils.primaryColor());
|
||||
}
|
||||
|
||||
@SuppressFBWarnings("DMI")
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
* Copyright (C) 2011 Bartek Przybylski
|
||||
* Copyright (C) 2015 ownCloud Inc.
|
||||
* Copyright (C) 2016 Andy Scherzinger
|
||||
*
|
||||
* <p>
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* <p>
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* <p>
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
@ -29,6 +29,7 @@ import android.annotation.TargetApi;
|
|||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
|
@ -49,9 +50,12 @@ import android.support.v4.content.res.ResourcesCompat;
|
|||
import android.support.v4.graphics.ColorUtils;
|
||||
import android.support.v4.graphics.drawable.DrawableCompat;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.widget.AppCompatCheckBox;
|
||||
import android.support.v7.widget.SwitchCompat;
|
||||
import android.text.Html;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.format.DateUtils;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.view.Menu;
|
||||
|
@ -404,7 +408,7 @@ public class DisplayUtils {
|
|||
*/
|
||||
public static void colorPreLollipopHorizontalProgressBar(ProgressBar progressBar) {
|
||||
if (progressBar != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
colorHorizontalProgressBar(progressBar, progressBar.getResources().getColor(R.color.color_accent));
|
||||
colorHorizontalProgressBar(progressBar, DisplayUtils.primaryAccentColor());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -442,7 +446,7 @@ public class DisplayUtils {
|
|||
colorPreLollipopHorizontalProgressBar(seekBar);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
int color = seekBar.getResources().getColor(R.color.color_accent);
|
||||
int color = DisplayUtils.primaryAccentColor();
|
||||
seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
|
@ -683,18 +687,18 @@ public class DisplayUtils {
|
|||
*
|
||||
* @param inputStream The File InputStream
|
||||
*/
|
||||
public static String getData(InputStream inputStream){
|
||||
public static String getData(InputStream inputStream) {
|
||||
|
||||
BufferedReader buffreader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
String line;
|
||||
StringBuilder text = new StringBuilder();
|
||||
try {
|
||||
while (( line = buffreader.readLine()) != null) {
|
||||
while ((line = buffreader.readLine()) != null) {
|
||||
text.append(line);
|
||||
text.append('\n');
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log_OC.e(TAG,e.getMessage());
|
||||
Log_OC.e(TAG, e.getMessage());
|
||||
}
|
||||
return text.toString();
|
||||
}
|
||||
|
@ -712,6 +716,35 @@ public class DisplayUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void tintCheckbox(AppCompatCheckBox checkBox, int color) {
|
||||
checkBox.setSupportButtonTintList(new ColorStateList(
|
||||
new int[][]{
|
||||
new int[]{-android.R.attr.state_checked},
|
||||
new int[]{android.R.attr.state_checked},
|
||||
},
|
||||
new int[]{
|
||||
Color.GRAY,
|
||||
color
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
public static void tintSwitch(SwitchCompat switchView, int color) {
|
||||
switchView.setTextColor(color);
|
||||
|
||||
int trackColor = Color.argb(77, Color.red(color), Color.green(color), Color.blue(color));
|
||||
|
||||
// setting the thumb color
|
||||
DrawableCompat.setTintList(switchView.getThumbDrawable(), new ColorStateList(
|
||||
new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
|
||||
new int[]{color, Color.WHITE}));
|
||||
|
||||
// setting the track color
|
||||
DrawableCompat.setTintList(switchView.getTrackDrawable(), new ColorStateList(
|
||||
new int[][]{new int[]{android.R.attr.state_checked}, new int[]{}},
|
||||
new int[]{trackColor, Color.parseColor("#4D000000")}));
|
||||
}
|
||||
|
||||
public static Drawable tintDrawable(@DrawableRes int id, int color) {
|
||||
Drawable drawable = ResourcesCompat.getDrawable(MainApp.getAppContext().getResources(), id, null);
|
||||
|
||||
|
@ -720,7 +753,7 @@ public class DisplayUtils {
|
|||
|
||||
public static Drawable tintDrawable(Drawable drawable, int color) {
|
||||
Drawable wrap = DrawableCompat.wrap(drawable);
|
||||
DrawableCompat.setTint(wrap, color);
|
||||
wrap.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
|
||||
|
||||
return wrap;
|
||||
}
|
||||
|
@ -766,6 +799,16 @@ public class DisplayUtils {
|
|||
return String.format("#%06X", 0xFFFFFF & color);
|
||||
}
|
||||
|
||||
public static int primaryAccentColor() {
|
||||
OCCapability capability = getCapability();
|
||||
|
||||
try {
|
||||
return adjustLightness(+0.1f, Color.parseColor(capability.getServerColor()));
|
||||
} catch (Exception e) {
|
||||
return MainApp.getAppContext().getResources().getColor(R.color.color_accent);
|
||||
}
|
||||
}
|
||||
|
||||
public static int primaryDarkColor() {
|
||||
OCCapability capability = getCapability();
|
||||
|
||||
|
@ -797,6 +840,11 @@ public class DisplayUtils {
|
|||
actionBar.setTitle(Html.fromHtml("<font color='" + colorHex + "'>" + title + "</font>"));
|
||||
}
|
||||
|
||||
public static Spanned getColoredTitle(String title, int color) {
|
||||
String colorHex = DisplayUtils.colorToHexString(color);
|
||||
return Html.fromHtml("<font color='" + colorHex + "'>" + title + "</font>");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set color of title to white/black depending on background color
|
||||
*
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
style="?android:attr/listSeparatorTextViewStyle"
|
||||
/>
|
||||
|
||||
<CheckBox
|
||||
<android.support.v7.widget.AppCompatCheckBox
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/canEditCreateCheckBox"
|
||||
|
@ -72,7 +72,7 @@
|
|||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<CheckBox
|
||||
<android.support.v7.widget.AppCompatCheckBox
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/canEditChangeCheckBox"
|
||||
|
@ -80,7 +80,7 @@
|
|||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<CheckBox
|
||||
<android.support.v7.widget.AppCompatCheckBox
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/canEditDeleteCheckBox"
|
||||
|
|
Loading…
Reference in a new issue