mirror of
https://codeberg.org/gitnex/GitNex
synced 2025-03-09 16:10:50 +01:00
Update for issue 267
This commit is contained in:
parent
3a481084b6
commit
f7d5ee9e7a
@ -3,6 +3,7 @@ package org.mian.gitnex.activities;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
@ -11,6 +12,7 @@ import android.os.Environment;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
@ -206,6 +208,18 @@ public class FileViewActivity extends BaseActivity implements BottomSheetFileVie
|
||||
.nightMode(pdfNightMode)
|
||||
.load();
|
||||
|
||||
}
|
||||
else if (appUtil.excludeFilesInFileViewerExtension(fileExtension)) { // files need to be excluded
|
||||
|
||||
imageView.setVisibility(View.GONE);
|
||||
singleCodeContents.setVisibility(View.GONE);
|
||||
pdfViewFrame.setVisibility(View.GONE);
|
||||
singleFileContentsFrame.setVisibility(View.VISIBLE);
|
||||
|
||||
singleFileContents.setText(getResources().getString(R.string.excludeFilesInFileviewer));
|
||||
singleFileContents.setGravity(Gravity.CENTER);
|
||||
singleFileContents.setTypeface(null, Typeface.BOLD);
|
||||
|
||||
}
|
||||
else { // file type not known - plain text view
|
||||
|
||||
|
@ -218,7 +218,8 @@ public class AppUtil {
|
||||
"coffee", "rc", "rs", "rust", "basic", "clj", "css", "dart", "lisp", "erl", "hs", "lsp", "rkt",
|
||||
"ss", "llvm", "ll", "lua", "matlab", "pascal", "r", "scala", "sql", "latex", "tex", "vb", "vbs",
|
||||
"vhd", "tcl", "wiki.meta", "yaml", "yml", "markdown", "xml", "proto", "regex", "py", "pl", "js",
|
||||
"html", "htm", "volt", "ini", "htaccess", "conf", "gitignore", "gradle", "txt", "properties", "bat"};
|
||||
"html", "htm", "volt", "ini", "htaccess", "conf", "gitignore", "gradle", "txt", "properties", "bat",
|
||||
"twig"};
|
||||
|
||||
return Arrays.asList(extValues).contains(ext);
|
||||
|
||||
@ -240,6 +241,16 @@ public class AppUtil {
|
||||
|
||||
}
|
||||
|
||||
public Boolean excludeFilesInFileViewerExtension(String ext) {
|
||||
|
||||
String[] extValues = new String[] {"doc", "docx", "ppt", "pptx", "xls", "xlsx", "xlsm", "odt",
|
||||
"ott", "odf", "ods", "ots", "exe", "jar", "odg", "otg", "odp", "otp", "bin", "dmg", "psd",
|
||||
"xcf"};
|
||||
|
||||
return Arrays.asList(extValues).contains(ext);
|
||||
|
||||
}
|
||||
|
||||
public String getLastCharactersOfWord( String str, int count ) {
|
||||
|
||||
return str.substring(str.length() - count);
|
||||
|
@ -554,4 +554,5 @@
|
||||
<string name="downloadFile">Download This File</string>
|
||||
<string name="waitLoadingDownloadFile">Please wait for the file to load to memory</string>
|
||||
<string name="downloadFileSaved">File is saved to Download directory</string>
|
||||
<string name="excludeFilesInFileviewer">This file type is not supported in file viewer. Download it instead from the three dotted menu?</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user