Commit 23ed8fd3 authored by Thomas's avatar Thomas
Browse files

Merge branch 'develop' of framagit.org:tom79/fedilab into develop

 Conflicts:
	app/src/main/java/app/fedilab/android/helper/Helper.java
parents 8914ac7c 6dab48af
Pipeline #299610 failed with stage
in 4 minutes and 18 seconds
......@@ -6,8 +6,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
versionCode 363
versionName "2.35.0"
versionCode 366
versionName "2.35.3"
multiDexEnabled true
renderscriptTargetApi 28 as int
renderscriptSupportModeEnabled true
......
Added:
- Simple click on reactions to add them
Fixed:
- Recent crashes (connection, when scrolling)
\ No newline at end of file
Fixed:
- Fix last remaining issues
\ No newline at end of file
Fixed:
- An issue with animated avatars in menu
- An issue with avatars in accounts list
- An issue with banana.dog instance
- An issue with sensitive media when there were already a video preview
- Crashes with polls on some instances
- Crashes with Pixelfed
- Some other issues.
\ No newline at end of file
......@@ -44,6 +44,7 @@ import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -157,6 +158,7 @@ import app.fedilab.android.sqlite.TimelineCacheDAO;
import app.fedilab.android.sqlite.TimelinesDAO;
import es.dmoral.toasty.Toasty;
import static app.fedilab.android.activities.WebviewActivity.trackingDomains;
import static app.fedilab.android.asynctasks.ManageFiltersAsyncTask.action.GET_ALL_FILTER;
import static app.fedilab.android.helper.Helper.changeDrawableColor;
......@@ -1112,7 +1114,7 @@ public abstract class BaseMainActivity extends BaseActivity
}
if (!BuildConfig.DONATIONS) {
MenuItem openCollectiveItem = navigationView.getMenu().findItem(R.id.nav_opencollective);
MenuItem openCollectiveItem = navigationView.getMenu().findItem(R.id.nav_liberapay);
if (openCollectiveItem != null) {
openCollectiveItem.setVisible(false);
}
......@@ -1256,7 +1258,7 @@ public abstract class BaseMainActivity extends BaseActivity
int lastReleaseNoteRead = sharedpreferences.getInt(Helper.SET_POPUP_RELEASE_NOTES, 0);
int versionCode = BuildConfig.VERSION_CODE;
if (lastReleaseNoteRead != versionCode) { //Need to push release notes
if (lastReleaseNoteRead != versionCode ) { //Need to push release notes
if (social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
new RetrieveRemoteDataAsyncTask(BaseMainActivity.this, BaseMainActivity.this).execute();
}
......@@ -1271,11 +1273,26 @@ public abstract class BaseMainActivity extends BaseActivity
LayoutInflater inflater = getLayoutInflater();
dialogReleaseNoteView = inflater.inflate(R.layout.popup_release_notes, new LinearLayout(BaseMainActivity.this), false);
dialogBuilderOptin.setView(dialogReleaseNoteView);
TextView release_title = dialogReleaseNoteView.findViewById(R.id.release_title);
TextView release_notes = dialogReleaseNoteView.findViewById(R.id.release_notes);
Button liberapay_support = dialogReleaseNoteView.findViewById(R.id.liberapay_support);
release_title.setText(getString(R.string.release_note_title, BuildConfig.VERSION_NAME));
release_notes.setText(finalContent);
if( BuildConfig.DONATIONS) {
liberapay_support.setVisibility(View.VISIBLE);
}else{
liberapay_support.setVisibility(View.GONE);
}
liberapay_support.setOnClickListener(v->{
Intent intentLiberapay = new Intent(Intent.ACTION_VIEW);
intentLiberapay.setData(Uri.parse("https://liberapay.com/tom79"));
try {
startActivity(intentLiberapay);
} catch (Exception e) {
Helper.openBrowser(BaseMainActivity.this, "https://liberapay.com/tom79");
}
});
dialogBuilderOptin.setPositiveButton(R.string.close, (dialog, id) -> dialog.dismiss());
try {
Handler handler = new Handler();
......@@ -1676,6 +1693,9 @@ public abstract class BaseMainActivity extends BaseActivity
}
});
}
if( trackingDomains != null){
trackingDomains = null;
}
if (hidde_menu != null)
LocalBroadcastManager.getInstance(BaseMainActivity.this).unregisterReceiver(hidde_menu);
if (update_topbar != null)
......@@ -1717,13 +1737,13 @@ public abstract class BaseMainActivity extends BaseActivity
Intent intent = new Intent(BaseMainActivity.this, AboutActivity.class);
startActivity(intent);
return false;
} else if (id == R.id.nav_opencollective) {
} else if (id == R.id.nav_liberapay) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://www.paypal.me/mastalab"));
intent.setData(Uri.parse("https://liberapay.com/tom79"));
try {
startActivity(intent);
} catch (Exception e) {
Helper.openBrowser(BaseMainActivity.this, "https://www.paypal.me/mastalab");
Helper.openBrowser(BaseMainActivity.this, "https://liberapay.com/tom79");
}
return false;
} else if (id == R.id.nav_upload) {
......@@ -2374,6 +2394,16 @@ public abstract class BaseMainActivity extends BaseActivity
}
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
}
public enum iconLauncher {
BUBBLES,
FEDIVERSE,
......@@ -2521,6 +2551,7 @@ public abstract class BaseMainActivity extends BaseActivity
}
}
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
if (mPageReferenceMap != null) {
......
......@@ -16,6 +16,7 @@ package app.fedilab.android.activities;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
......@@ -185,6 +186,7 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
}
@SuppressLint("CutPasteId")
@Override
public void onRetrieveAccount(Account account, Error error) {
if (error != null) {
......@@ -312,36 +314,33 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT);
getIntent.setType("image/*");
Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
pickIntent.setType("image/*");
Intent pickIntent = new Intent(Intent.ACTION_PICK);
pickIntent.setDataAndType(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
Intent chooserIntent = Intent.createChooser(getIntent, getString(R.string.toot_select_image));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
startActivityForResult(chooserIntent, PICK_IMAGE_HEADER);
});
set_change_profile_picture.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (ContextCompat.checkSelfPermission(EditProfileActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(EditProfileActivity.this,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE_PICTURE);
return;
}
set_change_profile_picture.setOnClickListener(v -> {
if (ContextCompat.checkSelfPermission(EditProfileActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(EditProfileActivity.this,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE_PICTURE);
return;
}
Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT);
getIntent.setType("image/*");
Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT);
getIntent.setType("image/*");
Intent pickIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
pickIntent.setType("image/*");
Intent pickIntent = new Intent(Intent.ACTION_PICK);
pickIntent.setDataAndType(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
Intent chooserIntent = Intent.createChooser(getIntent, getString(R.string.toot_select_image));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
startActivityForResult(chooserIntent, PICK_IMAGE_PROFILE);
}
Intent chooserIntent = Intent.createChooser(getIntent, getString(R.string.toot_select_image));
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{pickIntent});
startActivityForResult(chooserIntent, PICK_IMAGE_PROFILE);
});
if (!EditProfileActivity.this.isFinishing()) {
......
......@@ -589,8 +589,7 @@ public class LoginActivity extends BaseActivity {
String refresh_token = null;
if (resobj.has("refresh_token"))
refresh_token = resobj.getString("refresh_token");
SharedPreferences sharedpreferences1 = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences1.edit();
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, token);
editor.apply();
//Update the account with the token;
......@@ -601,10 +600,9 @@ public class LoginActivity extends BaseActivity {
} else {
try {
resobj = new JSONObject(response);
Account account = GNUAPI.parseAccountResponse(LoginActivity.this, resobj);
Account account = GNUAPI.parseAccountResponse(resobj);
account.setToken(basicAuth);
SharedPreferences sharedpreferences1 = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences1.edit();
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, basicAuth);
account.setInstance(instance);
......
......@@ -40,7 +40,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.FrameLayout;
......@@ -106,6 +105,7 @@ import app.fedilab.android.interfaces.OnRetrievePeertubeInterface;
import app.fedilab.android.sqlite.AccountDAO;
import app.fedilab.android.sqlite.PeertubeFavoritesDAO;
import app.fedilab.android.sqlite.Sqlite;
import app.fedilab.android.webview.CustomWebview;
import app.fedilab.android.webview.MastalabWebChromeClient;
import app.fedilab.android.webview.MastalabWebViewClient;
import es.dmoral.toasty.Toasty;
......@@ -183,7 +183,7 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
peertube_description = findViewById(R.id.peertube_description);
peertube_title = findViewById(R.id.peertube_title);
peertube_information_container = findViewById(R.id.peertube_information_container);
WebView webview_video = findViewById(R.id.webview_video);
CustomWebview webview_video = findViewById(R.id.webview_video);
playerView = findViewById(R.id.media_video);
write_comment_container = findViewById(R.id.write_comment_container);
ImageView my_pp = findViewById(R.id.my_pp);
......
......@@ -56,6 +56,7 @@ import app.fedilab.android.imageeditor.filters.FilterListener;
import app.fedilab.android.imageeditor.filters.FilterViewAdapter;
import app.fedilab.android.imageeditor.tools.EditingToolsAdapter;
import app.fedilab.android.imageeditor.tools.ToolType;
import es.dmoral.toasty.Toasty;
import ja.burhanrashid52.photoeditor.OnPhotoEditorListener;
import ja.burhanrashid52.photoeditor.PhotoEditor;
import ja.burhanrashid52.photoeditor.PhotoEditorView;
......@@ -163,8 +164,11 @@ public class PhotoEditorActivity extends BaseActivity implements OnPhotoEditorLi
mPhotoEditor.setOnPhotoEditorListener(this);
//Set Image Dynamically
mPhotoEditorView.getSource().setImageURI(uri);
try {
mPhotoEditorView.getSource().setImageURI(uri);
} catch (Exception e) {
Toasty.error(PhotoEditorActivity.this, getString(R.string.error)).show();
}
if (uri != null) {
try (InputStream inputStream = getContentResolver().openInputStream(uri)) {
......
......@@ -153,6 +153,11 @@ public class SettingsActivity extends BaseActivity {
}
@Override
public void onDestroy(){
super.onDestroy();
}
private void showDialog() {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this);
dialogBuilder.setMessage(R.string.restart_message);
......
......@@ -36,6 +36,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
......@@ -109,11 +110,11 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
loader.setVisibility(View.VISIBLE);
detailsStatus.setFocused(true);
//Some spannable
Status.fillSpan(ShowConversationActivity.this, detailsStatus);
Status.fillSpan(new WeakReference<>(ShowConversationActivity.this), detailsStatus);
if (detailsStatus.getPoll() != null) {
Status.makeEmojiPoll(ShowConversationActivity.this, detailsStatus.getPoll());
Status.makeEmojiPoll(new WeakReference<>(ShowConversationActivity.this), detailsStatus.getPoll());
}
Account.makeAccountNameEmoji(ShowConversationActivity.this, detailsStatus.getAccount());
Account.makeAccountNameEmoji(new WeakReference<>(ShowConversationActivity.this), detailsStatus.getAccount());
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
......
......@@ -316,7 +316,7 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
public void togglePlaying(View v) {
if (mCurrentFragment != null) {
mCurrentFragment.togglePlaying(v);
mCurrentFragment.togglePlaying();
}
}
......
......@@ -34,7 +34,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.WebView;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.Toast;
......@@ -56,6 +55,7 @@ import app.fedilab.android.helper.CountDrawable;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.sqlite.DomainBlockDAO;
import app.fedilab.android.sqlite.Sqlite;
import app.fedilab.android.webview.CustomWebview;
import app.fedilab.android.webview.MastalabWebChromeClient;
import app.fedilab.android.webview.MastalabWebViewClient;
import es.dmoral.toasty.Toasty;
......@@ -72,7 +72,7 @@ public class WebviewActivity extends BaseActivity {
private String url;
private String peertubeLinkToFetch;
private boolean peertubeLink;
private WebView webView;
private CustomWebview webView;
private Menu defaultMenu;
private MastalabWebViewClient mastalabWebViewClient;
......
......@@ -51,6 +51,7 @@ import app.fedilab.android.R;
import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask;
import app.fedilab.android.client.HttpsConnection;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.webview.CustomWebview;
import es.dmoral.toasty.Toasty;
/**
......@@ -60,7 +61,7 @@ import es.dmoral.toasty.Toasty;
public class WebviewConnectActivity extends BaseActivity {
private WebView webView;
private CustomWebview webView;
private AlertDialog alert;
private String clientId, clientSecret;
private String instance;
......
......@@ -33,6 +33,7 @@ import java.util.List;
import javax.net.ssl.HttpsURLConnection;
import app.fedilab.android.R;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.sqlite.DomainBlockDAO;
import app.fedilab.android.sqlite.Sqlite;
import es.dmoral.toasty.Toasty;
......@@ -61,12 +62,10 @@ public class DownloadTrackingDomainsAsyncTask extends AsyncTask<Void, Void, Bool
BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
List<String> domains = new ArrayList<>();
boolean canRecord = false;
while ((line = br.readLine()) != null) {
if (canRecord)
if (line.startsWith("0.0.0.0 ")) {
domains.add(line.replace("0.0.0.0 ", "").trim());
else if (line.contains("# Blocked domains"))
canRecord = true;
}
}
br.close();
connection.disconnect();
......
......@@ -369,9 +369,9 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
List<app.fedilab.android.client.Entities.Status> statuses = new StatusCacheDAO(contextReference.get(), db).getAllStatus(StatusCacheDAO.BOOKMARK_CACHE);
if (statuses != null) {
for (app.fedilab.android.client.Entities.Status status : statuses) {
app.fedilab.android.client.Entities.Status.fillSpan(contextReference.get(), status);
app.fedilab.android.client.Entities.Status.makeEmojiPoll(contextReference.get(), status.getReblog() != null ? status.getReblog().getPoll() : status.getPoll());
Account.makeAccountNameEmoji(contextReference.get(), status.getReblog() != null ? status.getReblog().getAccount() : status.getAccount());
app.fedilab.android.client.Entities.Status.fillSpan(contextReference, status);
app.fedilab.android.client.Entities.Status.makeEmojiPoll(contextReference, status.getReblog() != null ? status.getReblog().getPoll() : status.getPoll());
Account.makeAccountNameEmoji(contextReference, status.getReblog() != null ? status.getReblog().getAccount() : status.getAccount());
}
} else {
statuses = new ArrayList<>();
......
......@@ -47,6 +47,7 @@ import com.bumptech.glide.request.transition.Transition;
import org.jetbrains.annotations.NotNull;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
......@@ -199,7 +200,8 @@ public class Account implements Parcelable {
this.invited_by_account_id = in.readString();
}
public static void makeAccountNameEmoji(final Context context, Account account) {
public static void makeAccountNameEmoji(final WeakReference<Context> contextWeakReference, Account account) {
Context context = contextWeakReference.get();
if ((context instanceof Activity && ((Activity) context).isFinishing()) || account.getDisplay_name() == null)
return;
......@@ -225,13 +227,16 @@ public class Account implements Parcelable {
//emojis can be used several times so we have to loop
for (int startPosition = -1; (startPosition = displayNameSpan.toString().indexOf(targetedEmoji, startPosition + 1)) != -1; startPosition++) {
final int endPosition = startPosition + targetedEmoji.length();
if (endPosition <= displayNameSpan.toString().length() && endPosition >= startPosition) {
resource.setBounds(0, 0, (int) Helper.convertDpToPixel(20, context), (int) Helper.convertDpToPixel(20, context));
resource.setVisible(true, true);
ImageSpan imageSpan = new ImageSpan(resource);
displayNameSpan.setSpan(
imageSpan, startPosition,
endPosition, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
if (resource != null && endPosition <= displayNameSpan.toString().length() && endPosition >= startPosition) {
try {
resource.setBounds(0, 0, (int) Helper.convertDpToPixel(20, context), (int) Helper.convertDpToPixel(20, context));
resource.setVisible(true, true);
ImageSpan imageSpan = new ImageSpan(resource);
displayNameSpan.setSpan(
imageSpan, startPosition,
endPosition, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
} catch (Exception ignored) {
}
return;
}
}
......
......@@ -52,7 +52,7 @@ public class AccountAdmin implements Parcelable {
public AccountAdmin() {
}
protected AccountAdmin(Parcel in) {
private AccountAdmin(Parcel in) {
this.id = in.readString();
this.username = in.readString();
long tmpCreated_at = in.readLong();
......
......@@ -45,6 +45,7 @@ public class AccountCreation {
this.password = password;
}
@SuppressWarnings("unused")
public String getPasswordConfirm() {
return passwordConfirm;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment