mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
refactor: remove unused dependencies and update minor for sqlcipher
This commit is contained in:
parent
5e7aaba150
commit
c61234afab
7 changed files with 5 additions and 344 deletions
|
@ -93,15 +93,10 @@ dependencies {
|
||||||
exclude group: 'com.squareup.okhttp', module: 'okhttp-urlconnection'
|
exclude group: 'com.squareup.okhttp', module: 'okhttp-urlconnection'
|
||||||
}
|
}
|
||||||
implementation 'com.annimon:stream:1.1.8'
|
implementation 'com.annimon:stream:1.1.8'
|
||||||
implementation 'com.takisoft.fix:colorpicker:1.0.1'
|
|
||||||
implementation 'com.codewaves.stickyheadergrid:stickyheadergrid:0.9.4'
|
implementation 'com.codewaves.stickyheadergrid:stickyheadergrid:0.9.4'
|
||||||
implementation 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3-S2'
|
implementation 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3-S2'
|
||||||
implementation 'androidx.sqlite:sqlite-ktx:2.2.0'
|
implementation 'androidx.sqlite:sqlite-ktx:2.3.1'
|
||||||
implementation 'net.zetetic:sqlcipher-android:4.5.3@aar'
|
implementation 'net.zetetic:sqlcipher-android:4.5.4@aar'
|
||||||
implementation ('com.googlecode.ez-vcard:ez-vcard:0.9.11') {
|
|
||||||
exclude group: 'com.fasterxml.jackson.core'
|
|
||||||
exclude group: 'org.freemarker'
|
|
||||||
}
|
|
||||||
implementation project(":libsignal")
|
implementation project(":libsignal")
|
||||||
implementation project(":libsession")
|
implementation project(":libsession")
|
||||||
implementation project(":libsession-util")
|
implementation project(":libsession-util")
|
||||||
|
@ -117,8 +112,6 @@ dependencies {
|
||||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
|
||||||
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
|
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
|
||||||
implementation "nl.komponents.kovenant:kovenant-android:$kovenantVersion"
|
implementation "nl.komponents.kovenant:kovenant-android:$kovenantVersion"
|
||||||
implementation "com.github.lelloman:android-identicons:v11"
|
|
||||||
implementation "com.prof.rssparser:rssparser:2.0.4"
|
|
||||||
implementation "com.jakewharton.rxbinding3:rxbinding:3.1.0"
|
implementation "com.jakewharton.rxbinding3:rxbinding:3.1.0"
|
||||||
implementation "com.github.tbruyelle:rxpermissions:0.10.2"
|
implementation "com.github.tbruyelle:rxpermissions:0.10.2"
|
||||||
implementation "com.github.ybq:Android-SpinKit:1.4.0"
|
implementation "com.github.ybq:Android-SpinKit:1.4.0"
|
||||||
|
|
|
@ -11,7 +11,6 @@ import androidx.core.app.NotificationCompat;
|
||||||
import net.zetetic.database.sqlcipher.SQLiteConnection;
|
import net.zetetic.database.sqlcipher.SQLiteConnection;
|
||||||
import net.zetetic.database.sqlcipher.SQLiteDatabase;
|
import net.zetetic.database.sqlcipher.SQLiteDatabase;
|
||||||
import net.zetetic.database.sqlcipher.SQLiteDatabaseHook;
|
import net.zetetic.database.sqlcipher.SQLiteDatabaseHook;
|
||||||
import net.zetetic.database.sqlcipher.SQLiteException;
|
|
||||||
import net.zetetic.database.sqlcipher.SQLiteOpenHelper;
|
import net.zetetic.database.sqlcipher.SQLiteOpenHelper;
|
||||||
|
|
||||||
import org.session.libsession.utilities.TextSecurePreferences;
|
import org.session.libsession.utilities.TextSecurePreferences;
|
||||||
|
@ -151,7 +150,7 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
|
||||||
connection.execute("PRAGMA cipher_page_size = 4096;", null, null);
|
connection.execute("PRAGMA cipher_page_size = 4096;", null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SQLiteDatabase open(String path, DatabaseSecret databaseSecret, boolean useSQLCipher4) throws SQLiteException {
|
private static SQLiteDatabase open(String path, DatabaseSecret databaseSecret, boolean useSQLCipher4) {
|
||||||
return SQLiteDatabase.openDatabase(path, databaseSecret.asString(), null, SQLiteDatabase.OPEN_READWRITE, new SQLiteDatabaseHook() {
|
return SQLiteDatabase.openDatabase(path, databaseSecret.asString(), null, SQLiteDatabase.OPEN_READWRITE, new SQLiteDatabaseHook() {
|
||||||
@Override
|
@Override
|
||||||
public void preKey(SQLiteConnection connection) { SQLCipherOpenHelper.applySQLCipherPragmas(connection, useSQLCipher4); }
|
public void preKey(SQLiteConnection connection) { SQLCipherOpenHelper.applySQLCipherPragmas(connection, useSQLCipher4); }
|
||||||
|
|
|
@ -24,8 +24,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.components.CustomDefaultPreference;
|
import org.thoughtcrime.securesms.components.CustomDefaultPreference;
|
||||||
import org.thoughtcrime.securesms.conversation.v2.ViewUtil;
|
import org.thoughtcrime.securesms.conversation.v2.ViewUtil;
|
||||||
import org.thoughtcrime.securesms.preferences.widgets.ColorPickerPreference;
|
|
||||||
import org.thoughtcrime.securesms.preferences.widgets.ColorPickerPreferenceDialogFragmentCompat;
|
|
||||||
|
|
||||||
import network.loki.messenger.R;
|
import network.loki.messenger.R;
|
||||||
|
|
||||||
|
@ -60,9 +58,7 @@ public abstract class CorrectedPreferenceFragment extends PreferenceFragmentComp
|
||||||
public void onDisplayPreferenceDialog(Preference preference) {
|
public void onDisplayPreferenceDialog(Preference preference) {
|
||||||
DialogFragment dialogFragment = null;
|
DialogFragment dialogFragment = null;
|
||||||
|
|
||||||
if (preference instanceof ColorPickerPreference) {
|
if (preference instanceof CustomDefaultPreference) {
|
||||||
dialogFragment = ColorPickerPreferenceDialogFragmentCompat.newInstance(preference.getKey());
|
|
||||||
} else if (preference instanceof CustomDefaultPreference) {
|
|
||||||
dialogFragment = CustomDefaultPreference.CustomDefaultPreferenceDialogFragmentCompat.newInstance(preference.getKey());
|
dialogFragment = CustomDefaultPreference.CustomDefaultPreferenceDialogFragmentCompat.newInstance(preference.getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,251 +0,0 @@
|
||||||
package org.thoughtcrime.securesms.preferences.widgets;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.core.content.res.TypedArrayUtils;
|
|
||||||
import androidx.preference.DialogPreference;
|
|
||||||
import androidx.preference.PreferenceViewHolder;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import com.takisoft.colorpicker.ColorPickerDialog;
|
|
||||||
import com.takisoft.colorpicker.ColorPickerDialog.Size;
|
|
||||||
import com.takisoft.colorpicker.ColorStateDrawable;
|
|
||||||
|
|
||||||
import network.loki.messenger.R;
|
|
||||||
|
|
||||||
public class ColorPickerPreference extends DialogPreference {
|
|
||||||
|
|
||||||
private static final String TAG = ColorPickerPreference.class.getSimpleName();
|
|
||||||
|
|
||||||
private int[] colors;
|
|
||||||
private CharSequence[] colorDescriptions;
|
|
||||||
private int color;
|
|
||||||
private int columns;
|
|
||||||
private int size;
|
|
||||||
private boolean sortColors;
|
|
||||||
|
|
||||||
private ImageView colorWidget;
|
|
||||||
private OnPreferenceChangeListener listener;
|
|
||||||
|
|
||||||
public ColorPickerPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
|
||||||
|
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ColorPickerPreference, defStyleAttr, 0);
|
|
||||||
|
|
||||||
int colorsId = a.getResourceId(R.styleable.ColorPickerPreference_colors, R.array.color_picker_default_colors);
|
|
||||||
|
|
||||||
if (colorsId != 0) {
|
|
||||||
colors = context.getResources().getIntArray(colorsId);
|
|
||||||
}
|
|
||||||
|
|
||||||
colorDescriptions = a.getTextArray(R.styleable.ColorPickerPreference_colorDescriptions);
|
|
||||||
color = a.getColor(R.styleable.ColorPickerPreference_currentColor, 0);
|
|
||||||
columns = a.getInt(R.styleable.ColorPickerPreference_columns, 3);
|
|
||||||
size = a.getInt(R.styleable.ColorPickerPreference_colorSize, 2);
|
|
||||||
sortColors = a.getBoolean(R.styleable.ColorPickerPreference_sortColors, false);
|
|
||||||
|
|
||||||
a.recycle();
|
|
||||||
|
|
||||||
setWidgetLayoutResource(R.layout.preference_widget_color_swatch);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColorPickerPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
this(context, attrs, defStyleAttr, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("RestrictedApi")
|
|
||||||
public ColorPickerPreference(Context context, AttributeSet attrs) {
|
|
||||||
this(context, attrs, TypedArrayUtils.getAttr(context, R.attr.dialogPreferenceStyle,
|
|
||||||
android.R.attr.dialogPreferenceStyle));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColorPickerPreference(Context context) {
|
|
||||||
this(context, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setOnPreferenceChangeListener(OnPreferenceChangeListener listener) {
|
|
||||||
super.setOnPreferenceChangeListener(listener);
|
|
||||||
this.listener = listener;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(PreferenceViewHolder holder) {
|
|
||||||
super.onBindViewHolder(holder);
|
|
||||||
|
|
||||||
colorWidget = (ImageView) holder.findViewById(R.id.color_picker_widget);
|
|
||||||
setColorOnWidget(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setColorOnWidget(int color) {
|
|
||||||
if (colorWidget == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Drawable[] colorDrawable = new Drawable[]
|
|
||||||
{ContextCompat.getDrawable(getContext(), R.drawable.colorpickerpreference_pref_swatch)};
|
|
||||||
colorWidget.setImageDrawable(new ColorStateDrawable(colorDrawable, color));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current color.
|
|
||||||
*
|
|
||||||
* @return The current color.
|
|
||||||
*/
|
|
||||||
public int getColor() {
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the current color.
|
|
||||||
*
|
|
||||||
* @param color The current color.
|
|
||||||
*/
|
|
||||||
public void setColor(int color) {
|
|
||||||
setInternalColor(color, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all of the available colors.
|
|
||||||
*
|
|
||||||
* @return The available colors.
|
|
||||||
*/
|
|
||||||
public int[] getColors() {
|
|
||||||
return colors;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the available colors.
|
|
||||||
*
|
|
||||||
* @param colors The available colors.
|
|
||||||
*/
|
|
||||||
public void setColors(int[] colors) {
|
|
||||||
this.colors = colors;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the available colors should be sorted automatically based on their HSV
|
|
||||||
* values.
|
|
||||||
*
|
|
||||||
* @return Whether the available colors should be sorted automatically based on their HSV
|
|
||||||
* values.
|
|
||||||
*/
|
|
||||||
public boolean isSortColors() {
|
|
||||||
return sortColors;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets whether the available colors should be sorted automatically based on their HSV
|
|
||||||
* values. The sorting does not modify the order of the original colors supplied via
|
|
||||||
* {@link #setColors(int[])} or the XML attribute {@code app:colors}.
|
|
||||||
*
|
|
||||||
* @param sortColors Whether the available colors should be sorted automatically based on their
|
|
||||||
* HSV values.
|
|
||||||
*/
|
|
||||||
public void setSortColors(boolean sortColors) {
|
|
||||||
this.sortColors = sortColors;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the available colors' descriptions that can be used by accessibility services.
|
|
||||||
*
|
|
||||||
* @return The available colors' descriptions.
|
|
||||||
*/
|
|
||||||
public CharSequence[] getColorDescriptions() {
|
|
||||||
return colorDescriptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the available colors' descriptions that can be used by accessibility services.
|
|
||||||
*
|
|
||||||
* @param colorDescriptions The available colors' descriptions.
|
|
||||||
*/
|
|
||||||
public void setColorDescriptions(CharSequence[] colorDescriptions) {
|
|
||||||
this.colorDescriptions = colorDescriptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of columns to be used in the picker dialog for displaying the available
|
|
||||||
* colors. If the value is less than or equals to 0, the number of columns will be determined
|
|
||||||
* automatically by the system using FlexboxLayoutManager.
|
|
||||||
*
|
|
||||||
* @return The number of columns to be used in the picker dialog.
|
|
||||||
* @see com.google.android.flexbox.FlexboxLayoutManager
|
|
||||||
*/
|
|
||||||
public int getColumns() {
|
|
||||||
return columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the number of columns to be used in the picker dialog for displaying the available
|
|
||||||
* colors. If the value is less than or equals to 0, the number of columns will be determined
|
|
||||||
* automatically by the system using FlexboxLayoutManager.
|
|
||||||
*
|
|
||||||
* @param columns The number of columns to be used in the picker dialog. Use 0 to set it to
|
|
||||||
* 'auto' mode.
|
|
||||||
* @see com.google.android.flexbox.FlexboxLayoutManager
|
|
||||||
*/
|
|
||||||
public void setColumns(int columns) {
|
|
||||||
this.columns = columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the size of the color swatches in the dialog. It can be either
|
|
||||||
* {@link ColorPickerDialog#SIZE_SMALL} or {@link ColorPickerDialog#SIZE_LARGE}.
|
|
||||||
*
|
|
||||||
* @return The size of the color swatches in the dialog.
|
|
||||||
* @see ColorPickerDialog#SIZE_SMALL
|
|
||||||
* @see ColorPickerDialog#SIZE_LARGE
|
|
||||||
*/
|
|
||||||
@Size
|
|
||||||
public int getSize() {
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the size of the color swatches in the dialog. It can be either
|
|
||||||
* {@link ColorPickerDialog#SIZE_SMALL} or {@link ColorPickerDialog#SIZE_LARGE}.
|
|
||||||
*
|
|
||||||
* @param size The size of the color swatches in the dialog. It can be either
|
|
||||||
* {@link ColorPickerDialog#SIZE_SMALL} or {@link ColorPickerDialog#SIZE_LARGE}.
|
|
||||||
* @see ColorPickerDialog#SIZE_SMALL
|
|
||||||
* @see ColorPickerDialog#SIZE_LARGE
|
|
||||||
*/
|
|
||||||
public void setSize(@Size int size) {
|
|
||||||
this.size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setInternalColor(int color, boolean force) {
|
|
||||||
int oldColor = getPersistedInt(0);
|
|
||||||
|
|
||||||
boolean changed = oldColor != color;
|
|
||||||
|
|
||||||
if (changed || force) {
|
|
||||||
this.color = color;
|
|
||||||
|
|
||||||
persistInt(color);
|
|
||||||
|
|
||||||
setColorOnWidget(color);
|
|
||||||
|
|
||||||
if (listener != null) listener.onPreferenceChange(this, color);
|
|
||||||
notifyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Object onGetDefaultValue(TypedArray a, int index) {
|
|
||||||
return a.getString(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSetInitialValue(boolean restoreValue, Object defaultValueObj) {
|
|
||||||
final String defaultValue = (String) defaultValueObj;
|
|
||||||
setInternalColor(restoreValue ? getPersistedInt(0) : (!TextUtils.isEmpty(defaultValue) ? Color.parseColor(defaultValue) : 0), true);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
package org.thoughtcrime.securesms.preferences.widgets;
|
|
||||||
|
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.preference.PreferenceDialogFragmentCompat;
|
|
||||||
|
|
||||||
import com.takisoft.colorpicker.ColorPickerDialog;
|
|
||||||
import com.takisoft.colorpicker.OnColorSelectedListener;
|
|
||||||
|
|
||||||
public class ColorPickerPreferenceDialogFragmentCompat extends PreferenceDialogFragmentCompat implements OnColorSelectedListener {
|
|
||||||
|
|
||||||
private int pickedColor;
|
|
||||||
|
|
||||||
public static ColorPickerPreferenceDialogFragmentCompat newInstance(String key) {
|
|
||||||
ColorPickerPreferenceDialogFragmentCompat fragment = new ColorPickerPreferenceDialogFragmentCompat();
|
|
||||||
Bundle b = new Bundle(1);
|
|
||||||
b.putString(PreferenceDialogFragmentCompat.ARG_KEY, key);
|
|
||||||
fragment.setArguments(b);
|
|
||||||
return fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
|
||||||
ColorPickerPreference pref = getColorPickerPreference();
|
|
||||||
|
|
||||||
ColorPickerDialog.Params params = new ColorPickerDialog.Params.Builder(getContext())
|
|
||||||
.setSelectedColor(pref.getColor())
|
|
||||||
.setColors(pref.getColors())
|
|
||||||
.setColorContentDescriptions(pref.getColorDescriptions())
|
|
||||||
.setSize(pref.getSize())
|
|
||||||
.setSortColors(pref.isSortColors())
|
|
||||||
.setColumns(pref.getColumns())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
ColorPickerDialog dialog = new ColorPickerDialog(getActivity(), this, params);
|
|
||||||
dialog.setTitle(pref.getDialogTitle());
|
|
||||||
|
|
||||||
return dialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDialogClosed(boolean positiveResult) {
|
|
||||||
ColorPickerPreference preference = getColorPickerPreference();
|
|
||||||
|
|
||||||
if (positiveResult) {
|
|
||||||
preference.setColor(pickedColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onColorSelected(int color) {
|
|
||||||
this.pickedColor = color;
|
|
||||||
|
|
||||||
super.onClick(getDialog(), DialogInterface.BUTTON_POSITIVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorPickerPreference getColorPickerPreference() {
|
|
||||||
return (ColorPickerPreference) getPreference();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:state_enabled="false" android:color="@color/grey"/>
|
<item android:state_enabled="false" android:color="@color/gray50"/>
|
||||||
<item android:color="?prominentButtonColor"/>
|
<item android:color="?prominentButtonColor"/>
|
||||||
</selector>
|
</selector>
|
|
@ -220,18 +220,6 @@
|
||||||
<attr name="emoji_maxLength" format="integer" />
|
<attr name="emoji_maxLength" format="integer" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="ColorPickerPreference">
|
|
||||||
<attr name="currentColor" format="reference" />
|
|
||||||
<attr name="colors" format="reference" />
|
|
||||||
<attr name="sortColors" format="boolean|reference" />
|
|
||||||
<attr name="colorDescriptions" format="reference" />
|
|
||||||
<attr name="columns" format="integer|reference" />
|
|
||||||
<attr name="colorSize" format="enum|reference">
|
|
||||||
<enum name="large" value="1" />
|
|
||||||
<enum name="small" value="2" />
|
|
||||||
</attr>
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
<declare-styleable name="VerificationCodeView">
|
<declare-styleable name="VerificationCodeView">
|
||||||
<attr name="vcv_spacing" format="dimension"/>
|
<attr name="vcv_spacing" format="dimension"/>
|
||||||
<attr name="vcv_inputWidth" format="dimension"/>
|
<attr name="vcv_inputWidth" format="dimension"/>
|
||||||
|
|
Loading…
Reference in a new issue