Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- apply plugin: 'com.android.application'
- List<String> dirs = [
- 'main', // main sample code; look here for the interesting stuff.
- 'common', // components that are reused by multiple samples
- 'template'] // boilerplate code that is generated by the sample template
- process
- repositories {
- mavenLocal()
- maven {
- url
- 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
- }
- }
- android {
- signingConfigs {
- config {
- keyAlias 'key1'
- keyPassword 'Marcos&@*34134'
- storeFile file('C:/Users/marco/.android/debug.keystore')
- storePassword 'android'
- }
- }
- compileSdkVersion 27
- buildToolsVersion '27.0.3'
- defaultConfig {
- applicationId "net.panomaps"
- minSdkVersion 17
- targetSdkVersion 27
- versionCode 24
- versionName "5.2.5"
- multiDexEnabled true
- testInstrumentationRunner
- "android.support.test.runner.AndroidJUnitRunner"
- javaCompileOptions {
- annotationProcessorOptions {
- includeCompileClasspath true
- }
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'),
- 'proguard-rules.pro'
- signingConfig signingConfigs.config
- debuggable false
- }
- debug {
- signingConfig signingConfigs.config
- debuggable true
- }
- }
- splits {
- // Screen density split settings
- density {
- // Enable or disable the density split mechanism
- enable false
- // Exclude these densities from splits
- exclude "ldpi", "tvdpi", "xxxhdpi", "400dpi", "560dpi"
- }
- }
- sourceSets {
- main {
- dirs.each { dir ->
- java.srcDirs "src/${dir}/java"
- res.srcDirs "src/${dir}/res"
- assets.srcDirs = ['src/main/assets/']
- }
- }
- androidTest.setRoot('tests')
- androidTest.java.srcDirs = ['tests/src']
- }
- }
- dependencies {
- implementation 'com.google.firebase:firebase-core:11.8.0'
- compile fileTree(include: ['*.jar'], dir: 'libs')
- androidTestCompile('com.android.support.test.espresso:espresso-
- core:2.2.2',
- {
- exclude group: 'com.android.support', module: 'support-annotations'
- })
- compile 'com.android.support:appcompat-v7:27.0.3'
- compile 'com.android.support:support-v4:27.0.3'
- compile 'com.android.support:design:27.0.3'
- compile 'com.android.support.constraint:constraint-layout:1.0.2'
- compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.7'
- testCompile 'junit:junit:4.12'
- compile 'com.google.android.gms:play-services-ads:11.8.0'
- compile 'com.squareup.picasso:picasso:2.5.2'
- compile 'com.facebook.android:facebook-android-sdk:4.28.0'
- compile 'com.jakewharton:butterknife:8.8.1'
- annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
- compile 'com.squareup.picasso:picasso:2.5.2'
- compile 'org.xwalk:xwalk_core_library:23.53.589.4'
- compile 'com.google.firebase:firebase-messaging:11.8.0'
- compile 'com.android.support:multidex:1.0.2'
- compile 'com.github.jgabrielfreitas:BlurImageView:1.0.1'
- }
- configurations.all {
- resolutionStrategy.eachDependency { DependencyResolveDetails details ->
- def requested = details.requested
- if (requested.group == 'com.android.support') {
- if (!requested.name.startsWith("multidex")) {
- details.useVersion '27.0.3'
- }
- }
- }
- }
- apply plugin: 'com.google.gms.google-services'
- package net.panomaps;
- import android.annotation.SuppressLint;
- import android.content.Context;
- import android.content.DialogInterface;
- import android.content.Intent;
- import android.net.ConnectivityManager;
- import android.net.NetworkInfo;
- import android.net.Uri;
- import android.os.Bundle;
- import android.support.annotation.NonNull;
- import android.support.design.widget.NavigationView;
- import android.support.v4.view.GravityCompat;
- import android.support.v4.view.ViewPager;
- import android.support.v4.widget.DrawerLayout;
- import android.support.v7.app.ActionBarDrawerToggle;
- import android.support.v7.app.AlertDialog;
- import android.support.v7.app.AppCompatActivity;
- import android.support.v7.widget.Toolbar;
- import android.view.ContextThemeWrapper;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.View;
- import android.widget.FrameLayout;
- import android.widget.ProgressBar;
- import net.panomaps.animation.CubeOutTransformer;
- import org.xwalk.core.XWalkResourceClient;
- import org.xwalk.core.XWalkView;
- public class WebsiteActivity extends AppCompatActivity
- implements NavigationView.OnNavigationItemSelectedListener {
- private ProgressBar progressbar;
- private FrameLayout frameLayout;
- private XWalkView mXWalkView;
- @SuppressLint({"SetJavaScriptEnabled", "JavascriptInterface"})
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_website);
- Toolbar toolbar = findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
- DrawerLayout drawer = findViewById(R.id.drawer_layout);
- ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
- this, drawer, toolbar, R.string.navigation_drawer_open,
- R.string.navigation_drawer_close);
- drawer.addDrawerListener(toggle);
- toggle.syncState();
- NavigationView navigationView = findViewById(R.id.nav_view);
- navigationView.setNavigationItemSelectedListener(this);
- frameLayout = findViewById(R.id.frameLayout);
- progressbar = findViewById(R.id.progressBar);
- progressbar.setMax(100);
- mXWalkView = findViewById(R.id.activity_main);
- mXWalkView.load("https://panomaps.net/", null);
- mXWalkView.setResourceClient(new XWalkResourceClient(mXWalkView) {
- public void onProgressChanged(XWalkView view, int progress) {
- frameLayout.setVisibility(View.VISIBLE);
- progressbar.setProgress(progress);
- setTitle("Carregando...");
- if (progress == 100) {
- frameLayout.setVisibility(View.GONE);
- setTitle(view.getTitle());
- }
- super.onProgressChanged(view, progress);
- }
- });
- progressbar.setProgress(0);
- if (!haveNetworkConnection()) {
- android.app.AlertDialog.Builder Checkbuilder = new
- android.app.AlertDialog.Builder(WebsiteActivity.this);
- Checkbuilder.setMessage("Por favor conecte-se à internet!");
- android.app.AlertDialog alert = Checkbuilder.create();
- alert.show();
- } else {
- mXWalkView.load("https://panomaps.net/", null);
- }
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.menu_main, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- int id = item.getItemId();
- if (id == R.id.action_settings) {
- mXWalkView.load("https://panomaps.net/", null);
- } else if (id == R.id.nav_login) {
- mXWalkView.load("https://panomaps.net/login/", null);
- } else if (id == R.id.nav_information) {
- startActivity(new Intent(getApplicationContext(),
- AboutActivity.class));
- } else if (id == R.id.nav_exit) {
- finish();
- }
- return super.onOptionsItemSelected(item);
- }
- @SuppressWarnings("StatementWithEmptyBody")
- @Override
- public boolean onNavigationItemSelected(@NonNull MenuItem item) {
- // Handle navigation view item clicks here.
- int id = item.getItemId();
- if (id == R.id.nav_home) {
- mXWalkView.load("https://panomaps.net/", null);
- } else if (id == R.id.nav_login) {
- mXWalkView.load("https://panomaps.net/login/", null);
- } else if (id == R.id.nav_gallery) {
- startActivity(new Intent(getApplicationContext(),
- ImageSlideActivity.class));
- } else if (id == R.id.nav_fanpage) {
- mXWalkView.load("https://www.facebook.com/panomaps/", null);
- } else if (id == R.id.nav_weather) {
- mXWalkView.load("http://tempo.clic.com.br/sp/panorama", null);
- } else if (id == R.id.nav_share) {
- Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setData(Uri.parse("https://play.google.com/store/apps/details?
- id=net.panomaps&hl=pt"));
- startActivity(intent);
- } else if (id == R.id.nav_send) {
- Intent shareIntent = new Intent(Intent.ACTION_SEND);
- shareIntent.setType("text/plain");
- shareIntent.putExtra(Intent.EXTRA_TEXT, mXWalkView.getUrl());
- startActivity(Intent.createChooser(shareIntent, "Compartilhar esta
- página!"));
- }
- DrawerLayout drawer = findViewById(R.id.drawer_layout);
- drawer.closeDrawer(GravityCompat.START);
- return true;
- }
- private boolean haveNetworkConnection() {
- ConnectivityManager connectivityManager = (ConnectivityManager)
- this.getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo activeNetworkInfo = connectivityManager != null ?
- connectivityManager.getActiveNetworkInfo() : null;
- return activeNetworkInfo != null;
- }
- @Override
- public void onBackPressed() {
- ContextThemeWrapper ctw = new ContextThemeWrapper(this,
- R.style.PanomapsTheme);
- AlertDialog.Builder builder = new AlertDialog.Builder(ctw);
- builder.setMessage("Deseja encerrar?")
- .setCancelable(false)
- .setPositiveButton("sim", new DialogInterface.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int id) {
- finish();
- }
- })
- .setNegativeButton("Não", new DialogInterface.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int id) {
- dialog.cancel();
- }
- });
- AlertDialog alert = builder.create();
- alert.show();
- }
- @Override
- protected void onDestroy() {
- // TODO Auto-generated method stub
- super.onDestroy();
- }
- //ImageSlideActivity Implements
- public static class ImageSlideActivity extends AppCompatActivity
- implements NavigationView.OnNavigationItemSelectedListener {
- private final String[] images = {
- "https://panomaps.net/wp-content/uploads/2017/11/pic1-min-
- e1511665172974.jpg",
- "https://panomaps.net/wp-content/uploads/2017/11/pic13-min-
- e1511665543863.jpg",
- "https://panomaps.net/wp-content/uploads/2017/11/pic12-min-
- e1511665681915.jpg",
- "https://panomaps.net/wp-content/uploads/2017/11/pic11-min-
- e1511665716274.jpg",
- "https://panomaps.net/wp-content/uploads/2017/11/pic10-min-
- e1511665753232.jpg",
- "https://panomaps.net/wp-content/uploads/2017/11/pic9-min-
- e1511665784493.jpg",
- "https://panomaps.net/wp-content/uploads/2017/11/pic7-min-
- e1511665817962.jpg",
- "https://panomaps.net/wp-content/uploads/2017/11/pic6-min-
- e1511665848764.jpg",
- "https://panomaps.net/wp-content/uploads/2017/11/pic5-min-
- e1511665877509.jpg",
- "https://panomaps.net/wp-content/uploads/2017/11/pic4-min-
- e1511665926431.jpg",
- "https://panomaps.net/wp-content/uploads/2017/11/pic3-min-
- e1511665957215.jpg",
- "https://panomaps.net/wp-content/uploads/2017/11/pic2-min-
- e1511665994140.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/09/17022399_1215986178514776_365023691170945603_n.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/09/13615136_999490856830977_3122419246868025328_n.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/09/17021825_1215986368514757_628206607650428811_n.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/09/pôr_do_sol.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/09/16700542_1205474846232576_706463914410140412_o.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/09/19983497_1352050591575000_363134732384405712_o.jpg",
- "https://panomaps.net/wp-content/uploads/2017/10/200_foto-
- aérea2.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/12/20170730_120143-e1512575761895.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/12/20170730_115518-e1512575775276.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/12/20170730_114940.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/12/20170730_114905-e1512575793297.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/12/20170730_113539-e1512575805899.jpg",
- "https://panomaps.net/wp-
- content/uploads/2017/12/20170730_113506-e1512575721978.jpg",
- };
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.fragment_image_slider);
- Toolbar toolbar = findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
- DrawerLayout drawer = findViewById(R.id.drawer_layout);
- ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
- this, drawer, toolbar, R.string.navigation_drawer_open,
- R.string.navigation_drawer_close);
- drawer.addDrawerListener(toggle);
- toggle.syncState();
- NavigationView navigationView = findViewById(R.id.nav_view);
- navigationView.setNavigationItemSelectedListener(this);
- ViewPager viewPager = findViewById(R.id.viewPager);
- ViewPagerAdapter adapter = new
- ViewPagerAdapter(ImageSlideActivity.this, images);
- viewPager.setAdapter(adapter);
- viewPager.setPageTransformer(true, new CubeOutTransformer());
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is
- present.
- getMenuInflater().inflate(R.menu.menu_main, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- int id = item.getItemId();
- if (id == R.id.action_settings) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData(Uri.parse("https://panomaps.net/")));
- } else if (id == R.id.nav_login) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData(Uri.parse("https://panomaps.net/login/")));
- } else if (id == R.id.nav_information) {
- startActivity(new Intent(getApplicationContext(),
- AboutActivity.class));
- } else if (id == R.id.nav_exit) {
- finish();
- }
- return super.onOptionsItemSelected(item);
- }
- @SuppressWarnings("StatementWithEmptyBody")
- @Override
- public boolean onNavigationItemSelected(@NonNull MenuItem item) {
- // Handle navigation view item clicks here.
- int id = item.getItemId();
- if (id == R.id.nav_home) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData(Uri.parse("https://panomaps.net/")));
- } else if (id == R.id.nav_login) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData(Uri.parse("https://panomaps.net/login/")));
- } else if (id == R.id.nav_gallery) {
- startActivity(new Intent(getApplicationContext(),
- ImageSlideActivity.class));
- } else if (id == R.id.nav_fanpage) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData
- (Uri.parse("https://www.facebook.com/panomaps/")));
- } else if (id == R.id.nav_weather) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData(Uri.parse
- ("http://tempo.clic.com.br/sp/panorama")));
- } else if (id == R.id.nav_share) {
- Intent intent = new Intent(Intent.ACTION_VIEW);
- startActivity(intent.setData(Uri.parse
- ("https://play.google.com/store/apps/details?id=net.panomaps&hl=pt")));
- }
- DrawerLayout drawer = findViewById(R.id.drawer_layout);
- drawer.closeDrawer(GravityCompat.START);
- return true;
- }
- @Override
- public void onBackPressed() {
- super.onBackPressed();
- }
- @Override
- protected void onDestroy() {
- // TODO Auto-generated method stub
- super.onDestroy();
- finish();
- }
- }
- //AboutActivity Implements
- public static class AboutActivity extends AppCompatActivity
- implements NavigationView.OnNavigationItemSelectedListener {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.about_fragment);
- Toolbar toolbar = findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
- DrawerLayout drawer = findViewById(R.id.drawer_layout);
- ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
- this, drawer, toolbar, R.string.navigation_drawer_open,
- R.string.navigation_drawer_close);
- drawer.addDrawerListener(toggle);
- toggle.syncState();
- NavigationView navigationView = findViewById(R.id.nav_view);
- navigationView.setNavigationItemSelectedListener(this);
- Menu menu = navigationView.getMenu();
- MenuItem target = menu.findItem(R.id.nav_fanpage);
- target.setVisible(true);
- menu = navigationView.getMenu();
- target = menu.findItem(R.id.nav_share);
- target.setVisible(true);
- menu = navigationView.getMenu();
- target = menu.findItem(R.id.nav_send);
- target.setVisible(false);
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is
- present.
- getMenuInflater().inflate(R.menu.menu_main, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- int id = item.getItemId();
- if (id == R.id.action_settings) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData(Uri.parse
- ("https://panomaps.net/")));
- } else if (id == R.id.nav_login) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData(Uri.parse
- ("https://panomaps.net/login/")));
- } else if (id == R.id.nav_information) {
- startActivity(new Intent(getApplicationContext(),
- AboutActivity.class));
- } else if (id == R.id.nav_exit) {
- finish();
- }
- return super.onOptionsItemSelected(item);
- }
- @SuppressWarnings("StatementWithEmptyBody")
- @Override
- public boolean onNavigationItemSelected(@NonNull MenuItem item) {
- // Handle navigation view item clicks here.
- int id = item.getItemId();
- if (id == R.id.nav_home) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData(Uri.parse
- ("https://panomaps.net/")));
- } else if (id == R.id.nav_login) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData(Uri.parse
- ("https://panomaps.net/login/")));
- } else if (id == R.id.nav_gallery) {
- startActivity(new Intent(getApplicationContext(),
- ImageSlideActivity.class));
- } else if (id == R.id.nav_fanpage) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData(Uri.parse
- ("https://www.facebook.com/panomaps/")));
- } else if (id == R.id.nav_weather) {
- Intent intent = new Intent(this, WebsiteActivity.class);
- startActivity(intent.setData(Uri.parse
- ("http://tempo.clic.com.br/sp/panorama")));
- } else if (id == R.id.nav_share) {
- Intent intent = new Intent(Intent.ACTION_VIEW);
- startActivity(intent.setData
- (Uri.parse("https://play.google.com/store/apps/details?
- id=net.panomaps&hl=pt")));
- }
- DrawerLayout drawer = findViewById(R.id.drawer_layout);
- drawer.closeDrawer(GravityCompat.START);
- return true;
- }
- @Override
- public void onBackPressed() {
- super.onBackPressed();
- }
- @Override
- protected void onDestroy() {
- // TODO Auto-generated method stub
- super.onDestroy();
- finish();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement