import java.util.ArrayList;
-import android.annotation.TargetApi;
-import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
*/
protected int getReferencePosition() {
if (mCurrentListView != null) {
- return (mCurrentListView.getFirstVisiblePosition() + mCurrentListView.getLastVisiblePosition()) / 2;
+ return (mCurrentListView.getFirstVisiblePosition() +
+ mCurrentListView.getLastVisiblePosition()) / 2;
} else {
return 0;
}
final int firstPosition = mFirstPositions.remove(mFirstPositions.size() -1);
int top = mTops.remove(mTops.size() - 1);
- Log_OC.v(TAG, "Setting selection to position: " + firstPosition + "; top: " + top + "; index: " + index);
+ Log_OC.v(TAG, "Setting selection to position: " + firstPosition + "; top: "
+ + top + "; index: " + index);
if (mCurrentListView == mListView) {
if (mHeightCell*index <= mListView.getHeight()) {
private void onCreateSwipeToRefresh(SwipeRefreshLayout refreshLayout) {
// Colors in animations: background
- refreshLayout.setColorScheme(R.color.background_color, R.color.background_color, R.color.background_color,
- R.color.background_color);
+ refreshLayout.setColorScheme(R.color.background_color, R.color.background_color,
+ R.color.background_color, R.color.background_color);
refreshLayout.setOnRefreshListener(this);
}
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mListView.setChoiceMode(choiceMode);
mGridView.setChoiceMode(choiceMode);
+ } else {
+ ((ListView)mListView).setChoiceMode(choiceMode);
}
}
try {
mContainerActivity = (ContainerActivity) activity;
} catch (ClassCastException e) {
- throw new ClassCastException(activity.toString() + " must implement " + LocalFileListFragment.ContainerActivity.class.getSimpleName());
+ throw new ClassCastException(activity.toString() + " must implement " +
+ LocalFileListFragment.ContainerActivity.class.getSimpleName());
}
}
}
/**
- * Checks the file clicked over. Browses inside if it is a directory. Notifies the container activity in any case.
+ * Checks the file clicked over. Browses inside if it is a directory.
+ * Notifies the container activity in any case.
*/
@Override
public void onItemClick(AdapterView<?> l, View v, int position, long id) {
} else { /// Click on a file
ImageView checkBoxV = (ImageView) v.findViewById(R.id.custom_checkbox);
if (checkBoxV != null) {
- if (getListView().isItemChecked(position)) {
+ if (((ListView)getListView()).isItemChecked(position)) {
checkBoxV.setImageResource(android.R.drawable.checkbox_on_background);
} else {
checkBoxV.setImageResource(android.R.drawable.checkbox_off_background);
if(mDirectory != null){
directory = mDirectory;
} else {
- directory = Environment.getExternalStorageDirectory(); // TODO be careful with the state of the storage; could not be available
+ directory = Environment.getExternalStorageDirectory();
+ // TODO be careful with the state of the storage; could not be available
if (directory == null) return; // no files to show
}
}
directory = directory.getParentFile();
}
- mCurrentListView.clearChoices(); // by now, only files in the same directory will be kept as selected
+ // by now, only files in the same directory will be kept as selected
+ ((ListView)mCurrentListView).clearChoices();
mAdapter.swapDirectory(directory);
if (mDirectory == null || !mDirectory.equals(directory)) {
mCurrentListView.setSelection(0);
*/
public String[] getCheckedFilePaths() {
ArrayList<String> result = new ArrayList<String>();
- SparseBooleanArray positions = mCurrentListView.getCheckedItemPositions();
+ SparseBooleanArray positions = ((ListView)mCurrentListView).getCheckedItemPositions();
if (positions.size() > 0) {
for (int i = 0; i < positions.size(); i++) {
if (positions.get(positions.keyAt(i)) == true) {
- result.add(((File) mCurrentListView.getItemAtPosition(positions.keyAt(i))).getAbsolutePath());
+ result.add(((File) mCurrentListView.getItemAtPosition(
+ positions.keyAt(i))).getAbsolutePath());
}
}
public void onDirectoryClick(File directory);
/**
- * Callback method invoked when a file (non directory) is clicked by the user on the files list
+ * Callback method invoked when a file (non directory)
+ * is clicked by the user on the files list
*
* @param file
*/
/**
- * Callback method invoked when the parent activity is fully created to get the directory to list firstly.
+ * Callback method invoked when the parent activity
+ * is fully created to get the directory to list firstly.
*
* @return Directory to list firstly. Can be NULL.
*/