media in notifications
This commit is contained in:
parent
796f52b7be
commit
2513a2f305
|
@ -41,6 +41,7 @@
|
||||||
android:required="false" />
|
android:required="false" />
|
||||||
<application
|
<application
|
||||||
android:name="app.fedilab.android.activities.MainApplication"
|
android:name="app.fedilab.android.activities.MainApplication"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
android:icon="@mipmap/ic_launcher_bubbles"
|
android:icon="@mipmap/ic_launcher_bubbles"
|
||||||
|
|
|
@ -158,7 +158,15 @@ public class SlideMediaActivity extends BaseActivity implements OnDownloadInterf
|
||||||
int position = mPager.getCurrentItem();
|
int position = mPager.getCurrentItem();
|
||||||
Attachment attachment = attachments.get(position);
|
Attachment attachment = attachments.get(position);
|
||||||
if( attachment.getType().compareTo("image") == 0 ){
|
if( attachment.getType().compareTo("image") == 0 ){
|
||||||
Helper.manageMove(SlideMediaActivity.this, attachment.getUrl(), false);
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
|
if (ContextCompat.checkSelfPermission(SlideMediaActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(SlideMediaActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
ActivityCompat.requestPermissions(SlideMediaActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, Helper.EXTERNAL_STORAGE_REQUEST_CODE);
|
||||||
|
} else {
|
||||||
|
Helper.manageMove(SlideMediaActivity.this, attachment.getUrl(), false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Helper.manageMove(SlideMediaActivity.this, attachment.getUrl(), false);
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
if (ContextCompat.checkSelfPermission(SlideMediaActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(SlideMediaActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
if (ContextCompat.checkSelfPermission(SlideMediaActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(SlideMediaActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
|
|
@ -202,7 +202,8 @@ public class HttpsConnection {
|
||||||
|
|
||||||
.url(httpBuider.build())
|
.url(httpBuider.build())
|
||||||
.build();
|
.build();
|
||||||
try (Response httpresponse = client.newCall(requesthttp).execute()) {
|
try {
|
||||||
|
Response httpresponse = client.newCall(requesthttp).execute();
|
||||||
assert httpresponse.body() != null;
|
assert httpresponse.body() != null;
|
||||||
String response = httpresponse.body().string();
|
String response = httpresponse.body().string();
|
||||||
int code = httpresponse.code();
|
int code = httpresponse.code();
|
||||||
|
@ -213,7 +214,8 @@ public class HttpsConnection {
|
||||||
} else {
|
} else {
|
||||||
throw new HttpsConnectionException(code, error);
|
throw new HttpsConnectionException(code, error);
|
||||||
}
|
}
|
||||||
} finally {
|
} catch (Exception ignored){}
|
||||||
|
finally {
|
||||||
if (!cache.isClosed()) {
|
if (!cache.isClosed()) {
|
||||||
try {
|
try {
|
||||||
cache.close();
|
cache.close();
|
||||||
|
@ -222,6 +224,7 @@ public class HttpsConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
if (proxy != null)
|
if (proxy != null)
|
||||||
|
|
|
@ -145,6 +145,9 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<String> getPreloadItems(int position) {
|
public List<String> getPreloadItems(int position) {
|
||||||
|
if( statuses == null || statuses.size() == 0){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
Status status = statuses.get(position);
|
Status status = statuses.get(position);
|
||||||
if (status.getMedia_attachments() == null || status.getMedia_attachments().size() ==0) {
|
if (status.getMedia_attachments() == null || status.getMedia_attachments().size() ==0) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
|
Loading…
Reference in New Issue