Skip to content

Instantly share code, notes, and snippets.

View srmdev29's full-sized avatar

Sree srmdev29

  • Dallas
View GitHub Profile
@srmdev29
srmdev29 / UploadService.kt
Created February 26, 2016 11:31 — forked from danielgomezrico/UploadService.kt
Android / Retrofit - how to upload a file without multipart (as binary) for Kotlin
interface UploadService {
@Headers("Content-Type: image/jpeg")
@POST("/files")
fun uploadFile(@Body file: TypedFile): Observable<UploadedFile>
}
@srmdev29
srmdev29 / build.gradle
Created February 26, 2016 11:31 — forked from danielgomezrico/build.gradle
Android / add app version and build number to assembled apk.
def appVersionName = "1.0.0"
def appVersionCode = 12
android {
//...
defaultConfig {
//..
// Add version and build number to apk name
setProperty("archivesBaseName", "app-${appVersionName}-${appVersionCode}")
}
@srmdev29
srmdev29 / FlipAnimation-MainActivity
Last active February 26, 2016 11:14
FlipAnimation-Android
public class MainActivity extends AppCompatActivity {
private AnimatorSet mSetRightOut;
private AnimatorSet mSetLeftIn;
private boolean mIsBackVisible = false;
private View mCardFrontLayout;
private View mCardBackLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
@srmdev29
srmdev29 / IInAppBillingService.txt
Last active February 25, 2016 12:03
IInAppBillingService - In app subscription service helper class.
final InAppSub mInAppSub = new InAppSub(this);
mInAppSub.bindServiceConn();
Bundle ownedItems = mInAppSub.getPurchaseIntent();
if (ownedItems != null) {
int response = ownedItems.getInt("RESPONSE_CODE");
if (response != 0) {
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
@srmdev29
srmdev29 / Readme.md
Created February 9, 2016 13:27 — 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:

@srmdev29
srmdev29 / TimerTask
Last active February 6, 2016 00:02
it will run every 10mints and initial delay is 10minutes. I have used AsyncHttpClient for webservice calls(server) // compile 'com.loopj.android:android-async-http:1.4.5'
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startTimer();
}
private final static int DO_UPDATE_PROMOTE = 0;
int COUNTER_REFRESH_OTHERCARD = 0;
@srmdev29
srmdev29 / ArrayListSharedPreferences.txt
Last active January 26, 2016 18:48
Storing ArrayList on SharedPreferences . can store custom arraylist of objects.
private void setArrayListdata() {
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = sharedPrefs.edit();
Gson gson = new Gson();
ArrayList<Wagesdata> wagesdata = new ArrayList<Wagesdata>();
Wagesdata wagesdata1 = new Wagesdata();
wagesdata1.monthly2_wages = monthly_wages.getText().toString();
wagesdata1.monthly2_ebill = monthly_ebill.getText().toString();
wagesdata1.monthly2_gas = monthly_gas.getText().toString();
@srmdev29
srmdev29 / RestClient.java
Created October 21, 2015 15:27 — forked from Axxiss/RestClient.java
Restful client
public class RestClient {
private static final String TAG = "RestClient";
private static final String USER_AGENT = "VisioStorm Android";
/** Methods supported by RestClient */
public enum RequestMethod {
GET, POST
}
@srmdev29
srmdev29 / byte-sizetuts.md
Created September 26, 2015 12:28 — forked from honkskillet/byte-sizetuts.md
A series of golang tutorials with youtube videos.