Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc086a1e0b | ||
|
|
2a056aeb2e | ||
|
|
9e70ebc2a6 | ||
|
|
9686127f81 | ||
|
|
395c36ee83 | ||
|
|
906ff24e76 | ||
|
|
c8af974852 | ||
|
|
481339e2f5 | ||
|
|
b2ecae63a8 | ||
|
|
a67f798f2f | ||
|
|
d69485b70b | ||
|
|
421dfcca39 |
229
.idea/codeStyleSettings.xml
generated
229
.idea/codeStyleSettings.xml
generated
@@ -1,229 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectCodeStyleSettingsManager">
|
|
||||||
<option name="PER_PROJECT_SETTINGS">
|
|
||||||
<value>
|
|
||||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
|
|
||||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
|
|
||||||
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
|
|
||||||
<value />
|
|
||||||
</option>
|
|
||||||
<option name="IMPORT_LAYOUT_TABLE">
|
|
||||||
<value>
|
|
||||||
<package name="android" withSubpackages="true" static="false" />
|
|
||||||
<emptyLine />
|
|
||||||
<package name="com" withSubpackages="true" static="false" />
|
|
||||||
<emptyLine />
|
|
||||||
<package name="junit" withSubpackages="true" static="false" />
|
|
||||||
<emptyLine />
|
|
||||||
<package name="net" withSubpackages="true" static="false" />
|
|
||||||
<emptyLine />
|
|
||||||
<package name="org" withSubpackages="true" static="false" />
|
|
||||||
<emptyLine />
|
|
||||||
<package name="java" withSubpackages="true" static="false" />
|
|
||||||
<emptyLine />
|
|
||||||
<package name="javax" withSubpackages="true" static="false" />
|
|
||||||
<emptyLine />
|
|
||||||
<package name="" withSubpackages="true" static="false" />
|
|
||||||
<emptyLine />
|
|
||||||
<package name="" withSubpackages="true" static="true" />
|
|
||||||
<emptyLine />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="RIGHT_MARGIN" value="100" />
|
|
||||||
<AndroidXmlCodeStyleSettings>
|
|
||||||
<option name="USE_CUSTOM_SETTINGS" value="true" />
|
|
||||||
</AndroidXmlCodeStyleSettings>
|
|
||||||
<Objective-C-extensions>
|
|
||||||
<option name="GENERATE_INSTANCE_VARIABLES_FOR_PROPERTIES" value="ASK" />
|
|
||||||
<option name="RELEASE_STYLE" value="IVAR" />
|
|
||||||
<option name="TYPE_QUALIFIERS_PLACEMENT" value="BEFORE" />
|
|
||||||
<file>
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
|
||||||
</file>
|
|
||||||
<class>
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
|
||||||
</class>
|
|
||||||
<extensions>
|
|
||||||
<pair source="cpp" header="h" />
|
|
||||||
<pair source="c" header="h" />
|
|
||||||
</extensions>
|
|
||||||
</Objective-C-extensions>
|
|
||||||
<XML>
|
|
||||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
|
||||||
</XML>
|
|
||||||
<codeStyleSettings language="XML">
|
|
||||||
<option name="FORCE_REARRANGE_MODE" value="1" />
|
|
||||||
<indentOptions>
|
|
||||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
|
||||||
</indentOptions>
|
|
||||||
<arrangement>
|
|
||||||
<rules>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>xmlns:android</NAME>
|
|
||||||
<XML_NAMESPACE>Namespace:</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>xmlns:.*</NAME>
|
|
||||||
<XML_NAMESPACE>Namespace:</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
<order>BY_NAME</order>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>.*:id</NAME>
|
|
||||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>.*:name</NAME>
|
|
||||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>name</NAME>
|
|
||||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>style</NAME>
|
|
||||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>.*</NAME>
|
|
||||||
<XML_NAMESPACE>^$</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
<order>BY_NAME</order>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>.*:layout_width</NAME>
|
|
||||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>.*:layout_height</NAME>
|
|
||||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>.*:layout_.*</NAME>
|
|
||||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
<order>BY_NAME</order>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>.*:width</NAME>
|
|
||||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
<order>BY_NAME</order>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>.*:height</NAME>
|
|
||||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
<order>BY_NAME</order>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>.*</NAME>
|
|
||||||
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
<order>BY_NAME</order>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<rule>
|
|
||||||
<match>
|
|
||||||
<AND>
|
|
||||||
<NAME>.*</NAME>
|
|
||||||
<XML_NAMESPACE>.*</XML_NAMESPACE>
|
|
||||||
</AND>
|
|
||||||
</match>
|
|
||||||
<order>BY_NAME</order>
|
|
||||||
</rule>
|
|
||||||
</section>
|
|
||||||
</rules>
|
|
||||||
</arrangement>
|
|
||||||
</codeStyleSettings>
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="TermuxCodeStyle" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
8
.idea/gradle.xml
generated
8
.idea/gradle.xml
generated
@@ -3,16 +3,20 @@
|
|||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="disableWrapperSourceDistributionNotification" value="true" />
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="1.8" />
|
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
|
<option name="myModules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
15
.idea/inspectionProfiles/Project_Default.xml
generated
15
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -1,15 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="AndroidLintGoogleAppIndexingWarning" enabled="false" level="WARNING" enabled_by_default="false" />
|
|
||||||
<inspection_tool class="EmptyStatementBody" enabled="true" level="WARNING" enabled_by_default="true">
|
|
||||||
<option name="m_reportEmptyBlocks" value="true" />
|
|
||||||
<option name="commentsAreContent" value="true" />
|
|
||||||
</inspection_tool>
|
|
||||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
|
||||||
<option name="processCode" value="true" />
|
|
||||||
<option name="processLiterals" value="true" />
|
|
||||||
<option name="processComments" value="true" />
|
|
||||||
</inspection_tool>
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
||||||
7
.idea/inspectionProfiles/profiles_settings.xml
generated
7
.idea/inspectionProfiles/profiles_settings.xml
generated
@@ -1,7 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<settings>
|
|
||||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
|
||||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
|
||||||
<version value="1.0" />
|
|
||||||
</settings>
|
|
||||||
</component>
|
|
||||||
@@ -18,8 +18,8 @@ android {
|
|||||||
applicationId "com.termux"
|
applicationId "com.termux"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 31
|
versionCode 33
|
||||||
versionName "0.31"
|
versionName "0.33"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -49,12 +49,27 @@
|
|||||||
android:taskAffinity="com.termux.filereceiver"
|
android:taskAffinity="com.termux.filereceiver"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:noHistory="true">
|
android:noHistory="true">
|
||||||
|
<!-- Accept multiple file types when sending. -->
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
<action android:name="android.intent.action.EDIT" />
|
|
||||||
<action android:name="android.intent.action.SEND"/>
|
<action android:name="android.intent.action.SEND"/>
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<data android:mimeType="*/*" />
|
<data android:mimeType="application/*" />
|
||||||
|
<data android:mimeType="audio/*" />
|
||||||
|
<data android:mimeType="image/*" />
|
||||||
|
<data android:mimeType="message/*" />
|
||||||
|
<data android:mimeType="multipart/*" />
|
||||||
|
<data android:mimeType="text/*" />
|
||||||
|
<data android:mimeType="video/*" />
|
||||||
|
</intent-filter>
|
||||||
|
<!-- Be more restrictive for viewing files, restricting ourselves to text files. -->
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="text/*" />
|
||||||
|
<data android:mimeType="application/json" />
|
||||||
|
<data android:mimeType="application/*xml*" />
|
||||||
|
<data android:mimeType="application/*latex*" />
|
||||||
|
<data android:mimeType="application/javascript" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
@@ -78,7 +93,7 @@
|
|||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<provider android:authorities="com.termux.filepicker.provider"
|
<provider android:authorities="com.termux.filepicker.provider"
|
||||||
android:readPermission="com.termux.filepickder.READ"
|
android:readPermission="com.termux.filepicker.READ"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:grantUriPermissions="true"
|
android:grantUriPermissions="true"
|
||||||
android:name="com.termux.filepicker.TermuxFilePickerProvider" />
|
android:name="com.termux.filepicker.TermuxFilePickerProvider" />
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import android.text.SpannableString;
|
|||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@@ -678,7 +679,13 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
|||||||
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
String url = (String) urls[position];
|
String url = (String) urls[position];
|
||||||
startActivity(Intent.createChooser(new Intent(Intent.ACTION_VIEW, Uri.parse(url)), null));
|
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||||
|
try {
|
||||||
|
startActivity(i, null);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
// If no applications match, Android displays a system message.
|
||||||
|
startActivity(Intent.createChooser(i, null));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.content.Context;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.DialogInterface.OnDismissListener;
|
import android.content.DialogInterface.OnDismissListener;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.system.Os;
|
import android.system.Os;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -23,6 +24,7 @@ import java.io.InputStreamReader;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipInputStream;
|
import java.util.zip.ZipInputStream;
|
||||||
@@ -178,16 +180,25 @@ final class TermuxInstaller {
|
|||||||
|
|
||||||
/** Get bootstrap zip url for this systems cpu architecture. */
|
/** Get bootstrap zip url for this systems cpu architecture. */
|
||||||
static URL determineZipUrl() throws MalformedURLException {
|
static URL determineZipUrl() throws MalformedURLException {
|
||||||
String arch = System.getProperty("os.arch");
|
String termuxArch = null;
|
||||||
if (arch.startsWith("armv8")) {
|
// Note that we cannot use System.getProperty("os.arch") since that may give e.g. "aarch64"
|
||||||
arch = "aarch64";
|
// while a 64-bit runtime may not be installed (like on the Samsung Galaxy S5 Neo).
|
||||||
} else if (arch.startsWith("arm")) {
|
// Instead we search through the supported abi:s on the device, see:
|
||||||
// Handle different arm variants such as armv7l:
|
// http://developer.android.com/ndk/guides/abis.html
|
||||||
arch = "arm";
|
// Note that we search for abi:s in preferred order, and want to avoid installing arm on
|
||||||
} else if (arch.startsWith("x86")) { // "x86" on arcwelder, "x86_64" on 64-bit android.
|
// an x86 system where arm emulation is available.
|
||||||
arch = "i686";
|
final String[] androidArchNames = {"arm64-v8a", "x86", "armeabi-v7a"};
|
||||||
|
final String[] termuxArchNames = {"aarch64", "i686", "arm"};
|
||||||
|
|
||||||
|
final List<String> supportedArches = Arrays.asList(Build.SUPPORTED_ABIS);
|
||||||
|
for (int i = 0; i < termuxArchNames.length; i++) {
|
||||||
|
if (supportedArches.contains(androidArchNames[i])) {
|
||||||
|
termuxArch = termuxArchNames[i];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return new URL("https://termux.net/bootstrap/bootstrap-" + arch + ".zip");
|
}
|
||||||
|
|
||||||
|
return new URL("https://termux.net/bootstrap/bootstrap-" + termuxArch + ".zip");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Delete a folder and all its content or throw. */
|
/** Delete a folder and all its content or throw. */
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.termux.filepicker;
|
package com.termux.filepicker;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -12,6 +11,7 @@ import android.widget.ArrayAdapter;
|
|||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import com.termux.R;
|
import com.termux.R;
|
||||||
|
import com.termux.app.TermuxService;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -23,9 +23,6 @@ import java.util.List;
|
|||||||
/** Activity allowing picking files from the $HOME folder. */
|
/** Activity allowing picking files from the $HOME folder. */
|
||||||
public class TermuxFilePickerActivity extends ListActivity {
|
public class TermuxFilePickerActivity extends ListActivity {
|
||||||
|
|
||||||
@SuppressLint("SdCardPath")
|
|
||||||
final String TERMUX_HOME = "/data/data/com.termux/files/home";
|
|
||||||
|
|
||||||
private File mCurrentDirectory;
|
private File mCurrentDirectory;
|
||||||
private final List<File> mFiles = new ArrayList<>();
|
private final List<File> mFiles = new ArrayList<>();
|
||||||
private final List<String> mFileNames = new ArrayList<>();
|
private final List<String> mFileNames = new ArrayList<>();
|
||||||
@@ -38,7 +35,7 @@ public class TermuxFilePickerActivity extends ListActivity {
|
|||||||
|
|
||||||
mAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mFileNames);
|
mAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mFileNames);
|
||||||
|
|
||||||
enterDirectory(new File(TERMUX_HOME));
|
enterDirectory(new File(TermuxService.HOME_PATH));
|
||||||
setListAdapter(mAdapter);
|
setListAdapter(mAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,11 +66,11 @@ public class TermuxFilePickerActivity extends ListActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void enterDirectory(File directory) {
|
void enterDirectory(File directory) {
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(!directory.getAbsolutePath().equals(TERMUX_HOME));
|
getActionBar().setDisplayHomeAsUpEnabled(!directory.getAbsolutePath().equals(TermuxService.HOME_PATH));
|
||||||
|
|
||||||
String title = directory.getAbsolutePath() + "/";
|
String title = directory.getAbsolutePath() + "/";
|
||||||
if (title.startsWith(TERMUX_HOME)) {
|
if (title.startsWith(TermuxService.HOME_PATH)) {
|
||||||
title = "~" + title.substring(TERMUX_HOME.length(), title.length());
|
title = "~" + title.substring(TermuxService.HOME_PATH.length(), title.length());
|
||||||
}
|
}
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
|
|
||||||
|
|||||||
@@ -46,16 +46,6 @@ public class TermuxFileReceiverActivity extends Activity {
|
|||||||
final String type = intent.getType();
|
final String type = intent.getType();
|
||||||
final String scheme = intent.getScheme();
|
final String scheme = intent.getScheme();
|
||||||
|
|
||||||
if (intent.getExtras() == null) {
|
|
||||||
Log.e("termux", "NULL EXTRAS");
|
|
||||||
} else {
|
|
||||||
for (String key : intent.getExtras().keySet()) {
|
|
||||||
Object value = intent.getExtras().get(key);
|
|
||||||
Log.d("termux", String.format("Extra %s %s (%s)", key,
|
|
||||||
value.toString(), value.getClass().getName()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||||
final String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
|
final String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||||
final Uri sharedUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
final Uri sharedUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||||
@@ -74,9 +64,9 @@ public class TermuxFileReceiverActivity extends Activity {
|
|||||||
} else {
|
} else {
|
||||||
showErrorDialogAndQuit("Send action without content - nothing to save.");
|
showErrorDialogAndQuit("Send action without content - nothing to save.");
|
||||||
}
|
}
|
||||||
} else if (scheme.equals("content")) {
|
} else if ("content".equals(scheme)) {
|
||||||
handleContentUri(intent.getData(), intent.getStringExtra(Intent.EXTRA_TITLE));
|
handleContentUri(intent.getData(), intent.getStringExtra(Intent.EXTRA_TITLE));
|
||||||
} else if (scheme.equals("file")) {
|
} else if ("file".equals(scheme)) {
|
||||||
// When e.g. clicking on a downloaded apk:
|
// When e.g. clicking on a downloaded apk:
|
||||||
String path = intent.getData().getPath();
|
String path = intent.getData().getPath();
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
@@ -87,7 +77,7 @@ public class TermuxFileReceiverActivity extends Activity {
|
|||||||
showErrorDialogAndQuit("Cannot open file: " + e.getMessage() + ".");
|
showErrorDialogAndQuit("Cannot open file: " + e.getMessage() + ".");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showErrorDialogAndQuit("Unhandled scheme: " + intent.getScheme() + ".");
|
showErrorDialogAndQuit("Unable to receive any file or URL.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,25 +119,7 @@ public class TermuxFileReceiverActivity extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void promptNameAndSave(final InputStream in, final String attachmentFileName) {
|
void promptNameAndSave(final InputStream in, final String attachmentFileName) {
|
||||||
DialogUtils.textInput(this, R.string.file_received_title, attachmentFileName
|
DialogUtils.textInput(this, R.string.file_received_title, attachmentFileName, R.string.file_received_edit_button, new DialogUtils.TextSetListener() {
|
||||||
, android.R.string.ok, new DialogUtils.TextSetListener() {
|
|
||||||
@Override
|
|
||||||
public void onTextSet(final String text) {
|
|
||||||
if (saveStreamWithName(in, text) == null) return;
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}, R.string.file_received_open_folder_button, new DialogUtils.TextSetListener() {
|
|
||||||
@Override
|
|
||||||
public void onTextSet(String text) {
|
|
||||||
if (saveStreamWithName(in, text) == null) return;
|
|
||||||
|
|
||||||
Intent executeIntent = new Intent(TermuxService.ACTION_EXECUTE);
|
|
||||||
executeIntent.putExtra(TermuxService.EXTRA_CURRENT_WORKING_DIRECTORY, TERMUX_RECEIVEDIR);
|
|
||||||
executeIntent.setClass(TermuxFileReceiverActivity.this, TermuxService.class);
|
|
||||||
startService(executeIntent);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}, R.string.file_received_edit_button, new DialogUtils.TextSetListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextSet(String text) {
|
public void onTextSet(String text) {
|
||||||
File outFile = saveStreamWithName(in, text);
|
File outFile = saveStreamWithName(in, text);
|
||||||
@@ -171,6 +143,24 @@ public class TermuxFileReceiverActivity extends Activity {
|
|||||||
startService(executeIntent);
|
startService(executeIntent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
R.string.file_received_open_folder_button, new DialogUtils.TextSetListener() {
|
||||||
|
@Override
|
||||||
|
public void onTextSet(String text) {
|
||||||
|
if (saveStreamWithName(in, text) == null) return;
|
||||||
|
|
||||||
|
Intent executeIntent = new Intent(TermuxService.ACTION_EXECUTE);
|
||||||
|
executeIntent.putExtra(TermuxService.EXTRA_CURRENT_WORKING_DIRECTORY, TERMUX_RECEIVEDIR);
|
||||||
|
executeIntent.setClass(TermuxFileReceiverActivity.this, TermuxService.class);
|
||||||
|
startService(executeIntent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
android.R.string.cancel, new DialogUtils.TextSetListener() {
|
||||||
|
@Override
|
||||||
|
public void onTextSet(final String text) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}, new DialogInterface.OnDismissListener() {
|
}, new DialogInterface.OnDismissListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss(DialogInterface dialog) {
|
public void onDismiss(DialogInterface dialog) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
APP_ABI := armeabi-v7a x86
|
APP_ABI := arm64-v8a armeabi-v7a x86
|
||||||
APP_PLATFORM := android-21
|
APP_PLATFORM := android-21
|
||||||
NDK_TOOLCHAIN_VERSION := 4.9
|
NDK_TOOLCHAIN_VERSION := 4.9
|
||||||
APP_CFLAGS := -std=c11 -Wall -Wextra -Os -fno-stack-protector
|
APP_CFLAGS := -std=c11 -Wall -Wextra -Os -fno-stack-protector
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.5.0'
|
classpath 'com.android.tools.build:gradle:2.0.0'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|||||||
Reference in New Issue
Block a user