Fixed video compression in Android L, bug fixes
This commit is contained in:
parent
bc76df2f99
commit
87cb843ea0
@ -24,8 +24,8 @@ dependencies {
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 19
|
||||
buildToolsVersion '20.0.0'
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion '21.0.0'
|
||||
|
||||
signingConfigs {
|
||||
debug {
|
||||
@ -80,7 +80,7 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 8
|
||||
targetSdkVersion 19
|
||||
versionCode 359
|
||||
versionCode 361
|
||||
versionName "1.9.5"
|
||||
}
|
||||
}
|
||||
|
@ -108,6 +108,9 @@ public class ImageReceiver {
|
||||
if (img == null) {
|
||||
isPlaceholder = true;
|
||||
ImageLoader.getInstance().loadImage(fileLocation, httpUrl, this, size, cacheOnly);
|
||||
if (parentView != null) {
|
||||
parentView.invalidate();
|
||||
}
|
||||
} else {
|
||||
setImageBitmap(img, currentPath);
|
||||
}
|
||||
|
@ -2081,12 +2081,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
|
||||
if (end < 0 || info.presentationTimeUs < end) {
|
||||
info.offset = 0;
|
||||
info.flags = extractor.getSampleFlags();
|
||||
if (!isAudio) {
|
||||
buffer.limit(info.offset + info.size);
|
||||
buffer.position(info.offset);
|
||||
buffer.putInt(info.size - 4);
|
||||
}
|
||||
if (mediaMuxer.writeSampleData(muxerTrackIndex, buffer, info)) {
|
||||
if (mediaMuxer.writeSampleData(muxerTrackIndex, buffer, info, isAudio)) {
|
||||
didWriteData(messageObject, file, false, false);
|
||||
}
|
||||
extractor.advance();
|
||||
@ -2168,6 +2163,23 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
|
||||
resultWidth = temp;
|
||||
rotationValue = 90;
|
||||
rotateRender = 270;
|
||||
} else if (Build.VERSION.SDK_INT > 20) {
|
||||
if (rotationValue == 90) {
|
||||
int temp = resultHeight;
|
||||
resultHeight = resultWidth;
|
||||
resultWidth = temp;
|
||||
rotationValue = 0;
|
||||
rotateRender = 270;
|
||||
} else if (rotationValue == 180) {
|
||||
rotateRender = 180;
|
||||
rotationValue = 0;
|
||||
} else if (rotationValue == 270) {
|
||||
int temp = resultHeight;
|
||||
resultHeight = resultWidth;
|
||||
resultWidth = temp;
|
||||
rotationValue = 0;
|
||||
rotateRender = 90;
|
||||
}
|
||||
}
|
||||
|
||||
File inputFile = new File(videoPath);
|
||||
@ -2374,10 +2386,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
|
||||
}
|
||||
if (info.size > 1) {
|
||||
if ((info.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) == 0) {
|
||||
encodedData.limit(info.offset + info.size);
|
||||
encodedData.position(info.offset);
|
||||
encodedData.putInt(Integer.reverseBytes(info.size - 4));
|
||||
if (mediaMuxer.writeSampleData(videoTrackIndex, encodedData, info)) {
|
||||
if (mediaMuxer.writeSampleData(videoTrackIndex, encodedData, info, false)) {
|
||||
didWriteData(messageObject, cacheFile, false, false);
|
||||
}
|
||||
} else if (videoTrackIndex == -5) {
|
||||
|
@ -54,12 +54,13 @@ public class MP4Builder {
|
||||
|
||||
private InterleaveChunkMdat mdat = null;
|
||||
private Mp4Movie currentMp4Movie = null;
|
||||
FileOutputStream fos = null;
|
||||
private FileOutputStream fos = null;
|
||||
private FileChannel fc = null;
|
||||
private long dataOffset = 0;
|
||||
private long writedSinceLastMdat = 0;
|
||||
private boolean writeNewMdat = true;
|
||||
HashMap<Track, long[]> track2SampleSizes = new HashMap<Track, long[]>();
|
||||
private HashMap<Track, long[]> track2SampleSizes = new HashMap<Track, long[]>();
|
||||
private ByteBuffer sizeBuffer = null;
|
||||
|
||||
public MP4Builder createMovie(Mp4Movie mp4Movie) throws Exception {
|
||||
currentMp4Movie = mp4Movie;
|
||||
@ -74,6 +75,8 @@ public class MP4Builder {
|
||||
|
||||
mdat = new InterleaveChunkMdat();
|
||||
|
||||
sizeBuffer = ByteBuffer.allocateDirect(4);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -87,7 +90,7 @@ public class MP4Builder {
|
||||
fos.flush();
|
||||
}
|
||||
|
||||
public boolean writeSampleData(int trackIndex, ByteBuffer byteBuf, MediaCodec.BufferInfo bufferInfo) throws Exception {
|
||||
public boolean writeSampleData(int trackIndex, ByteBuffer byteBuf, MediaCodec.BufferInfo bufferInfo, boolean isAudio) throws Exception {
|
||||
if (writeNewMdat) {
|
||||
mdat.setContentSize(0);
|
||||
mdat.getBox(fc);
|
||||
@ -109,9 +112,16 @@ public class MP4Builder {
|
||||
}
|
||||
|
||||
currentMp4Movie.addSample(trackIndex, dataOffset, bufferInfo);
|
||||
byteBuf.position(bufferInfo.offset);
|
||||
byteBuf.position(bufferInfo.offset + (isAudio ? 0 : 4));
|
||||
byteBuf.limit(bufferInfo.offset + bufferInfo.size);
|
||||
|
||||
if (!isAudio) {
|
||||
sizeBuffer.position(0);
|
||||
sizeBuffer.putInt(bufferInfo.size - 4);
|
||||
sizeBuffer.position(0);
|
||||
fc.write(sizeBuffer);
|
||||
}
|
||||
|
||||
fc.write(byteBuf);
|
||||
dataOffset += bufferInfo.size;
|
||||
|
||||
|
@ -370,6 +370,7 @@ public class TLClassStore {
|
||||
classStore.put(TLRPC.TL_userRequest_old.constructor, TLRPC.TL_userRequest_old.class);
|
||||
classStore.put(TLRPC.TL_userForeign_old.constructor, TLRPC.TL_userForeign_old.class);
|
||||
classStore.put(TLRPC.TL_userDeleted_old.constructor, TLRPC.TL_userDeleted_old.class);
|
||||
classStore.put(TLRPC.TL_messageEcryptedAction.constructor, TLRPC.TL_messageEcryptedAction.class);
|
||||
}
|
||||
|
||||
static TLClassStore store = null;
|
||||
|
@ -278,9 +278,11 @@ public class ChatActionCell extends BaseCell {
|
||||
imageReceiver.draw(canvas, imageReceiver.getImageX(), imageReceiver.getImageY(), imageReceiver.getImageWidth(), imageReceiver.getImageHeight());
|
||||
}
|
||||
|
||||
canvas.save();
|
||||
canvas.translate(textXLeft, textY);
|
||||
textLayout.draw(canvas);
|
||||
canvas.restore();
|
||||
if (textLayout != null) {
|
||||
canvas.save();
|
||||
canvas.translate(textXLeft, textY);
|
||||
textLayout.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -926,7 +926,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
@Override
|
||||
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
if (visibleItemCount > 0) {
|
||||
if (firstVisibleItem <= 4) {
|
||||
if (firstVisibleItem <= 10) {
|
||||
if (!endReached && !loading) {
|
||||
if (messagesByDays.size() != 0) {
|
||||
MessagesController.getInstance().loadMessages(dialog_id, 20, maxMessageId, !cacheEndReaced, minDate, classGuid, false, false, null);
|
||||
|
74
TMessagesProj/src/main/res/values-v21/styles.xml
Normal file
74
TMessagesProj/src/main/res/values-v21/styles.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<!--
|
||||
~ This is the source code of Telegram for Android v. 1.7.x.
|
||||
~ It is licensed under GNU GPL v. 2 or later.
|
||||
~ You should have received a copy of the license in this archive (see LICENSE).
|
||||
~
|
||||
~ Copyright Nikolai Kudashov, 2013-2014.
|
||||
-->
|
||||
|
||||
<resources
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!--THEMES-->
|
||||
|
||||
<style name="Theme.TMessages.Start" parent="@android:style/Theme.Material">
|
||||
<item name="android:actionBarStyle">@style/ActionBar.Transparent.TMessages.Start</item>
|
||||
<item name="android:colorBackground">@android:color/white</item>
|
||||
<item name="android:windowBackground">@android:color/white</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.TMessages" parent="@android:style/Theme.Material.Light">
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowActionBarOverlay">false</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:colorBackground">@android:color/white</item>
|
||||
<item name="android:windowBackground">@android:color/white</item>
|
||||
<item name="android:itemTextAppearance">@style/ActionBar.Transparent.TMessages.Item</item>
|
||||
<item name="android:listViewStyle">@style/Theme.TMessages.ListView</item>
|
||||
<!--<item name="android:listChoiceBackgroundIndicator">@drawable/list_selector</item>-->
|
||||
<item name="android:editTextStyle">@style/Theme.TMessages.EditText</item>
|
||||
<item name="android:actionBarItemBackground">@drawable/bar_selector_style</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.TMessages.PopupNotification" parent="Theme.TMessages">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
|
||||
<!--ACTION BAR-->
|
||||
|
||||
<style name="ActionBar.Transparent.TMessages.Start" parent="android:style/Widget.Material.Light.ActionBar">
|
||||
<item name="android:background">@color/header</item>
|
||||
<item name="android:logo">@drawable/transparent</item>
|
||||
<item name="android:title">""</item>
|
||||
</style>
|
||||
|
||||
<!--ACTION BAR ITEMS-->
|
||||
|
||||
<style name="ActionBar.Transparent.TMessages.Item" parent="@android:TextAppearance.Widget.IconMenu.Item">
|
||||
<item name="android:textColor">#000000</item>
|
||||
<item name="android:textSize">18sp</item>
|
||||
</style>
|
||||
|
||||
<!--LIST VIEW-->
|
||||
|
||||
<style name="Theme.TMessages.ListView" parent="@android:style/Widget.Material.Light.ListView">
|
||||
<!--<item name="android:listSelector">@drawable/list_selector</item>-->
|
||||
<item name="android:fadingEdge">none</item>
|
||||
<item name="android:dividerHeight">1dp</item>
|
||||
<item name="android:divider">@color/divider</item>
|
||||
</style>
|
||||
|
||||
<!--EDIT TEXT-->
|
||||
|
||||
<style name="Theme.TMessages.EditText" parent="android:Widget.Material.Light.EditText">
|
||||
<item name="android:background">@drawable/holo_edit_text_light</item>
|
||||
<item name="android:textColor">#000000</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user