• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.sdklib.internal.project;
18 
19 
20 /**
21  * Helper class to read and write Apk Configuration into a {@link ProjectProperties} file.
22  */
23 public class ApkConfigurationHelper {
24     /**
25      * Reads the project settings from a {@link ProjectProperties} file and returns them as a
26      * {@link ApkSettings} object.
27      */
getSettings(ProjectProperties properties)28     public static ApkSettings getSettings(ProjectProperties properties) {
29         ApkSettings apkSettings = new ApkSettings();
30 
31         boolean splitByDensity = Boolean.parseBoolean(properties.getProperty(
32                 ProjectProperties.PROPERTY_SPLIT_BY_DENSITY));
33         apkSettings.setSplitByDensity(splitByDensity);
34 
35 
36         return apkSettings;
37     }
38 
39     /**
40      * Sets the content of a {@link ApkSettings} into a {@link ProjectProperties}.
41      * @param properties the {@link ProjectProperties} in which to store the settings.
42      * @param settings the project settings to store.
43      */
setProperties(ProjectProperties properties, ApkSettings settings)44     public static void setProperties(ProjectProperties properties, ApkSettings settings) {
45         properties.setProperty(ProjectProperties.PROPERTY_SPLIT_BY_DENSITY,
46                 Boolean.toString(settings.isSplitByDpi()));
47     }
48 }
49