Skip to content

Commit

Permalink
Make the switch to gradle!
Browse files Browse the repository at this point in the history
1) ABS is now published as an AAR, so we can eliminate all local
   dependencies and bundled jars.

2) Upgrade to ABS 4.4.0 (The Last Release) and deal with the loss
   of Sherlock.Dialog by faking it with our own themes.

3) Remove all traces of ant. The modern world is here.
  • Loading branch information
moxie0 committed Oct 10, 2013
1 parent 91dd558 commit 1c8f866
Show file tree
Hide file tree
Showing 17 changed files with 160 additions and 56 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ lint.xml
local.properties local.properties
ant.properties ant.properties
.DS_Store .DS_Store
build.log
build-log.xml
.gradle
build
signing.properties
gradle
gradlew
gradlew.bat
23 changes: 12 additions & 11 deletions AndroidManifest.xml
Original file line number Original file line Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.thoughtcrime.securesms" xmlns:tools="http://schemas.android.com/tools"
package="org.thoughtcrime.securesms"
android:versionCode="56" android:versionCode="56"
android:versionName="1.0"> android:versionName="1.0">


<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>


<permission android:name="org.thoughtcrime.securesms.ACCESS_SECRETS" <permission android:name="org.thoughtcrime.securesms.ACCESS_SECRETS"
android:label="Access to TextSecure Secrets" android:label="Access to TextSecure Secrets"
Expand All @@ -13,7 +14,8 @@
<uses-permission android:name="org.thoughtcrime.securesms.ACCESS_SECRETS"/> <uses-permission android:name="org.thoughtcrime.securesms.ACCESS_SECRETS"/>
<uses-permission android:name="android.permission.READ_PROFILE"/> <uses-permission android:name="android.permission.READ_PROFILE"/>
<uses-permission android:name="android.permission.WRITE_PROFILE"/> <uses-permission android:name="android.permission.WRITE_PROFILE"/>
<uses-permission android:name="android.permission.BROADCAST_WAP_PUSH"/> <uses-permission android:name="android.permission.BROADCAST_WAP_PUSH"
tools:ignore="ProtectedPermissions"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/> <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Expand Down Expand Up @@ -117,7 +119,7 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>


<activity android:name=".AutoInitiateActivity" <activity android:name=".AutoInitiateActivity"
android:theme="@style/Theme.Sherlock.Light.Dialog" android:theme="@style/TextSecure.Light.Dialog"
android:label="@string/AndroidManifest__textsecure_detected" android:label="@string/AndroidManifest__textsecure_detected"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>


Expand Down Expand Up @@ -145,8 +147,7 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>


<activity android:name=".ReceiveKeyActivity" <activity android:name=".ReceiveKeyActivity"
android:theme="@style/Theme.Sherlock.Light.Dialog" android:label="@string/AndroidManifest__complete_key_exchange"
android:label="@string/AndroidManifest__complete_key_exchange"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>


<activity android:name=".ApplicationPreferencesActivity" <activity android:name=".ApplicationPreferencesActivity"
Expand Down Expand Up @@ -185,10 +186,10 @@
android:enabled="true" android:enabled="true"
android:exported="true"> android:exported="true">
<intent-filter android:priority="1001"> <intent-filter android:priority="1001">
<action android:name="android.provider.Telephony.SMS_RECEIVED"></action> <action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="org.thoughtcrime.securesms.services.MESSAGE_SENT"></action> <action android:name="org.thoughtcrime.securesms.services.MESSAGE_SENT"/>
</intent-filter> </intent-filter>
</receiver> </receiver>


Expand All @@ -197,7 +198,7 @@
android:exported="true" android:exported="true"
android:permission="android.permission.BROADCAST_WAP_PUSH"> android:permission="android.permission.BROADCAST_WAP_PUSH">
<intent-filter android:priority="1001"> <intent-filter android:priority="1001">
<action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED"></action> <action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED"/>
<data android:mimeType="application/vnd.wap.mms-message" /> <data android:mimeType="application/vnd.wap.mms-message" />
</intent-filter> </intent-filter>
</receiver> </receiver>
Expand All @@ -206,15 +207,15 @@
android:enabled="true" android:enabled="true"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"></action> <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
</intent-filter> </intent-filter>
</receiver> </receiver>


<receiver android:name=".notifications.MarkReadReceiver" <receiver android:name=".notifications.MarkReadReceiver"
android:enabled="true" android:enabled="true"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="org.thoughtcrime.securesms.notifications.CLEAR"></action> <action android:name="org.thoughtcrime.securesms.notifications.CLEAR"/>
</intent-filter> </intent-filter>
</receiver> </receiver>


Expand Down
22 changes: 4 additions & 18 deletions BUILDING.md
Original file line number Original file line Diff line number Diff line change
@@ -1,23 +1,9 @@
Building TextSecure Building TextSecure
=================== ===================


Fetch ActionBarSherlock: 1. Ensure the 'Android Support Repository' is installed from the Android SDK manager.
1. Ensure gradle >= 1.8 is installed.


git clone git://github.com/JakeWharton/ActionBarSherlock.git ../ActionBarSherlock Execute Gradle:
pushd ../ActionBarSherlock && git checkout 4.2.0 && popd


Configure ActionBarSherlock for your android target: gradle build

android update project --path ../ActionBarSherlock/library --target 1

Configure TextSecure for your android target, linking to ASB:

android update project --path . --target 1 --library ../ActionBarSherlock/library

Finally, both codebases must share the android-support jar. As TextSecure's is newer, use it:

cp libs/android-support-v4.jar ../ActionBarSherlock/library/libs/android-support-v4.jar

Assuming your android toolchain is correctly configured, it should now be possible to build the TextSecure apk.

ant debug
86 changes: 86 additions & 0 deletions build.gradle
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,86 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}

apply plugin: 'android'

repositories {
mavenCentral()
maven {
url "https://raw.github.com/whispersystems/maven/master/gcm-client/releases/"
}
maven {
url "https://raw.github.com/whispersystems/maven/master/gson/releases/"
}
}

dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile 'com.googlecode.libphonenumber:libphonenumber:5.3'
compile 'com.android.support:support-v4:18.0.0'
compile 'org.whispersystems:gson:2.1'
compile 'com.google.android.gcm:gcm-client:1.0.2'
}

android {
compileSdkVersion 17
buildToolsVersion '17.0.0'

defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}

android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aild.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}

signingConfigs {
release
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}

def Properties props = new Properties()
def propFile = new File('signing.properties')

if (propFile.canRead()){
props.load(new FileInputStream(propFile))

if (props !=null &&
props.containsKey('STORE_FILE') &&
props.containsKey('STORE_PASSWORD') &&
props.containsKey('KEY_ALIAS') &&
props.containsKey('KEY_PASSWORD'))
{
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
} else {
println 'signing.properties found but some entries are missing'
android.buildTypes.release.signingConfig = null
}
}else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}
25 changes: 0 additions & 25 deletions build.xml

This file was deleted.

Binary file removed libs/android-support-v4.jar
Binary file not shown.
Binary file removed libs/gcm.jar
Binary file not shown.
Binary file removed libs/libphonenumber-5.3.jar
Binary file not shown.
Binary file removed libs/thoughtcrimegson-2.1.jar
Binary file not shown.
Binary file added res/drawable-hdpi/dialog_full_holo_light.9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/dialog_full_holo_light.9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/dialog_full_holo_light.9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions res/values-v11/themes.xml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="TextSecure.Light.Dialog" parent="@android:style/Theme.Holo.Light.Dialog"/>

</resources>
2 changes: 2 additions & 0 deletions res/values/colors.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
<color name="conversation_list_item_background_read_dark">#ff000000</color> <color name="conversation_list_item_background_read_dark">#ff000000</color>
<color name="conversation_list_item_background_unread_dark">#ff333333</color> <color name="conversation_list_item_background_unread_dark">#ff333333</color>


<color name="textsecure_holo_blue_light">#ff33b5e5</color>

</resources> </resources>
17 changes: 16 additions & 1 deletion res/values/styles.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -69,5 +69,20 @@
<item name="android:shadowRadius">0.0</item> <item name="android:shadowRadius">0.0</item>
<item name="android:lineSpacingMultiplier">1.25</item> <item name="android:lineSpacingMultiplier">1.25</item>
</style> </style>


<!-- For Holo Light Dialog Activity Styling Emulation -->
<style name="TextSecureDialogWindowTitle">
<item name="android:textSize">22sp</item>
<item name="android:textColor">@color/textsecure_holo_blue_light</item>
</style>

<style name="TextSecureDialogButtonBar">
<item name="android:background">@null</item>
<item name="android:dividerPadding">0dp</item>
</style>

<style name="TextSecureBorderlessButtonSmall">
<item name="android:textSize">14sp</item>
</style>

</resources> </resources>
25 changes: 25 additions & 0 deletions res/values/themes.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -61,4 +61,29 @@
<item name="navigation_drawer_shadow">@drawable/drawer_shadow_dark</item> <item name="navigation_drawer_shadow">@drawable/drawer_shadow_dark</item>
</style> </style>


<style name="TextSecure.Light.Dialog" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowTitleStyle">@style/TextSecureDialogWindowTitle</item>
<item name="android:windowBackground">@drawable/dialog_full_holo_light</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowActionModeOverlay">true</item>

<item name="android:colorBackgroundCacheHint">@null</item>

<item name="android:buttonBarStyle">@style/TextSecureDialogButtonBar</item>
<item name="android:borderlessButtonStyle">@style/TextSecureBorderlessButtonSmall</item>
<item name="android:textColor">@color/black</item>
<item name="android:textSize">16sp</item>
<item name="android:textStyle">normal</item>

<item name="android:listPreferredItemPaddingLeft">16dip</item>
<item name="android:listPreferredItemPaddingRight">16dip</item>
<item name="android:listPreferredItemPaddingStart">16dip</item>
<item name="android:listPreferredItemPaddingEnd">16dip</item>
</style>


</resources> </resources>
3 changes: 2 additions & 1 deletion src/org/thoughtcrime/securesms/AutoInitiateActivity.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/ */
package org.thoughtcrime.securesms; package org.thoughtcrime.securesms;


import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
Expand All @@ -40,7 +41,7 @@
* @author Moxie Marlinspike * @author Moxie Marlinspike
* *
*/ */
public class AutoInitiateActivity extends PassphraseRequiredSherlockActivity { public class AutoInitiateActivity extends Activity {


private long threadId; private long threadId;
private Recipient recipient; private Recipient recipient;
Expand Down

0 comments on commit 1c8f866

Please sign in to comment.