Service detection, account settings
* service detection: detect group memberships and query them for homesets * account settings * request account synchronization
@ -65,6 +65,7 @@ dependencies {
|
||||
compile 'com.android.support:appcompat-v7:23.+'
|
||||
compile 'com.android.support:cardview-v7:23.+'
|
||||
compile 'com.android.support:design:23.+'
|
||||
compile 'com.android.support:preference-v7:23.+'
|
||||
|
||||
compile project(':MemorizingTrustManager')
|
||||
|
||||
|
@ -129,7 +129,7 @@
|
||||
android:name=".ui.AccountActivity"
|
||||
android:parentActivityName=".ui.AccountsActivity">
|
||||
</activity>
|
||||
<activity android:name=".ui.CreateAddressBookActivity">
|
||||
<activity android:name=".ui.AccountSettingsActivity">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.DebugInfoActivity"
|
||||
|
@ -20,10 +20,6 @@ package at.bitfire.davdroid.syncadapter;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -49,10 +45,13 @@ package at.bitfire.davdroid.syncadapter;
|
||||
import at.bitfire.davdroid.log.ExternalFileLogger;
|
||||
import at.bitfire.davdroid.resource.LocalCollection;
|
||||
import at.bitfire.davdroid.resource.LocalResource;
|
||||
import at.bitfire.davdroid.ui.AccountActivity;
|
||||
import at.bitfire.davdroid.ui.DebugInfoActivity;
|
||||
import at.bitfire.davdroid.ui.settings.AccountActivity;
|
||||
import at.bitfire.ical4android.CalendarStorageException;
|
||||
import at.bitfire.vcard4android.ContactsStorageException;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
abstract public class SyncManager {
|
||||
|
||||
@ -226,7 +225,7 @@ abstract public class SyncManager {
|
||||
final Intent detailsIntent;
|
||||
if (e instanceof UnauthorizedException) {
|
||||
detailsIntent = new Intent(context, AccountActivity.class);
|
||||
detailsIntent.putExtra(AccountActivity.EXTRA_ACCOUNT, account);
|
||||
detailsIntent.putExtra(AccountActivity.EXTRA_ACCOUNT_NAME, account.name);
|
||||
} else {
|
||||
detailsIntent = new Intent(context, DebugInfoActivity.class);
|
||||
detailsIntent.putExtra(DebugInfoActivity.KEY_EXCEPTION, e);
|
||||
|
@ -18,18 +18,23 @@ import android.app.AlertDialog;
|
||||
import android.app.LoaderManager;
|
||||
import android.content.AsyncTaskLoader;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.Loader;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SyncRequest;
|
||||
import android.database.Cursor;
|
||||
import android.database.DatabaseUtils;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.provider.CalendarContract;
|
||||
import android.provider.ContactsContract;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.AppCompatRadioButton;
|
||||
import android.support.v7.widget.CardView;
|
||||
@ -55,18 +60,18 @@ import java.util.List;
|
||||
import at.bitfire.davdroid.Constants;
|
||||
import at.bitfire.davdroid.DavService;
|
||||
import at.bitfire.davdroid.R;
|
||||
import at.bitfire.davdroid.log.StringLogger;
|
||||
import at.bitfire.davdroid.model.CollectionInfo;
|
||||
import at.bitfire.davdroid.model.ServiceDB.Collections;
|
||||
import at.bitfire.davdroid.model.ServiceDB.OpenHelper;
|
||||
import at.bitfire.davdroid.model.ServiceDB.Services;
|
||||
import at.bitfire.ical4android.TaskProvider;
|
||||
import lombok.Cleanup;
|
||||
|
||||
public class AccountActivity extends AppCompatActivity implements Toolbar.OnMenuItemClickListener, LoaderManager.LoaderCallbacks<AccountActivity.AccountInfo> {
|
||||
|
||||
public static final String EXTRA_ACCOUNT_NAME = "account_name";
|
||||
|
||||
private String accountName;
|
||||
private Account account;
|
||||
private AccountInfo accountInfo;
|
||||
|
||||
Toolbar tbCardDAV, tbCalDAV;
|
||||
@ -75,11 +80,12 @@ public class AccountActivity extends AppCompatActivity implements Toolbar.OnMenu
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
accountName = getIntent().getStringExtra(EXTRA_ACCOUNT_NAME);
|
||||
String accountName = getIntent().getStringExtra(EXTRA_ACCOUNT_NAME);
|
||||
if (accountName == null)
|
||||
// invalid account name
|
||||
finish();
|
||||
setTitle(accountName);
|
||||
account = new Account(accountName, Constants.ACCOUNT_TYPE);
|
||||
|
||||
setContentView(R.layout.activity_account);
|
||||
|
||||
@ -106,8 +112,14 @@ public class AccountActivity extends AppCompatActivity implements Toolbar.OnMenu
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.sync_now:
|
||||
requestSync();
|
||||
break;
|
||||
case R.id.settings:
|
||||
// TODO
|
||||
Bundle args = new Bundle(1);
|
||||
Intent intent = new Intent(this, AccountSettingsActivity.class);
|
||||
intent.putExtra(AccountSettingsActivity.EXTRA_ACCOUNT, account);
|
||||
startActivity(intent);
|
||||
break;
|
||||
case R.id.delete_account:
|
||||
new AlertDialog.Builder(AccountActivity.this)
|
||||
@ -366,6 +378,9 @@ public class AccountActivity extends AppCompatActivity implements Toolbar.OnMenu
|
||||
tv.setText(info.description);
|
||||
}
|
||||
|
||||
tv = (TextView)v.findViewById(R.id.read_only);
|
||||
tv.setVisibility(info.readOnly ? View.VISIBLE : View.GONE);
|
||||
|
||||
return v;
|
||||
}
|
||||
}
|
||||
@ -401,6 +416,9 @@ public class AccountActivity extends AppCompatActivity implements Toolbar.OnMenu
|
||||
tv.setText(info.description);
|
||||
}
|
||||
|
||||
tv = (TextView)v.findViewById(R.id.read_only);
|
||||
tv.setVisibility(info.readOnly ? View.VISIBLE : View.GONE);
|
||||
|
||||
tv = (TextView)v.findViewById(R.id.events);
|
||||
tv.setVisibility(info.supportsVEVENT ? View.VISIBLE : View.GONE);
|
||||
|
||||
@ -414,8 +432,7 @@ public class AccountActivity extends AppCompatActivity implements Toolbar.OnMenu
|
||||
|
||||
/* USER ACTIONS */
|
||||
|
||||
protected void deleteAccount() {
|
||||
Account account = new Account(accountName, Constants.ACCOUNT_TYPE);
|
||||
private void deleteAccount() {
|
||||
AccountManager accountManager = AccountManager.get(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 22)
|
||||
@ -444,4 +461,21 @@ public class AccountActivity extends AppCompatActivity implements Toolbar.OnMenu
|
||||
}, null);
|
||||
}
|
||||
|
||||
private void requestSync() {
|
||||
String authorities[] = {
|
||||
ContactsContract.AUTHORITY,
|
||||
CalendarContract.AUTHORITY,
|
||||
TaskProvider.ProviderName.OpenTasks.authority
|
||||
};
|
||||
|
||||
for (String authority : authorities) {
|
||||
Bundle extras = new Bundle();
|
||||
extras.putInt(ContentResolver.SYNC_EXTRAS_EXPEDITED, 1);
|
||||
extras.putInt(ContentResolver.SYNC_EXTRAS_MANUAL, 1);
|
||||
ContentResolver.requestSync(account, authority, extras);
|
||||
}
|
||||
|
||||
Snackbar.make(getWindow().getDecorView(), R.string.account_synchronization_scheduled, Snackbar.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -131,6 +131,7 @@ public class AccountListFragment extends ListFragment implements LoaderManager.L
|
||||
|
||||
@Override
|
||||
protected void onStartLoading() {
|
||||
Constants.log.debug("AccountListFragment: Start loading");
|
||||
accountManager.addOnAccountsUpdatedListener(this, null, true);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright © 2013 – 2016 Ricki Hirner (bitfire web engineering).
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Public License v3.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
package at.bitfire.davdroid.ui;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import at.bitfire.davdroid.R;
|
||||
|
||||
public class AccountSettingsActivity extends AppCompatActivity {
|
||||
public final static String EXTRA_ACCOUNT = "account";
|
||||
|
||||
private Account account;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_account_settings);
|
||||
|
||||
account = getIntent().getParcelableExtra(EXTRA_ACCOUNT);
|
||||
setTitle(getString(R.string.settings_title, account.name));
|
||||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
if (savedInstanceState == null)
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.add(R.id.fragment, AccountSettingsFragment.instantiate(this, AccountSettingsFragment.class.getName(), getIntent().getExtras()))
|
||||
.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
Intent intent = new Intent(this, AccountActivity.class);
|
||||
intent.putExtra(AccountActivity.EXTRA_ACCOUNT_NAME, account.name);
|
||||
NavUtils.navigateUpTo(this, intent);
|
||||
return true;
|
||||
} else
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
}
|
@ -6,44 +6,39 @@
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
package at.bitfire.davdroid.ui.settings;
|
||||
package at.bitfire.davdroid.ui;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.provider.CalendarContract;
|
||||
import android.provider.ContactsContract;
|
||||
|
||||
import java.io.File;
|
||||
import android.support.v7.preference.EditTextPreference;
|
||||
import android.support.v7.preference.ListPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceFragmentCompat;
|
||||
import android.support.v7.preference.SwitchPreferenceCompat;
|
||||
|
||||
import at.bitfire.davdroid.R;
|
||||
import at.bitfire.davdroid.log.ExternalFileLogger;
|
||||
import at.bitfire.davdroid.syncadapter.AccountSettings;
|
||||
import at.bitfire.ical4android.TaskProvider;
|
||||
|
||||
public class AccountFragment extends PreferenceFragment {
|
||||
final static String ARG_ACCOUNT = "account";
|
||||
|
||||
public class AccountSettingsFragment extends PreferenceFragmentCompat {
|
||||
Account account;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
addPreferencesFromResource(R.xml.settings_account_prefs);
|
||||
|
||||
account = getArguments().getParcelable(ARG_ACCOUNT);
|
||||
account = getArguments().getParcelable(AccountSettingsActivity.EXTRA_ACCOUNT);
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle bundle, String s) {
|
||||
addPreferencesFromResource(R.xml.settings_account);
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
final AccountSettings settings = new AccountSettings(getActivity(), account);
|
||||
|
||||
// category: authentication
|
||||
@ -68,7 +63,7 @@ public class AccountFragment extends PreferenceFragment {
|
||||
}
|
||||
});
|
||||
|
||||
final SwitchPreference prefPreemptive = (SwitchPreference)findPreference("preemptive");
|
||||
final SwitchPreferenceCompat prefPreemptive = (SwitchPreferenceCompat)findPreference("preemptive");
|
||||
prefPreemptive.setChecked(settings.preemptiveAuth());
|
||||
prefPreemptive.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
@ -139,86 +134,6 @@ public class AccountFragment extends PreferenceFragment {
|
||||
prefSyncTasks.setSummary(R.string.settings_sync_summary_not_available);
|
||||
}
|
||||
|
||||
// category: debug info
|
||||
|
||||
final SwitchPreference prefLogExternalFile = (SwitchPreference)findPreference("log_external_file");
|
||||
prefLogExternalFile.setChecked(settings.logToExternalFile());
|
||||
File logDirectory = ExternalFileLogger.getDirectory(getActivity());
|
||||
prefLogExternalFile.setSummaryOn(logDirectory != null ?
|
||||
getString(R.string.settings_log_to_external_file_on, logDirectory.getPath()) :
|
||||
getString(R.string.settings_log_to_external_file_no_external_storage)
|
||||
);
|
||||
prefLogExternalFile.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
Boolean external = (Boolean) newValue;
|
||||
if (external) {
|
||||
getFragmentManager().beginTransaction()
|
||||
.add(LogExternalFileDialogFragment.newInstance(account), null)
|
||||
.commit();
|
||||
return false;
|
||||
} else {
|
||||
settings.logToExternalFile(false);
|
||||
refresh();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
final SwitchPreference prefLogVerbose = (SwitchPreference)findPreference("log_verbose");
|
||||
prefLogVerbose.setChecked(settings.logVerbose());
|
||||
prefLogVerbose.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
settings.logVerbose((Boolean) newValue);
|
||||
refresh(); return false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class LogExternalFileDialogFragment extends DialogFragment {
|
||||
private static final String
|
||||
KEY_ACCOUNT = "account";
|
||||
|
||||
public static LogExternalFileDialogFragment newInstance(Account account) {
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable(KEY_ACCOUNT, account);
|
||||
LogExternalFileDialogFragment fragment = new LogExternalFileDialogFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final AccountSettings settings = new AccountSettings(getActivity(), (Account)getArguments().getParcelable(KEY_ACCOUNT));
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.settings_security_warning)
|
||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
||||
.setMessage(R.string.settings_log_to_external_file_confirmation)
|
||||
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
settings.logToExternalFile(false);
|
||||
refresh();
|
||||
}
|
||||
})
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
settings.logToExternalFile(true);
|
||||
refresh();
|
||||
}
|
||||
})
|
||||
.create();
|
||||
}
|
||||
|
||||
private void refresh() {
|
||||
AccountFragment fragment = (AccountFragment)getActivity().getFragmentManager().findFragmentByTag(SettingsActivity.TAG_ACCOUNT_SETTINGS);
|
||||
if (fragment != null)
|
||||
fragment.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 – 2015 Ricki Hirner (bitfire web engineering).
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Public License v3.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
package at.bitfire.davdroid.ui.settings;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.app.Activity;
|
||||
import android.app.FragmentManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
import at.bitfire.davdroid.R;
|
||||
|
||||
public class AccountActivity extends Activity {
|
||||
public static final String EXTRA_ACCOUNT = "account";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.settings_account_activity);
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
final FragmentManager fm = getFragmentManager();
|
||||
AccountFragment fragment = (AccountFragment)fm.findFragmentById(R.id.account_fragment);
|
||||
if (fragment == null) {
|
||||
fragment = new AccountFragment();
|
||||
final Bundle args = new Bundle(1);
|
||||
Account account = getIntent().getExtras().getParcelable(EXTRA_ACCOUNT);
|
||||
args.putParcelable(AccountFragment.ARG_ACCOUNT, account);
|
||||
fragment.setArguments(args);
|
||||
|
||||
getFragmentManager().beginTransaction()
|
||||
.add(R.id.account_fragment, fragment, SettingsActivity.TAG_ACCOUNT_SETTINGS)
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 – 2015 Ricki Hirner (bitfire web engineering).
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Public License v3.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
package at.bitfire.davdroid.ui.settings;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.app.Activity;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import at.bitfire.davdroid.R;
|
||||
|
||||
public class SettingsActivity extends Activity {
|
||||
public final static String TAG_ACCOUNT_SETTINGS = "account_settings";
|
||||
|
||||
boolean tabletLayout;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.settings_activity);
|
||||
|
||||
tabletLayout = findViewById(R.id.right_pane) != null;
|
||||
if (tabletLayout) {
|
||||
SettingsScopeFragment scope = (SettingsScopeFragment)getFragmentManager().findFragmentById(R.id.settings_scope);
|
||||
scope.setLayout(true);
|
||||
}
|
||||
}
|
||||
|
||||
void showAccountSettings(Account account) {
|
||||
if (tabletLayout) {
|
||||
AccountFragment fragment = new AccountFragment();
|
||||
|
||||
Bundle args = new Bundle(1);
|
||||
args.putParcelable(AccountFragment.ARG_ACCOUNT, account);
|
||||
fragment.setArguments(args);
|
||||
|
||||
getFragmentManager().beginTransaction()
|
||||
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
|
||||
.replace(R.id.right_pane, fragment, TAG_ACCOUNT_SETTINGS)
|
||||
.commit();
|
||||
} else { // phone layout
|
||||
Intent intent = new Intent(getApplicationContext(), AccountActivity.class);
|
||||
intent.putExtra(AccountActivity.EXTRA_ACCOUNT, account);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2013 – 2015 Ricki Hirner (bitfire web engineering).
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Public License v3.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
package at.bitfire.davdroid.ui.settings;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.ListFragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
import at.bitfire.davdroid.Constants;
|
||||
import at.bitfire.davdroid.R;
|
||||
|
||||
public class SettingsScopeFragment extends ListFragment {
|
||||
Account[] accounts;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
final AccountManager manager = AccountManager.get(getActivity());
|
||||
accounts = manager.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||
|
||||
final String[] accountNames = new String[accounts.length];
|
||||
for (int i = 0; i < accounts.length; i++)
|
||||
accountNames[i] = accounts[i].name;
|
||||
setListAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_activated_1, accountNames));
|
||||
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
public void setLayout(boolean tabletLayout) {
|
||||
if (tabletLayout)
|
||||
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
setEmptyText(getString(R.string.settings_no_accounts));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||
l.clearChoices();
|
||||
((SettingsActivity)getActivity()).showAccountSettings(accounts[position]);
|
||||
l.setItemChecked(position, true);
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 878 B |
Before Width: | Height: | Size: 962 B |
Before Width: | Height: | Size: 953 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 613 B |
Before Width: | Height: | Size: 666 B |
Before Width: | Height: | Size: 594 B |
Before Width: | Height: | Size: 868 B |
Before Width: | Height: | Size: 910 B |
Before Width: | Height: | Size: 1020 B |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 912 B |
Before Width: | Height: | Size: 920 B |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.7 KiB |
5
app/src/main/res/drawable/ic_remove_circle_dark.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:alpha="0.54" android:height="32dp"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="32dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zm5,11H7v-2h10v2z"/>
|
||||
</vector>
|
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2013 – 2015 Ricki Hirner (bitfire web engineering).
|
||||
~ All rights reserved. This program and the accompanying materials
|
||||
~ are made available under the terms of the GNU Public License v3.0
|
||||
~ which accompanies this distribution, and is available at
|
||||
~ http://www.gnu.org/licenses/gpl.html
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="10dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<fragment
|
||||
android:layout_width="@dimen/leftcol_width"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/settings_scope"
|
||||
android:name="at.bitfire.davdroid.ui.settings.SettingsScopeFragment" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/right_pane"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
@ -52,6 +52,12 @@
|
||||
tools:text="Calendar Description"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/read_only"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/ic_remove_circle_dark"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/events"
|
||||
android:layout_width="32dp"
|
||||
|
@ -23,7 +23,7 @@
|
||||
android:clickable="false"
|
||||
android:id="@+id/checked"/>
|
||||
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
<LinearLayout android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
@ -44,4 +44,10 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/read_only"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/ic_remove_circle_dark"/>
|
||||
|
||||
</LinearLayout>
|
@ -47,10 +47,10 @@
|
||||
android:indeterminate="true"/>
|
||||
|
||||
<ListView
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/address_books"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:choiceMode="singleChoice"
|
||||
android:id="@+id/address_books"/>
|
||||
android:choiceMode="singleChoice"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
|
||||
<ListView
|
||||
android:id="@+id/calendars"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:choiceMode="multipleChoice"
|
||||
android:descendantFocusability="beforeDescendants"/>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2013 – 2015 Ricki Hirner (bitfire web engineering).
|
||||
~ Copyright © 2013 – 2016 Ricki Hirner (bitfire web engineering).
|
||||
~ All rights reserved. This program and the accompanying materials
|
||||
~ are made available under the terms of the GNU Public License v3.0
|
||||
~ which accompanies this distribution, and is available at
|
||||
@ -8,6 +8,6 @@
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/account_fragment" />
|
||||
android:id="@+id/fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
@ -12,4 +12,17 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/displayName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Display name"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Description"
|
||||
android:lines="2"/>
|
||||
|
||||
</LinearLayout>
|
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2013 – 2015 Ricki Hirner (bitfire web engineering).
|
||||
~ All rights reserved. This program and the accompanying materials
|
||||
~ are made available under the terms of the GNU Public License v3.0
|
||||
~ which accompanies this distribution, and is available at
|
||||
~ http://www.gnu.org/licenses/gpl.html
|
||||
-->
|
||||
|
||||
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:tag="scope"
|
||||
android:name="at.bitfire.davdroid.ui.settings.SettingsScopeFragment" />
|
@ -10,6 +10,11 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item android:id="@+id/sync_now"
|
||||
android:icon="@drawable/ic_sync_dark"
|
||||
android:title="@string/account_synchronize_now"
|
||||
app:showAsAction="always"/>
|
||||
|
||||
<item android:id="@+id/settings"
|
||||
android:icon="@drawable/ic_settings_dark"
|
||||
android:title="@string/account_settings"
|
||||
|
@ -12,6 +12,7 @@
|
||||
<!-- common strings -->
|
||||
<string name="app_name">DAVdroid</string>
|
||||
<string name="help">Help</string>
|
||||
<string name="manage_accounts">Manage accounts</string>
|
||||
<string name="please_wait">Please wait</string>
|
||||
<string name="send">Send</string>
|
||||
<string name="skip">Skip</string>
|
||||
@ -28,6 +29,8 @@
|
||||
<string name="account_list_empty">Welcome to DAVdroid!\n\nYou can add a CalDAV/CardDAV account now.</string>
|
||||
|
||||
<!-- AccountActivity -->
|
||||
<string name="account_synchronize_now">Synchronize now</string>
|
||||
<string name="account_synchronization_scheduled">Synchronization has been scheduled</string>
|
||||
<string name="account_settings">Account settings</string>
|
||||
<string name="account_delete">Delete account</string>
|
||||
<string name="account_delete_confirmation_title">Really delete account?</string>
|
||||
@ -128,9 +131,8 @@
|
||||
<string name="login_no_caldav_carddav">Couldn\'t find CalDAV or CardDAV service.</string>
|
||||
<string name="login_view_logs">View logs</string>
|
||||
|
||||
<!-- Settings activity -->
|
||||
<string name="settings_title">Settings</string>
|
||||
<string name="settings_no_accounts">No DAVdroid accounts found</string>
|
||||
<!-- AccountSettingsActivity -->
|
||||
<string name="settings_title">Settings: %s</string>
|
||||
<string name="settings_authentication">Authentication</string>
|
||||
<string name="settings_username">User name</string>
|
||||
<string name="settings_enter_username">Enter user name:</string>
|
||||
@ -167,16 +169,6 @@
|
||||
<item>Every 4 hours</item>
|
||||
<item>Once a day</item>
|
||||
</string-array>
|
||||
<string name="settings_debug">Debugging</string>
|
||||
<string name="settings_security_warning">Potential security risk!</string>
|
||||
<string name="settings_log_to_external_file">Log to external file</string>
|
||||
<string name="settings_log_to_external_file_confirmation">External log files will contain private data and be accessible by other apps. Turn off external logging and delete the log files after use.</string>
|
||||
<string name="settings_log_to_external_file_on">Logs are written to %s (if possible)</string>
|
||||
<string name="settings_log_to_external_file_no_external_storage">External storage is not available</string>
|
||||
<string name="settings_log_to_external_file_off">Logs are written to ADB</string>
|
||||
<string name="settings_log_verbose">Verbose logging</string>
|
||||
<string name="settings_log_verbose_on">Log synchronization information and network traffic</string>
|
||||
<string name="settings_log_verbose_off">Log only synchronization information</string>
|
||||
|
||||
<string name="settings_android_update_title">Android version update</string>
|
||||
<string name="settings_android_update_description">Android version updates may have an impact on how DAVdroid works. If there are problems, please delete your DAVdroid accounts and add them again.</string>
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
<color name="orangeA700">#ff6d00</color>
|
||||
|
||||
<color name="very_light_grey">#ebebeb</color>
|
||||
|
||||
<color name="black">#000000</color>
|
||||
<color name="grey">#888888</color>
|
||||
<color name="very_light_grey">#ebebeb</color>
|
||||
<color name="white">#ffffff</color>
|
||||
|
||||
|
||||
@ -33,6 +33,9 @@
|
||||
<item name="colorPrimary">@color/light_green500</item>
|
||||
<item name="colorPrimaryDark">@color/light_green700</item>
|
||||
<item name="colorAccent">@color/orangeA700</item>
|
||||
<item name="android:textColorPrimary">@color/black</item>
|
||||
<item name="android:textColorSecondary">@color/grey</item>
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
@ -40,9 +43,6 @@
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<!-- <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
|
||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/> -->
|
||||
|
||||
|
||||
<!-- AddAccountActivity -->
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
android:summary="@string/settings_password_summary"
|
||||
android:dialogTitle="@string/settings_enter_password" />
|
||||
|
||||
<SwitchPreference
|
||||
<SwitchPreferenceCompat
|
||||
android:key="preemptive"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_preemptive"
|
||||
@ -59,23 +59,4 @@
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/settings_debug">
|
||||
|
||||
<SwitchPreference
|
||||
android:key="log_external_file"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_log_to_external_file"
|
||||
android:summaryOn="@string/settings_log_to_external_file_on"
|
||||
android:summaryOff="@string/settings_log_to_external_file_off" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="log_verbose"
|
||||
android:persistent="false"
|
||||
android:dependency="log_external_file"
|
||||
android:title="@string/settings_log_verbose"
|
||||
android:summaryOn="@string/settings_log_verbose_on"
|
||||
android:summaryOff="@string/settings_log_verbose_off" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
@ -9,10 +9,10 @@
|
||||
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<PreferenceScreen android:title="@string/settings_title">
|
||||
<PreferenceScreen android:title="@string/manage_accounts">
|
||||
<intent
|
||||
android:targetPackage="at.bitfire.davdroid"
|
||||
android:targetClass="at.bitfire.davdroid.ui.settings.SettingsActivity"
|
||||
android:targetClass="at.bitfire.davdroid.ui.AccountsActivity"
|
||||
android:action="ACTION_VIEW" />
|
||||
</PreferenceScreen>
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 40aef8e2d5219c7595229a225c497c0e7237ec1c
|
||||
Subproject commit 67a8b968f9ed565d2091f78f252cd0475247bf6e
|