@Override public void onTreeSelected( int position, AdapterView<?> adapterView, Content content, List<Content> contents, String ref) { if ("dir".equals(content.getType())) { backPressed = false; mAdapter.mContent = content; mSelectedRef = ref; mPath = content.getPath(); mContentList.add(contents); mAdapter.notifyDataSetChanged(); } else { if (mGitModuleMap != null) { if (!StringUtils.isBlank(mGitModuleMap.get(content.getPath()))) { String[] userRepo = mGitModuleMap.get(content.getPath()).split("/"); getApplicationContext().openRepositoryInfoActivity(this, userRepo[0], userRepo[1], 0); } else { openFileViewer(content, ref); } } else { openFileViewer(content, ref); } } }
private void openFileViewer(Content content, String ref) { Intent intent = new Intent().setClass(this, FileViewerActivity.class); intent.putExtra(Constants.Repository.REPO_OWNER, mRepoOwner); intent.putExtra(Constants.Repository.REPO_NAME, mRepoName); intent.putExtra(Constants.Object.PATH, content.getPath()); intent.putExtra(Constants.Object.REF, ref); intent.putExtra(Constants.Object.NAME, content.getName()); intent.putExtra(Constants.Object.OBJECT_SHA, content.getSha()); startActivity(intent); }
@Override public int getItemPosition(Object object) { if (object instanceof ContentListFragment && !StringUtils.isBlank(mContent.getSha())) { return POSITION_NONE; } return POSITION_UNCHANGED; }