GithubHelp home page GithubHelp logo

tangoagency / avatar-view Goto Github PK

View Code? Open in Web Editor NEW
314.0 10.0 54.0 1.26 MB

Avatar ImageView with user's name first letter Drawable placeholder

License: MIT License

Java 100.00%
android android-library android-view android-ui android-data-binding

avatar-view's People

Contributors

bezmian avatar morristech avatar mzielu avatar radzio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avatar-view's Issues

Loading non-square images into AvatarView

AvatarView seems to stretch images to fit the circle when the images are non-square. Is there any way to change this behavior? For example, is it possible to make it crop and center the images instead of stretching them to fit the AvatarView?

Not Working with latest Picasso Library

public class PicassoLoader extends ImageLoaderBase {

public PicassoLoader() {
    super();
}

public PicassoLoader(String defaultPlaceholderString) {
    super(defaultPlaceholderString);
}

@Override
public void loadImage(@NonNull AvatarView avatarView, @NonNull AvatarPlaceholder avatarPlaceholder, String avatarUrl) {
    Picasso.with(getContext())
            .load(avatarUrl)
            .placeholder(avatarPlaceholder)
            .fit()
            .into(avatarView);
}

}

.with() method is removed in the latest version

Remove "android:label" from the library's manifest

A library doesn't need an application label. Having one actually causes conflicts with the consumer application when merging the manifests.

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@label value=(@string/all_appname) from AndroidManifest.xml:15:9-44
	is also present at [agency.tango.android:avatar-view-glide:0.0.2] AndroidManifest.xml:13:9-41 value=(@string/app_name).
	Suggestion: add 'tools:replace="android:label"' to <application> element at AndroidManifest.xml:10:5-58:19 to override.

Problem with Databinding - Cannot find a setter

I'm getting the following error while using AvatarView with databinding:

Cannot find a setter for <agency.tango.android.avatarview.views.AvatarView app:avatarUrl> that accepts parameter type 'java.lang.String'

If a binding adapter provides the setter, check that the adapter is annotated correctly and that the parameter type matches.

The problem could be that compatibility with older versions has been broken in Android gradle plugin 3.0?

I'm using gradle plugin 3.5.2

GlideLoader doesnt work.

Log Cat

07-31 23:18:33.132 7905-7905/com.example.kunda.test_avatar_library_withusername E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.kunda.test_avatar_library_withusername, PID: 7905
    java.lang.NoSuchMethodError: No virtual method load(Ljava/lang/String;)Lcom/bumptech/glide/DrawableTypeRequest; in class Lcom/bumptech/glide/RequestManager; or its super classes (declaration of 'com.bumptech.glide.RequestManager' appears in /data/app/com.example.kunda.test_avatar_library_withusername-2/base.apk)
        at agency.tango.android.avatarviewglide.GlideLoader.loadImage(GlideLoader.java:25)
        at agency.tango.android.avatarview.ImageLoaderBase.loadImage(ImageLoaderBase.java:21)
        at com.example.kunda.test_avatar_library_withusername.MainActivity.onCreate(MainActivity.java:19)
        at android.app.Activity.performCreate(Activity.java:5990)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
        at android.app.ActivityThread.access$800(ActivityThread.java:151)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5254)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

cause of error

public class GlideLoader extends ImageLoaderBase {

    public GlideLoader() {
        super();
    }

    public GlideLoader(String defaultPlaceholderString) {
        super(defaultPlaceholderString);
    }

    @Override
    public void loadImage(@NonNull AvatarView avatarView, @NonNull AvatarPlaceholder avatarPlaceholder, @NonNull String avatarUrl) {
        Glide.with(avatarView.getContext())
                .load(avatarUrl)
                .crossFade() ------>>>here is the error , this method is no longer supported
                .placeholder(avatarPlaceholder)
                .fitCenter()
                .into(avatarView);
    }

}

Main Activity

package com.example.kunda.test_avatar_library_withusername;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import agency.tango.android.avatarview.IImageLoader;
import agency.tango.android.avatarview.views.AvatarView;
import agency.tango.android.avatarviewglide.GlideLoader;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        AvatarView imageView = (AvatarView) findViewById(R.id.iv_profile_image);
        IImageLoader imageLoader = new GlideLoader();
        imageLoader.loadImage(imageView,"hhtp:bogusUrl","Kundan");

    }
}

Layout File

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:background="#000000"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <agency.tango.android.avatarview.views.AvatarView
        android:id="@+id/iv_profile_image"
        android:layout_width="100dp"
        android:layout_height="100dp"
        app:av_border_color="@android:color/white"
        app:av_border_width="4dp"
        app:av_text_size_percentage="35" />

</android.support.constraint.ConstraintLayout>

Runtime error: Unable to load images with picasso

Getting this run time error,
used both dependecies : implementation 'agency.tango.android:avatar-view:0.0.2'//for avatar-view
implementation 'agency.tango.android:avatar-view-picasso:0.0.2'//req. for avatar-view
Error:
java.lang.NoSuchMethodError: No static method with(Landroid/content/Context;)Lcom/squareup/picasso/Picasso; in class Lcom/squareup/picasso/Picasso; or its super classes (declaration of 'com.squareup.picasso.Picasso' appears in /data/app/in.dthoughtsinnolabs.adzapp-4mv9Fb3LlYixDWOhfVnOZw==/split_lib_directories_apk.apk:classes2.dex)

``
public class PicassoLoader extends ImageLoaderBase {

public PicassoLoader() {
    super();
}

public PicassoLoader(String defaultPlaceholderString) {
    super(defaultPlaceholderString);
}

@Override
public void loadImage(@NonNull AvatarView avatarView, @NonNull AvatarPlaceholder avatarPlaceholder, String avatarUrl) {
    Picasso.with(avatarView.getContext()) <= error lies here 
            .load(avatarUrl)
            .placeholder(avatarPlaceholder)
            .fit()
            .into(avatarView);
}

} ``

Can not be captured if located in a ViewGroup

Hi Sir,

I put AvatarView into a ViewGroup(such as LinearLayout) in xml file, and capture the ViewGroup with code snippet like below

mSrcViewGroup.setDrawingCacheEnabled(true);
Bitmap bm = mSrcViewGroup.getDrawingCache();
Bitmap copy = bm.copy(bm.getConfig(), true);
mSrcViewGroup.setDrawingCacheEnabled(false);
mDstImageView.setImageBitmap(copy);

As result, the whole ViewGroup(including sub-view) is captured except AvatarView. But I'm able to capture AvatarView itself(that is avatarView.getDrawingCache()) successfully. Can you help on this please?

Thanks in advance!

Update gradle build tool version

Update build tool version from classpath 'com.android.tools.build:gradle:2.2.0' to latest classpath 'com.android.tools.build:gradle:2.2.2'

Colors

is there an option to add a list of colors to select from them for the background?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.