Skip to content

Instantly share code, notes, and snippets.

View raghunandankavi2010's full-sized avatar
🤵‍♂️
Android dev looking to learn new technologies and always open for a new job.

Raghunandan Kavi raghunandankavi2010

🤵‍♂️
Android dev looking to learn new technologies and always open for a new job.
View GitHub Profile
@raghunandankavi2010
raghunandankavi2010 / drawlabels
Created November 9, 2018 16:28
labels without rounded rect
private void drawLabels(Canvas canvas) {
weekWidth = (getWidth () - getPaddingLeft () - getPaddingRight ()) / weeksCount;
graphHeight = getHeight () - getPaddingTop () - getPaddingBottom ();
float centerX = getPaddingLeft() + (weekWidth/2);
for(int i=0;i<weeksCount;i++) {
String week = "week "+i;
mTextPaint.getTextBounds(week, 0, week.length(), textBounds);
package com.santalu.diagonalimageview;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Point;
@raghunandankavi2010
raghunandankavi2010 / GridItemDecoration
Created June 27, 2017 05:56
GridItemDecoration for recyclerview
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.View;
/**
* Created by Raghunandan on 17-11-2015.
*/
public class GridItemDecoration extends RecyclerView.ItemDecoration {
@raghunandankavi2010
raghunandankavi2010 / GridItemDecoration
Created June 15, 2017 08:23
RecyclerView grid item decoration
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.View;
/**
* Created by Raghunandan on 17-11-2015.
*/
public class GridItemDecoration extends RecyclerView.ItemDecoration {
@raghunandankavi2010
raghunandankavi2010 / GlideImageLoad.java
Created March 12, 2017 04:23
Loading image via glide
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
final ViewHolder viewHolder;
if (convertView == null) {
viewHolder = new ViewHolder();
convertView = mLayoutInflater.inflate(R.layout.all_noti_item, parent, false);
viewHolder.profilePic = (ImageView) convertView.findViewById(R.id.profilePic);
convertView.setTag(viewHolder);
@raghunandankavi2010
raghunandankavi2010 / FinalLoad.java
Created March 11, 2017 10:04
Glide loding circular image with transformations
if(feedItems.get(position).getUser_details()!=null) {
Glide.with(activity).load(feedItems.get(position).getUser_details().getUser_profile_image())
.bitmapTransform(new CropCircleTransformation(activity))
.placeholder(R.drawable.pod_h)
.into(viewHolder.profilePic);
}else
{
// make sure Glide doesn't load anything into this view until told otherwise
Glide.clear(viewHolder.profilePic);
@raghunandankavi2010
raghunandankavi2010 / LoadImage.java
Created March 11, 2017 09:56
Glide loading image code
Glide.with(activity).load(feedItems.get(position).getUser_details().getUser_profile_image())
.asBitmap().centerCrop()
.placeholder(R.drawable.pod_h)
.into(new BitmapImageViewTarget(viewHolder.profilePic) {
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(activity.getResources(), resource);
circularBitmapDrawable.setCircular(true);
viewHolder.profilePic.setImageDrawable(circularBitmapDrawable);
public class RoundImageview extends NetworkImageView {
Context mContext;
public RoundImageview(Context context) {
super(context);
mContext = context;
}
public RoundImageview(Context context, AttributeSet attrs) {
this(context, attrs, 0);
@raghunandankavi2010
raghunandankavi2010 / CrystalSeekbar.java
Created February 18, 2017 18:35
Seekbar with touch move only on circle touch and not the highlight bar
package com.example.raghu.myapplication;
/**
* Created by Raghu on 18-02-2017.
*/
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@raghunandankavi2010
raghunandankavi2010 / Readme.md
Created February 24, 2016 04:56 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example: