Skip to content

Feature/34 add fragment to list branches #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 50 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c673a37
Adding feature of issues listing
n2oliver Apr 9, 2019
5fb20f7
Merge remote-tracking branch 'origin/feature/23-adding-feature-of-iss…
n2oliver Apr 11, 2019
095fa3c
Adding activity RepoDetailsActivity and its layout and changing the d…
n2oliver Apr 11, 2019
2188639
Adding navigation up support to toolbar and fixing the relative layou…
n2oliver Apr 11, 2019
5aa866b
Creating and addin RepoDetailsPagerAdapter to repo_detail_viewpager, …
n2oliver Apr 11, 2019
6903b05
Removing the default text string of fragments
n2oliver Apr 12, 2019
718dcd3
Adding funcionalities from IssueListActivity to the IssuesFragment. O…
Apr 12, 2019
d0bd97f
Fixing return of IssuesFragment.kt to fix the visibility of the fragment
n2oliver Apr 13, 2019
ba86bf2
Removing toolbar from activity_issues_list (that will be the fragment…
n2oliver Apr 13, 2019
5811119
Renaming IssuesFragment to IssuesListFragment and activity_issues_lis…
n2oliver Apr 13, 2019
bd27a7f
Removing access to IssueListActivity and access function of PullReque…
n2oliver Apr 13, 2019
83586b6
Optimizing imports from RepoListActivity
n2oliver Apr 13, 2019
e52f250
Removing not used fragment.
Apr 15, 2019
c21643a
Renaming TabLayout and ViewPager components
Apr 17, 2019
20a08e7
Tranferring titles to string resources and getting them by applicatio…
Apr 17, 2019
4384a55
Creating companion object to store constants on RepoDetailsPagerAdapt…
Apr 17, 2019
a434c13
Moving packages from parent package to repodetails package.
Apr 18, 2019
4a6a769
Moving PullRequestList to a Fragment.
Apr 18, 2019
2b93ca6
Removing unecessary files.
Apr 18, 2019
6a9a777
Renaming layout of fragment to fragment_pull_request_list.xml.
Apr 18, 2019
f9e1472
Deleting PullRequestsFragment and fixing the calling to PullRequestLi…
Apr 18, 2019
abb547b
Adding pojo to contributor response.
Apr 18, 2019
2661a3e
Adding endpoint to get contributors list on GitHubService
Apr 18, 2019
4baa505
Adding model to get contributors list from GitHubService
Apr 18, 2019
445c63a
Renaming loadContributorList to loadContributorsList
Apr 18, 2019
44370d7
Adding ContributorsListViewModel to the project
Apr 18, 2019
e675279
Renaming XML fragment_collaborators to fragment_contributors_list and…
Apr 18, 2019
4a5161e
Moving CollaboratorsFragment to its package (repodetails/contributors…
Apr 18, 2019
9d5636e
Renaming CollaboratorsFragment to CollaboratorsListFragment
Apr 18, 2019
e5cf9fc
Adding ContributorsListModel to the koin ModelModule
Apr 18, 2019
b969584
Adding ContributorsListViewModel to the koin ViewModelModule
Apr 18, 2019
d57064a
Adding ContributorsListAdapter to the project, fixing variables from …
Apr 18, 2019
1db6446
Adding Fragment to contributors listing
Apr 18, 2019
4226730
Renaming collaborators tab and collaborators string to Contributors a…
Apr 18, 2019
1265bf5
Removing PullRequestListActivity and IssueListActivity from AndroidMa…
n2oliver Apr 22, 2019
e3cec86
Adding Commit pojos to the project
n2oliver Apr 22, 2019
01dc5e3
Adding endpoint to commits listing from a repository on the GitHubSer…
n2oliver Apr 22, 2019
1b410b4
Adding CommitsListModel to the project
n2oliver Apr 22, 2019
af0bd2c
Adding CommitsListViewModel to the project
n2oliver Apr 22, 2019
603ae02
Adding CommitsListAdapter to the project with the item_commit_list
n2oliver Apr 22, 2019
d6a22fd
Adding CommitsListFragment and updating the RepoDetailsPagerAdapter w…
n2oliver Apr 22, 2019
71900a9
Limiting numbers of commit to 10
n2oliver Apr 22, 2019
db81afc
Adding BranchResponse pojo to the project
n2oliver Apr 23, 2019
6f6dcb8
Adding endpoint to get branches from GitHubService
n2oliver Apr 23, 2019
b4dfc1e
Adding CommitsListModel to the project
n2oliver Apr 23, 2019
8977a81
Adding BranchesListViewModel to the project
n2oliver Apr 23, 2019
f2d0af0
Adding BranchesListAdapter and item_branches_list to the project
n2oliver Apr 23, 2019
e39f825
Adding BranchesListFragment to the project and fixing function name o…
n2oliver Apr 23, 2019
d55167e
Refactoring to fix imports of package brancheslist, adding BranchesLi…
n2oliver Apr 23, 2019
5045326
Removing BranchesFragment from project
n2oliver Apr 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@
<activity
android:label="@string/app_name"
android:screenOrientation="portrait"
android:name=".pullrequest.PullRequestListActivity_" />

<activity
android:label="@string/app_name"
android:screenOrientation="portrait"
android:name=".issuelist.IssueListActivity_" />
android:name=".repodetails.RepoDetailsActivity_" />

<meta-data
android:name="io.fabric.ApiKey"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import java.util.List;

import br.com.luisfernandez.github.client.http.annotations.URL;
import br.com.luisfernandez.github.client.pojo.BranchResponse;
import br.com.luisfernandez.github.client.pojo.commit.CommitResponse;
import br.com.luisfernandez.github.client.pojo.ContributorResponse;
import br.com.luisfernandez.github.client.pojo.IssueResponse;
import br.com.luisfernandez.github.client.pojo.PullRequestResponse;
import br.com.luisfernandez.github.client.pojo.RepoListResponse;
Expand All @@ -25,4 +28,13 @@ public interface GitHubService

@GET("/repos/{owner}/{repoName}/issues")
Observable<List<IssueResponse>> listIssues(@Path("owner") String owner, @Path("repoName") String repoName);

@GET("/repos/{owner}/{repoName}/contributors")
Observable<List<ContributorResponse>> listContributors(@Path("owner") String owner, @Path("repoName") String repoName);

@GET("/repos/{owner}/{repoName}/commits?per_page=10")
Observable<List<CommitResponse>> listCommits(@Path("owner") String owner, @Path("repoName") String repoName);

@GET("/repos/{owner}/{repoName}/branches")
Observable<List<BranchResponse>> listBranches(@Path("owner") String owner, @Path("repoName") String repoName);
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
package br.com.luisfernandez.github.client.koin

import br.com.luisfernandez.github.client.issuelist.IssueListModel
import br.com.luisfernandez.github.client.issuelist.IssueListModelImpl
import br.com.luisfernandez.github.client.pullrequest.PullRequestModel
import br.com.luisfernandez.github.client.pullrequest.PullRequestModelImpl
import br.com.luisfernandez.github.client.repodetails.brancheslist.BranchesListModelImpl
import br.com.luisfernandez.github.client.repodetails.brancheslist.BranchesListModel
import br.com.luisfernandez.github.client.repodetails.commitslist.CommitsListModel
import br.com.luisfernandez.github.client.repodetails.commitslist.CommitsListModelImpl
import br.com.luisfernandez.github.client.repodetails.contributorslist.ContributorsListModel
import br.com.luisfernandez.github.client.repodetails.contributorslist.ContributorsListModelImpl
import br.com.luisfernandez.github.client.repodetails.issuelist.IssueListModel
import br.com.luisfernandez.github.client.repodetails.issuelist.IssueListModelImpl
import br.com.luisfernandez.github.client.repodetails.pullrequest.PullRequestModel
import br.com.luisfernandez.github.client.repodetails.pullrequest.PullRequestModelImpl
import br.com.luisfernandez.github.client.repolist.RepoListModel
import br.com.luisfernandez.github.client.repolist.RepoListModelImpl
import org.koin.dsl.module.module
Expand All @@ -27,4 +33,22 @@ val modelModule = module {
get()
)
}

single<ContributorsListModel> {
ContributorsListModelImpl(
get()
)
}

single<CommitsListModel> {
CommitsListModelImpl(
get()
)
}

single<BranchesListModel> {
BranchesListModelImpl(
get()
)
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package br.com.luisfernandez.github.client.koin

import br.com.luisfernandez.github.client.pullrequest.PullRequestPresenter
import br.com.luisfernandez.github.client.pullrequest.PullRequestPresenterImpl
import br.com.luisfernandez.github.client.repolist.RepoListPresenter
import br.com.luisfernandez.github.client.repolist.RepoListPresenterImpl
import org.koin.dsl.module.module
Expand All @@ -10,8 +8,4 @@ val presenterModule = module {
single<RepoListPresenter> {
RepoListPresenterImpl(get())
}

single<PullRequestPresenter> {
PullRequestPresenterImpl(get())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

package br.com.luisfernandez.github.client.koin

import br.com.luisfernandez.github.client.issuelist.IssueListViewModel
import br.com.luisfernandez.github.client.pullrequest.PullRequestViewModel
import br.com.luisfernandez.github.client.repodetails.brancheslist.BranchesListViewModel
import br.com.luisfernandez.github.client.repodetails.commitslist.CommitsListViewModel
import br.com.luisfernandez.github.client.repodetails.contributorslist.ContributorsListViewModel
import br.com.luisfernandez.github.client.repodetails.issuelist.IssueListViewModel
import br.com.luisfernandez.github.client.repodetails.pullrequest.PullRequestViewModel
import br.com.luisfernandez.github.client.repolist.RepoListViewModel
import org.koin.android.viewmodel.ext.koin.viewModel
import org.koin.dsl.module.module
Expand All @@ -28,4 +31,22 @@ val viewModelModule = module {
)
}

viewModel<ContributorsListViewModel> {
ContributorsListViewModel(
get()
)
}

viewModel<CommitsListViewModel> {
CommitsListViewModel(
get()
)
}

viewModel<BranchesListViewModel> {
BranchesListViewModel(
get()
)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package br.com.luisfernandez.github.client.pojo

import com.google.gson.annotations.SerializedName

data class BranchResponse(
@SerializedName("name") val name: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package br.com.luisfernandez.github.client.pojo

import com.google.gson.annotations.SerializedName

data class ContributorResponse(
@SerializedName("login") val login: String,
@SerializedName("avatar_url") val avatar_url: String,
@SerializedName("contributions") val contributions: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package br.com.luisfernandez.github.client.pojo.commit

import com.google.gson.annotations.SerializedName

data class Commit(
@SerializedName("committer") val committer: Committer,
@SerializedName("message") val message: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package br.com.luisfernandez.github.client.pojo.commit

import br.com.luisfernandez.github.client.pojo.User
import com.google.gson.annotations.SerializedName

data class CommitResponse(
@SerializedName("author") val author: User,
@SerializedName("commit") val commit: Commit
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package br.com.luisfernandez.github.client.pojo.commit

import com.google.gson.annotations.SerializedName
import java.util.Date

data class Committer(
@SerializedName("date") val date: Date
)

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package br.com.luisfernandez.github.client.repodetails

import android.annotation.SuppressLint
import android.support.v7.app.AppCompatActivity
import br.com.luisfernandez.github.client.R
import kotlinx.android.synthetic.main.activity_repo_details.*
import org.androidannotations.annotations.AfterViews
import org.androidannotations.annotations.EActivity
import org.androidannotations.annotations.Extra

@SuppressLint("Registered")
@EActivity(R.layout.activity_repo_details)
class RepoDetailsActivity : AppCompatActivity() {

@Extra
lateinit var owner: String

@Extra
lateinit var repoName: String

@AfterViews
fun afterViews() {
this.configToolbar()

val fragmentAdapter = RepoDetailsPagerAdapter(this, supportFragmentManager, owner, repoName)
viewPagerRepoDetail.adapter = fragmentAdapter

tabLayoutRepoDetail.setupWithViewPager(viewPagerRepoDetail)
}

private fun configToolbar() {
setSupportActionBar(toolbar)
supportActionBar?.let {
title = repoName
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
supportActionBar?.setDisplayShowTitleEnabled(true)
}
}

override fun onSupportNavigateUp(): Boolean {
onBackPressed()
return true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package br.com.luisfernandez.github.client.repodetails

import android.content.Context
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import br.com.luisfernandez.github.client.R
import br.com.luisfernandez.github.client.repodetails.brancheslist.BranchesListFragment
import br.com.luisfernandez.github.client.repodetails.commitslist.CommitsListFragment
import br.com.luisfernandez.github.client.repodetails.contributorslist.ContributorsListFragment
import br.com.luisfernandez.github.client.repodetails.issuelist.IssuesListFragment
import br.com.luisfernandez.github.client.repodetails.pullrequest.PullRequestListFragment

class RepoDetailsPagerAdapter(private val context: Context, fm: FragmentManager, owner: String, repoName: String):
FragmentPagerAdapter(fm) {

companion object {
const val OWNER = "OWNER"
const val REPONAME = "REPONAME"
}

val owner = owner
val repoName = repoName

override fun getCount(): Int {
return 5
}

override fun getItem(position: Int): Fragment {
val bundle = Bundle()
bundle.putString(OWNER, owner)
bundle.putString(REPONAME, repoName)

var fragment = when(position) {
0 -> PullRequestListFragment()
1 -> IssuesListFragment()
2 -> CommitsListFragment()
3 -> ContributorsListFragment()
4 -> BranchesListFragment()

else -> PullRequestListFragment()
}

fragment.arguments = bundle

return fragment
}

override fun getPageTitle(position: Int): CharSequence? {
return when(position){
0 -> context.getString(R.string.titlePullRequestsTab)
1-> context.getString(R.string.titleIssuesTab)
2 -> context.getString(R.string.titleCommitsTab)
3 -> context.getString(R.string.titleContributorsTab)
4 -> context.getString(R.string.titleBranchesTab)

else -> context.getString(R.string.titlePullRequestsTab)
}
}

}
Loading