diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger')
3 files changed, 11 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index f5d730282..9c633e781 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -155,6 +155,7 @@ public class XmppConnectionService extends Service { private final List<String> mInProgressAvatarFetches = new ArrayList<>(); private WakeLock wakeLock; private long mLastActivity = 0; + public static VideoCompressor CompressVideo; public DatabaseBackend databaseBackend; private ContentObserver contactObserver = new ContentObserver(null) { @@ -547,7 +548,7 @@ public class XmppConnectionService extends Service { Log.d(Config.LOGTAG,conversation.getAccount().getJid().toBareJid()+ ": not compressing video. sending as file"); attachFileToConversation(conversation, uri, callback); } else { - VideoCompressor CompressVideo = new VideoCompressor(path, compressed_path, new Interface() { + CompressVideo = new VideoCompressor(path, compressed_path, new Interface() { @Override public void videocompressed(boolean result) { if (result) { @@ -592,7 +593,6 @@ public class XmppConnectionService extends Service { @Override protected void onPostExecute(Boolean compressed) { super.onPostExecute(compressed); - wakeLock.release(); File video = new File(compressedpath); if (mListener != null) { if (video.exists() && video.length() > 0) { @@ -603,6 +603,7 @@ public class XmppConnectionService extends Service { Log.d(Config.LOGTAG, "Compression failed!"); } } + wakeLock.release(); } } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index 82be2098c..472a5e9c2 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -1846,7 +1846,7 @@ public class ConversationActivity extends XmppActivity }); } - private void attachVideoToConversation(Conversation conversation, Uri uri) { + private void attachVideoToConversation(Conversation conversation, final Uri uri) { if (conversation == null) { return; } diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 1e011de8c..54bb66c21 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -126,7 +126,7 @@ public abstract class XmppActivity extends Activity { protected boolean mUsingEnterKey = false; protected Toast mToast; - protected ProgressDialog mProgress; + protected ProgressDialog mProgress = null; Integer oldOrientation = getRequestedOrientation(); protected void hideToast() { @@ -146,6 +146,9 @@ public abstract class XmppActivity extends Activity { } protected void showProgress() { + if (mProgress == null) { + mProgress = new ProgressDialog(XmppActivity.this); + } setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); mProgress.setMessage(getString(R.string.compressing_video)); mProgress.setCancelable(false); @@ -153,9 +156,11 @@ public abstract class XmppActivity extends Activity { } protected void closeProgress() { - if (mProgress.isShowing()) { + if (mProgress != null && mProgress.isShowing()) { mProgress.dismiss(); setRequestedOrientation(oldOrientation); + } else { + mProgress = null; } } @@ -441,7 +446,6 @@ public abstract class XmppActivity extends Activity { if (ab!=null) { ab.setDisplayHomeAsUpEnabled(true); } - mProgress = new ProgressDialog(this); } protected boolean isOptimizingBattery() { |