get rid of jcenter

This commit is contained in:
kosyak 2024-08-12 10:19:51 +02:00
parent 3d5ecaf376
commit 5034778a7d
6 changed files with 383 additions and 5 deletions

View file

@ -19,7 +19,6 @@ repositories {
google()
mavenCentral()
maven { url='https://jitpack.io'}
jcenter()
}
configurations {
@ -77,7 +76,7 @@ dependencies {
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation 'com.github.bumptech.glide:glide:4.15.1'
// https://mvnrepository.com/artifact/info.androidhive/imagefilters
implementation 'info.androidhive:imagefilters:1.0.7'
implementation 'com.github.zomato:androidphotofilters:1.0.2'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
//implementation 'com.splitwise:tokenautocomplete:3.0.2'

View file

@ -25,7 +25,6 @@ import com.bumptech.glide.request.RequestOptions
import com.bumptech.glide.request.target.Target
import com.canhub.cropper.CropImageView
import com.leinardi.android.speeddial.UiUtils.getPrimaryColor
import com.zomato.photofilters.FilterPack
import com.zomato.photofilters.imageprocessors.Filter
import eu.siacs.conversations.R
import eu.siacs.conversations.databinding.ActivityEditBinding
@ -526,7 +525,7 @@ class EditActivity : AppCompatActivity(), CropImageView.OnCropImageCompleteListe
val filterThumbnailsManager = FilterThumbnailsManager()
filterThumbnailsManager.clearThumbs()
val noFilter = Filter(getString(R.string.none))
val noFilter = NamedFilter(getString(R.string.none))
filterThumbnailsManager.addThumb(FilterItem(bitmap, noFilter))
FilterPack.getFilterPack(this).forEach {

View file

@ -0,0 +1,336 @@
package eu.siacs.conversations.medialib.activities;
import android.content.Context;
import com.zomato.photofilters.geometry.Point;
import com.zomato.photofilters.imageprocessors.Filter;
import com.zomato.photofilters.imageprocessors.subfilters.BrightnessSubFilter;
import com.zomato.photofilters.imageprocessors.subfilters.ColorOverlaySubFilter;
import com.zomato.photofilters.imageprocessors.subfilters.ContrastSubFilter;
import com.zomato.photofilters.imageprocessors.subfilters.SaturationSubFilter;
import com.zomato.photofilters.imageprocessors.subfilters.ToneCurveSubFilter;
import com.zomato.photofilters.imageprocessors.subfilters.VignetteSubFilter;
import java.util.ArrayList;
import java.util.List;
import eu.siacs.conversations.R;
public final class FilterPack {
private FilterPack() {
}
public static List<NamedFilter> getFilterPack(Context context) {
List<NamedFilter> filters = new ArrayList<>();
filters.add(getAweStruckVibeFilter(context));
filters.add(getClarendon(context));
filters.add(getOldManFilter(context));
filters.add(getMarsFilter(context));
filters.add(getRiseFilter(context));
filters.add(getAprilFilter(context));
filters.add(getAmazonFilter(context));
filters.add(getStarLitFilter(context));
filters.add(getNightWhisperFilter(context));
filters.add(getLimeStutterFilter(context));
filters.add(getHaanFilter(context));
filters.add(getBlueMessFilter(context));
filters.add(getAdeleFilter(context));
filters.add(getCruzFilter(context));
filters.add(getMetropolis(context));
filters.add(getAudreyFilter(context));
return filters;
}
public static NamedFilter getStarLitFilter(Context context) {
Point[] rgbKnots;
rgbKnots = new Point[8];
rgbKnots[0] = new Point(0, 0);
rgbKnots[1] = new Point(34, 6);
rgbKnots[2] = new Point(69, 23);
rgbKnots[3] = new Point(100, 58);
rgbKnots[4] = new Point(150, 154);
rgbKnots[5] = new Point(176, 196);
rgbKnots[6] = new Point(207, 233);
rgbKnots[7] = new Point(255, 255);
NamedFilter filter = new NamedFilter();
filter.setName(context.getString(R.string.starlit));
filter.addSubFilter(new ToneCurveSubFilter(rgbKnots, null, null, null));
return filter;
}
public static NamedFilter getBlueMessFilter(Context context) {
Point[] redKnots;
redKnots = new Point[8];
redKnots[0] = new Point(0, 0);
redKnots[1] = new Point(86, 34);
redKnots[2] = new Point(117, 41);
redKnots[3] = new Point(146, 80);
redKnots[4] = new Point(170, 151);
redKnots[5] = new Point(200, 214);
redKnots[6] = new Point(225, 242);
redKnots[7] = new Point(255, 255);
NamedFilter filter = new NamedFilter();
filter.setName(context.getString(R.string.bluemess));
filter.addSubFilter(new ToneCurveSubFilter(null, redKnots, null, null));
filter.addSubFilter(new BrightnessSubFilter(30));
filter.addSubFilter(new ContrastSubFilter(1f));
return filter;
}
public static NamedFilter getAweStruckVibeFilter(Context context) {
Point[] rgbKnots;
Point[] redKnots;
Point[] greenKnots;
Point[] blueKnots;
rgbKnots = new Point[5];
rgbKnots[0] = new Point(0, 0);
rgbKnots[1] = new Point(80, 43);
rgbKnots[2] = new Point(149, 102);
rgbKnots[3] = new Point(201, 173);
rgbKnots[4] = new Point(255, 255);
redKnots = new Point[5];
redKnots[0] = new Point(0, 0);
redKnots[1] = new Point(125, 147);
redKnots[2] = new Point(177, 199);
redKnots[3] = new Point(213, 228);
redKnots[4] = new Point(255, 255);
greenKnots = new Point[6];
greenKnots[0] = new Point(0, 0);
greenKnots[1] = new Point(57, 76);
greenKnots[2] = new Point(103, 130);
greenKnots[3] = new Point(167, 192);
greenKnots[4] = new Point(211, 229);
greenKnots[5] = new Point(255, 255);
blueKnots = new Point[7];
blueKnots[0] = new Point(0, 0);
blueKnots[1] = new Point(38, 62);
blueKnots[2] = new Point(75, 112);
blueKnots[3] = new Point(116, 158);
blueKnots[4] = new Point(171, 204);
blueKnots[5] = new Point(212, 233);
blueKnots[6] = new Point(255, 255);
NamedFilter filter = new NamedFilter();
filter.setName(context.getString(R.string.struck));
filter.addSubFilter(new ToneCurveSubFilter(rgbKnots, redKnots, greenKnots, blueKnots));
return filter;
}
public static NamedFilter getLimeStutterFilter(Context context) {
Point[] blueKnots;
blueKnots = new Point[3];
blueKnots[0] = new Point(0, 0);
blueKnots[1] = new Point(165, 114);
blueKnots[2] = new Point(255, 255);
NamedFilter filter = new NamedFilter();
filter.setName(context.getString(R.string.lime));
filter.addSubFilter(new ToneCurveSubFilter(null, null, null, blueKnots));
return filter;
}
public static NamedFilter getNightWhisperFilter(Context context) {
Point[] rgbKnots;
Point[] redKnots;
Point[] greenKnots;
Point[] blueKnots;
rgbKnots = new Point[3];
rgbKnots[0] = new Point(0, 0);
rgbKnots[1] = new Point(174, 109);
rgbKnots[2] = new Point(255, 255);
redKnots = new Point[4];
redKnots[0] = new Point(0, 0);
redKnots[1] = new Point(70, 114);
redKnots[2] = new Point(157, 145);
redKnots[3] = new Point(255, 255);
greenKnots = new Point[3];
greenKnots[0] = new Point(0, 0);
greenKnots[1] = new Point(109, 138);
greenKnots[2] = new Point(255, 255);
blueKnots = new Point[3];
blueKnots[0] = new Point(0, 0);
blueKnots[1] = new Point(113, 152);
blueKnots[2] = new Point(255, 255);
NamedFilter filter = new NamedFilter();
filter.setName(context.getString(R.string.whisper));
filter.addSubFilter(new ContrastSubFilter(1.5f));
filter.addSubFilter(new ToneCurveSubFilter(rgbKnots, redKnots, greenKnots, blueKnots));
return filter;
}
public static NamedFilter getAmazonFilter(Context context) {
Point[] blueKnots;
blueKnots = new Point[6];
blueKnots[0] = new Point(0, 0);
blueKnots[1] = new Point(11, 40);
blueKnots[2] = new Point(36, 99);
blueKnots[3] = new Point(86, 151);
blueKnots[4] = new Point(167, 209);
blueKnots[5] = new Point(255, 255);
NamedFilter filter = new NamedFilter(context.getString(R.string.amazon));
filter.addSubFilter(new ContrastSubFilter(1.2f));
filter.addSubFilter(new ToneCurveSubFilter(null, null, null, blueKnots));
return filter;
}
public static NamedFilter getAdeleFilter(Context context) {
NamedFilter filter = new NamedFilter(context.getString(R.string.adele));
filter.addSubFilter(new SaturationSubFilter(-100f));
return filter;
}
public static NamedFilter getCruzFilter(Context context) {
NamedFilter filter = new NamedFilter(context.getString(R.string.cruz));
filter.addSubFilter(new SaturationSubFilter(-100f));
filter.addSubFilter(new ContrastSubFilter(1.3f));
filter.addSubFilter(new BrightnessSubFilter(20));
return filter;
}
public static NamedFilter getMetropolis(Context context) {
NamedFilter filter = new NamedFilter(context.getString(R.string.metropolis));
filter.addSubFilter(new SaturationSubFilter(-1f));
filter.addSubFilter(new ContrastSubFilter(1.7f));
filter.addSubFilter(new BrightnessSubFilter(70));
return filter;
}
public static NamedFilter getAudreyFilter(Context context) {
NamedFilter filter = new NamedFilter(context.getString(R.string.audrey));
Point[] redKnots;
redKnots = new Point[3];
redKnots[0] = new Point(0, 0);
redKnots[1] = new Point(124, 138);
redKnots[2] = new Point(255, 255);
filter.addSubFilter(new SaturationSubFilter(-100f));
filter.addSubFilter(new ContrastSubFilter(1.3f));
filter.addSubFilter(new BrightnessSubFilter(20));
filter.addSubFilter(new ToneCurveSubFilter(null, redKnots, null, null));
return filter;
}
public static NamedFilter getRiseFilter(Context context) {
Point[] blueKnots;
Point[] redKnots;
blueKnots = new Point[4];
blueKnots[0] = new Point(0, 0);
blueKnots[1] = new Point(39, 70);
blueKnots[2] = new Point(150, 200);
blueKnots[3] = new Point(255, 255);
redKnots = new Point[4];
redKnots[0] = new Point(0, 0);
redKnots[1] = new Point(45, 64);
redKnots[2] = new Point(170, 190);
redKnots[3] = new Point(255, 255);
NamedFilter filter = new NamedFilter(context.getString(R.string.rise));
filter.addSubFilter(new ContrastSubFilter(1.9f));
filter.addSubFilter(new BrightnessSubFilter(60));
filter.addSubFilter(new VignetteSubFilter(context, 200));
filter.addSubFilter(new ToneCurveSubFilter(null, redKnots, null, blueKnots));
return filter;
}
public static NamedFilter getMarsFilter(Context context) {
NamedFilter filter = new NamedFilter(context.getString(R.string.mars));
filter.addSubFilter(new ContrastSubFilter(1.5f));
filter.addSubFilter(new BrightnessSubFilter(10));
return filter;
}
public static NamedFilter getAprilFilter(Context context) {
Point[] blueKnots;
Point[] redKnots;
blueKnots = new Point[4];
blueKnots[0] = new Point(0, 0);
blueKnots[1] = new Point(39, 70);
blueKnots[2] = new Point(150, 200);
blueKnots[3] = new Point(255, 255);
redKnots = new Point[4];
redKnots[0] = new Point(0, 0);
redKnots[1] = new Point(45, 64);
redKnots[2] = new Point(170, 190);
redKnots[3] = new Point(255, 255);
NamedFilter filter = new NamedFilter(context.getString(R.string.april));
filter.addSubFilter(new ContrastSubFilter(1.5f));
filter.addSubFilter(new BrightnessSubFilter(5));
filter.addSubFilter(new VignetteSubFilter(context, 150));
filter.addSubFilter(new ToneCurveSubFilter(null, redKnots, null, blueKnots));
return filter;
}
public static NamedFilter getHaanFilter(Context context) {
Point[] greenKnots;
greenKnots = new Point[3];
greenKnots[0] = new Point(0, 0);
greenKnots[1] = new Point(113, 142);
greenKnots[2] = new Point(255, 255);
NamedFilter filter = new NamedFilter(context.getString(R.string.haan));
filter.addSubFilter(new ContrastSubFilter(1.3f));
filter.addSubFilter(new BrightnessSubFilter(60));
filter.addSubFilter(new VignetteSubFilter(context, 200));
filter.addSubFilter(new ToneCurveSubFilter(null, null, greenKnots, null));
return filter;
}
public static NamedFilter getOldManFilter(Context context) {
NamedFilter filter = new NamedFilter(context.getString(R.string.oldman));
filter.addSubFilter(new BrightnessSubFilter(30));
filter.addSubFilter(new SaturationSubFilter(0.8f));
filter.addSubFilter(new ContrastSubFilter(1.3f));
filter.addSubFilter(new VignetteSubFilter(context, 100));
filter.addSubFilter(new ColorOverlaySubFilter(100, .2f, .2f, .1f));
return filter;
}
public static NamedFilter getClarendon(Context context) {
Point[] redKnots;
Point[] greenKnots;
Point[] blueKnots;
redKnots = new Point[4];
redKnots[0] = new Point(0, 0);
redKnots[1] = new Point(56, 68);
redKnots[2] = new Point(196, 206);
redKnots[3] = new Point(255, 255);
greenKnots = new Point[4];
greenKnots[0] = new Point(0, 0);
greenKnots[1] = new Point(46, 77);
greenKnots[2] = new Point(160, 200);
greenKnots[3] = new Point(255, 255);
blueKnots = new Point[4];
blueKnots[0] = new Point(0, 0);
blueKnots[1] = new Point(33, 86);
blueKnots[2] = new Point(126, 220);
blueKnots[3] = new Point(255, 255);
NamedFilter filter = new NamedFilter(context.getString(R.string.clarendon));
filter.addSubFilter(new ContrastSubFilter(1.5f));
filter.addSubFilter(new BrightnessSubFilter(-10));
filter.addSubFilter(new ToneCurveSubFilter(null, redKnots, greenKnots, blueKnots));
return filter;
}
}

View file

@ -0,0 +1,25 @@
package eu.siacs.conversations.medialib.activities;
import com.zomato.photofilters.imageprocessors.Filter;
public class NamedFilter extends Filter {
private String name;
public NamedFilter() {
}
public NamedFilter(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View file

@ -2,5 +2,6 @@ package eu.siacs.conversations.medialib.models
import android.graphics.Bitmap
import com.zomato.photofilters.imageprocessors.Filter
import eu.siacs.conversations.medialib.activities.NamedFilter
data class FilterItem(var bitmap: Bitmap, val filter: Filter)
data class FilterItem(var bitmap: Bitmap, val filter: NamedFilter)

View file

@ -1107,4 +1107,22 @@
<string name="avater_shape_oval">Oval</string>
<string name="avater_shape_rounded_square">Rounded Square</string>
<string name="avater_shape_square">Square</string>
<string name="clarendon" translatable="false">Clarendon</string>
<string name="oldman" translatable="false">OldMan</string>
<string name="haan" translatable="false">Haan</string>
<string name="april" translatable="false">April</string>
<string name="mars" translatable="false">Mars</string>
<string name="rise" translatable="false">Rise</string>
<string name="audrey" translatable="false">Audrey</string>
<string name="metropolis" translatable="false">Metropolis</string>
<string name="cruz" translatable="false">Cruz</string>
<string name="adele" translatable="false">Adele</string>
<string name="amazon" translatable="false">Amazon</string>
<string name="starlit" translatable="false">Starlit</string>
<string name="bluemess" translatable="false">BlueMess</string>
<string name="struck" translatable="false">Struck</string>
<string name="whisper" translatable="false">Whisper</string>
<string name="lime" translatable="false">Lime</string>
</resources>