use of com.pkmmte.view.CircularImageView in project CircularImageView by Pkmmte.
the class SimpleAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
LayoutInflater mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = mInflater.inflate(R.layout.row, parent, false);
holder = new ViewHolder();
holder.imgAvatar = (CircularImageView) convertView.findViewById(R.id.imgAvatar);
convertView.setTag(holder);
} else
holder = (ViewHolder) convertView.getTag();
holder.imgAvatar.setImageResource(mImages[position]);
holder.imgAvatar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mContext.startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("http://google.com")));
}
});
return convertView;
}
use of com.pkmmte.view.CircularImageView in project CircularImageView by Pkmmte.
the class MainActivity method initList.
@SuppressLint("ClickableViewAccessibility")
private void initList() {
// Add header
View headerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.header, mList, false);
mList.addHeaderView(headerView, null, false);
// Add footer
View footerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.footer, mList, false);
mList.addFooterView(footerView, null, false);
// DOGE!!!
final CircularImageView imgDoge = (CircularImageView) headerView.findViewById(R.id.imgDoge);
final TextView txtWow = (TextView) headerView.findViewById(R.id.txtWow);
final TextView txtClick = (TextView) headerView.findViewById(R.id.txtClick);
imgDoge.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (imgDoge.isSelected()) {
txtWow.setVisibility(View.VISIBLE);
txtClick.setVisibility(View.VISIBLE);
} else {
txtWow.setVisibility(View.INVISIBLE);
txtClick.setVisibility(View.INVISIBLE);
}
return false;
}
});
// Load web image with a round transformation
final CircularImageView imgNetwork = (CircularImageView) footerView.findViewById(R.id.imgNetwork);
loadWebImage(imgNetwork);
// Set the most basic adapter
mAdapter = new SimpleAdapter(this, images);
mList.setAdapter(mAdapter);
}
use of com.pkmmte.view.CircularImageView in project Tusky by Vavassor.
the class EditProfileActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_profile);
ButterKnife.bind(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(getString(R.string.title_edit_profile));
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}
if (savedInstanceState != null) {
priorDisplayName = savedInstanceState.getString("priorDisplayName");
priorNote = savedInstanceState.getString("priorNote");
isAlreadySaving = savedInstanceState.getBoolean("isAlreadySaving");
currentlyPicking = (PickType) savedInstanceState.getSerializable("currentlyPicking");
avatarBase64 = savedInstanceState.getString("avatarBase64");
headerBase64 = savedInstanceState.getString("headerBase64");
} else {
priorDisplayName = null;
priorNote = null;
isAlreadySaving = false;
currentlyPicking = PickType.NOTHING;
avatarBase64 = null;
headerBase64 = null;
}
avatarButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onMediaPick(PickType.AVATAR);
}
});
headerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onMediaPick(PickType.HEADER);
}
});
avatarPreview.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
avatarPreview.setImageBitmap(null);
avatarPreview.setVisibility(View.INVISIBLE);
avatarBase64 = null;
}
});
headerPreview.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
headerPreview.setImageBitmap(null);
headerPreview.setVisibility(View.INVISIBLE);
headerBase64 = null;
}
});
mastodonAPI.accountVerifyCredentials().enqueue(new Callback<Account>() {
@Override
public void onResponse(Call<Account> call, Response<Account> response) {
if (!response.isSuccessful()) {
onAccountVerifyCredentialsFailed();
return;
}
Account me = response.body();
priorDisplayName = me.getDisplayName();
priorNote = me.note.toString();
CircularImageView avatar = (CircularImageView) findViewById(R.id.edit_profile_avatar_preview);
ImageView header = (ImageView) findViewById(R.id.edit_profile_header_preview);
displayNameEditText.setText(priorDisplayName);
noteEditText.setText(priorNote);
Picasso.with(avatar.getContext()).load(me.avatar).placeholder(R.drawable.avatar_default).error(R.drawable.avatar_error).into(avatar);
Picasso.with(header.getContext()).load(me.header).placeholder(R.drawable.account_header_default).into(header);
}
@Override
public void onFailure(Call<Account> call, Throwable t) {
onAccountVerifyCredentialsFailed();
}
});
}
Aggregations