Stable now

This commit is contained in:
David 2013-08-28 06:51:14 +02:00
parent c69280e8d3
commit 30e294ba5f
6 changed files with 19 additions and 29 deletions

View file

@ -8,8 +8,7 @@
android:minSdkVersion="7"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@ -19,16 +18,6 @@
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<application
android:allowBackup="true"

Binary file not shown.

View file

@ -12,5 +12,5 @@
# Project target.
target=android-17
android.library.reference.1=../../actionbarsherlock
android.library.reference.2=../../library
android.library.reference.1=../../workspace_juno/actionbarsherlock
android.library.reference.2=../Android-PullToRefresh/library

View file

@ -24,13 +24,10 @@ package de.luhmer.owncloudnewsreader;
import java.net.MalformedURLException;
import java.net.URL;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.ContentResolver;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.AsyncTask;
@ -46,7 +43,6 @@ import android.widget.EditText;
import com.actionbarsherlock.app.SherlockDialogFragment;
import de.luhmer.owncloudnewsreader.authentication.AccountGeneral;
import de.luhmer.owncloudnewsreader.authentication.AuthenticatorActivity;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.helper.FontHelper;
@ -497,6 +493,7 @@ public class LoginDialogFragment extends SherlockDialogFragment {
editor.putString(SettingsActivity.EDT_USERNAME_STRING, username);
editor.commit();
/*
AccountManager mAccountManager = AccountManager.get(mActivity);
//Remove all accounts first
@ -511,6 +508,7 @@ public class LoginDialogFragment extends SherlockDialogFragment {
mAccountManager.addAccountExplicitly(account, mPassword, null);
ContentResolver.setIsSyncable(account, getString(R.string.authorities), 1);
*/
LoginDialogFragment.this.getDialog().cancel();
if(mActivity instanceof AuthenticatorActivity)

View file

@ -104,17 +104,18 @@ public class NewsReaderListActivity extends MenuUtilsSherlockFragmentActivity im
//Remove all accounts first
Account[] accounts = mAccountManager.getAccounts();
for (int index = 0; index < accounts.length; index++) {
if (accounts[index].type.intern() == AccountGeneral.ACCOUNT_TYPE)
//mAccountManager.removeAccount(accounts[index], null, null);
isAccountThere = true;
if (accounts[index].type.intern() == AccountGeneral.ACCOUNT_TYPE) {
//mAccountManager.removeAccount(accounts[index], null, null);
isAccountThere = true;
}
}
if(!isAccountThere) {
//Then add the new account
Account account = new Account(getString(R.string.app_name), AccountGeneral.ACCOUNT_TYPE);
mAccountManager.addAccountExplicitly(account, "", null);
ContentResolver.setIsSyncable(account, getString(R.string.authorities), 1);
//Then add the new account
Account account = new Account(getString(R.string.app_name), AccountGeneral.ACCOUNT_TYPE);
mAccountManager.addAccountExplicitly(account, "", new Bundle());
//ContentResolver.setSyncAutomatically(account, getString(R.string.authorities), true);
//ContentResolver.setIsSyncable(account, getString(R.string.authorities), 1);
}

View file

@ -342,12 +342,14 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
* Request the sync for the default account, authority, and
* manual sync settings
*/
Bundle accBundle = new Bundle();
accBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
AccountManager mAccountManager = AccountManager.get(getActivity());
Account[] accounts = mAccountManager.getAccounts();
Bundle settingsBundle = new Bundle();
Account[] accounts = mAccountManager.getAccounts();
for(Account acc : accounts)
if(acc.type.equals(AccountGeneral.ACCOUNT_TYPE))
ContentResolver.requestSync(acc, AccountGeneral.ACCOUNT_TYPE, settingsBundle);
ContentResolver.requestSync(acc, AccountGeneral.ACCOUNT_TYPE, accBundle);
//http://stackoverflow.com/questions/5253858/why-does-contentresolver-requestsync-not-trigger-a-sync
}
} catch (RemoteException e) {
e.printStackTrace();