Skip to content

Commit

Permalink
Several performance improvements in Jumble, migrated to Android Studi…
Browse files Browse the repository at this point in the history
…o 1.0.2

and to Android ndk r10d. Also made some changes in server entry and lost
connection popups. Minimized a lot the Force Close that was happening after
trying to enter the app when it was in the background with no internet
connection and trying to enter again from the notifications panel.
  • Loading branch information
Theofilos-Chamalis committed Dec 30, 2014
1 parent 679675a commit bdc829d
Show file tree
Hide file tree
Showing 40 changed files with 57 additions and 80 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "libraries/Jumble"]
path = libraries/Jumble
url = https://www.github.com//Jumble.git
url = https://www.github.com/Morlunk/Jumble.git
[submodule "libraries/NetCipher"]
path = libraries/NetCipher
url = https://github.com//OnionKit.git
url = https://github.com/Morlunk/OnionKit.git
17 changes: 6 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
Expand All @@ -49,24 +49,19 @@ dependencies {


// Keep my credentials private :^)
signingFile = file 'signing.gradle';
if(signingFile.exists()) apply from: 'signing.gradle'
def signingFile = file 'signing.gradle';
if (signingFile.exists()) apply from: 'signing.gradle'

android {
compileSdkVersion 21
buildToolsVersion "21"

// Fixes crash with support lib and gradle 0.9.1, see:
// https://stackoverflow.com/questions/22509850/actionbaractivity-closes-after-pressing-hardware-menu-button-without-stack-trac
aaptOptions.useAaptPngCruncher = true
buildToolsVersion "21.1.1"

defaultConfig {
minSdkVersion 9
targetSdkVersion 21
applicationId "com.terracom.mumbleclient"
versionCode 72
versionName "1.0.0"
testPackageName "com.terracom.mumbleclient.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
buildConfigField "boolean", "DONATE_NAG", "false"
}
Expand All @@ -84,8 +79,8 @@ android {

jenkins {
// Abuse Jenkins environment variables. Neat.
env = System.getenv()
if(env.containsKey("BUILD_NUMBER") && env.containsKey("BUILD_DISPLAY_NAME")) {
def env = System.getenv()
if (env.containsKey("BUILD_NUMBER") && env.containsKey("BUILD_DISPLAY_NAME")) {
versionCode Integer.parseInt(env.get("BUILD_NUMBER"))
versionName env.get("BUILD_DISPLAY_NAME")
} else {
Expand Down
Empty file modified app/src/free/ic_launcher-web.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/free/res/drawable-hdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/free/res/drawable-mdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/free/res/drawable-xhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/free/res/drawable-xxhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/free/res/drawable-xxxhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 5 additions & 34 deletions app/src/main/java/com/terracom/mumbleclient/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.Gravity;

import com.terracom.jumble.Constants;
Expand Down Expand Up @@ -94,7 +93,7 @@ public class Settings {
public static final String PREF_CERT_PASSWORD = "certificatePassword";

public static final String PREF_DEFAULT_USERNAME = "defaultUsername";
public static final String DEFAULT_DEFAULT_USERNAME = "GuardID_GuardPIN"; // funny var name -> QRPushToTalk_User default
public static final String DEFAULT_DEFAULT_USERNAME = "GuardID_GuardPIN"; // funny var name

public static final String PREF_FORCE_TCP = "forceTcp";
public static final Boolean DEFAULT_FORCE_TCP = false;
Expand Down Expand Up @@ -170,41 +169,14 @@ public String getInputMethod() {
public int getJumbleInputMethod() {
String inputMethod = getInputMethod();
if (ARRAY_INPUT_METHOD_VOICE.equals(inputMethod)) {
//Log.d("---------------MhnymaaaaaaaVOICE-----------------", inputMethod);
return Constants.TRANSMIT_VOICE_ACTIVITY;
//return Constants.TRANSMIT_PUSH_TO_TALK;
} else if (ARRAY_INPUT_METHOD_PTT.equals(inputMethod)) {
//Log.d("---------------MhnymaaaaaaaPTT-----------------",inputMethod);
return Constants.TRANSMIT_PUSH_TO_TALK;
} else if (ARRAY_INPUT_METHOD_CONTINUOUS.equals(inputMethod)) {
//Log.d("---------------MhnymaaaaaaaCONTINUOUS-----------------",inputMethod);
return Constants.TRANSMIT_CONTINUOUS;
//return Constants.TRANSMIT_PUSH_TO_TALK;
}
throw new RuntimeException("Could not convert input method '" + inputMethod + "' to a Jumble input method id!");
}
/*public int getJumbleInputMethod() {
String inputMethod = getInputMethod();
if (ARRAY_INPUT_METHOD_VOICE.equals(inputMethod)) {
return Constants.TRANSMIT_PUSH_TO_TALK;
} else if (ARRAY_INPUT_METHOD_PTT.equals(inputMethod)) {
return Constants.TRANSMIT_PUSH_TO_TALK;
} else if (ARRAY_INPUT_METHOD_CONTINUOUS.equals(inputMethod)) {
return Constants.TRANSMIT_PUSH_TO_TALK;
}
throw new RuntimeException("Could not convert input method '" + inputMethod + "' to a Jumble input method id!");
}*/


/*public void setInputMethod(String inputMethod) {
if(ARRAY_INPUT_METHOD_VOICE.equals(inputMethod) ||
ARRAY_INPUT_METHOD_PTT.equals(inputMethod) ||
ARRAY_INPUT_METHOD_CONTINUOUS.equals(inputMethod)) {
preferences.edit().putString(PREF_INPUT_METHOD, inputMethod).apply();
} else {
throw new RuntimeException("Invalid input method " + inputMethod);
}
}*/

public void setInputMethod(String inputMethod) {
if(ARRAY_INPUT_METHOD_VOICE.equals(inputMethod) ||
Expand Down Expand Up @@ -269,9 +241,7 @@ public int getHotCornerGravity() {
/**
* @return the resource ID of the user-defined theme.
*/

/*
public int getTheme() {
/*public int getTheme() {
String theme = preferences.getString(PREF_THEME, ARRAY_THEME_LIGHT);
if(ARRAY_THEME_LIGHT.equals(theme))
return R.style.Theme_QRPushToTalk;
Expand All @@ -282,13 +252,14 @@ else if(ARRAY_THEME_SOLARIZED_LIGHT.equals(theme))
else if(ARRAY_THEME_SOLARIZED_DARK.equals(theme))
return R.style.Theme_QRPushToTalk_Solarized_Dark;
return -1;
}
*/
}*/

public int getTheme() {

return R.style.Theme_QRPushToTalk_Solarized_Light;

}

/**
* Attempts to read the certificate from the path specified in settings.
* @return The parsed bytes of the certificate, or null otherwise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,20 @@ public void onDrawerClosed(View drawerView) {
public void onDrawerOpened(View drawerView) {
supportInvalidateOptionsMenu();
}

@Override
public void onDrawerStateChanged(int newState) {
if (newState == DrawerLayout.STATE_DRAGGING) {
try {
// Workaround PTT staying on when the drawer is opened.
if (getService().isConnected() && getService().isTalking()) {
getService().setTalkingState(false);
}
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,15 @@ public void clear() {
public void updateChatTargetText(ChatTargetProvider.ChatTarget target) throws RemoteException {
if(getService() == null) return;

if(target == null) mChatTextEdit.setHint(getString(R.string.messageToChannel, getService().getSessionChannel().getName()));
else if(target.getUser() != null) mChatTextEdit.setHint(getString(R.string.messageToUser, target.getUser().getName()));
else if(target.getChannel() != null) mChatTextEdit.setHint(getString(R.string.messageToChannel, target.getChannel().getName()));
String hint = null;
if(target == null && getService().getSessionChannel() != null) {
hint = getString(R.string.messageToChannel, getService().getSessionChannel().getName());
} else if(target != null && target.getUser() != null) {
hint = getString(R.string.messageToUser, target.getUser().getName());
} else if(target != null && target.getChannel() != null) {
hint = getString(R.string.messageToChannel, target.getChannel().getName());
}
mChatTextEdit.setHint(hint);
mChatTextEdit.requestLayout(); // Needed to update bounds after hint change.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void onActivityCreated(Bundle savedInstanceState) {
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
//inflater.inflate(R.menu.channel_menu, menu);
// inflater.inflate(R.menu.channel_menu, menu);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
} catch (RemoteException e) {
e.printStackTrace();
}
return true; */
return true;*/
}

return super.onOptionsItemSelected(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public void onClick(DialogInterface dialog, int which) {
} catch (RemoteException e) {
e.printStackTrace();
}
break; */
break;*/
}
actionMode.finish();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
private static void updateAudioDependents(PreferenceScreen screen, String inputMethod) {
PreferenceCategory pttCategory = (PreferenceCategory) screen.findPreference("ptt_settings");
PreferenceCategory vadCategory = (PreferenceCategory) screen.findPreference("vad_settings");
//pttCategory.setEnabled(Settings.ARRAY_INPUT_METHOD_PTT.equals(inputMethod));
// pttCategory.setEnabled(Settings.ARRAY_INPUT_METHOD_PTT.equals(inputMethod));
pttCategory.setEnabled(true);
//vadCategory.setEnabled(Settings.ARRAY_INPUT_METHOD_VOICE.equals(inputMethod));
// vadCategory.setEnabled(Settings.ARRAY_INPUT_METHOD_VOICE.equals(inputMethod));
vadCategory.setEnabled(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ private Notification createNotification() {
// Add notification triggers
Intent muteIntent = new Intent(BROADCAST_MUTE);
Intent deafenIntent = new Intent(BROADCAST_DEAFEN);
//Intent overlayIntent = new Intent(BROADCAST_OVERLAY);
// Intent overlayIntent = new Intent(BROADCAST_OVERLAY);

builder.addAction(R.drawable.ic_action_microphone,
mService.getString(R.string.mute), PendingIntent.getBroadcast(mService, 1,
muteIntent, PendingIntent.FLAG_CANCEL_CURRENT));
builder.addAction(R.drawable.ic_action_audio,
mService.getString(R.string.deafen), PendingIntent.getBroadcast(mService, 1,
deafenIntent, PendingIntent.FLAG_CANCEL_CURRENT));
/*builder.addAction(R.drawable.ic_action_channels,
/* builder.addAction(R.drawable.ic_action_channels,
mService.getString(R.string.overlay), PendingIntent.getBroadcast(mService, 2,
overlayIntent, PendingIntent.FLAG_CANCEL_CURRENT));*/
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ public void onConnectionError(String message, boolean reconnecting) throws Remot

@Override
public void onUserConnected(User user) throws RemoteException {
// Immediately request avatar upon connection.
// FIXME: we need to refresh avatar when hash changes
getBinder().requestAvatar(user.getSession());
if (user.getTextureHash() != null &&
user.getTexture() == null) {
// Request avatar data if available.
getBinder().requestAvatar(user.getSession());
}
}

@Override
Expand All @@ -127,6 +129,12 @@ else if (user.isSelfMuted())
mNotification.setCustomContentText(contentText);
}
}

if (user.getTextureHash() != null &&
user.getTexture() == null) {
// Update avatar data if available.
getBinder().requestAvatar(user.getSession());
}
}

@Override
Expand Down
Empty file modified app/src/main/res/drawable-hdpi-v11/ic_stat_notify.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-hdpi-v9/ic_stat_notify.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-hdpi/ic_home.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-hdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-hdpi/ic_stat_notify.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-mdpi-v11/ic_stat_notify.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-mdpi-v9/ic_stat_notify.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-mdpi/ic_home.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-mdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-mdpi/ic_stat_notify.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-xhdpi-v11/ic_stat_notify.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-xhdpi-v9/ic_stat_notify.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-xhdpi/ic_home.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-xhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-xhdpi/ic_stat_notify.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-xxhdpi-v11/ic_stat_notify.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-xxhdpi-v9/ic_stat_notify.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-xxhdpi/ic_home.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-xxhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified app/src/main/res/drawable-xxhdpi/ic_stat_notify.png
100644 → 100755
Empty file modified app/src/main/res/drawable/ic_stat_notify.png
100644 → 100755
2 changes: 1 addition & 1 deletion app/src/main/res/layout/dialog_server_edit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
android:layout_height="wrap_content"
android:layout_weight="0.92"
android:inputType="textUri"
android:hint="141.237.72.148"/>
android:hint="http://www.plan.gr"/>

<EditText
android:id="@+id/server_edit_port"
Expand Down
21 changes: 2 additions & 19 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
#
# Copyright (C) 2014 Andrew Comminos
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

#Sat Jun 07 00:40:57 PDT 2014
#Mon Dec 08 12:27:40 PST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip

0 comments on commit bdc829d

Please sign in to comment.