Skip to content

Commit

Permalink
gradle update and some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Praharsh Jain committed Jun 15, 2022
1 parent 80c3d8b commit 9c3cc36
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 33 deletions.
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1651264206881</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
4 changes: 2 additions & 2 deletions .settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=
eclipse.preferences.version=1
gradle.user.home=
java.home=/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home
java.home=/Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/Home
jvm.arguments=
offline.mode=false
offline.mode=true
override.workspace.settings=true
show.console.view=true
show.executions.view=true
11 changes: 6 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 32
buildToolsVersion '33.0.0 rc2'
compileSdkVersion 33
buildToolsVersion '33.0.0'

defaultConfig {
applicationId "com.praharsh.vudit"
minSdkVersion 17
targetSdkVersion 32
targetSdkVersion 33
versionCode 1
versionName "1.0"
}
Expand All @@ -18,13 +18,14 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
namespace 'com.praharsh.vudit'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.7.0-alpha01'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.7.0-alpha02'
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'com.github.piasy:BigImageViewer:1.8.1'
implementation 'com.github.piasy:ProgressPieIndicator:1.8.1'
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.praharsh.vudit">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Expand All @@ -14,6 +14,7 @@
android:installLocation="preferExternal"
android:label="@string/app_name"
android:logo="@mipmap/ic_launcher"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<provider
Expand Down
38 changes: 27 additions & 11 deletions app/src/main/java/com/praharsh/vudit/FileViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import android.Manifest;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.app.SearchManager;
import android.content.ActivityNotFoundException;
import android.content.Context;
Expand All @@ -25,6 +26,7 @@
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.provider.Settings;
import android.view.ContextMenu;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -73,6 +75,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
Expand All @@ -95,6 +98,7 @@ public class FileViewer extends AppCompatActivity
private static final String[] requiredpermissions = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.MANAGE_EXTERNAL_STORAGE,
Manifest.permission.INTERNET,
Manifest.permission.ACCESS_NETWORK_STATE,
};
Expand Down Expand Up @@ -278,7 +282,7 @@ protected void onCreate(Bundle savedInstanceState) {
navigationView.setNavigationItemSelectedListener(this);
lv = findViewById(R.id.list);
registerForContextMenu(lv);
emptyListView=findViewById(R.id.empty);
emptyListView = findViewById(R.id.empty);
lv.setEmptyView(emptyListView);
lv.setOnItemClickListener((adapterView, view, i, l) -> openFile(files[i]));
homeViewLayout = findViewById(R.id.home_view);
Expand Down Expand Up @@ -339,6 +343,7 @@ protected void onCreate(Bundle savedInstanceState) {
final File f = new File(path);
if (f.exists()) {
RelativeLayout storageView = (RelativeLayout) getLayoutInflater().inflate(R.layout.storage_view, null, false);
storageView.setBackgroundColor(android.R.drawable.dialog_holo_dark_frame);
TextView details = storageView.findViewById(R.id.storage_details);
TextView name = storageView.findViewById(R.id.storage_name);
ProgressBar storageBar = storageView.findViewById(R.id.storage_bar);
Expand Down Expand Up @@ -572,15 +577,16 @@ public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMen
} else {
menu.add(Menu.NONE, 1, Menu.NONE, "Open with default system action");
String ext = Util.extension(current_file.getName());
if (Util.web_ext.contains(ext))
if (Util.web_ext.contains(ext)) {
menu.add(Menu.NONE, 2, Menu.NONE, "Preview");
}
menu.add(Menu.NONE, 3, Menu.NONE, "Share");
}
if (recentsView) {
menu.add(Menu.NONE, 4, Menu.NONE, "Remove from Recent Items");
} else if (favouritesView) {
menu.add(Menu.NONE, 4, Menu.NONE, "Open parent directory");
} else {
} else if (current_file.canWrite()) {
menu.add(Menu.NONE, 4, Menu.NONE, "Delete");
}
menu.add(Menu.NONE, 5, Menu.NONE, favouritesView ? "Remove from Favourites" : "Add to Favourites");
Expand Down Expand Up @@ -622,8 +628,9 @@ public boolean onContextItemSelected(MenuItem item) {
share.setAction(Intent.ACTION_SEND);
MimeTypeMap myMime = MimeTypeMap.getSingleton();
String mimeType = myMime.getMimeTypeFromExtension(Util.extension(current_file.getName()));
Uri uri = FileProvider.getUriForFile(getApplicationContext(), getApplicationContext().getPackageName(), current_file);
share.setType(mimeType);
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(current_file));
share.putExtra(Intent.EXTRA_STREAM, uri);
try {
startActivity(share);
} catch (Exception e) {
Expand Down Expand Up @@ -975,7 +982,10 @@ private void showProperties(final File current_file) {
year = ((year == null || "".equals(year)) ? "Unknown" : year);
bitrate = meta.extractMetadata(MediaMetadataRetriever.METADATA_KEY_BITRATE);
bitrate = ((bitrate == null || "".equals(bitrate)) ? "Unknown" : bitrate);
meta.release();
try {
meta.release();
} catch (IOException e) {
}
info += "\nTrack Duration : " + Util.getFormattedTimeDuration(duration);
info += "\nAlbum : " + album;
info += "\nArtist : " + artist;
Expand Down Expand Up @@ -1018,7 +1028,10 @@ private void showProperties(final File current_file) {
height = ((height == null || "".equals(height)) ? "Unknown" : height);
String width = meta.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH);
width = ((width == null || "".equals(width)) ? "Unknown" : width);
meta.release();
try {
meta.release();
}catch (IOException e){
}
info += "\nTrack Duration : " + Util.getFormattedTimeDuration(duration);
info += "\nBitrate : " + bitrate;
info += "\nWidth : " + width;
Expand Down Expand Up @@ -1321,7 +1334,6 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in
for (int res : grantResults) {
if (res != PackageManager.PERMISSION_GRANTED) {
showMsg("Permissions not granted", 0);
finish();
return;
}
}
Expand All @@ -1344,6 +1356,11 @@ private void checkAndRequestPermissions() {
if (!neededPermissions.isEmpty()) {
ActivityCompat.requestPermissions(this, neededPermissions.toArray(new String[neededPermissions.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);
}
if (SDK_INT >= Build.VERSION_CODES.R && !Environment.isExternalStorageManager()) {
Intent in = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
in.setData(Uri.fromParts("package", getPackageName(), null));
startActivity(in);
}
}

private void showMsg(String msg, int mode) {
Expand All @@ -1365,12 +1382,11 @@ private boolean appInstalled(String uri) {
}

private void listMediaFiles(int type) {
Uri uri = null;
String toolbarTitle = "";
String selectionQuery = null;
String[] selectionArgs = null;
ArrayList<File> fileList = null;
uri = MediaStore.Files.getContentUri("external");
Uri uri = MediaStore.Files.getContentUri("external");
switch (type) {
case 1: //images
toolbarTitle = "Pictures";
Expand Down Expand Up @@ -1463,8 +1479,8 @@ private void requestSDCardPermissions(String cardPath) {

private void switchToHomeView() {
homeView = true;
recentsView=false;
favouritesView=false;
recentsView = false;
favouritesView = false;
toolbar.setTitle("Vudit");
homeViewLayout.setVisibility(View.VISIBLE);
lv.setVisibility(View.GONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public void onProgressChanged(WebView view, int progress) {
settings.setDomStorageEnabled(true);
settings.setAllowFileAccess(true);
settings.setAllowContentAccess(true);
settings.setAppCacheEnabled(true);
settings.setDatabaseEnabled(true);
settings.setPluginState(WebSettings.PluginState.ON);
settings.setAllowFileAccessFromFileURLs(true);
Expand Down
Loading

0 comments on commit 9c3cc36

Please sign in to comment.