18a574694606f0e5d781334d0d426fc379c51f3edMarc Blank/*
28a574694606f0e5d781334d0d426fc379c51f3edMarc Blank * Copyright (C) 2011 The Android Open Source Project
38a574694606f0e5d781334d0d426fc379c51f3edMarc Blank *
48a574694606f0e5d781334d0d426fc379c51f3edMarc Blank * Licensed under the Apache License, Version 2.0 (the "License");
58a574694606f0e5d781334d0d426fc379c51f3edMarc Blank * you may not use this file except in compliance with the License.
68a574694606f0e5d781334d0d426fc379c51f3edMarc Blank * You may obtain a copy of the License at
78a574694606f0e5d781334d0d426fc379c51f3edMarc Blank *
88a574694606f0e5d781334d0d426fc379c51f3edMarc Blank *      http://www.apache.org/licenses/LICENSE-2.0
98a574694606f0e5d781334d0d426fc379c51f3edMarc Blank *
108a574694606f0e5d781334d0d426fc379c51f3edMarc Blank * Unless required by applicable law or agreed to in writing, software
118a574694606f0e5d781334d0d426fc379c51f3edMarc Blank * distributed under the License is distributed on an "AS IS" BASIS,
128a574694606f0e5d781334d0d426fc379c51f3edMarc Blank * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138a574694606f0e5d781334d0d426fc379c51f3edMarc Blank * See the License for the specific language governing permissions and
148a574694606f0e5d781334d0d426fc379c51f3edMarc Blank * limitations under the License.
158a574694606f0e5d781334d0d426fc379c51f3edMarc Blank */
168a574694606f0e5d781334d0d426fc379c51f3edMarc Blank
178a574694606f0e5d781334d0d426fc379c51f3edMarc Blankpackage com.android.emailcommon.service;
188a574694606f0e5d781334d0d426fc379c51f3edMarc Blank
198a574694606f0e5d781334d0d426fc379c51f3edMarc Blankpublic class SyncWindow {
208a574694606f0e5d781334d0d426fc379c51f3edMarc Blank    public static final int SYNC_WINDOW_USER = -1;
21b3cb475fd29f827002b9743822b2a99ff85d1b38Yu Ping Hu    public static final int SYNC_WINDOW_ACCOUNT = 0;
228a574694606f0e5d781334d0d426fc379c51f3edMarc Blank    public static final int SYNC_WINDOW_1_DAY = 1;
238a574694606f0e5d781334d0d426fc379c51f3edMarc Blank    public static final int SYNC_WINDOW_3_DAYS = 2;
248a574694606f0e5d781334d0d426fc379c51f3edMarc Blank    public static final int SYNC_WINDOW_1_WEEK = 3;
258a574694606f0e5d781334d0d426fc379c51f3edMarc Blank    public static final int SYNC_WINDOW_2_WEEKS = 4;
268a574694606f0e5d781334d0d426fc379c51f3edMarc Blank    public static final int SYNC_WINDOW_1_MONTH = 5;
278a574694606f0e5d781334d0d426fc379c51f3edMarc Blank    public static final int SYNC_WINDOW_ALL = 6;
28c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank
29c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank    public static int toDays(int window) {
30c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank        switch(window) {
31c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank            case SYNC_WINDOW_1_DAY:
32c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank                return 1;
33c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank            case SYNC_WINDOW_3_DAYS:
34c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank                return 3;
35c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank            case SYNC_WINDOW_1_WEEK:
36c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank                return 7;
37c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank            case SYNC_WINDOW_2_WEEKS:
38c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank                return 14;
39c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank            case SYNC_WINDOW_1_MONTH:
40c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank                return 30;
41c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank            case SYNC_WINDOW_ALL:
42c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank                return 365*10;
43b3cb475fd29f827002b9743822b2a99ff85d1b38Yu Ping Hu            case SYNC_WINDOW_ACCOUNT:
44c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank            default:
45c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank                return 14;
46c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank        }
47c6089bc01f2ae49fb11904a4b4f222811358254fMarc Blank    }
488a574694606f0e5d781334d0d426fc379c51f3edMarc Blank}
49