tangoagency / avatar-view Goto Github PK
View Code? Open in Web Editor NEWAvatar ImageView with user's name first letter Drawable placeholder
License: MIT License
Avatar ImageView with user's name first letter Drawable placeholder
License: MIT License
Can we have the option to change the background color the avatar-view?
Thanks,
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?
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
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.
Can we set a default background color instead of a random color ?
I want to change the border color of the view through programming. Can you help me, please?
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
Hello Sir,
I am not able to view the avatar image view in my app.Am currently using the avatar view in and adapter and some am not able to display the image,in fact nothing is displayed ..its just plain white.Can please tell me what is that am doing wrong?.
Here is the code:
imageLoader = new PicassoLoader();
imageLoader.loadImage(holder.iv_merchant_pic, "https://pbs.twimg.com/profile_images/556495456805453826/wKEOCDN0_400x400.png", "User Name");
For me I have mostly the case that I have firstname and lastname - so it would be great to have both letters.
eg "John Doe" => "JD"
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>
I get issue when add dependencies
compile 'agency.tango.android:avatar-view-glide:0.0.2'
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);
}
} ``
you can set two letters on the avatar
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 build tool version from classpath 'com.android.tools.build:gradle:2.2.0'
to latest classpath 'com.android.tools.build:gradle:2.2.2'
is there an option to add a list of colors to select from them for the background?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.