file pick
This commit is contained in:
parent
77a9367e31
commit
46467b40f9
4 changed files with 56 additions and 1 deletions
|
@ -16,6 +16,7 @@
|
|||
<entry key="app/src/main/res/layout/activity_video_player.xml" value="0.1" />
|
||||
<entry key="app/src/main/res/layout/activity_web_view.xml" value="0.17119565217391305" />
|
||||
<entry key="app/src/main/res/layout/list_buckets.xml" value="0.19610507246376813" />
|
||||
<entry key="app/src/main/res/menu/bucket_menu.xml" value="0.20260416666666667" />
|
||||
<entry key="app/src/main/res/menu/folder_menu.xml" value="0.2713541666666667" />
|
||||
<entry key="app/src/main/res/menu/object_menu.xml" value="0.20260416666666667" />
|
||||
<entry key="app/src/main/res/menu/popup_menu.xml" value="0.2713541666666667" />
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package asgardius.page.s3manager;
|
||||
|
||||
import static android.media.MediaExtractor.MetricsConstants.MIME_TYPE;
|
||||
import static com.amazonaws.regions.Regions.US_EAST_1;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
@ -8,8 +9,11 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -29,7 +33,7 @@ public class BucketSelect extends AppCompatActivity {
|
|||
ArrayList Name;
|
||||
ArrayList Img;
|
||||
RecyclerView recyclerView;
|
||||
String username, password, endpoint, prefix, location;
|
||||
String username, password, endpoint, prefix, location, file;
|
||||
int treelevel;
|
||||
|
||||
@Override
|
||||
|
@ -119,6 +123,35 @@ public class BucketSelect extends AppCompatActivity {
|
|||
@Override
|
||||
public void onLongClick(View view, int position) {
|
||||
//System.out.println("Long click on "+Name.get(position).toString());
|
||||
PopupMenu popupMenu = new PopupMenu(recyclerView.getContext(), view);
|
||||
|
||||
// Inflating popup menu from popup_menu.xml file
|
||||
popupMenu.getMenuInflater().inflate(R.menu.bucket_menu, popupMenu.getMenu());
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
||||
// Toast message on menu item clicked
|
||||
//Toast.makeText(MainActivity.this, "You Clicked " + menuItem.getTitle(), Toast.LENGTH_SHORT).show();
|
||||
if (menuItem.getTitle() == getResources().getString(R.string.file_upload)) {
|
||||
Toast.makeText(BucketSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
|
||||
//upload();
|
||||
file = upload().getData() != null ? upload().getData().toString() : null;
|
||||
//System.out.println(file);
|
||||
//Toast.makeText(BucketSelect.this, intent.getData().toString(), Toast.LENGTH_SHORT).show();
|
||||
|
||||
} else if (menuItem.getTitle() == getResources().getString(R.string.file_del)) {
|
||||
Toast.makeText(BucketSelect.this, getResources().getString(R.string.pending_feature), Toast.LENGTH_SHORT).show();
|
||||
/*if (Name.size() == 1 && treelevel >= 1) {
|
||||
Toast.makeText(BucketSelect.this, getResources().getString(R.string.only_item_onlist), Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
delete(prefix + Name.get(position).toString(), true);
|
||||
}*/
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
// Showing the popup menu
|
||||
popupMenu.show();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -137,4 +170,12 @@ public class BucketSelect extends AppCompatActivity {
|
|||
startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
private Intent upload() {
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.setType("*/*");
|
||||
startActivityForResult(intent, 100);
|
||||
return intent;
|
||||
}
|
||||
|
||||
}
|
12
app/src/main/res/menu/bucket_menu.xml
Normal file
12
app/src/main/res/menu/bucket_menu.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/upload"
|
||||
android:title="@string/file_upload" />
|
||||
|
||||
<item
|
||||
android:id="@+id/deletefolder"
|
||||
android:title="@string/file_del" />
|
||||
|
||||
</menu>
|
|
@ -12,6 +12,7 @@
|
|||
<string name="broken_database">Local database is corrupted. Please reinstall this app</string>
|
||||
<string name="pending_feature">This feature is not implemented yet</string>
|
||||
<string name="file_external">Open in</string>
|
||||
<string name="file_upload">Upload</string>
|
||||
<string name="file_del">Delete</string>
|
||||
<string name="file_del_confirm">Do you want to delete this file?</string>
|
||||
<string name="folder_del_confirm">Do you want to delete this folder?</string>
|
||||
|
|
Loading…
Reference in a new issue