some changes

This commit is contained in:
Thomas 2020-05-10 11:19:22 +02:00
parent c7a6390346
commit 8914ac7c32
5 changed files with 56 additions and 19 deletions

View File

@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
buildToolsVersion "29.0.3"
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
@ -87,7 +87,7 @@ dependencies {
}
annotationProcessor "com.github.bumptech.glide:compiler:4.11.0"
annotationProcessor 'com.android.support:support-annotations:28.0.0'
implementation "org.conscrypt:conscrypt-android:2.2.1"
implementation "org.conscrypt:conscrypt-android:2.4.0"
implementation "com.evernote:android-job:1.2.6"
implementation "com.google.code.gson:gson:2.8.5"
implementation "com.google.guava:guava:28.2-android"

View File

@ -2195,6 +2195,9 @@ public class API {
JSONObject resobj = new JSONObject(response);
JSONObject jsonObject = resobj.getJSONObject("software");
String name = jsonObject.getString("name").toUpperCase();
if( name.compareTo("CORGIDON") == 0 ){
name = "MASTODON";
}
instanceNodeInfo.setName(name);
instanceNodeInfo.setVersion(jsonObject.getString("version"));
instanceNodeInfo.setOpenRegistrations(resobj.getBoolean("openRegistrations"));

View File

@ -309,6 +309,33 @@ public class Status implements Parcelable {
}
}
matcher = Helper.ouichesPattern.matcher(content);
while (matcher.find()) {
Attachment attachment = new Attachment();
attachment.setType("audio");
String tag = matcher.group(1);
attachment.setId(tag);
if( tag == null){
continue;
}
attachment.setRemote_url("https://ouich.es/mp3/"+tag+".mp3");
attachment.setUrl("https://ouich.es/mp3/"+tag+".mp3");
if( status.getMedia_attachments() == null) {
status.setMedia_attachments(new ArrayList<>());
}
boolean alreadyAdded = false;
for(Attachment at: status.getMedia_attachments()){
if( tag.compareTo(at.getId()) == 0 ){
alreadyAdded = true;
break;
}
}
if( !alreadyAdded) {
status.getMedia_attachments().add(attachment);
}
}
Pattern aLink = Pattern.compile("<a((?!href).)*href=\"([^\"]*)\"[^>]*(((?!</a).)*)</a>");
Matcher matcherALink = aLink.matcher(content);
int count = 0;

View File

@ -607,9 +607,11 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
@SuppressLint({"SetJavaScriptEnabled", "ClickableViewAccessibility"})
@Override
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder viewHolder, int i) {
context = viewHolder.itemView.getContext();
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
context = viewHolder.itemView.getContext();
if (viewHolder.getItemViewType() != HIDDEN_STATUS) {
final ViewHolder holder = (ViewHolder) viewHolder;

View File

@ -518,6 +518,7 @@ public class Helper {
public static final Pattern twitterPattern = Pattern.compile("((@[\\w]+)@twitter\\.com)");
public static final Pattern youtubePattern = Pattern.compile("(www\\.|m\\.)?(youtube\\.com|youtu\\.be|youtube-nocookie\\.com)/(((?!([\"'<])).)*)");
public static final Pattern nitterPattern = Pattern.compile("(mobile\\.|www\\.)?twitter.com([\\w-/]+)");
public static final Pattern ouichesPattern = Pattern.compile("ouich\\.es/tag/(\\w+)");
public static final Pattern xmppPattern = Pattern.compile("xmpp:[-a-zA-Z0-9+$&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");
//Default values
public final static int DEFAULT_VIDEO_WIDTH = 640;
@ -1927,27 +1928,30 @@ public class Helper {
}
if (!urlHeader.contains("missing.png")) {
ImageView backgroundImage = headerLayout.findViewById(R.id.back_ground_image);
Glide.with(activity)
.asDrawable()
.load(urlHeader)
.into(new CustomTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
if( isValidContextForGlide(activity)){
Glide.with(activity)
.asDrawable()
.load(urlHeader)
.into(new CustomTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
backgroundImage.setImageDrawable(resource);
if (theme == THEME_LIGHT) {
backgroundImage.setImageAlpha(80);
} else {
backgroundImage.setImageAlpha(60);
}
backgroundImage.setImageDrawable(resource);
if (theme == THEME_LIGHT) {
backgroundImage.setImageAlpha(80);
} else {
backgroundImage.setImageAlpha(60);
}
}
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
@Override
public void onLoadCleared(@Nullable Drawable placeholder) {
}
});
}
}
});
}
}
profilePicture.setOnClickListener(null);
@ -3210,6 +3214,7 @@ public class Helper {
}
} else {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse(url));
try {
context.startActivity(intent);