Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.CompoundButton;
import android.widget.ListView;

import com.github.kevinsawicki.wishlist.SingleTypeAdapter;
import com.github.kevinsawicki.wishlist.ViewUpdater;
import com.github.kevinsawicki.wishlist.ViewUtils;
import com.github.mobile.R;
import com.github.mobile.ui.DialogFragmentActivity;
Expand Down Expand Up @@ -69,6 +67,14 @@ protected int[] getChildViewIds() {
@Override
protected void update(int position, Milestone item) {
setText(1, item.getTitle());

String description = item.getDescription();
if (!TextUtils.isEmpty(description))
ViewUtils.setGone(setText(2, description), false);
else
setGone(2, true);

setChecked(0, selected == position);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class MilestoneListAdapter extends SingleTypeAdapter<Milestone> {
*/
public MilestoneListAdapter(final Context context,
final Milestone[] elements) {
super(LayoutInflater.from(context), R.layout.milestone_item);
super(LayoutInflater.from(context), R.layout.milestone_list_item);
this.context = context.getApplicationContext();
setItems(elements);
}
Expand All @@ -61,7 +61,7 @@ protected void update(int position, Milestone milestone) {
(milestone.due_on != null) ?
context.getString(R.string.ms_due_by) + sdf.format(milestone.due_on)
: EMPTY_STR);
setText(2, context.getString(R.string.ms_opened_issues) + String.valueOf(milestone.open_issues));
setText(3, context.getString(R.string.ms_closed_issues) + String.valueOf(milestone.closed_issues));
setText(2, String.valueOf(milestone.open_issues));
setText(3, String.valueOf(milestone.closed_issues));
}
}
20 changes: 16 additions & 4 deletions app/src/main/res/layout/milestone_edit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
android:layout_alignEnd="@+id/tv_milestone_title"
android:layout_alignStart="@+id/tv_milestone_title"
android:layout_below="@+id/tv_milestone_title"
android:layout_marginTop="10dp"
/>
android:layout_marginTop="10dp" />

<TextView
android:id="@+id/tv_milestone_description"
Expand Down Expand Up @@ -99,9 +98,13 @@
android:id="@+id/b_clear"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/strut"
android:layout_alignParentEnd="true"
android:layout_alignStart="@id/strut"
android:layout_below="@id/et_milestone_description"
android:layout_marginEnd="10dp"
android:layout_marginStart="5dp"
android:layout_marginTop="10dp"
android:background="@color/color_primary"
android:text="@string/clear" />

<TextView
Expand Down Expand Up @@ -134,14 +137,20 @@
android:id="@+id/b_two_weeks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:background="@color/color_primary"
android:text="@string/ms_date_2_weeks" />

<Button
android:id="@+id/b_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:background="@color/color_primary"
android:text="@string/ms_date_month" />

</LinearLayout>
Expand All @@ -153,7 +162,10 @@
android:layout_alignEnd="@+id/ll_buttons"
android:layout_alignStart="@+id/ll_buttons"
android:layout_below="@+id/ll_buttons"
android:layout_marginTop="15dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:background="@color/color_primary"
android:text="@string/ms_choose_date" />

</RelativeLayout>
Expand Down
55 changes: 19 additions & 36 deletions app/src/main/res/layout/milestone_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,52 +15,35 @@
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/ListItemTwoLines"
android:gravity="center_vertical"
android:orientation="horizontal">

<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/MilestoneItemOpenedIssue"
android:paddingLeft="10dp"
android:singleLine="true"
android:textStyle="normal" />

<TextView
android:id="@+id/tv_milestone_closed_iss_number"
style="@style/MilestoneItemClosedIssue"
android:paddingLeft="10dp"
android:singleLine="true"
android:textStyle="normal" />
</LinearLayout>
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" />

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

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

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

</RelativeLayout>
88 changes: 88 additions & 0 deletions app/src/main/res/layout/milestone_list_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2012 GitHub Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/ListItemTwoLines"
android:gravity="center_vertical"
android:orientation="horizontal">

<LinearLayout
android:id="@+id/ll_milestone_issues_nums"
android:layout_width="30dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:orientation="vertical">

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

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

<LinearLayout
android:id="@+id/ll_milestone_issues"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toStartOf="@id/ll_milestone_issues_nums"
android:orientation="vertical">

<TextView
android:id="@+id/tv_milestone_opened_iss"
style="@style/MilestoneItemOpenedIssue"
android:singleLine="true"
android:text="@string/ms_opened_issues"
android:textStyle="normal" />

<TextView
android:id="@+id/tv_milestone_closed_iss"
style="@style/MilestoneItemClosedIssue"
android:singleLine="true"
android:text="@string/ms_closed_issues"
android:textStyle="normal" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toStartOf="@id/ll_milestone_issues"
android:orientation="vertical">

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

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

</RelativeLayout>
3 changes: 0 additions & 3 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,4 @@
<color name="color_primary_dark">#1A237E</color>
<color name="color_accent">#64DD17</color>

<color name="milestone_item_issue_closed">#ff7f7f</color>
<color name="milestone_item_issue_opened">#96d196</color>

</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
<string name="issues_display_closed">Display closed</string>
<string name="issues_display_opened">Display opened</string>

<string name="ms_due_by">Due by </string>
<string name="ms_due_by">"Due date "</string>
<string name="ms_opened_issues">"Opened: "</string>
<string name="ms_closed_issues">"Closed: "</string>
<string name="ms_new_milestone">New milestone</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@

<style name="MilestoneItemOpenedIssue">
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/milestone_item_issue_opened</item>
<item name="android:textColor">@color/issue_event_green</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>

<style name="MilestoneItemClosedIssue">
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/milestone_item_issue_closed</item>
<item name="android:textColor">@color/issue_event_red</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
Expand Down