Release 2.35.4

This commit is contained in:
Thomas 2020-05-17 11:49:02 +02:00
parent 00b7bf3990
commit 129621c73c
10 changed files with 98 additions and 84 deletions

View File

@ -6,8 +6,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 29 targetSdkVersion 29
versionCode 366 versionCode 367
versionName "2.35.3" versionName "2.35.4"
multiDexEnabled true multiDexEnabled true
renderscriptTargetApi 28 as int renderscriptTargetApi 28 as int
renderscriptSupportModeEnabled true renderscriptSupportModeEnabled true

View File

@ -1,8 +1,12 @@
Added:
- 100 Mo of cache for videos (can be changed in settings)
- Ouiches support for audio
Changed:
- Closing media
- Smoother settings
Fixed: Fixed:
- An issue with animated avatars in menu - Peertube comments
- An issue with avatars in accounts list - Some layout issues
- An issue with banana.dog instance - Some other crashes
- An issue with sensitive media when there were already a video preview
- Crashes with polls on some instances
- Crashes with Pixelfed
- Some other issues.

View File

@ -15,8 +15,8 @@ package app.fedilab.android.activities;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask; import android.os.AsyncTask;
@ -34,6 +34,7 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.Group; import androidx.constraintlayout.widget.Group;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
@ -175,8 +176,18 @@ public class AccountReportActivity extends BaseActivity implements OnAdminAction
public void onAdminAction(APIResponse apiResponse) { public void onAdminAction(APIResponse apiResponse) {
if (apiResponse.getError() != null) { if (apiResponse.getError() != null) {
if (apiResponse.getError().getStatusCode() == 403) { if (apiResponse.getError().getStatusCode() == 403) {
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK) {
style = R.style.DialogBlack;
} else {
style = R.style.Dialog;
}
AlertDialog.Builder builderInner; AlertDialog.Builder builderInner;
builderInner = new AlertDialog.Builder(AccountReportActivity.this, R.style.AppThemeDark); builderInner = new AlertDialog.Builder(AccountReportActivity.this, style);
builderInner.setTitle(R.string.reconnect_account); builderInner.setTitle(R.string.reconnect_account);
builderInner.setMessage(R.string.reconnect_account_message); builderInner.setMessage(R.string.reconnect_account_message);
builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss()); builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());

View File

@ -280,9 +280,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
} }
}); });
String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT); String user_agent = sharedpreferences.getString(Helper.SET_CUSTOM_USER_AGENT, Helper.USER_AGENT);
if (user_agent != null) { webview_video.getSettings().setUserAgentString(user_agent);
webview_video.getSettings().setUserAgentString(user_agent);
}
webview_video.getSettings().setAllowFileAccess(true); webview_video.getSettings().setAllowFileAccess(true);
webview_video.setWebChromeClient(mastalabWebChromeClient); webview_video.setWebChromeClient(mastalabWebChromeClient);
webview_video.getSettings().setDomStorageEnabled(true); webview_video.getSettings().setDomStorageEnabled(true);
@ -902,7 +900,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
} else { } else {
b.putParcelable("tootReply", remoteStatuses); b.putParcelable("tootReply", remoteStatuses);
} }
intent.putExtras(b); //Put your id to your next Intent intent.putExtras(b);
contextReference.get().startActivity(intent); contextReference.get().startActivity(intent);
} }
} }

View File

@ -80,6 +80,7 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
private String videoId; private String videoId;
private Account channel; private Account channel;
@SuppressWarnings("SuspiciousMethodCalls")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -539,6 +540,7 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie
List<String> tags = peertube.getTags(); List<String> tags = peertube.getTags();
if (tags != null && tags.size() > 0) { if (tags != null && tags.size() > 0) {
//noinspection ToArrayCallWithZeroLengthArrayArgument
String[] tagsA = tags.toArray(new String[tags.size()]); String[] tagsA = tags.toArray(new String[tags.size()]);
p_video_tags.setTags(tagsA); p_video_tags.setTags(tagsA);
} }

View File

@ -16,6 +16,7 @@ package app.fedilab.android.activities;
import android.Manifest; import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
@ -193,6 +194,7 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
} }
@SuppressWarnings("SuspiciousMethodCalls")
@Override @Override
public void onRetrievePeertubeChannels(APIResponse apiResponse) { public void onRetrievePeertubeChannels(APIResponse apiResponse) {
if (apiResponse.getError() != null || apiResponse.getAccounts() == null || apiResponse.getAccounts().size() == 0) { if (apiResponse.getError() != null || apiResponse.getAccounts() == null || apiResponse.getAccounts().size() == 0) {
@ -277,32 +279,29 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
}); });
set_upload_file.setEnabled(true); set_upload_file.setEnabled(true);
set_upload_file.setOnClickListener(new View.OnClickListener() { set_upload_file.setOnClickListener(v -> {
@Override if (ContextCompat.checkSelfPermission(PeertubeUploadActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
public void onClick(View v) { PackageManager.PERMISSION_GRANTED) {
if (ContextCompat.checkSelfPermission(PeertubeUploadActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != ActivityCompat.requestPermissions(PeertubeUploadActivity.this,
PackageManager.PERMISSION_GRANTED) { new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
ActivityCompat.requestPermissions(PeertubeUploadActivity.this, MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, return;
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE);
return;
}
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
intent.setType("*/*");
String[] mimetypes = {"video/*"};
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
startActivityForResult(intent, PICK_IVDEO);
} else {
intent.setType("video/*");
Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_image));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
startActivityForResult(chooserIntent, PICK_IVDEO);
}
} }
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
intent.setType("*/*");
String[] mimetypes = {"video/*"};
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
startActivityForResult(intent, PICK_IVDEO);
} else {
intent.setType("video/*");
Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
Intent chooserIntent = Intent.createChooser(intent, getString(R.string.toot_select_image));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
startActivityForResult(chooserIntent, PICK_IVDEO);
}
}); });
//Manage languages //Manage languages
@ -391,6 +390,7 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe
exception.printStackTrace(); exception.printStackTrace();
} }
@SuppressLint("ApplySharedPref")
@Override @Override
public void onCompleted(Context context, UploadInfo uploadInfo, ServerResponse serverResponse) { public void onCompleted(Context context, UploadInfo uploadInfo, ServerResponse serverResponse) {
try { try {

View File

@ -18,7 +18,10 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html;
import android.text.SpannableString;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@ -412,6 +415,13 @@ public class API {
status.setEmojis(new ArrayList<>()); status.setEmojis(new ArrayList<>());
status.setMedia_attachments(new ArrayList<>()); status.setMedia_attachments(new ArrayList<>());
status.setVisibility("public"); status.setVisibility("public");
status.setViewType(context);
SpannableString spannableString;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
spannableString = new SpannableString(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
else
spannableString = new SpannableString(Html.fromHtml(status.getContent()));
status.setContentSpan(new SpannableString(spannableString));
i++; i++;
statuses.add(status); statuses.add(status);
} }

View File

@ -857,6 +857,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) { if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
holder.status_action_container.setVisibility(View.GONE); holder.status_action_container.setVisibility(View.GONE);
holder.fedilab_features.setVisibility(View.GONE);
holder.status_peertube_container.setVisibility(View.VISIBLE); holder.status_peertube_container.setVisibility(View.VISIBLE);
holder.status_peertube_reply.setOnClickListener(v -> { holder.status_peertube_reply.setOnClickListener(v -> {
AlertDialog.Builder builderInner; AlertDialog.Builder builderInner;

View File

@ -14,10 +14,9 @@ package app.fedilab.android.fragments;
* You should have received a copy of the GNU General Public License along with Fedilab; if not, * You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -27,24 +26,27 @@ import android.widget.RelativeLayout;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.LoginActivity; import app.fedilab.android.activities.LoginActivity;
import app.fedilab.android.asynctasks.PostAdminActionAsyncTask; import app.fedilab.android.asynctasks.PostAdminActionAsyncTask;
import app.fedilab.android.asynctasks.RetrieveAccountsAsyncTask;
import app.fedilab.android.client.API; import app.fedilab.android.client.API;
import app.fedilab.android.client.APIResponse; import app.fedilab.android.client.APIResponse;
import app.fedilab.android.client.Entities.AdminAction; import app.fedilab.android.client.Entities.AdminAction;
import app.fedilab.android.client.Entities.Report; import app.fedilab.android.client.Entities.Report;
import app.fedilab.android.drawers.ReportsListAdapter; import app.fedilab.android.drawers.ReportsListAdapter;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.interfaces.OnAdminActionInterface; import app.fedilab.android.interfaces.OnAdminActionInterface;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
@ -59,9 +61,7 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
private Context context; private Context context;
private AsyncTask<Void, Void, Void> asyncTask; private AsyncTask<Void, Void, Void> asyncTask;
private ReportsListAdapter reportsListAdapter; private ReportsListAdapter reportsListAdapter;
private String max_id;
private List<Report> reports; private List<Report> reports;
private RetrieveAccountsAsyncTask.Type type;
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction; private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
private boolean firstLoad; private boolean firstLoad;
private SwipeRefreshLayout swipeRefreshLayout; private SwipeRefreshLayout swipeRefreshLayout;
@ -82,7 +82,6 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
if (bundle != null) { if (bundle != null) {
unresolved = bundle.getBoolean("unresolved", true); unresolved = bundle.getBoolean("unresolved", true);
} }
max_id = null;
firstLoad = true; firstLoad = true;
flag_loading = true; flag_loading = true;
swiped = false; swiped = false;
@ -109,7 +108,7 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
mLayoutManager = new LinearLayoutManager(context); mLayoutManager = new LinearLayoutManager(context);
lv_reports.setLayoutManager(mLayoutManager); lv_reports.setLayoutManager(mLayoutManager);
lv_reports.addOnScrollListener(new RecyclerView.OnScrollListener() { lv_reports.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(RecyclerView recyclerView, int dx, int dy) { public void onScrolled(@NotNull RecyclerView recyclerView, int dx, int dy) {
if (dy > 0) { if (dy > 0) {
int visibleItemCount = mLayoutManager.getChildCount(); int visibleItemCount = mLayoutManager.getChildCount();
int totalItemCount = mLayoutManager.getItemCount(); int totalItemCount = mLayoutManager.getItemCount();
@ -129,18 +128,14 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
} }
}); });
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { swipeRefreshLayout.setOnRefreshListener(() -> {
@Override reports = new ArrayList<>();
public void onRefresh() { firstLoad = true;
max_id = null; flag_loading = true;
reports = new ArrayList<>(); swiped = true;
firstLoad = true; AdminAction adminAction = new AdminAction();
flag_loading = true; adminAction.setUnresolved(unresolved);
swiped = true; asyncTask = new PostAdminActionAsyncTask(context, API.adminAction.GET_REPORTS, null, adminAction, DisplayAdminReportsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
AdminAction adminAction = new AdminAction();
adminAction.setUnresolved(unresolved);
asyncTask = new PostAdminActionAsyncTask(context, API.adminAction.GET_REPORTS, null, adminAction, DisplayAdminReportsFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}); });
AdminAction adminAction = new AdminAction(); AdminAction adminAction = new AdminAction();
@ -155,15 +150,8 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
} }
/**
* Refresh report in list
*/
public void refreshFilter() {
reportsListAdapter.notifyDataSetChanged();
}
@Override @Override
public void onAttach(Context context) { public void onAttach(@NotNull Context context) {
super.onAttach(context); super.onAttach(context);
this.context = context; this.context = context;
} }
@ -191,22 +179,24 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
//Admin right not granted through the API? //Admin right not granted through the API?
if (apiResponse.getError().getStatusCode() == 403) { if (apiResponse.getError().getStatusCode() == 403) {
AlertDialog.Builder builderInner; AlertDialog.Builder builderInner;
builderInner = new AlertDialog.Builder(context, R.style.AppThemeDark); SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK) {
style = R.style.DialogBlack;
} else {
style = R.style.Dialog;
}
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(R.string.reconnect_account); builderInner.setTitle(R.string.reconnect_account);
builderInner.setMessage(R.string.reconnect_account_message); builderInner.setMessage(R.string.reconnect_account_message);
builderInner.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { builderInner.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
@Override builderInner.setPositiveButton(R.string.validate, (dialog, which) -> {
public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(context, LoginActivity.class);
dialog.dismiss(); intent.putExtra("admin", true);
} context.startActivity(intent);
});
builderInner.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(context, LoginActivity.class);
intent.putExtra("admin", true);
context.startActivity(intent);
}
}); });
builderInner.show(); builderInner.show();
} else { } else {
@ -226,8 +216,6 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
else else
textviewNoAction.setVisibility(View.GONE); textviewNoAction.setVisibility(View.GONE);
max_id = apiResponse.getMax_id();
if (swiped) { if (swiped) {
reportsListAdapter = new ReportsListAdapter(this.reports); reportsListAdapter = new ReportsListAdapter(this.reports);
lv_reports.setAdapter(reportsListAdapter); lv_reports.setAdapter(reportsListAdapter);

View File

@ -2999,7 +2999,7 @@ public class Helper {
} }
try { try {
assert url != null; assert url != null;
if (disableGif || (!url.endsWith(".gif") && account.getAvatar_static().compareTo(account.getAvatar()) == 0)) { if (social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE || disableGif || (!url.endsWith(".gif") && account.getAvatar_static().compareTo(account.getAvatar()) == 0)) {
Glide.with(imageView.getContext()) Glide.with(imageView.getContext())
.asDrawable() .asDrawable()
.load(url) .load(url)