diff --git a/.idea/misc.xml b/.idea/misc.xml
index c43b055..ce84a50 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -10,6 +10,7 @@
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 836c6e2..94ff6e8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -15,6 +15,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.AsgardiusS3Manager"
tools:targetApi="31">
+
diff --git a/app/src/main/java/asgardius/page/s3manager/MainActivity.java b/app/src/main/java/asgardius/page/s3manager/MainActivity.java
index f5349e6..4a1ec00 100644
--- a/app/src/main/java/asgardius/page/s3manager/MainActivity.java
+++ b/app/src/main/java/asgardius/page/s3manager/MainActivity.java
@@ -23,6 +23,7 @@ public class MainActivity extends AppCompatActivity {
static boolean DEFAULT_PATH_STYLE_ACCESS = true;
String alias, username, password, endpoint;
RecyclerView recyclerView;
+ SQLiteDatabase db;
ArrayList Name;
ArrayList Img;
@@ -38,7 +39,7 @@ public class MainActivity extends AppCompatActivity {
recyclerView.setLayoutManager(linearLayoutManager);
MyDbHelper dbHelper = new MyDbHelper(this);
- SQLiteDatabase db = dbHelper.getWritableDatabase();
+ db = dbHelper.getWritableDatabase();
if (db != null) {
// Database Queries
System.out.println("Database OK");
@@ -50,6 +51,7 @@ public class MainActivity extends AppCompatActivity {
Name.add(cursor.getString(0));
Img.add(R.drawable.account);
}
+ db.close();
} else {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.broken_database), Toast.LENGTH_SHORT).show();
}
@@ -96,6 +98,7 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onClick(View view, int position) {
//System.out.println("Click on "+Name.get(position).toString());
+ db = dbHelper.getWritableDatabase();
if (db != null) {
// Database Queries
System.out.println("Database OK");
@@ -107,6 +110,7 @@ public class MainActivity extends AppCompatActivity {
endpoint = cursor.getString(0);
username = cursor.getString(1);
password = cursor.getString(2);
+ db.close();
explorer();
}
} catch (Exception e) {
diff --git a/app/src/main/java/asgardius/page/s3manager/TextViewer.java b/app/src/main/java/asgardius/page/s3manager/TextViewer.java
new file mode 100644
index 0000000..45f60ed
--- /dev/null
+++ b/app/src/main/java/asgardius/page/s3manager/TextViewer.java
@@ -0,0 +1,39 @@
+package asgardius.page.s3manager;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.os.Bundle;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class TextViewer extends AppCompatActivity {
+ EditText filecontent;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_text_viewer);
+ filecontent = (EditText)findViewById(R.id.textShow);
+
+ try {
+ // Create a URL for the desired page
+ URL url = new URL("yoursite.com/thefile.txt");
+
+ // Read all the text returned by the server
+ BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
+ String str = in.readLine();
+ in.close();
+ filecontent.setText(str);
+ } catch (MalformedURLException e) {
+ Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_conn_fail), Toast.LENGTH_SHORT).show();
+ } catch (IOException e) {
+ Toast.makeText(getApplicationContext(),getResources().getString(R.string.media_conn_fail), Toast.LENGTH_SHORT).show();
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_text_viewer.xml b/app/src/main/res/layout/activity_text_viewer.xml
new file mode 100644
index 0000000..d57867e
--- /dev/null
+++ b/app/src/main/res/layout/activity_text_viewer.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ec513ce..7848cf2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -24,7 +24,7 @@
File Explorer Test
Unsupported file type
Video Test
- Cannot retrieve media file
+ Cannot retrieve remote file
Invalid media file
Cannot connect to server
Dummy Button