Don't show sync for 30 days dialog.
There is a sync button/ flow in the widget to take care of this.
fixes b/6308859 Don't show "sync 30 days" dialog when creating widget
Change-Id: I7dbef676bf2a14b1b3d034810d6847cab7373fcb
diff --git a/res/layout/folder_sync_for_widget_dialog.xml b/res/layout/folder_sync_for_widget_dialog.xml
deleted file mode 100644
index 4e17f98..0000000
--- a/res/layout/folder_sync_for_widget_dialog.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2012 Google Inc.
- Licensed to The Android Open Source Project.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:fillViewport="true"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:layout_width="match_parent">
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TextView
- android:id="@+id/folder_sync_for_widget_text"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:padding="10dip"
- android:paddingBottom="20dip"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:singleLine="false"
- android:text="@string/folder_sync_for_widget_description" />
-
- <CheckBox
- android:id="@+id/folder_sync_for_widget_confirm"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/folder_sync_for_widget_text"
- android:text="@string/folder_sync_for_widget_checkbox"
- android:checked="true" />
-
- </RelativeLayout>
-
-</ScrollView>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6b68507..cd381a4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -572,14 +572,6 @@
</plurals>
<!-- Manage folders mode, sync option: don't synchronize any conversation with this folder [CHAR LIMIT=100] -->
<string name="sync_none">Sync: None</string>
- <!-- Title for dialog encouraging users enable sync for a currently non-synced folder [CHAR LIMIT=30] -->
- <string name="folder_sync_for_widget_title">Sync folder</string>
-
- <!-- Dialog text encouraging users to enable sync for a newly created widget [CHAR LIMIT=400] -->
- <string name="folder_sync_for_widget_description">To view conversations in the widget, sync this folder.</string>
-
- <!-- Checkbox text to enable sync for a folder where a widget is in the processes of being added, and sync had been not been enabled [CHAR LIMIT=30] -->
- <string name="folder_sync_for_widget_checkbox">Sync last <xliff:g id="numSyncDays" example="30">%d</xliff:g> days</string>
<!-- Folder selection dialog -->
<!-- Title for change folders dialog [CHAR LIMIT=30] -->
diff --git a/src/com/android/mail/ui/FolderSelectionActivity.java b/src/com/android/mail/ui/FolderSelectionActivity.java
index f404822..c09dbfd 100644
--- a/src/com/android/mail/ui/FolderSelectionActivity.java
+++ b/src/com/android/mail/ui/FolderSelectionActivity.java
@@ -143,17 +143,6 @@
finish();
}
- @Override
- public Dialog onCreateDialog(int id, Bundle bundle) {
- Dialog dialog = null;
- switch (id) {
- case R.layout.folder_sync_for_widget_dialog:
- dialog = new SyncForWidgetDialog(this, mAccount, mSelectedFolder, this);
- break;
- }
- return dialog == null ? super.onCreateDialog(id, bundle) : dialog;
- }
-
/**
* Create a widget for the specified account and folder
*/
@@ -215,20 +204,7 @@
startActivity(shortcutNameIntent);
finish();
} else if (mConfigureWidget) {
- // Check to see if the widget is set to be synchronized
- final Set<String> synchronizedFoldersSet = Sets.newHashSet();
-
- // Add all of the synchronized folders to the set
- // TODO: (mindyp) deal with folders.
- // synchronizedFoldersSet.addAll(settings.getFoldersIncluded());
- // synchronizedFoldersSet.addAll(settings.getFoldersPartial());
-
- if (!synchronizedFoldersSet.contains(mSelectedFolder.name)) {
- // Display a dialog offering to enable sync for this folder
- showDialog(R.layout.folder_sync_for_widget_dialog);
- } else {
- createWidget(mAppWidgetId, mAccount, mSelectedFolder);
- }
+ createWidget(mAppWidgetId, mAccount, mSelectedFolder);
}
}
}
diff --git a/src/com/android/mail/ui/SyncForWidgetDialog.java b/src/com/android/mail/ui/SyncForWidgetDialog.java
deleted file mode 100644
index eff0b8c..0000000
--- a/src/com/android/mail/ui/SyncForWidgetDialog.java
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2012 Google Inc. All Rights Reserved.
-
-package com.android.mail.ui;
-
-import android.content.res.Resources;
-import android.view.View;
-
-import android.app.AlertDialog;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.database.Cursor;
-import android.os.AsyncTask;
-import android.view.LayoutInflater;
-import android.widget.CheckBox;
-
-import com.android.mail.R;
-import com.android.mail.providers.Account;
-import com.android.mail.providers.Folder;
-import com.google.common.collect.Sets;
-
-import java.util.Set;
-
-/**
- * A dialog for users attempting to create a widget for a non-synced folder.
- */
-public class SyncForWidgetDialog extends AlertDialog
- implements DialogInterface.OnClickListener {
-
- private static final long SYNC_DAYS = 30;
- private final Account mAccount;
- private final Folder mFolder;
-
- private final DialogInterface.OnClickListener mConfirmClickListener;
-
- public SyncForWidgetDialog(Context context, Account account, Folder folder,
- DialogInterface.OnClickListener confirmWidgetCreationListener) {
- super(context);
-
- mAccount = account;
- mFolder = folder;
- mConfirmClickListener = confirmWidgetCreationListener;
- final ContentResolver resolver = context.getContentResolver();
-
- // Get the current sync window for the specified account
- // TODO: get sync days from settings.
- final long syncDays = SYNC_DAYS;
-
- final Resources res = context.getResources();
-
- setTitle(R.string.folder_sync_for_widget_title);
- setIcon(res.getDrawable(R.mipmap.ic_launcher_mail));
- setButton(DialogInterface.BUTTON_POSITIVE, context.getString(android.R.string.ok), this);
- setButton(DialogInterface.BUTTON_NEGATIVE,
- context.getString(android.R.string.cancel), this);
-
- LayoutInflater inflater = (LayoutInflater) context.getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
- final View dialogContents = inflater.inflate(R.layout.folder_sync_for_widget_dialog, null);
- final CheckBox checkboxView =
- (CheckBox) dialogContents.findViewById(R.id.folder_sync_for_widget_confirm);
- checkboxView.setText(res.getString(R.string.folder_sync_for_widget_checkbox, syncDays));
- setView(dialogContents);
- }
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- CheckBox confirmView = (CheckBox) findViewById(R.id.folder_sync_for_widget_confirm);
-
- if (confirmView.isChecked()) {
-
- AsyncTask<Context, Void, Void> enableFolderSyncTask =
- new AsyncTask<Context, Void, Void>() {
-
- @Override
- protected Void doInBackground(Context... params) {
- final Context context = params[0];
- // TODO: (mindyp) enable syncing of folder.
-
- return null;
- }
-
- };
- enableFolderSyncTask.execute(getContext());
- }
- }
-
- // Call the activity the created this widget, to let them know that the user pressed OK
- mConfirmClickListener.onClick(dialog, which);
- }
-
-}