Skip to content

Instantly share code, notes, and snippets.

View seupedro's full-sized avatar

Seu Pedro seupedro

View GitHub Profile
@seupedro
seupedro / AccessModifier.java
Last active January 10, 2018 19:32
Modificador de Acesso - Access Modifier Android
public class Carro {
private int mModelo;
public Carro() {
mModelo = 0;
setup();
}
public Carro(int modelo) {
public class ReportCard {
//Defining variables
private String mMateria;
private double mNota;
//Constructor
public ReportCard( String materia, double nota){
mMateria = materia;
mNota = nota;
}
//Getter Methods
@seupedro
seupedro / AppBaseActivity.java
Created January 27, 2018 16:54
Android: Easiest way to reuse a common Navigation drawer among a group of activities.
/*
* This is a simple and easy approach to reuse the same
* navigation drawer on your other activities. Just create
* a base layout that conains a DrawerLayout, the
* navigation drawer and a FrameLayout to hold your
* content view. All you have to do is to extend your
* activities from this class to set that navigation
* drawer. Happy hacking :)
* P.S: You don't need to declare this Activity in the
* AndroidManifest.xml. This is just a base class.
@seupedro
seupedro / DrawerActivity.java
Last active February 13, 2018 22:23 — forked from libinbensin/DrawerActivity
Android Navigation Drawer with Activities
public class DrawerActivity extends ActionBarActivity {
private DrawerLayout mDrawerLayout = null;
private ListView mDrawerList = null;
private String[] mDrawerItems;
private ActionBarDrawerToggle mDrawerToggle = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drawer_layout);
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* 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
*
* Unless required by applicable law or agreed to in writing, software
@seupedro
seupedro / AnimatedLinearLayout.java
Last active May 23, 2018 01:29
Simple android:animateLayoutChanges="true" example
package com.example.nakamoto.fishtool;
import android.animation.LayoutTransition;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
public class AnimatedLinearLayout extends Activity {
@seupedro
seupedro / AndroidManifest.xml
Created May 24, 2018 10:29 — forked from billmote/AndroidManifest.xml
When pushing code from your IDE, wake the device and show the activity.
<?xml version="1.0" encoding="utf-8"?>
<!-- Add this as a debug manifest so the permissions won't be required by your production app -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
</manifest>
@seupedro
seupedro / CustomScrollviewWithTabs.xml
Created May 24, 2018 11:23
A custom Scrollview with TabLayout and ImageView inside with parallax effect
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".activity.AquaInfo">
<android.support.design.widget.AppBarLayout
@seupedro
seupedro / CursorRecyclerAdapter.java
Created May 27, 2018 01:42 — forked from Shywim/CursorRecyclerAdapter.java
A custom Adapter for the new RecyclerView, behaving like the CursorAdapter class from previous ListView and alike. Now with Filters and updated doc.
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Matthieu Harlé
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@seupedro
seupedro / DateFormattingBasedOnLocale.java
Created June 2, 2018 13:40
Formate date based on User Locale on Android
String weddingDate = "26/02/1974";
/* Specify which format is */
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Date date = null;
try {
/* Parse to date object */
date = sdf.parse(weddingDate);
} catch (ParseException e) {
// handle exception here !