<commit_before>/* Copyright (c) 2009 <NAME> <<EMAIL>>
 *
 * 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.
 */

package tv.studer.smssync;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Date;

import tv.studer.smssync.SmsSyncService.SmsSyncState;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.AlertDialog.Builder;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
import android.preference.Preference.OnPreferenceChangeListener;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

/**
 * This is the main activity showing the status of the SMS Sync service and
 * providing controls to configure it.
 */
public class SmsSync extends PreferenceActivity implements OnPreferenceChangeListener {
    private static final int DIALOG_MISSING_CREDENTIALS = 1;

    private static final int DIALOG_FIRST_SYNC = 2;
    
    private static final int DIALOG_SYNC_DATA_RESET = 3;
    
    private static final int DIALOG_INVALID_IMAP_FOLDER = 4;

    private static final int DIALOG_NEED_FIRST_MANUAL_SYNC = 5;
    
    private static final int DIALOG_ABOUT = 6;
    
    private static final int MENU_INFO = 0;
    
    private static final int MENU_SHARE = 1;
    
    private static final int MENU_MARKET = 2;

    private StatusPreference mStatusPref;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        PreferenceManager prefMgr = getPreferenceManager();
        
        addPreferencesFromResource(R.xml.main_screen);

        PreferenceCategory cat = new PreferenceCategory(this);
        cat.setOrder(0);
        getPreferenceScreen().addPreference(cat);
        mStatusPref = new StatusPreference(this);
        mStatusPref.setSelectable(false);
        cat.setTitle(R.string.ui_status_label);
        cat.addPreference(mStatusPref);

        Preference pref = prefMgr.findPreference(PrefStore.PREF_LOGIN_USER);<commit_msg>Remove duplicate "SMS Backup" title bar for SDK levels >= 3.<commit_after>/* Copyright (c) 2009 <NAME> <<EMAIL>>
 *
 * 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.
 */

package tv.studer.smssync;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Date;

import tv.studer.smssync.SmsSyncService.SmsSyncState;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.AlertDialog.Builder;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
import android.preference.PreferenceManager;
import android.preference.Preference.OnPreferenceChangeListener;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

/**
 * This is the main activity showing the status of the SMS Sync service and
 * providing controls to configure it.
 */
public class SmsSync extends PreferenceActivity implements OnPreferenceChangeListener {
    private static final int DIALOG_MISSING_CREDENTIALS = 1;

    private static final int DIALOG_FIRST_SYNC = 2;
    
    private static final int DIALOG_SYNC_DATA_RESET = 3;
    
    private static final int DIALOG_INVALID_IMAP_FOLDER = 4;

    private static final int DIALOG_NEED_FIRST_MANUAL_SYNC = 5;
    
    private static final int DIALOG_ABOUT = 6;
    
    private static final int MENU_INFO = 0;
    
    private static final int MENU_SHARE = 1;
    
    private static final int MENU_MARKET = 2;

    private StatusPreference mStatusPref;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        PreferenceManager prefMgr = getPreferenceManager();

        addPreferencesFromResource(R.xml.main_screen);

        mStatusPref = new StatusPreference(this);
        mStatusPref.setSelectable(false);
        
        int sdkLevel = 1;
        try {
            sdkLevel = Integer.parseInt(Build.VERSION.SDK);
        } catch (NumberFormatException nfe) {
            // ignore (assume sdkLevel == 1)
        }

        if (sdkLevel < 3) {
            // Older versions don't show the title bar for PreferenceActivity
            PreferenceCategory cat = new PreferenceCategory(this);
            cat.setOrder(0);
            getPreferenceScreen().addPreference(cat);
            cat.setTitle(R.string.ui_status_label);
            cat.addPreference(mStatusPref);
        } else {
            // Newer SDK version show the title bar for PreferenceActivity
            mStatusPref.setOrder(0);
            getPreferenceScreen().addPreference(mStatusPref);
        }
        
        Preference pref = prefMgr.findPreference(PrefStore.PREF_LOGIN_USER);
{'fraction_non_alphanumeric': 0.07667507709559854, 'fraction_numerical': 0.005747126436781609, 'mean_word_length': 3.863667348329925, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6980225', 'n_tokens_mistral': 2004, 'n_tokens_neox': 1948, 'n_words': 581}