aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/http/HttpConnectionManager.java2
-rw-r--r--src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java8
-rw-r--r--src/main/java/de/pixart/messenger/http/HttpUploadConnection.java2
-rw-r--r--src/main/java/de/pixart/messenger/services/ExportLogsService.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/UpdaterActivity.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java7
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java2
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/jingle/JingleSocks5Transport.java4
8 files changed, 17 insertions, 12 deletions
diff --git a/src/main/java/de/pixart/messenger/http/HttpConnectionManager.java b/src/main/java/de/pixart/messenger/http/HttpConnectionManager.java
index 340bc6d7a..383fe72a5 100644
--- a/src/main/java/de/pixart/messenger/http/HttpConnectionManager.java
+++ b/src/main/java/de/pixart/messenger/http/HttpConnectionManager.java
@@ -72,7 +72,7 @@ public class HttpConnectionManager extends AbstractConnectionManager {
}
}
- public Proxy getProxy() throws IOException {
+ public static Proxy getProxy() throws IOException {
return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(InetAddress.getByAddress(new byte[]{127, 0, 0, 1}), 8118));
}
}
diff --git a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
index fd2c054c3..2120ab309 100644
--- a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
+++ b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
@@ -226,12 +226,12 @@ public class HttpDownloadConnection implements Transferable {
private long retrieveFileSize() throws IOException {
PowerManager.WakeLock wakeLock = mHttpConnectionManager.createWakeLock("http_download_filesize" + message.getUuid());
try {
- WakeLockHelper.acquire(wakeLock);
+ wakeLock.acquire();
Log.d(Config.LOGTAG, "retrieve file size. interactive:" + String.valueOf(interactive));
changeStatus(STATUS_CHECKING);
HttpURLConnection connection;
if (mUseTor) {
- connection = (HttpURLConnection) mUrl.openConnection(mHttpConnectionManager.getProxy());
+ connection = (HttpURLConnection) mUrl.openConnection(HttpConnectionManager.getProxy());
} else {
connection = (HttpURLConnection) mUrl.openConnection();
}
@@ -299,9 +299,9 @@ public class HttpDownloadConnection implements Transferable {
HttpURLConnection connection = null;
PowerManager.WakeLock wakeLock = mHttpConnectionManager.createWakeLock("http_download_" + message.getUuid());
try {
- WakeLockHelper.acquire(wakeLock);
+ wakeLock.acquire();
if (mUseTor) {
- connection = (HttpURLConnection) mUrl.openConnection(mHttpConnectionManager.getProxy());
+ connection = (HttpURLConnection) mUrl.openConnection(HttpConnectionManager.getProxy());
} else {
connection = (HttpURLConnection) mUrl.openConnection();
}
diff --git a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java
index fb2d1d49e..e598db080 100644
--- a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java
+++ b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java
@@ -188,7 +188,7 @@ public class HttpUploadConnection implements Transferable {
wakeLock.acquire(readTimeout);
Log.d(Config.LOGTAG, "uploading to " + mPutUrl.toString() + " w/ read timeout of " + readTimeout + "s");
if (mUseTor) {
- connection = (HttpURLConnection) mPutUrl.openConnection(mHttpConnectionManager.getProxy());
+ connection = (HttpURLConnection) mPutUrl.openConnection(HttpConnectionManager.getProxy());
} else {
connection = (HttpURLConnection) mPutUrl.openConnection();
}
diff --git a/src/main/java/de/pixart/messenger/services/ExportLogsService.java b/src/main/java/de/pixart/messenger/services/ExportLogsService.java
index 17cb11562..33725e211 100644
--- a/src/main/java/de/pixart/messenger/services/ExportLogsService.java
+++ b/src/main/java/de/pixart/messenger/services/ExportLogsService.java
@@ -83,7 +83,7 @@ public class ExportLogsService extends Service {
}
private void export() {
- WakeLockHelper.acquire(wakeLock);
+ wakeLock.acquire();
List<Conversation> conversations = mDatabaseBackend.getConversations(Conversation.STATUS_AVAILABLE);
conversations.addAll(mDatabaseBackend.getConversations(Conversation.STATUS_ARCHIVED));
NotificationManager mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
diff --git a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
index 0915d3399..f98872b7c 100644
--- a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
@@ -209,7 +209,7 @@ public class UpdaterActivity extends XmppActivity {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
if (pm != null) {
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, getClass().getName());
- WakeLockHelper.acquire(mWakeLock);
+ mWakeLock.acquire();
}
mProgressDialog.show();
}
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
index f49331c5b..ef531f5fe 100644
--- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
@@ -35,6 +35,7 @@ import android.os.PowerManager;
import android.os.SystemClock;
import android.preference.PreferenceManager;
import android.provider.Settings;
+import android.support.annotation.BoolRes;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatDelegate;
@@ -401,7 +402,7 @@ public abstract class XmppActivity extends ActionBarActivity {
}
mColorWhite = ContextCompat.getColor(this, R.color.white70);
this.mUsingEnterKey = usingEnterKey();
- mUseSubject = getPreferences().getBoolean("use_subject", getResources().getBoolean(R.bool.use_subject));
+ mUseSubject = getBooleanPreference("use_subject", R.bool.use_subject);
}
protected boolean isCameraFeatureAvailable() {
@@ -449,6 +450,10 @@ public abstract class XmppActivity extends ActionBarActivity {
return PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
}
+ protected boolean getBooleanPreference(String name, @BoolRes int res) {
+ return getPreferences().getBoolean(name, getResources().getBoolean(res));
+ }
+
public boolean useSubjectToIdentifyConference() {
return mUseSubject;
}
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index 1ea8174fe..5c9d1108a 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -299,7 +299,7 @@ public class XmppConnection implements Runnable {
try {
startXmpp(localSocket);
} catch (InterruptedException e) {
- Log.d(Config.LOGTAG,account.getJid().asBareJid()+": thread was interrupted before beginning stream");
+ Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": thread was interrupted before beginning stream");
return;
} catch (Exception e) {
throw new IOException(e.getMessage());
diff --git a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleSocks5Transport.java b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleSocks5Transport.java
index 42beee9d6..374e02750 100644
--- a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleSocks5Transport.java
+++ b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleSocks5Transport.java
@@ -85,7 +85,7 @@ public class JingleSocks5Transport extends JingleTransport {
InputStream fileInputStream = null;
final PowerManager.WakeLock wakeLock = connection.getConnectionManager().createWakeLock("jingle_send_" + connection.getSessionId());
try {
- WakeLockHelper.acquire(wakeLock);
+ wakeLock.acquire();
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.reset();
fileInputStream = connection.getFileInputStream();
@@ -125,7 +125,7 @@ public class JingleSocks5Transport extends JingleTransport {
OutputStream fileOutputStream = null;
final PowerManager.WakeLock wakeLock = connection.getConnectionManager().createWakeLock("jingle_receive_" + connection.getSessionId());
try {
- WakeLockHelper.acquire(wakeLock);
+ wakeLock.acquire();
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.reset();
//inputStream.skip(45);