Skip to content

Instantly share code, notes, and snippets.

Avatar

Harish Sridharan sharish

View GitHub Profile
View RatingBarDrawable.xml
<!-- Rating bar drawable -->
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background"
android:drawable="@drawable/apptheme_rate_star_small_off_holo_light" />
<item android:id="@android:id/secondaryProgress"
android:drawable="@drawable/apptheme_rate_star_small_half_holo_light" />
<item android:id="@android:id/progress"
android:drawable="@drawable/apptheme_rate_star_small_on_holo_light" />
</layer-list>
View PieChart.xml
<com.cooltechworks.chartexample.PieChart
android:layout_marginTop="@dimen/margin_medium"
android:id="@+id/pie_chart"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center"
/>
View PieChartSample.java
final PieChart pie = (PieChart) this.findViewById(R.id.pie_chart);
float[] marks = {0.35f, 0.3f, 0.2f,0.15f};
String[] subjects = { "Physics", "Maths", "Chemistry", "CS"};
int[] colors = {Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW};
for (int i = 0; i < marks.length; i++) {
View FormattedPrice.java
public String getFormattedPrice(Resources resources) {
final String LAKH = "L";
final String CRORE = "C";
double value = getPrice();
String rupees = resources.getString(R.string.rupee);
if (value >= 100) {
View FormattedPrice
public String getFormattedPrice(Resources resources) {
final String LAKH = "L";
final String CRORE = "C";
double value = getPrice();
String rupees = resources.getString(R.string.rupee);
if (value >= 100) {
View ColorShadesUsageLayout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:background="@color/blue_bg"
android:orientation="vertical">
<TextView
android:id="@+id/output_color_code"
android:layout_width="match_parent"
View ColorShadesUsage.java
package com.cooltechworks.materialcolorshades;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import android.widget.SeekBar;
import android.widget.TextView;
View OnDownUsageMainActivityLayout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<View
android:id="@+id/hello"
android:layout_width="150dp"
android:layout_height="150dp"
View OnDownUsage.java
package com.cooltechworks.ondownsample;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
View OnDownListener.java
package com.cooltechworks.ondownsample;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
/**
* Created by sharish on 7/24/15.
*/
public abstract class OnDownListener implements View.OnTouchListener {
You can’t perform that action at this time.