Skip to content
Snippets Groups Projects
Commit af54c85c authored by John Carlson's avatar John Carlson
Browse files

Add status and ref to build details

parent 8483cca5
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -22,8 +22,8 @@ def versionPatch = 1
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
 
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
compileSdkVersion 25
buildToolsVersion "25.0.0"
 
project.ext {
LABCOAT_FABRIC_KEY = project.hasProperty("LABCOAT_FABRIC_KEY") ? project.LABCOAT_FABRIC_KEY : "";
Loading
Loading
@@ -31,7 +31,7 @@ android {
defaultConfig {
applicationId "com.commit451.gitlab"
minSdkVersion 16
targetSdkVersion 24
targetSdkVersion 25
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode versionMajor * 1000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
Loading
Loading
@@ -74,12 +74,12 @@ dependencies {
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
 
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:palette-v7:24.2.1'
compile 'com.android.support:customtabs:24.2.1'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.android.support:palette-v7:25.0.0'
compile 'com.android.support:customtabs:25.0.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile('com.squareup.retrofit2:converter-simplexml:2.1.0') {
exclude group: 'xpp3', module: 'xpp3'
Loading
Loading
package com.commit451.gitlab.adapter;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import com.commit451.easel.Easel;
import com.commit451.gitlab.R;
import com.commit451.gitlab.viewHolder.AccessViewHolder;
/**
* Adapter to show the access levels
*/
public class AccessAdapter extends RecyclerView.Adapter<AccessViewHolder> {
private String[] mValues;
private String mSelectedValue;
private int mColorControlHighlight;
public AccessAdapter(Context context, String[] roles) {
mColorControlHighlight = Easel.getThemeAttrColor(context, R.attr.colorControlHighlight);
mValues = roles;
}
public void setSelectedAccess(String access) {
mSelectedValue = access;
}
public String getValueAt(int position) {
return mValues[position];
}
private final View.OnClickListener onProjectClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = (int) v.getTag(R.id.list_position);
mSelectedValue = getValueAt(position);
notifyDataSetChanged();
}
};
@Override
public AccessViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
AccessViewHolder holder = AccessViewHolder.inflate(parent);
holder.itemView.setOnClickListener(onProjectClickListener);
return holder;
}
@Override
public void onBindViewHolder(final AccessViewHolder holder, int position) {
String accessLevel = getValueAt(position);
holder.bind(accessLevel, mColorControlHighlight, accessLevel.equalsIgnoreCase(mSelectedValue));
holder.itemView.setTag(R.id.list_position, position);
}
@Override
public int getItemCount() {
return mValues.length;
}
@Nullable
public String getSelectedValue() {
return mSelectedValue;
}
}
Loading
Loading
@@ -49,6 +49,8 @@ public class BuildDescriptionFragment extends ButterKnifeFragment {
ViewGroup mRoot;
@BindView(R.id.swipe_layout)
SwipeRefreshLayout mSwipeRefreshLayout;
@BindView(R.id.text_status)
TextView mTextStatus;
@BindView(R.id.text_duration)
TextView mTextDuration;
@BindView(R.id.text_created)
Loading
Loading
@@ -57,6 +59,8 @@ public class BuildDescriptionFragment extends ButterKnifeFragment {
TextView mTextFinished;
@BindView(R.id.text_runner)
TextView mTextRunner;
@BindView(R.id.text_ref)
TextView mTextRef;
@BindView(R.id.text_author)
TextView mTextAuthor;
@BindView(R.id.text_message)
Loading
Loading
@@ -130,11 +134,15 @@ public class BuildDescriptionFragment extends ButterKnifeFragment {
if (startedTime == null) {
startedTime = new Date();
}
String status = String.format(getString(R.string.build_status), build.getStatus());
mTextStatus.setText(status);
String timeTaken = DateUtil.getTimeTaken(startedTime, finishedTime);
String duration = String.format(getString(R.string.build_duration), timeTaken);
mTextDuration.setText(duration);
String created = String.format(getString(R.string.build_created), DateUtil.getRelativeTimeSpanString(getActivity(), build.getCreatedAt()));
mTextCreated.setText(created);
String ref = String.format(getString(R.string.build_ref), build.getRef());
mTextRef.setText(ref);
if (build.getFinishedAt() != null) {
String finished = String.format(getString(R.string.build_finished), DateUtil.getRelativeTimeSpanString(getActivity(), build.getFinishedAt()));
mTextFinished.setText(finished);
Loading
Loading
Loading
Loading
@@ -32,6 +32,16 @@
android:orientation="vertical"
android:padding="8dp">
 
<TextView
android:id="@+id/text_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:text="Status: success"/>
<TextView
android:id="@+id/text_duration"
android:layout_width="wrap_content"
Loading
Loading
@@ -97,6 +107,16 @@
android:text="@string/build_commit"
android:textAppearance="?android:attr/textAppearanceLarge"/>
 
<TextView
android:id="@+id/text_ref"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:textAppearance="?android:attr/textAppearanceMedium"
tools:text="Ref: master"/>
<TextView
android:id="@+id/text_author"
android:layout_width="wrap_content"
Loading
Loading
Loading
Loading
@@ -414,6 +414,7 @@
<item>Details</item>
<item>Log</item>
</string-array>
<string name="build_ref">Ref: %1$s</string>
<string name="build_status">Status: %1$s</string>
<string name="build_duration">Duration: %1$s</string>
<string name="build_created">Created: %1$s</string>
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment