コード例 #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    setTheme(Gh4Application.THEME);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.generic_list);

    mRepoOwner = getIntent().getExtras().getString(Constants.Repository.REPO_OWNER);
    mRepoName = getIntent().getExtras().getString(Constants.Repository.REPO_NAME);
    mFilePath = getIntent().getExtras().getString(Constants.Object.PATH);
    mRef = getIntent().getExtras().getString(Constants.Object.REF);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle("History");
    actionBar.setSubtitle(mFilePath);

    ListView listView = (ListView) findViewById(R.id.list_view);
    listView.setOnItemClickListener(this);

    mCommitAdapter = new CommitAdapter(this, new ArrayList<RepositoryCommit>());
    listView.setAdapter(mCommitAdapter);

    loadData();

    getSupportLoaderManager().initLoader(0, null, this);
    getSupportLoaderManager().getLoader(0).forceLoad();
  }
コード例 #2
0
ファイル: RepositoryActivity.java プロジェクト: JoonyLi/gh4a
  @Override
  public void onBackPressed() {
    if (mPager != null) {
      if (mPager.getCurrentItem() == 1) {
        backPressed = true;
        if (mPath != null && mPath.lastIndexOf("/") != -1) {
          mPath = mPath.substring(0, mPath.lastIndexOf("/"));
        } else {
          mPath = null;
        }

        if (fileStacks.size() > 1) {
          mAdapter.notifyDataSetChanged();
          return;
        } else {
          super.onBackPressed();
        }
      } else {
        super.onBackPressed();
      }
    }
  }
コード例 #3
0
ファイル: RepositoryActivity.java プロジェクト: JoonyLi/gh4a
  @Override
  public void onCreate(Bundle savedInstanceState) {
    setTheme(Gh4Application.THEME);
    super.onCreate(savedInstanceState);

    fileStacks = new ArrayList<ContentListFragment>();
    mContentList = new ArrayList<List<Content>>();

    Bundle data = getIntent().getExtras().getBundle(Constants.DATA_BUNDLE);
    if (data != null) {
      mRepoOwner = data.getString(Constants.Repository.REPO_OWNER);
      mRepoName = data.getString(Constants.Repository.REPO_NAME);
    } else {
      Bundle bundle = getIntent().getExtras();
      mRepoOwner = bundle.getString(Constants.Repository.REPO_OWNER);
      mRepoName = bundle.getString(Constants.Repository.REPO_NAME);
      mSelectedRef = bundle.getString(Constants.Repository.SELECTED_REF);
      mSelectBranchTag = bundle.getString(Constants.Repository.SELECTED_BRANCHTAG_NAME);
    }

    if (!isOnline()) {
      setErrorView();
      return;
    }

    setContentView(R.layout.view_pager_repo);

    mActionBar = getSupportActionBar();
    mActionBar.setTitle(mRepoOwner + "/" + mRepoName);
    mActionBar.setDisplayHomeAsUpEnabled(true);

    showLoading();
    getSupportLoaderManager().initLoader(0, null, this);
    getSupportLoaderManager().getLoader(0).forceLoad();

    getSupportLoaderManager().initLoader(1, null, this);
    getSupportLoaderManager().initLoader(2, null, this);

    getSupportLoaderManager().initLoader(3, null, this);
    getSupportLoaderManager().getLoader(3).forceLoad();

    getSupportLoaderManager().initLoader(4, null, this);
  }