mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-17 07:30:16 -05:00
Give the user the choice of whether to enable Push as they create a new IMAP account.
TODO: explanatory prose underneath
This commit is contained in:
parent
849a1de91e
commit
84ab290046
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_width="fill_parent">
|
android:layout_width="fill_parent">
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
@ -21,11 +21,19 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
/>
|
/>
|
||||||
<Spinner
|
<Spinner
|
||||||
android:id="@+id/account_check_frequency"
|
android:id="@+id/account_check_frequency"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent" />
|
android:layout_width="fill_parent" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/account_enable_push"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:text="@string/account_setup_options_enable_push_label"
|
||||||
|
android:summary="@string/account_setup_options_enable_push_summary"
|
||||||
|
/>
|
||||||
<TextView
|
<TextView
|
||||||
android:text="@string/account_setup_options_mail_display_count_label"
|
android:text="@string/account_setup_options_mail_display_count_label"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -60,20 +68,20 @@
|
|||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_marginTop="-54dip"
|
android:layout_marginTop="-54dip"
|
||||||
android:gravity="bottom|right"
|
android:gravity="bottom|right"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent">
|
android:layout_width="fill_parent">
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/next"
|
android:id="@+id/next"
|
||||||
android:text="@string/next_action"
|
android:text="@string/next_action"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:minWidth="@dimen/button_minWidth"
|
android:minWidth="@dimen/button_minWidth"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:drawableRight="@drawable/button_indicator_next"
|
android:drawableRight="@drawable/button_indicator_next"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_centerVertical="false" />
|
android:layout_centerVertical="false" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -344,7 +344,11 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android based
|
|||||||
<string name="account_setup_options_mail_check_frequency_6hour">Every 6 hours</string>
|
<string name="account_setup_options_mail_check_frequency_6hour">Every 6 hours</string>
|
||||||
<string name="account_setup_options_mail_check_frequency_12hour">Every 12 hours</string>
|
<string name="account_setup_options_mail_check_frequency_12hour">Every 12 hours</string>
|
||||||
<string name="account_setup_options_mail_check_frequency_24hour">Every 24 hours</string>
|
<string name="account_setup_options_mail_check_frequency_24hour">Every 24 hours</string>
|
||||||
|
|
||||||
|
|
||||||
|
<string name="account_setup_options_enable_push_label">Enable server push for this account</string>
|
||||||
|
<string name="account_setup_options_enable_push_summary">If your server supports it, new messages will appear instantly. This option can dramatically improve or hurt performance.</string>
|
||||||
|
|
||||||
<string name="account_setup_options_default_label">Send mail from this account by default</string>
|
<string name="account_setup_options_default_label">Send mail from this account by default</string>
|
||||||
<string name="account_setup_options_notify_label">Notify me when mail arrives</string>
|
<string name="account_setup_options_notify_label">Notify me when mail arrives</string>
|
||||||
<string name="account_setup_options_notify_sync_label">Notify me while mail is being checked</string>
|
<string name="account_setup_options_notify_sync_label">Notify me while mail is being checked</string>
|
||||||
|
@ -5,6 +5,7 @@ import com.android.email.K9Activity;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
@ -14,6 +15,7 @@ import android.widget.Spinner;
|
|||||||
import com.android.email.Account;
|
import com.android.email.Account;
|
||||||
import com.android.email.Email;
|
import com.android.email.Email;
|
||||||
import com.android.email.Preferences;
|
import com.android.email.Preferences;
|
||||||
|
import com.android.email.mail.Store;
|
||||||
import com.android.email.R;
|
import com.android.email.R;
|
||||||
|
|
||||||
public class AccountSetupOptions extends K9Activity implements OnClickListener {
|
public class AccountSetupOptions extends K9Activity implements OnClickListener {
|
||||||
@ -29,6 +31,7 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener {
|
|||||||
|
|
||||||
private CheckBox mNotifyView;
|
private CheckBox mNotifyView;
|
||||||
private CheckBox mNotifySyncView;
|
private CheckBox mNotifySyncView;
|
||||||
|
private CheckBox mPushEnable;
|
||||||
|
|
||||||
private Account mAccount;
|
private Account mAccount;
|
||||||
|
|
||||||
@ -49,6 +52,7 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener {
|
|||||||
mDefaultView = (CheckBox)findViewById(R.id.account_default);
|
mDefaultView = (CheckBox)findViewById(R.id.account_default);
|
||||||
mNotifyView = (CheckBox)findViewById(R.id.account_notify);
|
mNotifyView = (CheckBox)findViewById(R.id.account_notify);
|
||||||
mNotifySyncView = (CheckBox)findViewById(R.id.account_notify_sync);
|
mNotifySyncView = (CheckBox)findViewById(R.id.account_notify_sync);
|
||||||
|
mPushEnable = (CheckBox)findViewById(R.id.account_enable_push);
|
||||||
|
|
||||||
findViewById(R.id.next).setOnClickListener(this);
|
findViewById(R.id.next).setOnClickListener(this);
|
||||||
|
|
||||||
@ -114,6 +118,27 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener {
|
|||||||
.getAutomaticCheckIntervalMinutes());
|
.getAutomaticCheckIntervalMinutes());
|
||||||
SpinnerOption.setSpinnerOptionValue(mDisplayCountView, mAccount
|
SpinnerOption.setSpinnerOptionValue(mDisplayCountView, mAccount
|
||||||
.getDisplayCount());
|
.getDisplayCount());
|
||||||
|
|
||||||
|
|
||||||
|
boolean isPushCapable = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Store store = Store.getInstance(mAccount.getStoreUri(), getApplication());
|
||||||
|
isPushCapable = store.isPushCapable();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.e(Email.LOG_TAG, "Could not get remote store", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!isPushCapable) {
|
||||||
|
mPushEnable.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
mPushEnable.setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onDone() {
|
private void onDone() {
|
||||||
@ -124,6 +149,13 @@ public class AccountSetupOptions extends K9Activity implements OnClickListener {
|
|||||||
.getSelectedItem()).value);
|
.getSelectedItem()).value);
|
||||||
mAccount.setDisplayCount((Integer)((SpinnerOption)mDisplayCountView
|
mAccount.setDisplayCount((Integer)((SpinnerOption)mDisplayCountView
|
||||||
.getSelectedItem()).value);
|
.getSelectedItem()).value);
|
||||||
|
|
||||||
|
if (mPushEnable.isChecked()) {
|
||||||
|
mAccount.setFolderPushMode(Account.FolderMode.FIRST_CLASS);
|
||||||
|
} else {
|
||||||
|
mAccount.setFolderPushMode(Account.FolderMode.NONE);
|
||||||
|
}
|
||||||
|
|
||||||
mAccount.save(Preferences.getPreferences(this));
|
mAccount.save(Preferences.getPreferences(this));
|
||||||
if (mDefaultView.isChecked()) {
|
if (mDefaultView.isChecked()) {
|
||||||
Preferences.getPreferences(this).setDefaultAccount(mAccount);
|
Preferences.getPreferences(this).setDefaultAccount(mAccount);
|
||||||
|
Loading…
Reference in New Issue
Block a user