use of com.github.kevinsawicki.wishlist.ViewFinder in project PocketHub by pockethub.
the class BaseActivity method onCreate.
@CallSuper
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
lifecycleSubject.onNext(ActivityEvent.CREATE);
finder = new ViewFinder(this);
}
use of com.github.kevinsawicki.wishlist.ViewFinder in project PocketHub by pockethub.
the class DialogFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
finder = new ViewFinder(view);
}
use of com.github.kevinsawicki.wishlist.ViewFinder in project PocketHub by pockethub.
the class RepositoryListFragment method onListItemLongClick.
@Override
public boolean onListItemLongClick(ListView list, View v, int position, long itemId) {
if (!isUsable()) {
return false;
}
final Repository repo = (Repository) list.getItemAtPosition(position);
if (repo == null) {
return false;
}
MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()).title(InfoUtils.createRepoId(repo));
final MaterialDialog[] dialogHolder = new MaterialDialog[1];
View view = getActivity().getLayoutInflater().inflate(R.layout.repo_dialog, null);
ViewFinder finder = new ViewFinder(view);
final User owner = repo.owner();
avatars.bind(finder.imageView(R.id.iv_owner_avatar), owner);
finder.setText(R.id.tv_owner_name, getString(R.string.navigate_to_user, owner.login()));
finder.onClick(R.id.ll_owner_area, new OnClickListener() {
@Override
public void onClick(View v) {
dialogHolder[0].dismiss();
viewUser(owner);
}
});
if ((recentRepos != null) && (recentRepos.contains(repo))) {
finder.find(R.id.divider).setVisibility(View.VISIBLE);
finder.find(R.id.ll_recent_repo_area).setVisibility(View.VISIBLE);
finder.onClick(R.id.ll_recent_repo_area, new OnClickListener() {
@Override
public void onClick(View v) {
dialogHolder[0].dismiss();
recentRepos.remove(repo);
refresh();
}
});
}
builder.customView(view, false);
MaterialDialog dialog = builder.build();
dialogHolder[0] = dialog;
dialog.setCanceledOnTouchOutside(true);
dialog.show();
return true;
}
use of com.github.kevinsawicki.wishlist.ViewFinder in project PocketHub by pockethub.
the class NewsFragment method onListItemLongClick.
@Override
public boolean onListItemLongClick(ListView l, View v, int position, long itemId) {
if (!isUsable()) {
return false;
}
final GitHubEvent event = (GitHubEvent) l.getItemAtPosition(position);
final Repository repo = ConvertUtils.eventRepoToRepo(event.repo());
final User user = event.actor();
if (repo != null && user != null) {
final MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()).title(R.string.navigate_to);
// Hacky but necessary since material dialogs has a different API
final MaterialDialog[] dialogHolder = new MaterialDialog[1];
View view = getActivity().getLayoutInflater().inflate(R.layout.nav_dialog, null);
ViewFinder finder = new ViewFinder(view);
avatars.bind(finder.imageView(R.id.iv_user_avatar), user);
avatars.bind(finder.imageView(R.id.iv_repo_avatar), repo.owner());
finder.setText(R.id.tv_login, user.login());
finder.setText(R.id.tv_repo_name, InfoUtils.createRepoId(repo));
finder.onClick(R.id.ll_user_area, new OnClickListener() {
@Override
public void onClick(View v) {
dialogHolder[0].dismiss();
viewUser(user);
}
});
finder.onClick(R.id.ll_repo_area, new OnClickListener() {
@Override
public void onClick(View v) {
dialogHolder[0].dismiss();
viewRepository(repo);
}
});
builder.customView(view, false);
MaterialDialog dialog = builder.build();
dialogHolder[0] = dialog;
dialog.setCanceledOnTouchOutside(true);
dialog.show();
return true;
}
return false;
}
Aggregations