public void update() { mRemotesListView.updateRemotesList(); // select the appropriate menu_main List<String> names = Remote.getNames(getActivity()); String lastSelectedRemotePref = Remote.getPersistedRemoteName(getActivity()); if (names.contains(lastSelectedRemotePref)) { mRemotesListView.selectRemote(lastSelectedRemotePref); } else if (!names.isEmpty()) { mRemotesListView.selectRemote(0); } else { // mRemotesListView.selectRemote(-1, false); } updateTitle(); updateInfoTextView(); }
private void onRemoteSelected(int position) { String remoteName = mRemotesListView.getRemoteName(position); Remote.setLastUsedRemoteName(getActivity(), remoteName); mTargetRemotePosition = position; close(); }
/** * Add a button to a remote and save it to disk If you call save on another remote with the same * name which was loaded earlier, you will overwrite this changes<br> * Please note that this is highly inefficient for adding multiple buttons. Load the remote, and * add the buttons manually instead of using this. * * @param c * @param remote * @param b */ public static void addButton(Context c, String remote, Button b) { Remote r = Remote.load(c, remote); r.addButton(b); r.save(c); }