Skip to content

Instantly share code, notes, and snippets.

View romitgithub's full-sized avatar

Romit Choudhary romitgithub

  • India
View GitHub Profile
import React, { PureComponent } from "react";
class Dropdown extends PureComponent {
constructor(props) {
// spelling mistake change for constructor
super(props);
this.state = {
isOpen: this.props.isInitialStateOpen,
};
}
<CustomColorIconView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_location_dark"
app:dciv_color="@color/white" />
<declare-styleable name="CustomColorIconView">
<attr name="dciv_color" format="color"/>
</declare-styleable>
public class CustomColorIconView extends ImageView{
public CustomColorIconView(Context context) {
super(context);
}
public CustomColorIconView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/arrow_down"
android:fromDegrees="180"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="180" />
<?xml version="1.0" encoding="utf-8"?>
<RatingView
android:id="@+id/ratingBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:numStars="5"
app:rating="2"
/>
<declare-styleable name="RatingView">
<attr name="numStars" format="integer"/>
<attr name="rating" format="integer"/>
</declare-styleable>
public class RatingView extends LinearLayout {
private boolean ratingOngoing = false;
private Context mContext;
private OnRateListener onRateListener;
private boolean mRatingAllowed;
private int mNumStars = 5;
private int mRating = 0;
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/star_unselected"
android:state_checked="false"/>
<item android:drawable="@drawable/star_selected"
android:state_checked="true"/>
<item android:drawable="@drawable/star_unselected"/>
</selector>
<?xml version="1.0" encoding="utf-8"?>
<CheckBox
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_margin="8dp"
android:background="@drawable/rate_app_checkbox_background"
android:button="@color/transparent" />