diff options
author | Xavier Ducrohet <xav@android.com> | 2012-09-13 17:23:17 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2012-09-18 18:58:44 -0700 |
commit | aea408b68a6f833327b6e0954a28f414f58133ac (patch) | |
tree | 2c35517f590aa02872165dc80b6b080b355fb25a /testapps/libsTest/lib2/src | |
parent | ba21bdb94f3b988443c0b16b44df97969eaab60c (diff) | |
download | sdk-aea408b68a6f833327b6e0954a28f414f58133ac.zip sdk-aea408b68a6f833327b6e0954a28f414f58133ac.tar.gz sdk-aea408b68a6f833327b6e0954a28f414f58133ac.tar.bz2 |
Generate smaller R classes for libraries.
Using the new --output-text-symbols from aapt the build
system now generates the R class for libraries manually
based on the symbols exported by the libraries and the
final values computed by aapt when using all the resource
folders.
Because only R.java is concerned, the Manifest class is
now included in the library jar file.
Also added a new test apps that uses instrumentation to
verify the build system.
Change-Id: Ic436ea8eb070844e9db8b3b2620fbf665839d40b
Diffstat (limited to 'testapps/libsTest/lib2/src')
3 files changed, 59 insertions, 0 deletions
diff --git a/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/Lib2.java b/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/Lib2.java new file mode 100644 index 0000000..bb8e4db --- /dev/null +++ b/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/Lib2.java @@ -0,0 +1,43 @@ +package com.android.tests.libstest.lib2; + +import android.app.Activity; +import android.widget.TextView; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +public class Lib2 { + + public static void handleTextView(Activity a) { + TextView tv = (TextView) a.findViewById(R.id.lib2_text2); + if (tv != null) { + tv.setText(getContent()); + } + } + + private static String getContent() { + InputStream input = Lib2.class.getResourceAsStream("Lib2.txt"); + if (input == null) { + return "FAILED TO FIND Lib2.txt"; + } + + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(input, "UTF-8")); + + return reader.readLine(); + } catch (IOException e) { + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + } + } + } + + return "FAILED TO READ CONTENT"; + } +} diff --git a/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/Lib2.txt b/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/Lib2.txt new file mode 100644 index 0000000..94cabe4 --- /dev/null +++ b/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/Lib2.txt @@ -0,0 +1 @@ +SUCCESS-LIB2
\ No newline at end of file diff --git a/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/MainActivity.java b/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/MainActivity.java new file mode 100644 index 0000000..012f203 --- /dev/null +++ b/testapps/libsTest/lib2/src/com/android/tests/libstest/lib2/MainActivity.java @@ -0,0 +1,15 @@ +package com.android.tests.libstest.lib2; + +import android.app.Activity; +import android.os.Bundle; + +public class MainActivity extends Activity { + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.lib2_main); + + Lib2.handleTextView(this); + } +} |