public void onClick(View view) { restorableFiles = util.findRestorableFiles(); prepForModal(); alertText.setVisibility(View.VISIBLE); alertModal.setVisibility(View.VISIBLE); if (restorableFiles.size() > 0) { alertCancel.setVisibility(View.VISIBLE); alertCancel.setOnClickListener(dismissModal); alertText.setText("Which file would you like to backup from?"); alertListOne.setVisibility(View.VISIBLE); findViewById(R.id.object_selector_modal_list_one_header).setVisibility(View.GONE); ListView modalList = (ListView) findViewById(R.id.modal_list_one); modalList.setAdapter( new ArrayAdapter<String>( BackupRestoreScreen.this, settingsRef.getSearchModalListLayout(), R.id.filter_option, restorableFiles)); modalList.setOnItemClickListener(fileSelected); Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int windowHeight = display.getHeight(); RelativeLayout.LayoutParams listOneParams = (RelativeLayout.LayoutParams) alertListOne.getLayoutParams(); if (listOneParams.height > (int) windowHeight * 0.6f) { listOneParams.height = (int) (windowHeight * 0.6f); alertListOne.setLayoutParams(listOneParams); } } else { alertOk.setVisibility(View.VISIBLE); String defaultDirectory = util.getDefaultDirectoryPath(); alertText.setText( "There were no restorable .maol files found in the default directory. \n\n" + "If you have a backup (.maol) file please place it in the directory " + defaultDirectory); alertOk.setOnClickListener(dismissModal); } }
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) { util.restoreData(restorableFiles.get(position)); }
public void onClick(View view) { util.backupData(); }