Merge branch 'disable_gif' into develop

This commit is contained in:
stom79 2017-12-10 08:49:13 +01:00
commit 968bb9a748
39 changed files with 104 additions and 21 deletions

View File

@ -35,7 +35,6 @@ import fr.gouv.etalab.mastodon.R;
import fr.gouv.etalab.mastodon.asynctasks.RetrieveInstanceAsyncTask;
import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.client.Entities.Instance;
import fr.gouv.etalab.mastodon.client.Entities.InstanceSocial;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveInstanceInterface;

View File

@ -39,7 +39,6 @@ import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

View File

@ -620,7 +620,22 @@ public class ShowAccountActivity extends AppCompatActivity implements OnPostActi
}
Glide.with(getApplicationContext()).load(account.getAvatar()).apply(RequestOptions.circleCropTransform()).into(account_pp);
boolean disableGif = sharedpreferences.getBoolean(Helper.SET_DISABLE_GIF, false);
if( !disableGif)
Glide.with(getApplicationContext()).load(account.getAvatar()).apply(RequestOptions.circleCropTransform()).into(account_pp);
else
Glide.with(getApplicationContext())
.asBitmap()
.load(account.getAvatar())
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), Helper.addBorder(resource, account_pp.getContext()));
circularBitmapDrawable.setCircular(true);
account_pp.setImageDrawable(circularBitmapDrawable);
}
});
}

View File

@ -32,8 +32,6 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
@ -149,10 +147,7 @@ public class AccountsListAdapter extends RecyclerView.Adapter implements OnPostA
holder.account_fgc.setText(withSuffix(account.getFollowing_count()));
holder.account_frc.setText(withSuffix(account.getFollowers_count()));
//Profile picture
Glide.with(holder.account_pp.getContext())
.load(account.getAvatar())
.into(holder.account_pp);
Helper.loadGiF(context, account.getAvatar(), holder.account_pp);
if( account.isMakingAction()){
holder.account_follow.setEnabled(false);
}else {

View File

@ -375,9 +375,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
imParams.height = (int) Helper.convertDpToPixel(30, context);
imParams.width = (int) Helper.convertDpToPixel(30, context);
holder.status_replies_profile_pictures.addView(imageView, imParams);
Glide.with(imageView.getContext())
.load(replies.getAccount().getAvatar())
.into(imageView);
Helper.loadGiF(context, replies.getAccount().getAvatar(), imageView);
i++;
addedPictures.add(replies.getAccount().getAcct());
}
@ -602,19 +600,13 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
Helper.absoluteDateTimeReveal(context, holder.status_toot_date, status.getCreated_at());
if( status.getReblog() != null) {
Glide.with(holder.status_account_profile_boost.getContext())
.load(ppurl)
.into(holder.status_account_profile_boost);
Glide.with(holder.status_account_profile_boost_by.getContext())
.load(status.getAccount().getAvatar())
.into(holder.status_account_profile_boost_by);
Helper.loadGiF(context, ppurl, holder.status_account_profile_boost);
Helper.loadGiF(context, status.getAccount().getAvatar(), holder.status_account_profile_boost_by);
holder.status_account_profile_boost.setVisibility(View.VISIBLE);
holder.status_account_profile_boost_by.setVisibility(View.VISIBLE);
holder.status_account_profile.setVisibility(View.GONE);
}else{
Glide.with(holder.status_account_profile.getContext())
.load(ppurl)
.into(holder.status_account_profile);
Helper.loadGiF(context, ppurl, holder.status_account_profile);
holder.status_account_profile_boost.setVisibility(View.GONE);
holder.status_account_profile_boost_by.setVisibility(View.GONE);
holder.status_account_profile.setVisibility(View.VISIBLE);

View File

@ -216,6 +216,19 @@ public class SettingsFragment extends Fragment {
}
});
boolean disableGif = sharedpreferences.getBoolean(Helper.SET_DISABLE_GIF, false);
final CheckBox set_disable_gif = rootView.findViewById(R.id.set_disable_gif);
set_disable_gif.setChecked(disableGif);
set_disable_gif.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_DISABLE_GIF, set_disable_gif.isChecked());
editor.apply();
}
});
boolean livenotif = sharedpreferences.getBoolean(Helper.SET_LIVE_NOTIFICATIONS, true);
final CheckBox set_live_notif = rootView.findViewById(R.id.set_live_notify);
set_live_notif.setChecked(livenotif);
@ -235,6 +248,7 @@ public class SettingsFragment extends Fragment {
});
boolean display_global = sharedpreferences.getBoolean(Helper.SET_DISPLAY_GLOBAL, true);
final CheckBox set_display_global = rootView.findViewById(R.id.set_display_global);
set_display_global.setChecked(display_global);

View File

@ -216,6 +216,7 @@ public class Helper {
public static final String INSTANCE_VERSION = "instance_version";
public static final String SET_LIVE_NOTIFICATIONS = "set_show_replies";
public static final String SET_PICTURE_URL = "set_picture_url";
public static final String SET_DISABLE_GIF = "set_disable_gif";
public static final int ATTACHMENT_ALWAYS = 1;
public static final int ATTACHMENT_WIFI = 2;
public static final int ATTACHMENT_ASK = 3;
@ -1674,4 +1675,26 @@ public class Helper {
return output;
}
public static void loadGiF(final Context context, String url, final ImageView imageView){
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
boolean disableGif = sharedpreferences.getBoolean(SET_DISABLE_GIF, false);
if( !disableGif)
Glide.with(imageView.getContext())
.load(url)
.into(imageView);
else
Glide.with(context)
.asBitmap()
.load(url)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
imageView.setImageBitmap(resource);
}
});
}
}

View File

@ -119,6 +119,14 @@
android:text="@string/live_notif"
android:layout_height="wrap_content" />
<!-- GIF AVATARS -->
<CheckBox
android:id="@+id/set_disable_gif"
android:layout_width="wrap_content"
android:text="@string/set_disable_gif"
android:layout_height="wrap_content" />
<!-- TABS Layout -->
<LinearLayout
android:id="@+id/translation_layout_container"

View File

@ -120,6 +120,14 @@
android:text="@string/live_notif"
android:layout_height="wrap_content" />
<!-- GIF AVATARS -->
<CheckBox
android:id="@+id/set_disable_gif"
android:layout_width="wrap_content"
android:text="@string/set_disable_gif"
android:layout_height="wrap_content" />
<!-- Translation engine -->
<LinearLayout
android:layout_marginTop="10dp"

View File

@ -413,4 +413,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -443,4 +443,5 @@
<string name="search">البحث</string>
<string name="delete">حذف</string>
<string name="fetch_more_toots">تحميل المزيد من التبويقات ...</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -421,4 +421,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -402,4 +402,5 @@
<string name="search">Suche</string>
<string name="delete">Löschen</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -412,4 +412,5 @@
<string name="search">Rechercher</string>
<string name="delete">Supprimer</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -429,4 +429,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -406,4 +406,5 @@ https://yandex.ru/legal/confidential/?lang=en
<string name="search">Cari</string>
<string name="delete">Hapus</string>
<string name="fetch_more_toots">Ambil lebih banyak kutipan…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -405,4 +405,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -405,4 +405,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Zoeken</string>
<string name="delete">Verwijderen</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -421,4 +421,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Pesquisar</string>
<string name="delete">Eliminar</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -417,4 +417,5 @@ Vă mulțumesc:
<string name="search">Căutare</string>
<string name="delete">Șterge</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -421,4 +421,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -421,4 +421,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -413,4 +413,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -405,4 +405,5 @@ Teşekkürler: </string>
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -421,4 +421,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -405,4 +405,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -399,4 +399,5 @@
<string name="search">Search</string>
<string name="delete">Delete</string>
<string name="fetch_more_toots">Fetch more toots…</string>
<string name="set_disable_gif">Disable GIF avatars</string>
</resources>

View File

@ -300,6 +300,7 @@
<string name="set_display_reply">Display previous message in responses</string>
<string name="set_display_local">Display local timeline</string>
<string name="set_display_global">Display federated timeline</string>
<string name="set_disable_gif">Disable GIF avatars</string>
<string name="set_folder_title">Path: </string>
<string name="set_auto_store_toot">Save drafts automatically</string>
<string name="set_bubble_counter">Display counters</string>