use of im.actor.sdk.controllers.pickers.file.items.ExplorerItem in project actor-platform by actorapp.
the class ExplorerAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
//Timer.start();
View itemView;
ExploreItemViewHolder holder;
if (convertView == null) {
convertView = View.inflate(context, R.layout.picker_item_file, null);
holder = new ExploreItemViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ExploreItemViewHolder) convertView.getTag();
}
itemView = convertView;
ExplorerItem item = getItem(position);
item.bindImage(holder);
item.bindData(holder);
if (getCount() == 1) {
holder.disableDivider();
}
//Timer.stop("Item created");
return itemView;
}
use of im.actor.sdk.controllers.pickers.file.items.ExplorerItem in project actor-platform by actorapp.
the class ExplorerFragment method loadHistory.
private ArrayList<ExplorerItem> loadHistory() {
ArrayList<ExplorerItem> history = new ArrayList<ExplorerItem>();
ArrayList<String> pathesFromDB = HistoryDatabase.getHistory(pickerActivity);
if (!pathesFromDB.isEmpty()) {
history.add(new HeaderItem(getString(R.string.picker_file_header_recent)));
for (String pathFromDB : pathesFromDB) {
File historyFile = new File(pathFromDB);
if (historyFile.exists())
history.add(getFileItem(historyFile));
}
}
return history;
}
use of im.actor.sdk.controllers.pickers.file.items.ExplorerItem in project actor-platform by actorapp.
the class FilePickerActivity method onItemClick.
@Override
public void onItemClick(AdapterView<?> parent, View itemView, int position, long id) {
ExplorerItem item = (ExplorerItem) parent.getItemAtPosition(position);
if (item instanceof BackItem) {
onBackPressed();
return;
}
if (item.isDirectory()) {
String path = item.getPath();
Bundle bundle = new Bundle();
bundle.putString("path", path);
Fragment fragment = new ExplorerFragment();
fragment.setArguments(bundle);
getFragmentManager().beginTransaction().setCustomAnimations(R.animator.picker_fragment_explorer_enter, R.animator.picker_fragment_explorer_exit, R.animator.picker_fragment_explorer_return, R.animator.picker_fragment_explorer_out).replace(R.id.container, fragment).addToBackStack(path).commit();
} else {
selectItem(item, itemView);
returnResult();
}
}
use of im.actor.sdk.controllers.pickers.file.items.ExplorerItem in project actor-platform by actorapp.
the class WelcomeExplorerAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View itemView;
ExplorerItem item = getItem(position);
if (item instanceof HeaderItem) {
itemView = View.inflate(context, R.layout.picker_item_header, null);
itemView.setTag("header");
item.bindData(itemView);
return itemView;
} else {
if (convertView != null && !convertView.getTag().equals("header"))
return super.getView(position, convertView, parent);
else
return super.getView(position, null, parent);
}
}
use of im.actor.sdk.controllers.pickers.file.items.ExplorerItem in project actor-platform by actorapp.
the class SearchTask method doInBackground.
@Override
protected final ArrayList<ExplorerItem> doInBackground(Void... voids) {
handler.post(new Runnable() {
@Override
public void run() {
//onPreStart();
}
});
handler.post(new Runnable() {
@Override
public void run() {
//onSearchStarted();
}
});
Log.i("Searching", "Search started. Root path: " + root);
for (File file : index) {
compare(file);
if (isCancelled()) {
Log.i("Searching", "Canceled");
return null;
}
}
resort();
Log.i("Searching", "Search ended. " + foundItems.size() + " items found");
ArrayList<ExplorerItem> items = new ArrayList<ExplorerItem>();
for (File file : foundItems) {
ExplorerItem item;
if (file.isDirectory()) {
item = Converter.getFolderItem(file);
} else {
item = Converter.getFileItem(file, false);
}
if (item != null)
items.add(item);
}
// Collections.sort(items, new CancelableComparator(query));
return items;
}
Aggregations