[Gradle] Allow dialer to be compiled as a library

This CL adds a new build-library.gradle file for AOSP dialer.
This allows the dialer to be built as a library that can be
included from GoogleDialer.

Switching to a library project meant making two other changes:
  - changed all switch statements that used resources to if statements.
    This was required because resource IDs are not final in library
    projects.
  - changed InCalUI code to import com.android.dialer.R instead of
    com.android.incallui.R. See http://b.android.com/82743 for more info
    on why this is required.

src-N isn't supported yet. Also, this isn't the ideal project layout.
In the future we should consider switching to the following layout:
  - dialer/incallui/ <- incall UI as an independent library project
  - dialer/dialerlib/ <- dialer code as an independent library project
  - dialer/app <- skelent app that builds a standalone dialer AOSP app

Bug: 26676586
Change-Id: I07fbee4d33cc683539e4f8b3953c93f1427af9d7
diff --git a/build-library.gradle b/build-library.gradle
new file mode 100644
index 0000000..f96ff2b
--- /dev/null
+++ b/build-library.gradle
@@ -0,0 +1,34 @@
+apply plugin: 'com.android.library'
+
+android {
+    defaultConfig {
+        minSdkVersion 23
+        targetSdkVersion 23
+        multiDexEnabled true
+    }
+
+    sourceSets.main {
+        java.srcDirs = ['src', 'src-pre-N', 'InCallUI/src']
+        manifest.srcFile 'AndroidManifest.xml'
+        res.srcDirs = ['res']
+    }
+}
+
+dependencies {
+    compile 'com.android.support:support-v4:23.1.+'
+    compile 'com.android.support:support-v13:23.1.+'
+    compile 'com.android.support:appcompat-v7:23.1.+'
+    compile 'com.android.support:cardview-v7:23.1.+'
+    compile 'com.android.support:design:23.1.+'
+    compile 'com.android.support:recyclerview-v7:23.1.+'
+
+    compile project(':android-common')
+    compile project(':guava')
+    compile project(':libphonenumber')
+    compile project(':jsr305')
+    compile project(':vcard')
+
+    compile project(':ContactsCommon')
+    compile project(':InCallUI')
+    compile project(':PhoneCommon')
+}