This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import meu_pacote.UserAuthenticator; | |
import play.mvc.Controller; | |
import play.mvc.Security; | |
@Security.Authenticated(UserAuthenticator.class) | |
public class MyController extends Controller { | |
// Todos os métodos estarão sujeitos ao Autenticator | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import controllers.SecuredController; | |
import play.mvc.Http; | |
import play.mvc.Result; | |
import play.mvc.Security; | |
import java.util.Optional; | |
public class Authenticator extends Security.Authenticator { | |
public static final String ID_SESSION = "id_session"; // eu coloco o email ou um código |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SeuController extends Controller { | |
public Result login() { | |
System.out.println("Chamando meu método java"); | |
// Aqui vc faz algo... | |
// retorno pra view... | |
return ok(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
public static Finder<Long, Foo> find = new Finder<>(Foo.class); | |
Long id; | |
String name; | |
List<Doo> dooList; | |
/* Retorna uma lista de objetos Foo pelo type de Doo */ | |
public static List<Foo> getAllFoos(String type) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** This method was called by Play! through the some tag in the html */ | |
public CompletableFuture<Result> submit() { | |
auth = FirebaseAuth.getInstance(app); | |
final Form<LoginForm> filledForm = loginForm.bindFromRequest(); | |
return signIn(filledForm); | |
} | |
private CompletableFuture<Result> signIn(Form<LoginForm> filledForm) { | |
final CompletableFuture<Result> resultFuture = new CompletableFuture(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DialogBuilder { | |
/** | |
* Cria um diálogo com uma mensagem personalizada | |
* | |
* @param context | |
* @param message | |
*/ | |
public static void createGenericErrorDialog(Context context, String message) { | |
final Dialog errorDialog = new Dialog(context); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Monster extends Enemy { | |
private String monsterName; | |
protected void monsterfy() { | |
this.monsterName = "Monster " + getRandomId(); // comando qualquer | |
} | |
} | |
class People extends Monster { | |
// quando a classe for criada, eu quero que o método monsterfy() execute como um "init()" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="#F3F3F4" | |
android:orientation="vertical" > | |
<android.support.v4.view.ViewPager | |
android:id="@+id/pager" | |
android:layout_width="match_parent" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Verifico se é a aba de produtos e, caso seja, troco o menu da toolbar | |
pager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { | |
@Override | |
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |
} | |
@Override | |
public void onPageSelected(int position) { | |
// Verifico se é a aba de produtos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Dude { | |
// Easy way ¬¬ april, 14 2018 | |
fun main(args: Array<String>) { | |
lambdaCall({ | |
System.out.println(it) | |
}) | |
} | |