Skip to content

Commit

Permalink
Commit: Center loading spinner; Make author/comitter gravatars link t…
Browse files Browse the repository at this point in the history
…o Profile

Signed-off-by: Eddie Ringle <eddie@eringle.net>
  • Loading branch information
EddieRingle committed Jan 25, 2011
1 parent 6984286 commit 9cddd01
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 24 deletions.
28 changes: 14 additions & 14 deletions res/layout/commit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
android:orientation="vertical">
<include android:id="@+id/include_top_bar" layout="@layout/top_bar" />
<ScrollView
android:id="@+id/sv_commit_content"
android:layout_width="fill_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/rl_commit_commitInfoLayout"
android:id="@+id/ll_commit_commitInfoLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_commit_view_header"
Expand Down Expand Up @@ -185,17 +185,17 @@
android:drawableLeft="@drawable/file_modified"
android:text="X files changed" />
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_commit_progressLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone">
<ProgressBar
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
android:indeterminateOnly="true" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/rl_commit_progressLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone">
<ProgressBar
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
android:indeterminateOnly="true" />
</RelativeLayout>
</LinearLayout>
37 changes: 27 additions & 10 deletions src/net/idlesoft/android/apps/github/activities/Commit.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import java.text.ParseException;
Expand Down Expand Up @@ -66,7 +67,7 @@ public class Commit extends Activity {

private GetCommitTask mGetCommitTask;

private LinearLayout mCommitLayout;
private ScrollView mCommitLayout;

private RelativeLayout mProgressLayout;

Expand Down Expand Up @@ -108,16 +109,17 @@ protected void buildUi() {
// Get the commit data for that commit ID so that we can get the
// tree ID and filename.
try {
final ImageView authorImage = (ImageView) findViewById(R.id.commit_view_author_gravatar);
final ImageView committerImage = (ImageView) findViewById(R.id.commit_view_committer_gravatar);

// If the committer is the author then just show them as the
// author, otherwise show
// both people
((TextView) findViewById(R.id.commit_view_author_name)).setText(mAuthor);
if (mAuthorGravatar != null) {
((ImageView) findViewById(R.id.commit_view_author_gravatar))
.setImageBitmap(mAuthorGravatar);
authorImage.setImageBitmap(mAuthorGravatar);
} else {
((ImageView) findViewById(R.id.commit_view_author_gravatar))
.setImageBitmap(Commit.loadGravatarByLoginName(Commit.this, mAuthor));
authorImage.setImageBitmap(Commit.loadGravatarByLoginName(Commit.this, mAuthor));
}

// Set the commit message
Expand Down Expand Up @@ -152,14 +154,29 @@ protected void buildUi() {
((TextView) findViewById(R.id.commit_view_committer_time))
.setText(authorDate);
if (mCommitterGravatar != null) {
((ImageView) findViewById(R.id.commit_view_committer_gravatar))
.setImageBitmap(mCommitterGravatar);
committerImage.setImageBitmap(mCommitterGravatar);
} else {
((ImageView) findViewById(R.id.commit_view_committer_gravatar))
.setImageBitmap(Commit.loadGravatarByLoginName(Commit.this, mCommitter));
committerImage.setImageBitmap(Commit.loadGravatarByLoginName(Commit.this, mCommitter));
}
}

OnClickListener onGravatarClick = new OnClickListener() {
public void onClick(View v) {
Intent i = new Intent(Commit.this, Profile.class);
if (v.getId() == authorImage.getId()) {
i.putExtra("username", mAuthor);
} else if (v.getId() == committerImage.getId()) {
i.putExtra("username", mCommitter);
} else {
return;
}
startActivity(i);
}
};

authorImage.setOnClickListener(onGravatarClick);
committerImage.setOnClickListener(onGravatarClick);

int filesAdded, filesRemoved, filesChanged;

try {
Expand Down Expand Up @@ -295,7 +312,7 @@ public void onCreate(final Bundle icicle) {

mGapi.authenticate(mUsername, mPassword);

mCommitLayout = (LinearLayout) findViewById(R.id.rl_commit_commitInfoLayout);
mCommitLayout = (ScrollView) findViewById(R.id.sv_commit_content);
mProgressLayout = (RelativeLayout) findViewById(R.id.rl_commit_progressLayout);

final Bundle extras = getIntent().getExtras();
Expand Down

0 comments on commit 9cddd01

Please sign in to comment.