-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
View include: - title - due to date - description - progress - back to milestones list button
- Loading branch information
Showing
8 changed files
with
188 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 87 additions & 1 deletion
88
app/src/main/java/com/github/mobile/ui/milestone/MilestoneFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,95 @@ | ||
package com.github.mobile.ui.milestone; | ||
|
||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ProgressBar; | ||
import android.widget.TextView; | ||
|
||
import com.github.mobile.R; | ||
import com.github.mobile.ui.DialogFragment; | ||
|
||
import org.eclipse.egit.github.core.Milestone; | ||
|
||
import java.text.DateFormat; | ||
import java.text.SimpleDateFormat; | ||
|
||
import static com.github.mobile.Intents.EXTRA_MILESTONE; | ||
|
||
/** | ||
* Created by Александр on 20.12.2017. | ||
*/ | ||
|
||
public class MilestoneFragment { | ||
public class MilestoneFragment extends DialogFragment { | ||
private Milestone milestone; | ||
|
||
private TextView milestoneTitle; | ||
private TextView milestoneDueTo; | ||
private TextView milestoneDescription; | ||
private ProgressBar milestoneProgress; | ||
private TextView milestoneProgressPercentage; | ||
|
||
@Override | ||
public void onAttach(Context context) { | ||
super.onAttach(context); | ||
|
||
milestone = (Milestone) getSerializableExtra(EXTRA_MILESTONE); | ||
} | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) { | ||
return inflater.inflate(R.layout.repo_milestone_item, null); | ||
} | ||
|
||
@Override | ||
public void onViewCreated(View view, Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
|
||
milestoneTitle = (TextView) finder.find(R.id.tv_milestone_name); | ||
milestoneDueTo = (TextView) finder.find(R.id.tv_milestone_due_to); | ||
milestoneDescription = (TextView) finder.find(R.id.tv_milestone_description); | ||
milestoneProgress = (ProgressBar) finder.find(R.id.pB_milestone_completion_progress); | ||
milestoneProgressPercentage = (TextView) finder.find(R.id.tv_milestone_progress_percentage); | ||
} | ||
|
||
@Override | ||
public void onActivityCreated(Bundle savedInstanceState) { | ||
super.onActivityCreated(savedInstanceState); | ||
if (milestone != null){ | ||
updateMilestone(milestone); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch (item.getItemId()) { | ||
// case R.id.m_edit: | ||
// if (issue != null) { | ||
// Intent intent = EditIssueActivity.createIntent(issue, | ||
// repositoryId.getOwner(), repositoryId.getName(), user); | ||
// startActivityForResult(intent, ISSUE_EDIT); | ||
// } | ||
// return true; | ||
} | ||
return true; | ||
} | ||
|
||
private void updateMilestone(final Milestone milestone){ | ||
if (!isUsable()){ | ||
return; | ||
} | ||
|
||
milestoneTitle.setText(milestone.getTitle()); | ||
DateFormat sdf = SimpleDateFormat.getDateInstance(); | ||
milestoneDueTo.setText(sdf.format(milestone.getDueOn())); | ||
milestoneDescription.setText(milestone.getDescription()); | ||
int totalIssues = milestone.getClosedIssues() + milestone.getOpenIssues(); | ||
int progress = totalIssues == 0 ? 0 : milestone.getClosedIssues() * 100 / totalIssues; | ||
milestoneProgress.setProgress(progress); | ||
milestoneProgressPercentage.setText(String.valueOf(progress)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
style="@style/Toolbar" /> | ||
|
||
<fragment | ||
android:id="@android:id/list" | ||
class="com.github.mobile.ui.milestone.MilestoneFragment" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:id="@+id/tv_milestone_name" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Milestone name" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_milestone_due_to" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="31.12.2017" /> | ||
|
||
<TextView | ||
android:id="@+id/tv_milestone_description" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="Lorem ipsum ............................................................................" /> | ||
|
||
<ProgressBar | ||
android:id="@+id/pB_milestone_completion_progress" | ||
style="?android:attr/progressBarStyleHorizontal" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:max="100" | ||
android:progress="20" /> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="horizontal"> | ||
|
||
<TextView | ||
android:id="@+id/tv_milestone_progress_percentage" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" | ||
android:text="50" /> | ||
|
||
<TextView | ||
android:id="@+id/lbl_milestone_progress_percentage" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_weight="1" | ||
android:text="% completed" /> | ||
</LinearLayout> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Sat Mar 04 11:22:22 CET 2017 | ||
#Wed Dec 20 02:21:43 MSK 2017 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip |