Move create folder button to action bar in Uploader

This commit is contained in:
masensio 2015-08-11 11:14:26 +02:00
parent 2b79f3292f
commit eda6f71491
2 changed files with 22 additions and 6 deletions

View file

@ -53,12 +53,12 @@
android:orientation="horizontal" >
<Button
android:id="@+id/uploader_new_folder"
android:id="@+id/uploader_cancel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_weight="1"
android:text="@string/uploader_btn_new_folder_text" />
android:text="@string/common_cancel" />
<Button
android:id="@+id/uploader_choose_folder"

View file

@ -57,6 +57,8 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
@ -356,9 +358,8 @@ public class Uploader extends FileActivity
break;
case R.id.uploader_new_folder:
CreateFolderDialogFragment dialog = CreateFolderDialogFragment.newInstance(mFile);
dialog.show(getSupportFragmentManager(), "createdirdialog");
case R.id.uploader_cancel:
finish();
break;
@ -432,7 +433,7 @@ public class Uploader extends FileActivity
Button btnChooseFolder = (Button) findViewById(R.id.uploader_choose_folder);
btnChooseFolder.setOnClickListener(this);
Button btnNewFolder = (Button) findViewById(R.id.uploader_new_folder);
Button btnNewFolder = (Button) findViewById(R.id.uploader_cancel);
btnNewFolder.setOnClickListener(this);
mListView.setOnItemClickListener(this);
@ -648,11 +649,26 @@ public class Uploader extends FileActivity
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
menu.findItem(R.id.action_upload).setVisible(false);
menu.findItem(R.id.action_sort).setVisible(false);
menu.findItem(R.id.action_sync_account).setVisible(false);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
boolean retval = true;
switch (item.getItemId()) {
case R.id.action_create_dir:
CreateFolderDialogFragment dialog = CreateFolderDialogFragment.newInstance(mFile);
dialog.show(
getSupportFragmentManager(),
CreateFolderDialogFragment.CREATE_FOLDER_FRAGMENT);
break;
case android.R.id.home:
if((mParents.size() > 1)) {
onBackPressed();