Suppression des strings de Preferences inutiles et des activites inutilisées.
authorDa Risk <darisk972@gmail.com>
Thu, 02 Jul 2009 21:52:16 +0200
changeset 328 5e760859a5d7
parent 327 eb633aedfdba
child 329 abc2cfc924fa
Suppression des strings de Preferences inutiles et des activites inutilisées.
AndroidManifest.xml
res/layout/contactlist.xml
res/values-en/strings.xml
res/values-fr/strings.xml
src/com/beem/project/beem/ui/ContactListSettings.java
src/com/beem/project/beem/ui/CreateAccount.java
--- a/AndroidManifest.xml	Thu Jul 02 10:57:45 2009 +0200
+++ b/AndroidManifest.xml	Thu Jul 02 21:52:16 2009 +0200
@@ -10,8 +10,6 @@
 				<category android:name="android.intent.category.LAUNCHER" />
 			</intent-filter>
 		</activity>
-		<activity android:name=".ui.ContactListSettings"
-			android:label="@string/app_name" />
 		<activity android:name=".ui.SendIM" android:label="@string/SendIMActTitle"
 			android:launchMode="singleTop" />
 		<activity android:name=".ui.ChangeStatus" android:label="@string/ChangeStatusActTitle" />
--- a/res/layout/contactlist.xml	Thu Jul 02 10:57:45 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
-
-        <ExpandableListView android:id="@+id/android:list"
-			android:layout_width="fill_parent"
-			android:layout_height="fill_parent"
-            android:layout_weight="1" />
-
-        <TextView android:id="@+id/android:empty"
-			android:layout_width="fill_parent"
-            android:layout_height="fill_parent" android:text="@string/ConListNotConnected" />
-
-</LinearLayout>
--- a/res/values-en/strings.xml	Thu Jul 02 10:57:45 2009 +0200
+++ b/res/values-en/strings.xml	Thu Jul 02 21:52:16 2009 +0200
@@ -18,23 +18,6 @@
 	<string name="BeemServiceDestroyed">BeemService destroyed</string>
 
 	<!--  Preferences informations -->
-	<string name="PreferenceFileName">Beem</string>
-	<string name="PreferenceHostKey">host</string>
-	<string name="PreferenceJID">Jabber ID</string>
-	<string name="PreferenceLoginKey">login</string>
-	<string name="PreferencePasswordKey">password</string>
-	<string name="PreferenceService">service</string>
-	<string name="PreferencePortKey">port</string>
-	<string name="PreferenceProxyHost">proxy_host</string>
-	<string name="PreferenceProxyPort">proxy_port</string>
-	<string name="PreferenceUseProxy">use_proxy</string>
-	<string name="PreferenceProxyType">proxy_type</string>
-	<string name="PreferenceProxyUser">proxy_user</string>
-	<string name="PreferenceProxyPassword">proxy_password</string>
-	<string name="PreferenceProxyTypeNone">None</string>
-	<string name="PreferenceProxyTypeHttp">HTTP</string>
-	<string name="PreferenceProxyTypeSocks4">SOCKS4</string>
-	<string name="PreferenceProxyTypeSocks5">SOCKS5</string>
 	<string name="PreferenceStatus">status</string>
 	<string name="PreferenceStatusText">status_text</string>
 	<string name="PreferenceIsConfigured">preference_is_configured</string>
--- a/res/values-fr/strings.xml	Thu Jul 02 10:57:45 2009 +0200
+++ b/res/values-fr/strings.xml	Thu Jul 02 21:52:16 2009 +0200
@@ -18,23 +18,6 @@
 	<string name="BeemServiceDestroyed">BeemService détruit</string>
 
 	<!--  Preferences informations -->
-	<string name="PreferenceFileName">Beem</string>
-	<string name="PreferenceHostKey">host</string>
-	<string name="PreferenceJID">Jabber ID</string>
-	<string name="PreferenceLoginKey">login</string>
-	<string name="PreferencePasswordKey">password</string>
-	<string name="PreferenceService">service</string>
-	<string name="PreferencePortKey">port</string>
-	<string name="PreferenceProxyHost">proxy_host</string>
-	<string name="PreferenceProxyPort">proxy_port</string>
-	<string name="PreferenceUseProxy">use_proxy</string>
-	<string name="PreferenceProxyType">proxy_type</string>
-	<string name="PreferenceProxyUser">proxy_user</string>
-	<string name="PreferenceProxyPassword">proxy_password</string>
-	<string name="PreferenceProxyTypeNone">None</string>
-	<string name="PreferenceProxyTypeHttp">HTTP</string>
-	<string name="PreferenceProxyTypeSocks4">SOCKS4</string>
-	<string name="PreferenceProxyTypeSocks5">SOCKS5</string>
 	<string name="PreferenceStatus">status</string>
 	<string name="PreferenceStatusText">status_text</string>
 	<string name="PreferenceIsConfigured">preference_is_configured</string>
--- a/src/com/beem/project/beem/ui/ContactListSettings.java	Thu Jul 02 10:57:45 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-package com.beem.project.beem.ui;
-
-import android.app.Activity;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.Spinner;
-import android.widget.AdapterView.OnItemSelectedListener;
-import android.widget.LinearLayout.LayoutParams;
-
-import com.beem.project.beem.R;
-
-public class ContactListSettings extends Activity {
-
-    public static final int              CHANGE      = 1;
-    private boolean                      mIsChanged  = false;
-    private SharedPreferences            mSettings;
-    private String[]                     mProxyTypeString;
-
-    private final OnItemSelectedListener mProxyType  = new OnItemSelectedListener() {
-
-	                                                 @Override
-	                                                 public void onItemSelected(AdapterView<?> parent, View arg1,
-	                                                         int arg2, long arg3) {
-		                                             String value = parent.getSelectedItem().toString();
-		                                             LinearLayout ll = (LinearLayout) findViewById(R.id.proxy_layout);
-		                                             SharedPreferences.Editor editor = mSettings.edit();
-		                                             LayoutParams lp = (LayoutParams) ll.getLayoutParams();
-		                                             if (value
-		                                                     .equals(getString(R.string.PreferenceProxyTypeNone))) {
-		                                                 ll.setVisibility(View.INVISIBLE);
-		                                                 lp.height = 0;
-		                                                 ll.setLayoutParams(lp);
-		                                                 editor.putBoolean(
-		                                                         getString(R.string.PreferenceUseProxy), false);
-		                                             } else {
-		                                                 ll.setVisibility(View.VISIBLE);
-		                                                 lp.height = android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
-		                                                 ll.setLayoutParams(lp);
-		                                                 editor.putBoolean(
-		                                                         getString(R.string.PreferenceUseProxy), true);
-		                                             }
-		                                             if (!value
-		                                                     .equals(getPreferenceString(R.string.PreferenceProxyType))) {
-		                                                 editor
-		                                                         .putString(
-		                                                                 getString(R.string.PreferenceProxyType),
-		                                                                 value);
-		                                                 mIsChanged = true;
-		                                             }
-		                                             editor.commit();
-	                                                 }
-
-	                                                 @Override
-	                                                 public void onNothingSelected(AdapterView<?> arg0) {
-	                                                 }
-
-	                                             };
-
-    private final OnClickListener        mOkListener = new OnClickListener() {
-
-	                                                 public void onClick(View v) {
-		                                             SharedPreferences.Editor editor = mSettings.edit();
-
-		                                             if (isChanged(R.id.host, R.string.PreferenceHostKey)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferenceHostKey),
-		                                                         getWidgetText(R.id.host));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (Integer.parseInt(getWidgetText(R.id.port)) != mSettings
-		                                                     .getInt(getString(R.string.PreferencePortKey),
-		                                                             5222)) {
-		                                                 editor.putInt(getString(R.string.PreferencePortKey),
-		                                                         Integer.parseInt(getWidgetText(R.id.port)));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (isChanged(R.id.userid, R.string.PreferenceLoginKey)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferenceLoginKey),
-		                                                         getWidgetText(R.id.userid));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (isChanged(R.id.password,
-		                                                     R.string.PreferencePasswordKey)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferencePasswordKey),
-		                                                         getWidgetText(R.id.password));
-		                                                 mIsChanged = true;
-		                                             }
-
-		                                             if (isChanged(R.id.proxy_host,
-		                                                     R.string.PreferenceProxyHost)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferenceProxyHost),
-		                                                         getWidgetText(R.id.proxy_host));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (Integer.parseInt(getWidgetText(R.id.proxy_port)) != mSettings
-		                                                     .getInt(getString(R.string.PreferenceProxyPort), 0)) {
-		                                                 editor
-		                                                         .putInt(
-		                                                                 getString(R.string.PreferenceProxyPort),
-		                                                                 Integer
-		                                                                         .parseInt(getWidgetText(R.id.proxy_port)));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (isChanged(R.id.proxy_login,
-		                                                     R.string.PreferenceProxyUser)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferenceProxyUser),
-		                                                         getWidgetText(R.id.proxy_login));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (isChanged(R.id.proxy_pwd,
-		                                                     R.string.PreferenceProxyPassword)) {
-		                                                 editor.putString(
-		                                                         getString(R.string.PreferenceProxyPassword),
-		                                                         getWidgetText(R.id.proxy_pwd));
-		                                                 mIsChanged = true;
-		                                             }
-		                                             if (mIsChanged == true) {
-		                                                 editor.commit();
-		                                                 setResult(RESULT_OK);
-		                                             } else
-		                                                 setResult(RESULT_CANCELED);
-		                                             finish();
-	                                                 }
-	                                             };
-
-    private String getPreferenceString(int id) {
-	return mSettings.getString(getString(id), "");
-    }
-
-    private String getWidgetText(int id) {
-	EditText widget = (EditText) this.findViewById(id);
-	return widget.getText().toString();
-    }
-
-    private boolean isChanged(int idEdit, int idPreference) {
-	return (!getWidgetText(idEdit).equals(getPreferenceString(idPreference)));
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-	super.onCreate(savedInstanceState);
-	setContentView(R.layout.contactlistsettings);
-
-	String TypeNone = getString(R.string.PreferenceProxyTypeNone);
-	String TypeHTTP = getString(R.string.PreferenceProxyTypeHttp);
-	String TypeSocks4 = getString(R.string.PreferenceProxyTypeSocks4);
-	String TypeSocks5 = getString(R.string.PreferenceProxyTypeSocks5);
-
-	mProxyTypeString = new String[] { TypeNone, TypeHTTP, TypeSocks4, TypeSocks5 };
-	mSettings = getSharedPreferences(getString(R.string.settings_filename), MODE_PRIVATE);
-
-	Spinner sp = (Spinner) findViewById(R.id.proxy_type);
-	ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,
-	        mProxyTypeString);
-	adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
-	sp.setAdapter(adapter);
-	for (int i = 0; i < mProxyTypeString.length; ++i)
-	    if (mProxyTypeString[i].equals(getPreferenceString(R.string.PreferenceProxyType)))
-		sp.setSelection(i);
-	sp.setOnItemSelectedListener(mProxyType);
-
-	Button ok = (Button) findViewById(R.id.ok);
-	ok.setOnClickListener(mOkListener);
-
-	showSettings();
-    }
-
-    private void showSettings() {
-	EditText e = (EditText) findViewById(R.id.host);
-	e.setText(getPreferenceString(R.string.PreferenceHostKey));
-	e = (EditText) findViewById(R.id.port);
-	e.setText(String.valueOf(mSettings.getInt(getString(R.string.PreferencePortKey), 5222)));
-	e = (EditText) findViewById(R.id.userid);
-	e.setText(getPreferenceString(R.string.PreferenceLoginKey));
-	e = (EditText) findViewById(R.id.password);
-	e.setText(getPreferenceString(R.string.PreferencePasswordKey));
-
-	e = (EditText) findViewById(R.id.proxy_host);
-	e.setText(getPreferenceString(R.string.PreferenceProxyHost));
-	e = (EditText) findViewById(R.id.proxy_port);
-	e.setText(String.valueOf(mSettings.getInt(getString(R.string.PreferenceProxyPort), 1080)));
-	e = (EditText) findViewById(R.id.proxy_login);
-	e.setText(getPreferenceString(R.string.PreferenceProxyUser));
-	e = (EditText) findViewById(R.id.proxy_pwd);
-	e.setText(getPreferenceString(R.string.PreferenceProxyPassword));
-    }
-
-}
--- a/src/com/beem/project/beem/ui/CreateAccount.java	Thu Jul 02 10:57:45 2009 +0200
+++ b/src/com/beem/project/beem/ui/CreateAccount.java	Thu Jul 02 21:52:16 2009 +0200
@@ -248,6 +248,7 @@
 			SharedPreferences.Editor settingsEditor = settings.edit();
 			settingsEditor.putString(getString(R.string.settings_key_account_username), usernameFieldValue);
 			settingsEditor.putString(getString(R.string.settings_key_account_password), passwordFieldValue);
+			settingsEditor.putBoolean(getString(R.string.PreferenceIsConfigured), true);
 			settingsEditor.commit();
 			finish();
 		    }