Fix #564 - rounded pp everywhere

This commit is contained in:
stom79 2018-11-14 14:07:25 +01:00
parent 53744a81e8
commit 03017d090a
6 changed files with 29 additions and 132 deletions

View File

@ -54,10 +54,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
@ -167,23 +164,7 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
}
Glide.with(getApplicationContext())
.asBitmap()
.load(url)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
BitmapDrawable ppDrawable = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(resource, (int) Helper.convertDpToPixel(25, getApplicationContext()), (int) Helper.convertDpToPixel(25, getApplicationContext()), true));
if( pp_actionBar != null){
pp_actionBar.setImageDrawable(ppDrawable);
} else if( getSupportActionBar() != null){
getSupportActionBar().setIcon(ppDrawable);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
}
});
Helper.loadGiF(getApplicationContext(), url, pp_actionBar);
set_profile_name = findViewById(R.id.set_profile_name);
set_profile_description = findViewById(R.id.set_profile_description);

View File

@ -24,11 +24,8 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v4.widget.SwipeRefreshLayout;
@ -52,14 +49,12 @@ import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import fr.gouv.etalab.mastodon.R;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveFeedsAsyncTask;
import fr.gouv.etalab.mastodon.client.APIResponse;
@ -190,22 +185,7 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
if( url.startsWith("/") ){
url = Helper.getLiveInstanceWithProtocol(OwnerStatusActivity.this) + account.getAvatar();
}
Glide.with(OwnerStatusActivity.this)
.asBitmap()
.load(url)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
BitmapDrawable ppDrawable = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(resource, (int) Helper.convertDpToPixel(25, OwnerStatusActivity.this), (int) Helper.convertDpToPixel(25, OwnerStatusActivity.this), true));
if( pp_actionBar != null){
pp_actionBar.setImageDrawable(ppDrawable);
} else if( getSupportActionBar() != null){
getSupportActionBar().setIcon(ppDrawable);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
}
});
Helper.loadGiF(getApplicationContext(), url, pp_actionBar);
swipeRefreshLayout = findViewById(R.id.swipeContainer);
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

View File

@ -20,7 +20,6 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
@ -535,18 +534,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
if( url.startsWith("/") ){
url = Helper.getLiveInstanceWithProtocol(getApplicationContext()) + account.getAvatar();
}
Glide.with(getApplicationContext())
.asBitmap()
.load(url)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
BitmapDrawable ppDrawable = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(resource, (int) Helper.convertDpToPixel(25, getApplicationContext()), (int) Helper.convertDpToPixel(25, getApplicationContext()), true));
if( pp_actionBar != null){
pp_actionBar.setImageDrawable(ppDrawable);
}
}
});
Helper.loadGiF(getApplicationContext(), url, pp_actionBar);
}
final AppBarLayout appBar = findViewById(R.id.appBar);

View File

@ -18,12 +18,9 @@ package fr.gouv.etalab.mastodon.activities;
import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.ActionBar;
@ -39,10 +36,6 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import java.util.ArrayList;
import java.util.List;
@ -198,23 +191,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
if( url.startsWith("/") ){
url = Helper.getLiveInstanceWithProtocol(getApplicationContext()) + account.getAvatar();
}
Glide.with(getApplicationContext())
.asBitmap()
.load(url)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
BitmapDrawable ppDrawable = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(resource, (int) Helper.convertDpToPixel(25, getApplicationContext()), (int) Helper.convertDpToPixel(25, getApplicationContext()), true));
if( pp_actionBar != null){
pp_actionBar.setImageDrawable(ppDrawable);
} else if( getSupportActionBar() != null){
getSupportActionBar().setIcon(ppDrawable);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
}
});
Helper.loadGiF(getApplicationContext(), url, pp_actionBar);
isRefreshed = false;

View File

@ -17,32 +17,30 @@ package fr.gouv.etalab.mastodon.activities;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.pm.PackageManager;
import android.graphics.BitmapFactory;
import android.os.Environment;
import android.os.Parcelable;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.net.Uri;
import android.support.v4.content.FileProvider;
import android.support.v7.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.speech.RecognizerIntent;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.Html;
@ -84,7 +82,6 @@ import com.github.stom79.mytransl.client.HttpsConnectionException;
import com.github.stom79.mytransl.translate.Translate;
import com.vanniktech.emoji.EmojiPopup;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@ -102,6 +99,8 @@ import java.util.Locale;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import fr.gouv.etalab.mastodon.R;
import fr.gouv.etalab.mastodon.asynctasks.PostStatusAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveAccountsForReplyAsyncTask;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveEmojiAsyncTask;
@ -117,30 +116,29 @@ import fr.gouv.etalab.mastodon.client.Entities.Mention;
import fr.gouv.etalab.mastodon.client.Entities.Results;
import fr.gouv.etalab.mastodon.client.Entities.Status;
import fr.gouv.etalab.mastodon.client.Entities.StoredStatus;
import fr.gouv.etalab.mastodon.client.Entities.Version;
import fr.gouv.etalab.mastodon.client.Glide.GlideApp;
import fr.gouv.etalab.mastodon.client.HttpsConnection;
import fr.gouv.etalab.mastodon.drawers.CustomEmojiAdapter;
import fr.gouv.etalab.mastodon.drawers.EmojisSearchAdapter;
import fr.gouv.etalab.mastodon.helper.MastalabAutoCompleteTextView;
import fr.gouv.etalab.mastodon.interfaces.OnDownloadInterface;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveEmojiInterface;
import fr.gouv.etalab.mastodon.sqlite.CustomEmojiDAO;
import fr.gouv.etalab.mastodon.client.Entities.Version;
import fr.gouv.etalab.mastodon.drawers.AccountsReplyAdapter;
import fr.gouv.etalab.mastodon.drawers.AccountsSearchAdapter;
import fr.gouv.etalab.mastodon.drawers.CustomEmojiAdapter;
import fr.gouv.etalab.mastodon.drawers.DraftsListAdapter;
import fr.gouv.etalab.mastodon.drawers.EmojisSearchAdapter;
import fr.gouv.etalab.mastodon.drawers.TagsSearchAdapter;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.helper.MastalabAutoCompleteTextView;
import fr.gouv.etalab.mastodon.interfaces.OnDownloadInterface;
import fr.gouv.etalab.mastodon.interfaces.OnPostStatusActionInterface;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveAccountsReplyInterface;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveAttachmentInterface;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveEmojiInterface;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveSearcAccountshInterface;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveSearchInterface;
import fr.gouv.etalab.mastodon.jobs.ScheduledTootsSyncJob;
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
import fr.gouv.etalab.mastodon.sqlite.CustomEmojiDAO;
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
import fr.gouv.etalab.mastodon.sqlite.StatusStoredDAO;
import fr.gouv.etalab.mastodon.R;
import static fr.gouv.etalab.mastodon.helper.Helper.HOME_TIMELINE_INTENT;
import static fr.gouv.etalab.mastodon.helper.Helper.INTENT_ACTION;
@ -404,22 +402,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
if( url.startsWith("/") ){
url = Helper.getLiveInstanceWithProtocol(getApplicationContext()) + account.getAvatar();
}
Glide.with(getApplicationContext())
.asBitmap()
.load(url)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
BitmapDrawable ppDrawable = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(resource, (int) Helper.convertDpToPixel(25, getApplicationContext()), (int) Helper.convertDpToPixel(25, getApplicationContext()), true));
if( pp_actionBar != null){
pp_actionBar.setImageDrawable(ppDrawable);
} else if( getSupportActionBar() != null){
getSupportActionBar().setIcon(ppDrawable);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
}
});
Helper.loadGiF(getApplicationContext(), url, pp_actionBar);
if( sharedContent != null ){ //Shared content

View File

@ -1275,17 +1275,7 @@ public class Helper {
if( url.startsWith("/") ){
url = Helper.getLiveInstanceWithProtocol(activity) + url;
}
Glide.with(activity.getApplicationContext())
.asBitmap()
.load(url)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
Resources res = activity.getResources();
imageView.setImageBitmap(resource);
}
});
loadGiF(activity,url, imageView);
}
@ -1494,9 +1484,7 @@ public class Helper {
if( url.startsWith("/") ){
url = Helper.getLiveInstanceWithProtocol(activity) + account.getAvatar();
}
Glide.with(activity.getApplicationContext())
.load(url)
.into(profilePicture);
loadGiF(activity, url, profilePicture);
String urlHeader = account.getHeader();
if( urlHeader.startsWith("/") ){
urlHeader = Helper.getLiveInstanceWithProtocol(activity) + account.getHeader();