List of usage examples for android.widget TextView setOnSystemUiVisibilityChangeListener
public void setOnSystemUiVisibilityChangeListener(OnSystemUiVisibilityChangeListener l)
From source file:cw.kop.autobackground.sources.SourceListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_sources, container, false); final ImageView emptyArrow = (ImageView) view.findViewById(R.id.empty_arrow); TextView emptyText = (TextView) view.findViewById(R.id.empty_text); emptyText.setText("Try hitting the + and adding some sources"); emptyText.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { @Override/*w w w . java 2 s.co m*/ public void onSystemUiVisibilityChange(int visibility) { emptyArrow.setVisibility(visibility); } }); sourceList = (ListView) view.findViewById(R.id.source_list); sourceList.setEmptyView(emptyArrow); addButtonBackground = (ImageView) view.findViewById(R.id.floating_button); addButton = (ImageView) view.findViewById(R.id.floating_button_icon); addButton.setOnClickListener(this); resetAddButtonIcon(); setButton = (Button) view.findViewById(R.id.set_button); setButton.setOnClickListener(this); final SourceListAdapter.CardClickListener listener = new SourceListAdapter.CardClickListener() { @Override public void onDeleteClick(final View view, final int index) { listAdapter.saveData(); if (FileHandler.isDownloading) { Toast.makeText(appContext, "Cannot delete while downloading", Toast.LENGTH_SHORT).show(); return; } Source item = listAdapter.getItem(index); String type = item.getType(); if (type.equals(AppSettings.FOLDER)) { DialogFactory.ActionDialogListener clickListener = new DialogFactory.ActionDialogListener() { @Override public void onClickRight(View v) { listAdapter.removeItem(index); new ImageCountTask().execute(); this.dismissDialog(); } }; DialogFactory.showActionDialog(appContext, "", "Delete " + item.getTitle() + "?", clickListener, -1, R.string.cancel_button, R.string.ok_button); } else { DialogFactory.ActionDialogListener clickListener = new DialogFactory.ActionDialogListener() { @Override public void onClickMiddle(View v) { this.dismissDialog(); listAdapter.removeItem(index); new ImageCountTask().execute(); } @Override public void onClickRight(View v) { Source source = listAdapter.getItem(index); FileHandler.deleteBitmaps(appContext, source); sendToast("Deleting " + source.getTitle() + " images"); listAdapter.removeItem(index); new ImageCountTask().execute(); this.dismissDialog(); } }; DialogFactory.showActionDialog(appContext, "Delete images along with this source?", "This cannot be undone.", clickListener, R.string.cancel_button, R.string.no_button, R.string.yes_button); } } @Override public void onViewImageClick(View view, int index) { showViewImageFragment(view, index); } @Override public void onEditClick(View view, int index) { startEditFragment(view, index); } @Override public void onExpandClick(View view, int position) { onItemClick(null, view, position, 0); } }; if (listAdapter == null) { listAdapter = new SourceListAdapter(getActivity(), listener); for (int index = 0; index < AppSettings.getNumberSources(); index++) { Source source = AppSettings.getSource(index); listAdapter.addItem(source, false); Log.i(TAG, "Added: " + source.getTitle()); } } sourceList.setAdapter(listAdapter); sourceList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { listAdapter.toggleActivated(position); int firstVisiblePosition = sourceList.getFirstVisiblePosition(); View childView = sourceList.getChildAt(position - firstVisiblePosition); sourceList.getAdapter().getView(position, childView, sourceList); return true; } }); sourceList.setOnItemClickListener(this); return view; }