use of com.cloudrail.si.services.GoogleCloudPlatform in project cloudrail-si-android-sdk by CloudRail.
the class BucketViewer method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_bucket_viewer, container, false);
this.listView = (ListView) v.findViewById(R.id.bucketListView);
this.spinner = (ProgressBar) v.findViewById(R.id.spinner);
switch(mServiceString) {
case "amazon":
{
service = new AmazonS3(context, MainActivity.AMAZON_ACCESS_KEY, MainActivity.AMAZON_SECRET_ACCESS_KEY, MainActivity.AMAZON_REGION);
break;
}
case "backblaze":
{
service = new Backblaze(context, MainActivity.BACKBLAZE_ACCOUNT_ID, MainActivity.BACKBLACE_APP_KEY);
break;
}
case "google":
{
service = new GoogleCloudPlatform(context, MainActivity.GOOGLE_CLIENT_EMAIL, MainActivity.GOOGLE_PRIVATE_KEY, MainActivity.GOOGLE_PROJECT_ID);
break;
}
case "microsoft":
{
service = new MicrosoftAzure(context, MainActivity.AZURE_ACCOUNT_NAME, MainActivity.AZURE_ACCESS_KEY);
break;
}
case "rackspace":
{
service = new Rackspace(context, MainActivity.RACKSPACE_USER_NAME, MainActivity.RACKSPACE_API_KEY, MainActivity.RACKSPACE_REGION);
break;
}
}
refreshList();
this.listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
selectedItem = view;
selectedItemPosition = position;
PopupMenu popupMenu = new PopupMenu(context, view);
MenuInflater menuInflater = ((Activity) context).getMenuInflater();
menuInflater.inflate(R.menu.selected_bucket_bar, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch(item.getItemId()) {
case R.id.action_delete_bucket:
{
removeItem();
return true;
}
default:
return false;
}
}
});
popupMenu.show();
return true;
}
});
this.listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
selectedItem = view;
selectedItemPosition = position;
ArrayAdapter<Bucket> adapter = (ArrayAdapter<Bucket>) listView.getAdapter();
Bucket bucket = adapter.getItem(position);
mListener.onBucketSelected(mServiceString, bucket.getName(), bucket.getIdentifier());
}
});
((TextView) v.findViewById(R.id.text2)).setText(mServiceString);
return v;
}
use of com.cloudrail.si.services.GoogleCloudPlatform in project cloudrail-si-android-sdk by CloudRail.
the class FileViewer method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_file_viewer, container, false);
this.listView = (ListView) v.findViewById(R.id.fileListView);
this.spinner = (ProgressBar) v.findViewById(R.id.spinner);
switch(mServiceString) {
case "amazon":
{
// service = new AmazonS3(context, "[Your S3 Access Key ID]", "[Your S3 Secret Access Key]", "[Your AWS region]");
service = new AmazonS3(context, MainActivity.AMAZON_ACCESS_KEY, MainActivity.AMAZON_SECRET_ACCESS_KEY, MainActivity.AMAZON_REGION);
break;
}
case "backblaze":
{
service = new Backblaze(context, MainActivity.BACKBLAZE_ACCOUNT_ID, MainActivity.BACKBLACE_APP_KEY);
break;
}
case "google":
{
service = new GoogleCloudPlatform(context, MainActivity.GOOGLE_CLIENT_EMAIL, MainActivity.GOOGLE_PRIVATE_KEY, MainActivity.GOOGLE_PROJECT_ID);
break;
}
case "microsoft":
{
service = new MicrosoftAzure(context, MainActivity.AZURE_ACCOUNT_NAME, MainActivity.AZURE_ACCESS_KEY);
break;
}
case "rackspace":
{
service = new Rackspace(context, MainActivity.RACKSPACE_USER_NAME, MainActivity.RACKSPACE_API_KEY, MainActivity.RACKSPACE_REGION);
break;
}
}
refreshList();
this.listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
selectedItem = view;
selectedItemPosition = position;
PopupMenu popupMenu = new PopupMenu(context, view);
MenuInflater menuInflater = ((Activity) context).getMenuInflater();
menuInflater.inflate(R.menu.selected_file_bar, popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch(item.getItemId()) {
case R.id.action_delete_file:
{
removeItem();
return true;
}
case R.id.action_download_file:
{
downloadItem();
return true;
}
default:
return false;
}
}
});
popupMenu.show();
return true;
}
});
((TextView) v.findViewById(R.id.text2)).setText("Bucket \"" + mBucketName + "\"");
return v;
}
Aggregations