diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 03cbbae9..04a0a6ca 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -95,6 +95,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{
+
+ private final Context context;
+ /**
+ * Create milestone list adapter
+ *
+ * @param context
+ * @param elements
+ * @param avatars
+ */
+ public MilestoneListAdapter(final Context context,
+ final Milestone[] elements, final AvatarLoader avatars) {
+ super(LayoutInflater.from(context), R.layout.milestone_item);
+ this.context = context.getApplicationContext();
+ setItems(elements);
+ }
+
+ @Override
+ protected int[] getChildViewIds() {
+ 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) {
+ SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy");
+
+ setText(0, milestone.getTitle());
+ setText(1, context.getString(R.string.ms_due_by) + sdf.format(milestone.getDueOn()));
+ setText(2, context.getString(R.string.ms_opened_issues) + String.valueOf(milestone.getOpenIssues()));
+ setText(3, context.getString(R.string.ms_closed_issues) + String.valueOf(milestone.getClosedIssues()));
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryMilestonesActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryMilestonesActivity.java
new file mode 100644
index 00000000..e0e2678a
--- /dev/null
+++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryMilestonesActivity.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2013 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.
+ */
+package com.github.mobile.ui.repo;
+
+import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
+import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP;
+import static com.github.mobile.Intents.EXTRA_REPOSITORY;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.app.ActionBar;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.Toast;
+
+import com.github.mobile.Intents;
+import com.github.mobile.R;
+import com.github.mobile.ui.DialogFragmentActivity;
+
+import org.eclipse.egit.github.core.Repository;
+
+/**
+ * Activity to view repository milestones
+ */
+public class RepositoryMilestonesActivity extends DialogFragmentActivity {
+
+ /**
+ * Create intent for this activity
+ *
+ * @param repository
+ * @return intent
+ */
+ public static Intent createIntent(Repository repository) {
+ return new Intents.Builder("repo.milestones.VIEW").repo(repository).toIntent();
+ }
+
+ private Repository repository;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.repo_milestones);
+
+ repository = getSerializableExtra(EXTRA_REPOSITORY);
+
+ ActionBar actionBar = getSupportActionBar();
+ actionBar.setTitle(repository.getName());
+ actionBar.setSubtitle(R.string.milestone);
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ Intent intent = RepositoryViewActivity.createIntent(repository);
+ intent.addFlags(FLAG_ACTIVITY_CLEAR_TOP | FLAG_ACTIVITY_SINGLE_TOP);
+ startActivity(intent);
+ return true;
+ case R.id.add_ms_menu_item:
+ //todo change on opening of milestone_create_page
+ Toast.makeText(this, "open milestone", Toast.LENGTH_SHORT).show();
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.milestone, menu);
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryMilestonesFragment.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryMilestonesFragment.java
new file mode 100644
index 00000000..725413d2
--- /dev/null
+++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryMilestonesFragment.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2013 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.
+ */
+package com.github.mobile.ui.repo;
+
+import static com.github.mobile.Intents.EXTRA_REPOSITORY;
+import static org.eclipse.egit.github.core.service.IssueService.STATE_OPEN;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v4.content.Loader;
+import android.view.View;
+import android.widget.ListView;
+import android.widget.Toast;
+
+import com.github.kevinsawicki.wishlist.SingleTypeAdapter;
+import com.github.mobile.R;
+import com.github.mobile.ThrowableLoader;
+import com.github.mobile.ui.ItemListFragment;
+import com.github.mobile.util.AvatarLoader;
+import com.google.inject.Inject;
+
+import java.util.List;
+
+import org.eclipse.egit.github.core.Milestone;
+import org.eclipse.egit.github.core.Repository;
+import org.eclipse.egit.github.core.service.MilestoneService;
+
+/**
+ * Fragment to display a list of milestones for a specific repository
+ */
+public class RepositoryMilestonesFragment extends ItemListFragment {
+
+ /**
+ * Avatar loader
+ */
+ @Inject
+ protected AvatarLoader avatars;
+
+ /**
+ * Milestone service
+ */
+ @Inject
+ protected MilestoneService service;
+
+ private Repository repo;
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+
+ repo = getSerializableExtra(EXTRA_REPOSITORY);
+ }
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ setEmptyText(R.string.no_milestone);
+ }
+
+ @Override
+ public Loader> onCreateLoader(int id, Bundle args) {
+ return new ThrowableLoader>(getActivity(), items) {
+
+ @Override
+ public List loadData() throws Exception {
+ //todo which state? STATE_OPEN?
+ return service.getMilestones(repo, STATE_OPEN);
+ }
+ };
+ }
+
+ @Override
+ protected SingleTypeAdapter createAdapter(List items) {
+ //todo what to send to MilestoneListAdapter
+ return new MilestoneListAdapter(getActivity(),
+ items.toArray(new Milestone[items.size()]), avatars);
+ }
+
+ @Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+ final Milestone milestone = (Milestone) l.getItemAtPosition(position);
+ Toast.makeText(getContext(),milestone.getTitle(),Toast.LENGTH_SHORT).show();
+ //todo add open milestone view page
+ }
+
+ @Override
+ protected int getErrorMessage(Exception exception) {
+ return R.string.error_milestones_load;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java
index bd61df70..8cc8a41c 100644
--- a/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java
+++ b/app/src/main/java/com/github/mobile/ui/repo/RepositoryViewActivity.java
@@ -198,6 +198,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.m_contributors:
startActivity(RepositoryContributorsActivity.createIntent(repository));
return true;
+ case R.id.m_milestone:
+ startActivity(RepositoryMilestonesActivity.createIntent(repository));
+ return true;
case R.id.m_parent_repo:
if (repository.getParent() == null) {
// TODO: save parent in OrganizationRepositories so we don't need to do this
diff --git a/app/src/main/res/layout/milestone_edit.xml b/app/src/main/res/layout/milestone_edit.xml
new file mode 100644
index 00000000..31c146e0
--- /dev/null
+++ b/app/src/main/res/layout/milestone_edit.xml
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/milestone_item.xml b/app/src/main/res/layout/milestone_item.xml
index 89a5fa34..f8109734 100644
--- a/app/src/main/res/layout/milestone_item.xml
+++ b/app/src/main/res/layout/milestone_item.xml
@@ -15,35 +15,52 @@
limitations under the License.
-->
-
-
+ style="@style/ListItemTwoLines"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+ android:layout_height="match_parent"
+ android:layout_toLeftOf="@id/ll_milestone_issues"
+ android:orientation="vertical">
+ android:paddingBottom="0dp"
+ android:paddingLeft="10dp"
+ android:singleLine="true"
+ android:textStyle="normal" />
+ android:paddingLeft="10dp"
+ android:singleLine="true"
+ android:textStyle="normal" />
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/repo_milestones.xml b/app/src/main/res/layout/repo_milestones.xml
new file mode 100644
index 00000000..967ce78d
--- /dev/null
+++ b/app/src/main/res/layout/repo_milestones.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/milestone.xml b/app/src/main/res/menu/milestone.xml
new file mode 100644
index 00000000..1fabbfea
--- /dev/null
+++ b/app/src/main/res/menu/milestone.xml
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/milestone_edit.xml b/app/src/main/res/menu/milestone_edit.xml
new file mode 100644
index 00000000..3df47f8a
--- /dev/null
+++ b/app/src/main/res/menu/milestone_edit.xml
@@ -0,0 +1,27 @@
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/repository.xml b/app/src/main/res/menu/repository.xml
index dd3b7eb6..6877c950 100644
--- a/app/src/main/res/menu/repository.xml
+++ b/app/src/main/res/menu/repository.xml
@@ -29,6 +29,12 @@
android:id="@+id/m_contributors"
app:showAsAction="never"
android:title="@string/contributors"/>
+
+
+
- Отобразить Markdown
Копировать хэш
Скопировано в буфер обмена
+ "Закрытые: "
+ "До "
+ "Открытые: "
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index be7ef48e..00d3dba6 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -346,5 +346,8 @@
Copy hash
Copied to clipboard
Parent repository
+ Due by
+ Opened:
+ Closed: