Viagem autocaravana dia D

LEVANTAMENTO DA AUTOCARAVANA: Após sair do trabalho, fui então buscar a autocaravana. Na Campervan, aguardavam por mim para assinar contrato, fazer uma inspeção da caravana para registar os riscos e batidas existentes na carinha, e deram-me uma explicação de como funcionam as águas e a eletricidade… 
Ao pegar no “bicho” (nunca tinha conduzido um veículo tão grande) a primeira impressão foi: Onde está o espelho retrovisor?!? R: Não existe, é compensado por espelhos laterais gigantes, mas a princípio causa assim uma certa impressão em não ver o que está na retaguarda, só se vê o que as lateriais deixam ver. De resto a condução não é muito diferente dos ligeiros, tendo só de fazer as curvas mais largas para que a roda de traz não bata nos passeios, é preciso um espaço de estacionamento maior, e é preciso maior espaço para fazer manobras simples… mas nada disso foi grande problema.

ARRUMAÇÃO DA CARAVANA: Começam os problemas e verifica-se a nobiçe dos artistas, que me leva aqui a criar a rúbrica “Erros comuns dos Nobs caravanistas” A caravana tem vários espaços para arrumação, mas já tinhamos arrumados as coisas todas nos sacos e malas! Claro que não faz sentido, não é um porta-bagagens de um automóvel.

#Erro 1: Arrumar tudo o que for possível nos armários da caravana e não levar malas e malinas e sacos…  

O espaço da autocaravana não é muito (contem as vezes que vou dizer isto ao longo desta rubrica) portanto tudo o que ocupa mais espaço do que o destinado nos armários, estorva: Malas para as camas quando queremos comer, malas para as cadeiras/mesas quando queros dormir… Portanto pode ser uma bocado chato esta dança das malas.

 

Viagem Autocaravana » Dia D-1

O que não pode faltar:

  1. Equipamento para corrida: Férias não existem sem uma corrida matinal, enquanto toda a gente está a dormir, um pouco depois do sol nascer, saio para explorar na corrida locais novos, cheiros, natureza, é assim que tem de começar o dia, e claro, um elástico para o “upper body workout” após a corrida.
  2. A viola: Outro artigo indispensável, pois é uma excelente forma de terminar um dia, ou passar uma tarde, tirando uns acordes da viola e cantarolando umas músicas…
  3. Prancha de Surf: Se vamos passar por praias, que tal experimentar umas ondas, a prancha com certeza vai estorvar porque ocupa muito espaço, mas também tem de ir.
  4. Livros: Estar sem fazer nada de barriga para o ar, não é bem a minha cena… uns livrinhos, Bíblia e Patriarcas e Profetas, foram as escolhas para a viagem.
  5. Necessaire: Pronto, depois de tudo o resto, parece que também faz falta uma roupa e os artigos de higiene pessoal.

Preparação viagem Autocaravana

Em contexto de pandemia, a família sugeriu este ano fazer umas férias de autocaravana no final de agosto. Ora isto será algo inédito, porque nunca fizemos nada semelhante, e estamos habituados a hotéis, buffet, piscina, ginásio, avião, que é um bocadinho diferente da provável “canseira” das férias numa autocaravana.

Para ter a certeza que a família irá gostar deste tipo de férias, pensei primeiro em fazer uma experiência de 5 dias, para ajudar na decisão de adjudicar a ideia…

1) Empresa aluguer autocaravanas: Sendo 5 pessoas, a escolha ficou logo limitada, uma vez que a maioria das empresas aluga viaturas com lotação máxima de 4 pessoas. Das hipóteses pesquisados, a escolha recaiu sobre a campervan – pareceu-nos a mais económica, e a mais “transparente” em todas as condições e * (asteriscos).

2) Escolha do itinerário: Sendo uma experiência, não abusamos nos destinos, ficamos por 3 ou 4 locais da bela costa vicentina, falaremos deles mais à frente.
3) Tutoriais para totós: “manutenção de autocaravanas” senti necessidade de estar mais informado do que irei encontrar: Descobri o que são águas limpas, águas cinzentas, e águas pretas (acho que é sonho de qualquer caravanista, vazar a cassete da retrete!!!), energia elétrica, gás para o fogão etc… (explico melhor quando meter a mão na massa!)

Ora o elenco para a viagem:  Pai, Mãe, Filha 14 anos (e a amiga) e a filha mais nova de 9 anos. Veremos o que isto dá!

Anuncios do Admob no Flutter

pubspec.yaml

dependencies:
flutter:
sdk: flutter

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
firebase_admob: ^0.9.0+9

AndroidManifest.xml

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB_APP_ID]"/>

Main

import 'package:firebase_admob/firebase_admob.dart';
 @override
Widget (BuildContext context) {
  FirebaseAdMob.instance.initialize(appId: "[ADMOB_APP_ID]");
  myBanner
..load()
..show(
anchorOffset: 60.0,
horizontalCenterOffset: 10.0,
anchorType: AnchorType.bottom,
);


myInterstitial
..load()
..show(
anchorType: AnchorType.bottom,
anchorOffset: 0.0,
horizontalCenterOffset: 0.0,
);

return Scaffold(

 
MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
keywords: <String>['games', 'game','Kids'],
contentUrl: 'https://flutter.io',
childDirected: false,
testDevices: <String>[], // Android emulators are considered test devices
);

BannerAd myBanner = BannerAd(
adUnitId: [Your Banner.Ad.Id],
size: AdSize.smartBanner,
targetingInfo: targetingInfo,
listener: (MobileAdEvent event) {
print("BannerAd event is $event");
},
);

InterstitialAd myInterstitial = InterstitialAd(
adUnitId: [Your Interstitial.Ad_Id],
targetingInfo: targetingInfo,
listener: (MobileAdEvent event) {
print("InterstitialAd event is $event");
},
);

 

JunKenPon – Como eu fiz este aplicativo em Flutter (#2 Gesture Detector)

#1 - Criação do Interface

import 'package:flutter/material.dart';
import 'package:jankenpon/Game.dart';

void main(){
runApp(MaterialApp(
home: Game(),
debugShowCheckedModeBanner: false,
));
}
import 'dart:math';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class Game extends StatefulWidget {
@override
_GameState createState() => _GameState();
}

class _GameState extends State<Game> {

var _imageAppChoice=AssetImage("images/base.png");
var _batleResult="Batle Field";
var _resultado="";
var _userVictory=0, _appVictory=0;

var _imageBatleResult=AssetImage("images/base.png");

void _selectOption(String userChoice) {
var options = ["rock", "paper", "scissors", "lizard", "spock"];
var number = Random().nextInt(5);
var appChoice = options[number];

//Show App Choice Image
switch (appChoice) {
case "rock":
setState(() {
this._imageAppChoice = AssetImage("images/rock.png");
});
break;
case "paper":
setState(() {
this._imageAppChoice = AssetImage("images/paper.png");
});
break;
case "scissors":
setState(() {
this._imageAppChoice = AssetImage("images/scissors.png");
});
break;
case "lizard":
setState(() {
this._imageAppChoice = AssetImage("images/lizard.png");
});
break;
case "spock":
setState(() {
this._imageAppChoice = AssetImage("images/spock.png");
});
break;
}

//If User Wins: Change Imagem
if(userChoice=="rock" && appChoice == "scissors") {
this._imageBatleResult=AssetImage("images/rock_scissors_win.png");
_batleResult="You Win! Your rock crushed the scissors";
}
if(userChoice=="rock" && appChoice == "lizard") {
this._imageBatleResult=AssetImage("images/rock_lizard_win.png");
_batleResult="You Win! Your rock smashed the lizard";
}
if(userChoice=="lizard" && appChoice == "paper") {
this._imageBatleResult=AssetImage("images/lizard_paper_win.png");
_batleResult="You Win! Your lizard ate the paper";
}
if(userChoice=="lizard" && appChoice == "spock") {
this._imageBatleResult=AssetImage("images/lizard_spock_win.png");
_batleResult="You Win! Your lizard poisoned the Spock";
}
if(userChoice=="spock" && appChoice == "scissors") {
this._imageBatleResult=AssetImage("images/spock_scissors_win.png");
_batleResult="You Win! Your Spock destroyed the scissors";
}
if(userChoice=="spock" && appChoice == "rock") {
this._imageBatleResult=AssetImage("images/spock_rock_win.png");
_batleResult="You Win! Your Spock vaporized the rock";
}
if(userChoice=="scissors" && appChoice == "paper") {
this._imageBatleResult=AssetImage("images/scissors_paper_win.png");
_batleResult="You Win! Your scissors cut the paper";
}
if(userChoice=="scissors" && appChoice == "lizard") {
this._imageBatleResult=AssetImage("images/scissors_lizard_win.png");
_batleResult="You Win! Your scissors beheaded the lizard";
}
if(userChoice=="paper" && appChoice == "rock") {
this._imageBatleResult=AssetImage("images/paper_rock_win.png");
_batleResult="You Win! Your paper covered the rock";
}
if(userChoice=="paper" && appChoice == "spock") {
this._imageBatleResult=AssetImage("images/paper_spock_win.png");
_batleResult="You Win! Your paper disapproves Spock";
}

//Image when user lose
if(appChoice=="rock" && userChoice == "scissors") {
this._imageBatleResult=AssetImage("images/rock_scissors_lose.png");
_batleResult="You Lose! Your scissors were destroyed by the rock";
}
if(appChoice=="rock" && userChoice == "lizard") {
this._imageBatleResult=AssetImage("images/rock_lizard_lose.png");
_batleResult="You Lose! Your lizard was smashed by the rock";
}
if(appChoice=="lizard" && userChoice == "paper") {
this._imageBatleResult=AssetImage("images/lizard_paper_lose.png");
_batleResult="You Lose! Your paper was eaten by the lizard";
}
if(appChoice=="lizard" && userChoice == "spock") {
this._imageBatleResult=AssetImage("images/lizard_spock_lose.png");
_batleResult="You Lose! Your Spock was poisoned by the lizard";
}
if(appChoice=="spock" && userChoice == "scissors") {
this._imageBatleResult=AssetImage("images/spock_scissors_lose.png");
_batleResult="You Lose! Your scissors were destroyed by Spock";
}

if(appChoice=="spock" && userChoice == "rock") {
this._imageBatleResult=AssetImage("images/spock_rock_lose.png");
_batleResult="You Lose! Your rock was vaporized by Spock";
}
if(appChoice=="scissors" && userChoice == "paper") {
this._imageBatleResult=AssetImage("images/scissors_paper_lose.png");
_batleResult="You Lose! Your paper was cut by scissors";
}
if(appChoice=="scissors" && userChoice == "lizard") {
this._imageBatleResult=AssetImage("images/scissors_lizard_lose.png");
_batleResult="You Lose! Your lizard was beheaded by scissors";
}
if(appChoice=="paper" && userChoice == "rock") {
this._imageBatleResult=AssetImage("images/paper_rock_lose.png");
_batleResult="You Lose! Your rock was covered by the paper";
}
if(appChoice=="paper" && userChoice == "spock") {
this._imageBatleResult=AssetImage("images/paper_spock_lose.png");
_batleResult="You Lose! Your Spock was disapproved by the paper";
}


//Check if user wins
if (
(userChoice == "rock" && appChoice == "scissors") ||
(userChoice == "rock" && appChoice == "lizard") ||
(userChoice == "lizard" && appChoice == "paper") ||
(userChoice == "lizard" && appChoice == "spock") ||
(userChoice == "spock" && appChoice == "scissors") ||
(userChoice == "spock" && appChoice == "rock") ||
(userChoice == "scissors" && appChoice == "paper") ||
(userChoice == "scissors" && appChoice == "lizard") ||
(userChoice == "paper" && appChoice == "rock") ||
(userChoice == "paper" && appChoice == "spock")
) {
setState(() {
_userVictory=_userVictory+1;
_resultado="win";
});

//Check if App wins
} else if (
(appChoice == "rock" && userChoice == "scissors") ||
(appChoice == "rock" && userChoice == "lizard") ||
(appChoice == "lizard" && userChoice == "paper") ||
(appChoice == "lizard" && userChoice == "spock") ||
(appChoice == "spock" && userChoice == "scissors") ||
(appChoice == "spock" && userChoice == "rock") ||
(appChoice == "scissors" && userChoice == "paper") ||
(appChoice == "scissors" && userChoice == "lizard") ||
(appChoice == "paper" && userChoice == "rock") ||
(appChoice == "paper" && userChoice == "spock")
) {
setState(() {
_appVictory=_appVictory+1;
_resultado="lose";

});

//Else - Draw!
} else {
setState(() {
_batleResult = "Draw! You chose the same as the App!";
this._imageBatleResult=AssetImage("images/draw.png");
_resultado="draw";
});
}
}

@override
Widget build(BuildContext context) {

return Scaffold(
appBar: AppBar(
title: Text("JanKenPon")
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 6, bottom: 4),
child: Text(
"App choice",
textAlign: TextAlign.right,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold
),
),
),
Image(image: this._imageAppChoice, height: 60,),
Padding(
padding: EdgeInsets.only(top: 6, bottom: 6, left: 6, right: 6),
child: Text(
this._batleResult,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
fontWeight: _resultado=="win"? FontWeight.bold : FontWeight.normal ,
color: _resultado=="win"? Colors.green : _resultado=="lose"? Colors.deepOrange : Colors.black,
),
),
),
Image(image: this._imageBatleResult, height: 90,),
Padding(
padding: EdgeInsets.only(top: 6, bottom: 4),
child: Text(
"Choose your option",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
onTap: ()=>_selectOption("rock"),
child: Image.asset("images/rock.png", height: 80,),

),
GestureDetector(
onTap: ()=>_selectOption("paper"),
child: Image.asset("images/paper.png", height: 70,),
),
GestureDetector(
onTap: ()=>_selectOption("scissors"),
child: Image.asset("images/scissors.png", height: 70,),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
GestureDetector(
onTap: ()=>_selectOption("lizard"),
child: Image.asset("images/lizard.png", height: 70,),
),
GestureDetector(
onTap: ()=>_selectOption("spock"),
child: Image.asset("images/spock.png", height: 70,),
),
],
),
Padding(
padding: EdgeInsets.only(top: 12, bottom: 0),
child: Text(
"You: $_userVictory | App: $_appVictory",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
fontWeight: _userVictory>_appVictory ? FontWeight.bold : FontWeight.normal ,
color: _userVictory>_appVictory ? Colors.green : _appVictory>_userVictory ? Colors.deepOrange : Colors.black,
),
),
),
]),
);
}
}

 leo.name: jankenpon

description: A new Flutter application.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
sdk: ">=2.1.0 <3.0.0"

dependencies:
flutter:
sdk: flutter

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2


dev_dependencies:
flutter_test:
sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true

# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg

assets:
- images/base.png
- images/lizard.png
- images/lizard_paper_lose.png
- images/lizard_paper_win.png
- images/lizard_spock_lose.png
- images/lizard_spock_win.png
- images/logo.png
- images/paper.png
- images/paper_rock_lose.png
- images/paper_rock_win.png
- images/paper_spock_lose.png
- images/paper_spock_win.png
- images/rock.png
- images/rock_lizard_lose.png
- images/rock_lizard_win.png
- images/rock_scissors_lose.png
- images/rock_scissors_win.png
- images/scissors.png
- images/scissors_lizard_lose.png
- images/scissors_lizard_win.png
- images/scissors_paper_lose.png
- images/scissors_paper_win.png
- images/spock.png
- images/spock_rock_lose.png
- images/spock_rock_win.png
- images/spock_scissors_lose.png
- images/spock_scissors_win.png
- images/draw.png

# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.

# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages

JunKenPon – Como eu fiz este aplicativo em Flutter

#1 - Criação do Interface

import 'package:flutter/material.dart';
import 'package:jankenpon/Game.dart';

void main(){
runApp(MaterialApp(
home: Game(),
debugShowCheckedModeBanner: false,
));
}
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class Game extends StatefulWidget {
@override
_GameState createState() => _GameState();
}

class _GameState extends State<Game> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("JanKenPon")
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 24, bottom: 8),
child: Text(
"App choice",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold
),
),
),
Image.asset("images/base.png", height: 80,),
Padding(
padding: EdgeInsets.only(top: 24, bottom: 8),
child: Text(
"Batle field",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold
),
),
),
Image.asset("images/base.png", height: 120,),
Padding(
padding: EdgeInsets.only(top: 24, bottom: 8),
child: Text(
"Choose your option",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset("images/rock.png", height: 80,),
Image.asset("images/paper.png", height: 80,),
Image.asset("images/scissors.png", height: 80,),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset("images/lizard.png", height: 80,),
Image.asset("images/spock.png", height: 80,),
],
),
Padding(
padding: EdgeInsets.only(top: 24, bottom: 8),
child: Text(
"- Points -",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.normal,
),
),
),
]),
);
}
}

WebView

package com.byronsystemdeveloper.byronsystemdeveloper;

import android.graphics.Bitmap;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;

public class MainActivity extends AppCompatActivity {

private ProgressBar progressBar;
private WebView webView;
private WebSettings webSettings;
private String url;

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

progressBar=findViewById(R.id.progressBar);
webView=findViewById(R.id.webView);
url="http://34.105.161.132";
webView.loadUrl(url);
webSettings=webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setWebViewClient(new mWebViewClient());

}

private class mWebViewClient extends WebViewClient {

@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
view.loadUrl(url);
return true;
}

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
progressBar.setVisibility(View.VISIBLE);
super.onPageStarted(view, url, favicon);
}

@Override
public void onPageFinished(WebView view, String url) {
progressBar.setVisibility(View.GONE);
super.onPageFinished(view, url);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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">

<WebView
android:id="@+id/webView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" >

</WebView>

<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteX="172dp"
tools:layout_editor_absoluteY="333dp" />
</android.support.constraint.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.byronsystemdeveloper.byronsystemdeveloper" >

<uses-permission android:name="android.permission.INTERNET"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

Press Back twice to Exit


import android.content.Intent;
import android.os.CountDownTimer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

private static boolean userPressedBackAgain;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

}

@Override
public void onBackPressed() {

if(!userPressedBackAgain){
Toast.makeText(this, "Back again to exit", Toast.LENGTH_LONG).show();
userPressedBackAgain=true;
} else {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}

new CountDownTimer(3000,1000){
@Override
public void onTick(long millisUntilFinished) {

}

@Override
public void onFinish() {
userPressedBackAgain =false;
}
}.start();
}
}

Animation Drawable

import android.graphics.drawable.AnimationDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

ImageView imageView = findViewById(R.id.imageViewLayout);
AnimationDrawable animationDrawable = new AnimationDrawable();
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v1),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v2),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v3),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v4),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v5),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v6),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v7),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v8),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v9),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v10),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v11),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v12),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v13),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v14),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v15),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v16),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v17),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v18),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v19),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v20),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v21),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v22),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v23),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v24),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v25),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v26),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v27),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v28),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v29),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v30),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v31),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v32),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v33),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v34),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v35),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v36),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v37),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v38),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v39),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v40),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v41),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v42),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v43),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v44),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v45),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v46),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v47),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v48),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v49),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v50),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v51),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v52),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v53),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v54),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v55),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v56),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v57),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v58),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v59),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v60),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v61),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v62),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v63),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v64),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v65),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v66),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v67),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v68),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v69),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v70),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v71),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v72),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v73),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v74),50);
animationDrawable.addFrame(getResources().getDrawable(R.drawable.v75),50);
animationDrawable.setOneShot(false); // true for stop after play the image
imageView.setImageDrawable(animationDrawable);
animationDrawable.start();


}
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context=".MainActivity">

<ImageView
android:id="@+id/imageViewLayout"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@tools:sample/backgrounds/scenic" />
</android.support.constraint.ConstraintLayout>