Move from arbitrary resource filters to fix ones

Resource filters are used when generating additional APK containing only
specific resources.
The previous UI allowed for any type of filters, but we are moving to a
simpler way with fixed filters.
The first one is the density. Selecting the filter will generate 4 APKs per
application: default (all resources), hdpi (only hdpi/nodpi and default
resources), mdpi, ldpi.
This commit is contained in:
Xavier Ducrohet
2009-08-24 11:07:51 -07:00
parent 68a7a11d24
commit 338bc1cc45
11 changed files with 246 additions and 633 deletions

View File

@@ -20,6 +20,7 @@ import com.android.apkbuilder.ApkBuilder.ApkCreationException;
import com.android.apkbuilder.internal.ApkBuilderImpl;
import com.android.apkbuilder.internal.ApkBuilderImpl.ApkFile;
import com.android.sdklib.internal.project.ApkConfigurationHelper;
import com.android.sdklib.internal.project.ApkSettings;
import com.android.sdklib.internal.project.ProjectProperties;
import com.android.sdklib.internal.project.ProjectProperties.PropertyType;
@@ -35,7 +36,6 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
public class ApkBuilderTask extends Task {
@@ -214,11 +214,13 @@ public class ApkBuilderTask extends Task {
ProjectProperties properties = ProjectProperties.load(baseDir.getAbsolutePath(),
PropertyType.DEFAULT);
Map<String, String> apkConfigs = ApkConfigurationHelper.getConfigs(properties);
if (apkConfigs.size() > 0) {
Set<Entry<String, String>> entrySet = apkConfigs.entrySet();
for (Entry<String, String> entry : entrySet) {
createApk(apkBuilder, entry.getKey(), entry.getValue(), path);
ApkSettings apkSettings = ApkConfigurationHelper.getSettings(properties);
if (apkSettings != null) {
Map<String, String> apkFilters = apkSettings.getResourceFilters();
if (apkFilters.size() > 0) {
for (Entry<String, String> entry : apkFilters.entrySet()) {
createApk(apkBuilder, entry.getKey(), entry.getValue(), path);
}
}
}