Misc bug fixes DO NOT MERGE

(cherry pick from 67c3f1d864ad3338dfc1d194b35eaaaaa71a7aeb)

First, when computing the fully qualified package names of activities
to store the activity to theme mapping in the ManifestInfo, also allow
activities to not be prefixed by a dot and still prefix the package
path provided there are no dots in the activity name.

Second, escape string values specified in the Add Translation Dialog
when creating the corresponding resources.

Third, soon the ResourceRepository will no longer provide a protected
mWrapper field, so replicate it inside ProjectResources.

Change-Id: I7660aa6921e3b667e63a25c645ca21efc443b7ce
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
index 55cad2b..e43b04c 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/manifest/ManifestInfo.java
@@ -225,9 +225,9 @@
                 String theme = activity.getAttributeNS(NS_RESOURCES, ATTRIBUTE_THEME);
                 if (theme != null && theme.length() > 0) {
                     String name = activity.getAttributeNS(NS_RESOURCES, ATTRIBUTE_NAME);
-                    if (name.startsWith(".")  //$NON-NLS-1$
-                            && mPackage != null && mPackage.length() > 0) {
-                        name = mPackage + name;
+                    int index = name.indexOf('.');
+                    if (index <= 0 && mPackage != null && !mPackage.isEmpty()) {
+                      name =  mPackage + (index == -1 ? "." : "") + name;
                     }
                     mActivityThemes.put(name, theme);
                 }
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java
index 68c2257..7c3fd4c 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java
@@ -65,7 +65,7 @@
     private Map<IntArrayWrapper, String> mStyleableValueToNameMap;
 
     private final DynamicIdMap mDynamicIdMap = new DynamicIdMap(DYNAMIC_ID_SEED_START);
-
+    private final IntArrayWrapper mWrapper = new IntArrayWrapper(null);
     private final IProject mProject;
 
     public static ProjectResources create(IProject project) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/AddTranslationDialog.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/AddTranslationDialog.java
index ce7e936..f4f6361 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/AddTranslationDialog.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/AddTranslationDialog.java
@@ -21,6 +21,7 @@
 
 import com.android.ide.common.rendering.api.ResourceValue;
 import com.android.ide.common.resources.ResourceItem;
+import com.android.ide.common.resources.ValueResourceParser;
 import com.android.ide.common.resources.configuration.FolderConfiguration;
 import com.android.ide.eclipse.adt.AdtPlugin;
 import com.android.ide.eclipse.adt.AdtUtils;
@@ -384,7 +385,7 @@
             sb.append("    <string name=\"");  //$NON-NLS-1$
             sb.append(key);
             sb.append("\">");                  //$NON-NLS-1$
-            sb.append(value);
+            sb.append(ValueResourceParser.escapeResourceString(value));
             sb.append("</string>\n");          //$NON-NLS-1$
         }
         sb.append("\n</resources>");           //$NON-NLS-1$