Пример #1
0
  @Override
  protected void bindView(View v, Download download) {
    ViewHolder viewHolder = (ViewHolder) v.getTag();

    viewHolder.tvTitle.setText(download.getName());
    if (!StringUtils.isBlank(download.getDescription())) {
      viewHolder.tvDesc.setVisibility(View.VISIBLE);
      viewHolder.tvDesc.setText(download.getDescription());
    } else {
      viewHolder.tvDesc.setVisibility(View.GONE);
    }

    CharSequence created =
        DateUtils.getRelativeTimeSpanString(
            download.getCreatedAt().getTime(),
            System.currentTimeMillis(),
            MINUTE_IN_MILLIS,
            FORMAT_SHOW_DATE | FORMAT_SHOW_YEAR | FORMAT_NUMERIC_DATE);
    viewHolder.tvExtra.setText(
        mContext.getString(
            R.string.download_extradata,
            Formatter.formatFileSize(mContext, download.getSize()),
            download.getDownloadCount(),
            created));
  }
Пример #2
0
 @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);
     }
   }
 }
Пример #3
0
 @Override
 public int getItemPosition(Object object) {
   if (object instanceof ContentListFragment && !StringUtils.isBlank(mContent.getSha())) {
     return POSITION_NONE;
   }
   return POSITION_UNCHANGED;
 }
Пример #4
0
 /* (non-Javadoc)
  * @see android.view.View.OnClickListener#onClick(android.view.View)
  */
 @Override
 public void onClick(View v) {
   EditText etTitle = (EditText) findViewById(R.id.et_title);
   EditText etDesc = (EditText) findViewById(R.id.et_desc);
   if (etTitle.getText() == null || StringUtils.isBlank(etTitle.getText().toString())) {
     showMessage(getResources().getString(R.string.issue_error_title), false);
   } else {
     String desc = "";
     if (etTitle.getText() != null) {
       desc = etDesc.getText().toString();
     }
     new CreateIssueTask(this, false).execute(etTitle.getText().toString(), desc);
   }
 }
Пример #5
0
  private void fillTabs() {
    mActionBar.removeAllTabs();
    mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    mActionBar.setSubtitle(
        StringUtils.isBlank(mSelectBranchTag) ? mRepository.getMasterBranch() : mSelectBranchTag);

    mAdapter = new RepositoryAdapter(getSupportFragmentManager());
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mAdapter);

    mPager.setOnPageChangeListener(
        new OnPageChangeListener() {

          @Override
          public void onPageScrollStateChanged(int arg0) {}

          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {}

          @Override
          public void onPageSelected(int arg0) {
            mActionBar.getTabAt(arg0).select();
          }
        });

    Tab tab =
        mActionBar
            .newTab()
            .setText(R.string.about)
            .setTabListener(new TabListener<SherlockFragmentActivity>(this, 0 + "", mPager));
    mActionBar.addTab(tab, mCurrentTab == 0);

    tab =
        mActionBar
            .newTab()
            .setText(R.string.repo_files)
            .setTabListener(new TabListener<SherlockFragmentActivity>(this, 1 + "", mPager));
    mActionBar.addTab(tab, mCurrentTab == 1);

    tab =
        mActionBar
            .newTab()
            .setText(getResources().getQuantityString(R.plurals.commit, 2))
            .setTabListener(new TabListener<SherlockFragmentActivity>(this, 2 + "", mPager));
    mActionBar.addTab(tab, mCurrentTab == 2);
  }