mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Merge pull request #954 from deltachat/android4_bugfixes
Android4 bugfixes
This commit is contained in:
@@ -56,15 +56,12 @@
|
||||
|
||||
<org.thoughtcrime.securesms.components.rangeslider.TimeRangeSlider
|
||||
android:id="@+id/timeRangeSlider"
|
||||
android:paddingStart="40dp"
|
||||
android:paddingEnd="40dp"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingRight="40dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
app:minValue="50"
|
||||
app:maxValue="100"
|
||||
|
||||
app:paddingLeft="40dp"
|
||||
app:paddingRight="40dp"
|
||||
/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2015 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="?android:attr/scrollbarSize"
|
||||
android:paddingRight="?android:attr/scrollbarSize"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:focusable="true" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/icon_frame"
|
||||
android:layout_width="56dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingStart="8dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
>
|
||||
<android.support.v7.internal.widget.PreferenceImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:maxWidth="48dp"
|
||||
app:maxHeight="48dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="15dip"
|
||||
android:layout_marginLeft="15dip"
|
||||
android:layout_marginEnd="6dip"
|
||||
android:layout_marginRight="6dip"
|
||||
android:layout_marginTop="6dip"
|
||||
android:layout_marginBottom="6dip"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView android:id="@android:id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textSize="16sp"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal" />
|
||||
|
||||
<TextView android:id="@android:id/summary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@android:id/title"
|
||||
android:layout_alignStart="@android:id/title"
|
||||
android:layout_alignLeft="@android:id/title"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:maxLines="4" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- Preference should place its actual preference widget here. -->
|
||||
<LinearLayout android:id="@android:id/widget_frame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -222,6 +222,8 @@
|
||||
<attr name="displayTextFontSize" format="dimension|reference"/>
|
||||
<attr name="minValue" format="integer"/>
|
||||
<attr name="maxValue" format="integer"/>
|
||||
<attr name="paddingLeft" format="dimension|reference"/>
|
||||
<attr name="paddingRight" format="dimension|reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="TimeRangeSlider">
|
||||
|
||||
+14
-7
@@ -7,30 +7,37 @@
|
||||
|
||||
<Preference android:key="preference_category_notifications"
|
||||
android:title="@string/pref_notifications"
|
||||
android:icon="@drawable/ic_notifications_24dp"/>
|
||||
android:icon="@drawable/ic_notifications_24dp"
|
||||
android:layout="@layout/preference_item" />
|
||||
|
||||
<Preference android:key="preference_category_app_protection"
|
||||
android:title="@string/pref_privacy"
|
||||
android:icon="@drawable/ic_security_24dp"/>
|
||||
android:icon="@drawable/ic_security_24dp"
|
||||
android:layout="@layout/preference_item" />
|
||||
|
||||
<Preference android:key="preference_category_appearance"
|
||||
android:title="@string/pref_appearance"
|
||||
android:icon="@drawable/ic_brightness_6_24dp"/>
|
||||
android:icon="@drawable/ic_brightness_6_24dp"
|
||||
android:layout="@layout/preference_item" />
|
||||
|
||||
<Preference android:key="preference_category_chats"
|
||||
android:title="@string/pref_chats_and_media"
|
||||
android:icon="@drawable/ic_forum_24dp"/>
|
||||
android:icon="@drawable/ic_forum_24dp"
|
||||
android:layout="@layout/preference_item" />
|
||||
|
||||
<Preference android:key="preference_category_advanced"
|
||||
android:title="@string/menu_advanced"
|
||||
android:icon="@drawable/ic_advanced_24dp"/>
|
||||
android:icon="@drawable/ic_advanced_24dp"
|
||||
android:layout="@layout/preference_item" />
|
||||
|
||||
<Preference android:key="preference_category_invite"
|
||||
android:title="@string/menu_invite"
|
||||
android:icon="@drawable/ic_invite_24dp"/>
|
||||
android:icon="@drawable/ic_invite_24dp"
|
||||
android:layout="@layout/preference_item" />
|
||||
|
||||
<Preference android:key="preference_category_help"
|
||||
android:title="@string/menu_help"
|
||||
android:icon="@drawable/ic_help_24dp"/>
|
||||
android:icon="@drawable/ic_help_24dp"
|
||||
android:layout="@layout/preference_item" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -918,7 +918,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
String ext = "";
|
||||
if(filename==null) {
|
||||
filename = new SimpleDateFormat("yyyy-MM-dd-HH-mm").format(new Date());
|
||||
ext = "."+MimeTypeMap.getSingleton().getExtensionFromMimeType(attachment.getContentType());
|
||||
ext = "." + MediaUtil.getExtensionFromMimeType(attachment.getContentType());
|
||||
}
|
||||
else {
|
||||
int i = filename.lastIndexOf(".");
|
||||
|
||||
@@ -4,7 +4,9 @@ import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.os.Build;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.ViewCompat;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
@@ -12,6 +14,7 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -69,23 +72,13 @@ public class RangeSliderView extends View {
|
||||
|
||||
public RangeSliderView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public RangeSliderView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
int [] attributes = new int [] {android.R.attr.paddingLeft,
|
||||
android.R.attr.paddingStart,
|
||||
android.R.attr.paddingRight,
|
||||
android.R.attr.paddingEnd};
|
||||
|
||||
TypedArray arr = context.obtainStyledAttributes(attrs, attributes);
|
||||
|
||||
sliderPaddingLeft = arr.getDimensionPixelOffset(0,
|
||||
arr.getDimensionPixelOffset(1, -1));
|
||||
sliderPaddingRight = arr.getDimensionPixelOffset(2,
|
||||
arr.getDimensionPixelOffset(3, -1));
|
||||
|
||||
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RangeSliderView);
|
||||
trackTintColor = typedArray.getColor(
|
||||
R.styleable.RangeSliderView_trackTintColor,
|
||||
@@ -123,6 +116,11 @@ public class RangeSliderView extends View {
|
||||
100
|
||||
);
|
||||
|
||||
sliderPaddingRight = typedArray.getDimensionPixelOffset(R.styleable.RangeSliderView_paddingRight, 20);
|
||||
sliderPaddingLeft = typedArray.getDimensionPixelOffset(R.styleable.RangeSliderView_paddingLeft, 20);
|
||||
|
||||
typedArray.recycle();
|
||||
|
||||
minValueThumb = new ThumbLayer(thumbInnerRadius, thumbOutlineSize, trackHighlightTintColor, trackTintColor);
|
||||
minValueDisplayLabel = new TextLayer(displayTextFontSize, trackHighlightTintColor);
|
||||
|
||||
|
||||
@@ -298,7 +298,9 @@ public class MapDataManager implements DcEventCenter.DcEventDelegate, GenerateIn
|
||||
|
||||
private void showLineLayer(MapSource source) {
|
||||
LineLayer lineLayer = (LineLayer) mapboxStyle.getLayer(source.getLineLayer());
|
||||
lineLayer.setProperties(visibility(showTraces ? VISIBLE : NONE));
|
||||
if (lineLayer != null) {
|
||||
lineLayer.setProperties(visibility(showTraces ? VISIBLE : NONE));
|
||||
}
|
||||
}
|
||||
|
||||
private void applyFilters(int[] contactIds) {
|
||||
@@ -316,17 +318,23 @@ public class MapDataManager implements DcEventCenter.DcEventDelegate, GenerateIn
|
||||
|
||||
private void applyLastPositionFilter() {
|
||||
SymbolLayer markerLayer = (SymbolLayer) mapboxStyle.getLayer(LAST_POSITION_LAYER);
|
||||
markerLayer.setFilter(filterProvider.getTimeFilter());
|
||||
if (markerLayer != null) {
|
||||
markerLayer.setFilter(filterProvider.getTimeFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private void applyMarkerFilter(MapSource source) {
|
||||
SymbolLayer markerLayer = (SymbolLayer) mapboxStyle.getLayer(source.getMarkerLayer());
|
||||
markerLayer.setFilter(filterProvider.getMarkerFilter());
|
||||
if (markerLayer != null) {
|
||||
markerLayer.setFilter(filterProvider.getMarkerFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private void applyLineFilter(MapSource source) {
|
||||
LineLayer lineLayer = (LineLayer) mapboxStyle.getLayer(source.getLineLayer());
|
||||
lineLayer.setFilter(filterProvider.getTimeFilter());
|
||||
if (lineLayer != null) {
|
||||
lineLayer.setFilter(filterProvider.getTimeFilter());
|
||||
}
|
||||
}
|
||||
|
||||
private int[] getContactIds(int chatId) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.util.Log;
|
||||
import android.webkit.MimeTypeMap;
|
||||
|
||||
import org.thoughtcrime.securesms.util.FileProviderUtil;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -189,7 +190,7 @@ public class PersistentBlobProvider {
|
||||
}
|
||||
|
||||
private static @NonNull String getExtensionFromMimeType(String mimeType) {
|
||||
final String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
|
||||
final String extension = MediaUtil.getExtensionFromMimeType(mimeType);
|
||||
return extension != null ? extension : BLOB_EXTENSION;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.net.Uri;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.WorkerThread;
|
||||
@@ -42,6 +40,7 @@ public class MediaUtil {
|
||||
|
||||
private static final String TAG = MediaUtil.class.getSimpleName();
|
||||
|
||||
public static final String IMAGE_WEBP = "image/webp";
|
||||
public static final String IMAGE_PNG = "image/png";
|
||||
public static final String IMAGE_JPEG = "image/jpeg";
|
||||
public static final String IMAGE_GIF = "image/gif";
|
||||
@@ -281,4 +280,21 @@ public class MediaUtil {
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
public static String getExtensionFromMimeType(String contentType) {
|
||||
String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(contentType);
|
||||
if (extension != null) {
|
||||
return extension;
|
||||
}
|
||||
|
||||
//custom handling needed for unsupported extensions on Android 4.X
|
||||
switch (contentType) {
|
||||
case AUDIO_AAC:
|
||||
return "aac";
|
||||
case IMAGE_WEBP:
|
||||
return "webp";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -126,8 +126,7 @@ public class SaveAttachmentTask extends ProgressDialogAsyncTask<SaveAttachmentTa
|
||||
}
|
||||
|
||||
private String generateOutputFileName(@NonNull String contentType, long timestamp) {
|
||||
MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
|
||||
String extension = mimeTypeMap.getExtensionFromMimeType(contentType);
|
||||
String extension = MediaUtil.getExtensionFromMimeType(contentType);
|
||||
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd-HHmmss");
|
||||
String base = "deltachat-" + dateFormatter.format(timestamp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user