Skip to content

Commit

Permalink
Add List view of all repository milestones
Browse files Browse the repository at this point in the history
#7 Closed
  • Loading branch information
UEvgeniy committed Dec 16, 2017
1 parent 081cf03 commit ae5596c
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import org.eclipse.egit.github.core.Milestone;

import java.text.SimpleDateFormat;
/**
* List adapter for a list of milestones
*/
Expand All @@ -38,11 +39,8 @@ public class MilestoneListAdapter extends SingleTypeAdapter<Milestone> {
*/
public MilestoneListAdapter(final Context context,
final Milestone[] elements, final AvatarLoader avatars) {
super(LayoutInflater.from(context), R.layout.contributor_item);

/*this.context = context.getApplicationContext();
this.avatars = avatars;
setItems(elements);*/
super(LayoutInflater.from(context), R.layout.milestone_item);
setItems(elements);
}

@Override
Expand All @@ -54,16 +52,19 @@ public long getItemId(final int position) {

@Override
protected int[] getChildViewIds() {
//todo
//return new int[] { R.id.iv_avatar, R.id.tv_login, R.id.tv_contributions };
return new int[]{};
return new int[]{R.id.tv_milestone_title,
R.id.tv_milestone_due_to,
R.id.tv_milestone_opened_iss_number,
R.id.tv_milestone_closed_iss_number};
}

@Override
protected void update(int position, Milestone milestone) {
//todo
/*avatars.bind(imageView(0), contributor);
setText(1, contributor.getLogin());
setText(2, context.getString(R.string.contributions, contributor.getContributions()));*/
SimpleDateFormat sdf = new SimpleDateFormat("dd.MMM.yyyy");

setText(0, milestone.getTitle());
setText(1, "Due by " + sdf.format(milestone.getDueOn()));
setText(2, "Opened: " + String.valueOf(milestone.getOpenIssues()));
setText(3, "Closed: " + String.valueOf(milestone.getClosedIssues()));
}
}
55 changes: 36 additions & 19 deletions app/src/main/res/layout/milestone_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,52 @@
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/ListItem" >

<RadioButton
android:id="@+id/rb_selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false" />
style="@style/ListItemTwoLines"
android:gravity="center_vertical"
android:orientation="horizontal">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/rb_selected"
android:orientation="vertical"
android:paddingLeft="5dp" >
android:layout_height="match_parent"
android:layout_toLeftOf="@id/ll_milestone_issues"
android:orientation="vertical">

<TextView
android:id="@+id/tv_milestone_title"
style="@style/ListTitleText"
android:singleLine="true" />
android:paddingBottom="0dp"
android:paddingLeft="10dp"
android:singleLine="true"
android:textStyle="normal" />

<TextView
android:id="@+id/tv_milestone_description"
android:id="@+id/tv_milestone_due_to"
style="@style/ListSubtitleText"
android:singleLine="true" />
android:paddingLeft="10dp"
android:singleLine="true"
android:textStyle="normal" />
</LinearLayout>

<LinearLayout
android:id="@+id/ll_milestone_issues"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:orientation="vertical">

<TextView
android:id="@+id/tv_milestone_opened_iss_number"
style="@style/ListSubtitleText"
android:paddingLeft="10dp"
android:singleLine="true"
android:textStyle="normal" />

<TextView
android:id="@+id/tv_milestone_closed_iss_number"
style="@style/ListSubtitleText"
android:paddingLeft="10dp"
android:singleLine="true"
android:textStyle="normal" />
</LinearLayout>

</RelativeLayout>

0 comments on commit ae5596c

Please sign in to comment.