Android Open Source - octodroid Profile View From Project Back to project page octodroid .
License The source code is released under:
MIT License
If you think the Android project octodroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code package com.example.octodroid.views;
/ * w w w . j a v a 2 s . c o m * /
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.example.octodroid.R;
import com.rejasupotaro.octodroid.GitHub;
import com.rejasupotaro.octodroid.models.User;
import butterknife.ButterKnife;
import butterknife.InjectView;
import rx.android.view.ViewObservable;
public class ProfileView extends FrameLayout {
@InjectView(R.id.user_image)
ImageView userImageView;
@InjectView(R.id.user_name)
TextView userNameTextView;
public ProfileView(Context context) {
super (context);
}
public ProfileView(Context context, AttributeSet attrs) {
super (context, attrs);
}
public ProfileView(Context context, AttributeSet attrs, int defStyleAttr) {
super (context, attrs, defStyleAttr);
}
public void setup() {
View view = View.inflate(getContext(), R.layout.view_profile, null);
addView(view);
ButterKnife.inject(this );
ViewObservable.bindView(this , GitHub.client().user())
.cache()
.subscribe(r -> {
if (!r.isSuccessful()) {
return ;
}
setUser(r.entity());
});
}
private void setUser(User user) {
Glide.with(userImageView.getContext())
.load(user.getAvatarUrl())
.into(userImageView);
userNameTextView.setText(user.getLogin());
}
}
Java Source Code List com.example.octodroid.ApplicationTest.java com.example.octodroid.MyApplication.java com.example.octodroid.SessionPrefsSchema.java com.example.octodroid.activities.LoginActivity.java com.example.octodroid.activities.MainActivity.java com.example.octodroid.activities.SearchResultActivity.java com.example.octodroid.adapters.HottestRepositoryAdapter.java com.example.octodroid.adapters.SearchResultAdapter.java com.example.octodroid.views.DividerItemDecoration.java com.example.octodroid.views.MoreLoadScrollListener.java com.example.octodroid.views.ProfileView.java com.example.octodroid.views.helpers.ProgressDialogHelper.java com.example.octodroid.views.helpers.ToastHelper.java com.example.octodroid.views.holders.ProgressViewHolder.java com.example.octodroid.views.holders.RepositoryItemViewHolder.java com.rejasupotaro.octodroid.ApplicationTest.java com.rejasupotaro.octodroid.AuthenticationRequired.java com.rejasupotaro.octodroid.ConnectivityObserver.java com.rejasupotaro.octodroid.GitHubClient.java com.rejasupotaro.octodroid.GitHub.java com.rejasupotaro.octodroid.GsonProvider.java com.rejasupotaro.octodroid.http.AbstractClient.java com.rejasupotaro.octodroid.http.ApiClient.java com.rejasupotaro.octodroid.http.CacheControl.java com.rejasupotaro.octodroid.http.Header.java com.rejasupotaro.octodroid.http.Link.java com.rejasupotaro.octodroid.http.Method.java com.rejasupotaro.octodroid.http.PaginationHeaderParserTest.java com.rejasupotaro.octodroid.http.PaginationHeaderParser.java com.rejasupotaro.octodroid.http.Pagination.java com.rejasupotaro.octodroid.http.RequestCreator.java com.rejasupotaro.octodroid.http.Response.java com.rejasupotaro.octodroid.http.params.All.java com.rejasupotaro.octodroid.http.params.Order.java com.rejasupotaro.octodroid.http.params.Participating.java com.rejasupotaro.octodroid.http.params.Sort.java com.rejasupotaro.octodroid.http.params.Type.java com.rejasupotaro.octodroid.models.Notification.java com.rejasupotaro.octodroid.models.Plan.java com.rejasupotaro.octodroid.models.Repository.java com.rejasupotaro.octodroid.models.Resource.java com.rejasupotaro.octodroid.models.SearchResult.java com.rejasupotaro.octodroid.models.Subject.java com.rejasupotaro.octodroid.models.User.java