Search in sources :

Example 1 with CircularImageView

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;
}
Also used : LayoutInflater(android.view.LayoutInflater) Intent(android.content.Intent) CircularImageView(com.pkmmte.view.CircularImageView) View(android.view.View)

Example 2 with CircularImageView

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);
}
Also used : LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) CircularImageView(com.pkmmte.view.CircularImageView) View(android.view.View) ListView(android.widget.ListView) CircularImageView(com.pkmmte.view.CircularImageView) MotionEvent(android.view.MotionEvent) SuppressLint(android.annotation.SuppressLint)

Example 3 with CircularImageView

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();
        }
    });
}
Also used : Account(com.keylesspalace.tusky.entity.Account) ImageView(android.widget.ImageView) CircularImageView(com.pkmmte.view.CircularImageView) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) CircularImageView(com.pkmmte.view.CircularImageView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar) CircularImageView(com.pkmmte.view.CircularImageView)

Aggregations

View (android.view.View)3 CircularImageView (com.pkmmte.view.CircularImageView)3 LayoutInflater (android.view.LayoutInflater)2 ImageView (android.widget.ImageView)2 SuppressLint (android.annotation.SuppressLint)1 Intent (android.content.Intent)1 ActionBar (android.support.v7.app.ActionBar)1 Toolbar (android.support.v7.widget.Toolbar)1 MotionEvent (android.view.MotionEvent)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 Account (com.keylesspalace.tusky.entity.Account)1