Define a custom class extending SeekBar to show the progress text on thumb of SeekBar.
public class TextThumbSeekBar extends SeekBar {
private int mThumbSize;
private TextPaint mTextPaint;
public TextThumbSeekBar(Context context) {| package com.gabesechan.android.reusable.receivers; | |
| import java.util.Date; | |
| import android.content.BroadcastReceiver; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.telephony.TelephonyManager; | |
| public abstract class PhonecallReceiver extends BroadcastReceiver { |
| <?xml version="1.0" encoding="utf-8"?> | |
| <!-- | |
| Copyright (C) 2015 The Android Open Source Project | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 |
| package com.drc.paytm_example; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| import java.util.Random; | |
| import android.app.Activity; | |
| import android.os.Bundle; | |
| import android.util.Log; | |
| import android.view.Window; |
So we're working on creating Android Material Awesome, a library which will hopefully incorperate the benefits of Material Design, Twitter's Bootstrap, and FontAwesome. What we really wanted is a project other people can easily include into their projects using gradle dependencies. To do this we needed to create a standalone library project so we could make it as lightweight as possible for including as a dependency, and a sample app that would use it for testing. These are the steps we took to get started in Android Studio (version 1.1).
The first thing we needed to do was to create two new projects, with all the default settings (Blank Activity etc). One for our sample app, and one for our library. We added both of ours into the same GitHub repo, however you can save them wherever you like.
| apply from: "$rootDir/utils.gradle" | |
| android { | |
| defaultConfig { | |
| buildConfigField 'String', 'SECRET_KEY', toJavaCodeString(SECRET_KEY) | |
| } | |
| } |
| Enabling communication with API if server has Self-Signed Certificate |
| import android.support.v7.widget.LinearLayoutManager; | |
| import android.support.v7.widget.RecyclerView; | |
| public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener { | |
| public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName(); | |
| private int previousTotal = 0; // The total number of items in the dataset after the last load | |
| private boolean loading = true; // True if we are still waiting for the last set of data to load. | |
| private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more. | |
| int firstVisibleItem, visibleItemCount, totalItemCount; |
| ImageView imageView = (ImageView) findViewById(R.id.card_thumbnail_image); | |
| Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose); | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ | |
| //Default | |
| imageView.setBackgroundResource(R.drawable.rose); | |
| } else { | |
| //RoundCorners | |
| RoundCornersDrawable round = new RoundCornersDrawable(mBitmap, | |
| getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius |
| package com.github.manuelpeinado.toolbartest; | |
| import android.graphics.Color; | |
| import android.graphics.drawable.Drawable; | |
| import android.os.Bundle; | |
| import android.support.v7.app.ActionBarActivity; | |
| import android.support.v7.widget.Toolbar; | |
| import android.view.Menu; | |
| import android.view.View; |