You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.4 KiB
71 lines
2.4 KiB
11 years ago
|
/*
|
||
|
* Copyright 2010-2013 Eric Kok et al.
|
||
|
*
|
||
|
* Transdroid is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* Transdroid is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with Transdroid. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
11 years ago
|
package org.transdroid.core.gui.navigation;
|
||
|
|
||
|
import org.androidannotations.annotations.EBean;
|
||
11 years ago
|
import org.transdroid.daemon.IDaemonAdapter;
|
||
11 years ago
|
|
||
|
import android.view.View;
|
||
|
import android.view.ViewGroup;
|
||
|
|
||
|
/**
|
||
|
* List adapter that holds filter items, that is, servers, view types and labels and is displayed as content to a
|
||
|
* Spinner instead of a ListView.
|
||
|
* @author Eric Kok
|
||
|
*/
|
||
|
@EBean
|
||
|
public class FilterListDropDownAdapter extends FilterListAdapter {
|
||
|
|
||
11 years ago
|
protected NavigationSelectionView navigationSelectionView = null;
|
||
|
private String currentServer = null;
|
||
|
private String currentFilter = null;
|
||
|
|
||
11 years ago
|
@Override
|
||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||
11 years ago
|
// This returns the singleton navigation spinner view
|
||
|
if (navigationSelectionView == null) {
|
||
|
navigationSelectionView = NavigationSelectionView_.build(context);
|
||
11 years ago
|
}
|
||
11 years ago
|
navigationSelectionView.bind(currentServer, currentFilter);
|
||
|
return navigationSelectionView;
|
||
11 years ago
|
}
|
||
|
|
||
|
@Override
|
||
|
public View getDropDownView(int position, View convertView, ViewGroup parent) {
|
||
|
// This returns the item to show in the drop down list
|
||
|
return super.getView(position, convertView, parent);
|
||
|
}
|
||
11 years ago
|
|
||
|
public void updateCurrentFilter(NavigationFilter currentFilter) {
|
||
|
this.currentFilter = currentFilter.getName();
|
||
|
if (navigationSelectionView != null)
|
||
|
navigationSelectionView.bind(this.currentServer, this.currentFilter);
|
||
|
}
|
||
|
|
||
|
public void updateCurrentServer(IDaemonAdapter currentConnection) {
|
||
|
this.currentServer = currentConnection.getSettings().getName();
|
||
|
if (navigationSelectionView != null)
|
||
|
navigationSelectionView.bind(this.currentServer, this.currentFilter);
|
||
|
}
|
||
11 years ago
|
|
||
|
public void hideServersLabel() {
|
||
11 years ago
|
serverSeparator.setViewVisibility(View.GONE);
|
||
11 years ago
|
notifyDataSetInvalidated();
|
||
|
}
|
||
11 years ago
|
|
||
|
}
|