forked from sk22/megalodon
-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef23734
commit 0c8f903
Showing
9 changed files
with
941 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
841 changes: 841 additions & 0 deletions
841
mastodon/src/main/java/org/joinmastodon/android/FileProvider.java
Large diffs are not rendered by default.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
mastodon/src/main/java/org/joinmastodon/android/TweakedFileProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.joinmastodon.android; | ||
|
||
import android.database.Cursor; | ||
import android.net.Uri; | ||
import android.os.ParcelFileDescriptor; | ||
import android.util.Log; | ||
|
||
import java.io.FileNotFoundException; | ||
import java.util.Arrays; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
public class TweakedFileProvider extends FileProvider{ | ||
private static final String TAG="TweakedFileProvider"; | ||
|
||
@Override | ||
public String getType(@NonNull Uri uri){ | ||
Log.d(TAG, "getType() called with: uri = ["+uri+"]"); | ||
if(uri.getPathSegments().get(0).equals("image_cache")){ | ||
Log.i(TAG, "getType: HERE!"); | ||
return "image/jpeg"; // might as well be a png but image decoding APIs don't care, needs to be image/* though | ||
} | ||
return super.getType(uri); | ||
} | ||
|
||
@Override | ||
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder){ | ||
Log.d(TAG, "query() called with: uri = ["+uri+"], projection = ["+Arrays.toString(projection)+"], selection = ["+selection+"], selectionArgs = ["+Arrays.toString(selectionArgs)+"], sortOrder = ["+sortOrder+"]"); | ||
return super.query(uri, projection, selection, selectionArgs, sortOrder); | ||
} | ||
|
||
@Override | ||
public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException{ | ||
Log.d(TAG, "openFile() called with: uri = ["+uri+"], mode = ["+mode+"]"); | ||
return super.openFile(uri, mode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<paths> | ||
<cache-path name="image_cache" path="images/"/> | ||
</paths> |