Merge branch 'develop'

This commit is contained in:
Thomas 2020-07-10 18:09:55 +02:00
commit 095b42b540
8 changed files with 24 additions and 9 deletions

View File

@ -6,8 +6,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 19 minSdkVersion 19
targetSdkVersion 29 targetSdkVersion 29
versionCode 375 versionCode 376
versionName "2.36.1" versionName "2.36.2"
multiDexEnabled true multiDexEnabled true
renderscriptTargetApi 28 as int renderscriptTargetApi 28 as int
renderscriptSupportModeEnabled true renderscriptSupportModeEnabled true

View File

@ -0,0 +1,2 @@
Fixed:
- Crash when adding media (Pixelfed/Mastodon)

View File

@ -248,6 +248,9 @@ public class LoginActivity extends BaseActivity {
return; return;
} }
instance = login_instance.getText().toString().trim().toLowerCase(); instance = login_instance.getText().toString().trim().toLowerCase();
if(instance.length() == 0) {
return;
}
connect_button.setEnabled(false); connect_button.setEnabled(false);
new Thread(() -> { new Thread(() -> {
instanceNodeInfo = new API(LoginActivity.this).displayNodeInfo(instance); instanceNodeInfo = new API(LoginActivity.this).displayNodeInfo(instance);

View File

@ -113,6 +113,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Objects; import java.util.Objects;
import java.util.Random;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.UUID; import java.util.UUID;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -1265,7 +1266,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
toot_space_left.setText("0"); toot_space_left.setText("0");
if (attachments != null) { if (attachments != null) {
for (Attachment attachment : attachments) { for (Attachment attachment : attachments) {
View namebar = findViewById(Integer.parseInt(attachment.getId())); View namebar = findViewById(attachment.getViewId());
if (namebar != null && namebar.getParent() != null) if (namebar != null && namebar.getParent() != null)
((ViewGroup) namebar.getParent()).removeView(namebar); ((ViewGroup) namebar.getParent()).removeView(namebar);
} }
@ -1463,7 +1464,7 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
toot_space_left.setText("0"); toot_space_left.setText("0");
if (attachments != null) { if (attachments != null) {
for (Attachment attachment : attachments) { for (Attachment attachment : attachments) {
View namebar = findViewById(Integer.parseInt(attachment.getId())); View namebar = findViewById(attachment.getViewId());
if (namebar != null && namebar.getParent() != null) if (namebar != null && namebar.getParent() != null)
((ViewGroup) namebar.getParent()).removeView(namebar); ((ViewGroup) namebar.getParent()).removeView(namebar);
} }
@ -1795,7 +1796,10 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
if (url == null || url.trim().equals("")) if (url == null || url.trim().equals(""))
url = attachment.getUrl(); url = attachment.getUrl();
final ImageView imageView = new ImageView(PixelfedComposeActivity.this); final ImageView imageView = new ImageView(PixelfedComposeActivity.this);
imageView.setId(Integer.parseInt(attachment.getId())); Random rand = new Random();
int n = rand.nextInt(10000000);
imageView.setId(n);
attachment.setViewId(n);
LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
imParams.setMargins(20, 5, 20, 5); imParams.setMargins(20, 5, 20, 5);

View File

@ -2244,7 +2244,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
toot_space_left.setText("0"); toot_space_left.setText("0");
if (attachments != null) { if (attachments != null) {
for (Attachment attachment : attachments) { for (Attachment attachment : attachments) {
View namebar = findViewById(Integer.parseInt(attachment.getId())); View namebar = findViewById(attachment.getViewId());
if (namebar != null && namebar.getParent() != null) if (namebar != null && namebar.getParent() != null)
((ViewGroup) namebar.getParent()).removeView(namebar); ((ViewGroup) namebar.getParent()).removeView(namebar);
} }
@ -2582,7 +2582,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
toot_space_left.setText("0"); toot_space_left.setText("0");
if (attachments != null) { if (attachments != null) {
for (Attachment attachment : attachments) { for (Attachment attachment : attachments) {
View namebar = findViewById(Integer.parseInt(attachment.getId())); View namebar = findViewById(attachment.getViewId());
if (namebar != null && namebar.getParent() != null) if (namebar != null && namebar.getParent() != null)
((ViewGroup) namebar.getParent()).removeView(namebar); ((ViewGroup) namebar.getParent()).removeView(namebar);
} }
@ -3045,7 +3045,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
if (url == null || url.trim().equals("")) if (url == null || url.trim().equals(""))
url = attachment.getUrl(); url = attachment.getUrl();
final ImageView imageView = new ImageView(TootActivity.this); final ImageView imageView = new ImageView(TootActivity.this);
imageView.setId(Integer.parseInt(attachment.getId())); imageView.setId(attachment.getViewId());
LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
imParams.setMargins(20, 5, 20, 5); imParams.setMargins(20, 5, 20, 5);
@ -3193,7 +3193,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
if (url == null || url.trim().equals("")) if (url == null || url.trim().equals(""))
url = attachment.getUrl(); url = attachment.getUrl();
final ImageView imageView = new ImageView(TootActivity.this); final ImageView imageView = new ImageView(TootActivity.this);
imageView.setId(Integer.parseInt(attachment.getId())); imageView.setId(attachment.getViewId());
LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); LinearLayout.LayoutParams imParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
imParams.setMargins(20, 5, 20, 5); imParams.setMargins(20, 5, 20, 5);

View File

@ -2224,6 +2224,9 @@ public class API {
public InstanceNodeInfo displayNodeInfo(String domain) { public InstanceNodeInfo displayNodeInfo(String domain) {
if( domain == null) {
return null;
}
String response; String response;
InstanceNodeInfo instanceNodeInfo = new InstanceNodeInfo(); InstanceNodeInfo instanceNodeInfo = new InstanceNodeInfo();
if (domain.startsWith("http://")) { if (domain.startsWith("http://")) {

View File

@ -26,6 +26,7 @@
android:id="@+id/appBar" android:id="@+id/appBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/cyanea_primary_dark"
android:fitsSystemWindows="true"> android:fitsSystemWindows="true">
<com.google.android.material.appbar.CollapsingToolbarLayout <com.google.android.material.appbar.CollapsingToolbarLayout

View File

@ -0,0 +1,2 @@
Fixed:
- Crash when adding media (Pixelfed/Mastodon)