Implementation of import button and FileBrowser
This commit is contained in:
parent
00ba6a4bf0
commit
1112dde4d8
14 changed files with 1356 additions and 3 deletions
|
|
@ -20,6 +20,7 @@ import com.ericsson.uecontrol.core.behaviour.UeBehaviourSleep;
|
|||
import com.ericsson.uecontrol.core.behaviour.UeBehaviourSurfing;
|
||||
import com.ericsson.uecontrol.gui.fragments.BehaviourListFragment;
|
||||
import com.ericsson.uecontrol.gui.fragments.FileBrowserDialog;
|
||||
import com.ericsson.uecontrol.gui.fragments.FileBrowserDialog.OnFileSelectionListener;
|
||||
import com.ericsson.uecontrol.gui.fragments.StatusFragment;
|
||||
import com.ericsson.uecontrol.gui.util.CSVWriter;
|
||||
|
||||
|
|
@ -31,7 +32,8 @@ import java.io.File;
|
|||
import de.mindpipe.android.logging.log4j.LogConfigurator;
|
||||
|
||||
|
||||
public class MainActivity extends FragmentActivity implements OnSharedPreferenceChangeListener{
|
||||
public class MainActivity extends FragmentActivity implements OnSharedPreferenceChangeListener,
|
||||
OnFileSelectionListener {
|
||||
private static final Logger log = Logger.getLogger(MainActivity.class);
|
||||
public static final String DEFAULT_LOG_PATH = "/sdcard/uecontrol/";
|
||||
public static final String BEHAVIOUR_SAVE_FILE = "behaviour_list.json";
|
||||
|
|
@ -203,7 +205,8 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
|||
return true;
|
||||
}
|
||||
else if (id == R.id.action_import) {
|
||||
//TODO:
|
||||
FileBrowserDialog browser = FileBrowserDialog.newInstance("/sdcard");
|
||||
browser.show(this.getFragmentManager(), "import");
|
||||
}
|
||||
else if (id == R.id.action_export) {
|
||||
//TODO:
|
||||
|
|
@ -214,6 +217,16 @@ public class MainActivity extends FragmentActivity implements OnSharedPreference
|
|||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
public void onFileSelection(String tag, File file){
|
||||
try {
|
||||
if(tag.equals("import")) {
|
||||
currentExecutor.read(file.getAbsolutePath());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Unable to import from: "+file.getAbsolutePath(), e);
|
||||
Toast.makeText(this, "Unable to import from file", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateExecutionState(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue