mirror of
https://github.com/etesync/android
synced 2025-02-20 11:32:10 +00:00
Fix Settings rendering issues
* fix Settings rendering issues (fixes #459) * version bump to 0.7.1
This commit is contained in:
parent
b29756aff2
commit
23dba581e1
@ -4,7 +4,7 @@ N:Gump;Forrest;Mr.
|
|||||||
FN:Forrest Gump
|
FN:Forrest Gump
|
||||||
ORG:Bubba Gump Shrimp Co.
|
ORG:Bubba Gump Shrimp Co.
|
||||||
TITLE:Shrimp Man
|
TITLE:Shrimp Man
|
||||||
PHOTO;VALUE=URL;TYPE=PNG:http://10.0.0.11:3000/assets/davdroid-logo-192.png
|
PHOTO;VALUE=URL;TYPE=PNG:http://192.168.0.11:3000/assets/davdroid-logo-192.png
|
||||||
TEL;TYPE=WORK,VOICE:(111) 555-1212
|
TEL;TYPE=WORK,VOICE:(111) 555-1212
|
||||||
TEL;TYPE=HOME,VOICE:(404) 555-1212
|
TEL;TYPE=HOME,VOICE:(404) 555-1212
|
||||||
ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
|
ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
|
||||||
|
@ -14,7 +14,7 @@ import java.net.URISyntaxException;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class TestConstants {
|
public class TestConstants {
|
||||||
public static final String ROBOHYDRA_BASE = "http://10.0.0.11:3000/";
|
public static final String ROBOHYDRA_BASE = "http://192.168.0.11:3000/";
|
||||||
|
|
||||||
public static URI roboHydra;
|
public static URI roboHydra;
|
||||||
static {
|
static {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="at.bitfire.davdroid"
|
package="at.bitfire.davdroid"
|
||||||
android:versionCode="55" android:versionName="0.7"
|
android:versionCode="56" android:versionName="0.7.1"
|
||||||
android:installLocation="internalOnly">
|
android:installLocation="internalOnly">
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
@ -83,12 +83,16 @@
|
|||||||
android:excludeFromRecents="true" >
|
android:excludeFromRecents="true" >
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".syncadapter.SettingsActivity"
|
android:name=".ui.settings.SettingsActivity"
|
||||||
android:label="@string/settings_title" >
|
android:label="@string/settings_title" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
|
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".ui.settings.AccountActivity"
|
||||||
|
android:label="@string/settings_title" >
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -9,7 +9,7 @@ package at.bitfire.davdroid;
|
|||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
public static final String
|
public static final String
|
||||||
APP_VERSION = "0.7",
|
APP_VERSION = "0.7.1",
|
||||||
ACCOUNT_TYPE = "bitfire.at.davdroid",
|
ACCOUNT_TYPE = "bitfire.at.davdroid",
|
||||||
WEB_URL_HELP = "https://davdroid.bitfire.at/configuration?pk_campaign=davdroid-app",
|
WEB_URL_HELP = "https://davdroid.bitfire.at/configuration?pk_campaign=davdroid-app",
|
||||||
WEB_URL_VIEW_LOGS = "https://github.com/bitfireAT/davdroid/wiki/How-to-view-the-logs";
|
WEB_URL_VIEW_LOGS = "https://github.com/bitfireAT/davdroid/wiki/How-to-view-the-logs";
|
||||||
|
@ -21,7 +21,7 @@ import android.view.View;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import at.bitfire.davdroid.syncadapter.AddAccountActivity;
|
import at.bitfire.davdroid.syncadapter.AddAccountActivity;
|
||||||
import at.bitfire.davdroid.syncadapter.SettingsActivity;
|
import at.bitfire.davdroid.ui.settings.SettingsActivity;
|
||||||
|
|
||||||
public class MainActivity extends Activity {
|
public class MainActivity extends Activity {
|
||||||
|
|
||||||
|
@ -89,15 +89,15 @@ public class AccountSettings {
|
|||||||
public String getUserName() {
|
public String getUserName() {
|
||||||
return accountManager.getUserData(account, KEY_USERNAME);
|
return accountManager.getUserData(account, KEY_USERNAME);
|
||||||
}
|
}
|
||||||
void setUserName(String userName) { accountManager.setUserData(account, KEY_USERNAME, userName); }
|
public void setUserName(String userName) { accountManager.setUserData(account, KEY_USERNAME, userName); }
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return accountManager.getPassword(account);
|
return accountManager.getPassword(account);
|
||||||
}
|
}
|
||||||
void setPassword(String password) { accountManager.setPassword(account, password); }
|
public void setPassword(String password) { accountManager.setPassword(account, password); }
|
||||||
|
|
||||||
public boolean getPreemptiveAuth() { return Boolean.parseBoolean(accountManager.getUserData(account, KEY_AUTH_PREEMPTIVE)); }
|
public boolean getPreemptiveAuth() { return Boolean.parseBoolean(accountManager.getUserData(account, KEY_AUTH_PREEMPTIVE)); }
|
||||||
void setPreemptiveAuth(boolean preemptive) { accountManager.setUserData(account, KEY_AUTH_PREEMPTIVE, Boolean.toString(preemptive)); }
|
public void setPreemptiveAuth(boolean preemptive) { accountManager.setUserData(account, KEY_AUTH_PREEMPTIVE, Boolean.toString(preemptive)); }
|
||||||
|
|
||||||
|
|
||||||
// sync. settings
|
// sync. settings
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
package at.bitfire.davdroid.syncadapter;
|
|
||||||
|
|
||||||
import android.accounts.Account;
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.app.Fragment;
|
|
||||||
import android.app.FragmentManager;
|
|
||||||
import android.app.FragmentTransaction;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import at.bitfire.davdroid.R;
|
|
||||||
|
|
||||||
public class SettingsActivity extends Activity {
|
|
||||||
private final static String KEY_SELECTED_ACCOUNT = "selected_account";
|
|
||||||
|
|
||||||
protected Account selectedAccount;
|
|
||||||
boolean tabletLayout;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_settings);
|
|
||||||
|
|
||||||
tabletLayout = findViewById(R.id.right_pane) != null;
|
|
||||||
if (!tabletLayout)
|
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.add(R.id.content_pane, new SettingsScopeFragment())
|
|
||||||
.commit();
|
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
|
||||||
selectedAccount = savedInstanceState.getParcelable(KEY_SELECTED_ACCOUNT);
|
|
||||||
if (selectedAccount != null)
|
|
||||||
showAccountSettings(selectedAccount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
|
||||||
outState.putParcelable(KEY_SELECTED_ACCOUNT, selectedAccount);
|
|
||||||
super.onSaveInstanceState(outState);
|
|
||||||
}
|
|
||||||
|
|
||||||
void showAccountSettings(Account account) {
|
|
||||||
selectedAccount = account;
|
|
||||||
|
|
||||||
FragmentManager fm = getFragmentManager();
|
|
||||||
Fragment settingsFragment = new SettingsAccountFragment();
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putParcelable(SettingsAccountFragment.KEY_ACCOUNT, account);
|
|
||||||
settingsFragment.setArguments(args);
|
|
||||||
|
|
||||||
FragmentTransaction ft = fm
|
|
||||||
.beginTransaction()
|
|
||||||
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
|
||||||
|
|
||||||
if (tabletLayout)
|
|
||||||
ft .replace(R.id.right_pane, settingsFragment);
|
|
||||||
else // phone layout
|
|
||||||
ft .replace(R.id.content_pane, settingsFragment)
|
|
||||||
.addToBackStack(null);
|
|
||||||
|
|
||||||
ft.commit();
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
package at.bitfire.davdroid.ui.settings;
|
||||||
|
|
||||||
|
import android.accounts.Account;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.FragmentManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import at.bitfire.davdroid.R;
|
||||||
|
|
||||||
|
public class AccountActivity extends Activity {
|
||||||
|
static final String EXTRA_ACCOUNT = "account";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
setContentView(R.layout.settings_account_activity);
|
||||||
|
|
||||||
|
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)
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,11 +6,9 @@
|
|||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package at.bitfire.davdroid.syncadapter;
|
package at.bitfire.davdroid.ui.settings;
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.accounts.AccountManager;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
import android.preference.EditTextPreference;
|
import android.preference.EditTextPreference;
|
||||||
@ -19,19 +17,21 @@ import android.preference.Preference;
|
|||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
|
|
||||||
import at.bitfire.davdroid.R;
|
import at.bitfire.davdroid.R;
|
||||||
|
import at.bitfire.davdroid.syncadapter.AccountSettings;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
public class SettingsAccountFragment extends PreferenceFragment {
|
public class AccountFragment extends PreferenceFragment {
|
||||||
final static String KEY_ACCOUNT = "account";
|
final static String ARG_ACCOUNT = "account";
|
||||||
|
|
||||||
protected Account account;
|
Account account;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.account_prefs);
|
addPreferencesFromResource(R.xml.settings_account_prefs);
|
||||||
|
|
||||||
account = getArguments().getParcelable(KEY_ACCOUNT);
|
account = getArguments().getParcelable(ARG_ACCOUNT);
|
||||||
readFromAccount();
|
readFromAccount();
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
package at.bitfire.davdroid.ui.settings;
|
||||||
|
|
||||||
|
import android.accounts.Account;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.FragmentTransaction;
|
||||||
|
import android.app.ListFragment;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import at.bitfire.davdroid.R;
|
||||||
|
|
||||||
|
public class SettingsActivity extends Activity {
|
||||||
|
private final static String KEY_SELECTED_ACCOUNT = "selected_account";
|
||||||
|
|
||||||
|
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)
|
||||||
|
.commit();
|
||||||
|
} else { // phone layout
|
||||||
|
Intent intent = new Intent(getApplicationContext(), AccountActivity.class);
|
||||||
|
intent.putExtra(AccountActivity.EXTRA_ACCOUNT, account);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@
|
|||||||
* http://www.gnu.org/licenses/gpl.html
|
* http://www.gnu.org/licenses/gpl.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package at.bitfire.davdroid.syncadapter;
|
package at.bitfire.davdroid.ui.settings;
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.accounts.AccountManager;
|
import android.accounts.AccountManager;
|
||||||
@ -26,17 +26,22 @@ public class SettingsScopeFragment extends ListFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
final AccountManager manager = AccountManager.get(this.getActivity());
|
final AccountManager manager = AccountManager.get(getActivity());
|
||||||
accounts = manager.getAccountsByType(Constants.ACCOUNT_TYPE);
|
accounts = manager.getAccountsByType(Constants.ACCOUNT_TYPE);
|
||||||
|
|
||||||
final String[] accountNames = new String[accounts.length];
|
final String[] accountNames = new String[accounts.length];
|
||||||
for (int i = 0; i < accounts.length; i++)
|
for (int i = 0; i < accounts.length; i++)
|
||||||
accountNames[i] = accounts[i].name;
|
accountNames[i] = accounts[i].name;
|
||||||
setListAdapter(new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_list_item_activated_1, accountNames));
|
setListAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_activated_1, accountNames));
|
||||||
|
|
||||||
return super.onCreateView(inflater, container, savedInstanceState);
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLayout(boolean tabletLayout) {
|
||||||
|
if (tabletLayout)
|
||||||
|
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
@ -16,8 +16,8 @@
|
|||||||
<fragment
|
<fragment
|
||||||
android:layout_width="@dimen/titles_width"
|
android:layout_width="@dimen/titles_width"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:tag="scope"
|
android:id="@+id/settings_scope"
|
||||||
android:name="at.bitfire.davdroid.syncadapter.SettingsScopeFragment" />
|
android:name="at.bitfire.davdroid.ui.settings.SettingsScopeFragment" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/right_pane"
|
android:id="@+id/right_pane"
|
@ -8,10 +8,6 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/content_pane"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_margin="10dp"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal"
|
android:id="@+id/account_fragment" />
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
@ -7,8 +7,8 @@
|
|||||||
~ http://www.gnu.org/licenses/gpl.html
|
~ http://www.gnu.org/licenses/gpl.html
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/settings_accounts"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:choiceMode="singleChoice" />
|
android:tag="scope"
|
||||||
|
android:name="at.bitfire.davdroid.ui.settings.SettingsScopeFragment" />
|
Loading…
Reference in New Issue
Block a user