+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..61d237e
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,52 @@
+apply plugin: 'com.android.application'
+
+def keystorePropertiesFile = rootProject.file("keystore.properties")
+def keystoreProperties = new Properties()
+
+keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
+
+android {
+ compileSdkVersion 24
+ buildToolsVersion "24.0.0"
+
+ signingConfigs {
+ config {
+ keyAlias 'CineAcessoKey'
+ keyPassword 'l4v1d-l1v3'
+ storeFile file('C:/Users/Cinema_2/Desktop/Ademir/cineacesso/cine/cineacesso_key.jks')
+ storePassword 'l4v1d-l1v3'
+ }
+ }
+
+ defaultConfig {
+ applicationId "lavid.com.cineacesso"
+ minSdkVersion 16
+ targetSdkVersion 24
+ versionCode 3
+ versionName "1.2"
+ multiDexEnabled true
+ jackOptions.enabled = true
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ shrinkResources true
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ signingConfig signingConfigs.config
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:multidex:1.0.1'
+ compile 'com.android.support:appcompat-v7:24.0.0'
+ compile 'com.android.support:design:24.0.0'
+ compile 'com.google.android.gms:play-services-vision:9.2.1'
+ compile 'com.android.volley:volley:1.0.0'
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..fd9ff95
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,20 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\Ademir\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+-keep class com.android.volley.** {*;}
+-keep class com.android.**
+-dontshrink
diff --git a/app/src/androidTest/java/lavid/com/cineacesso/ApplicationTest.java b/app/src/androidTest/java/lavid/com/cineacesso/ApplicationTest.java
new file mode 100644
index 0000000..e54e271
--- /dev/null
+++ b/app/src/androidTest/java/lavid/com/cineacesso/ApplicationTest.java
@@ -0,0 +1,13 @@
+package lavid.com.cineacesso;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f823cc0
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
new file mode 100644
index 0000000..8ff1c6b
Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ
diff --git a/app/src/main/java/lavid/com/cineacesso/activities/AuxTypeActivity.java b/app/src/main/java/lavid/com/cineacesso/activities/AuxTypeActivity.java
new file mode 100644
index 0000000..3585086
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/activities/AuxTypeActivity.java
@@ -0,0 +1,178 @@
+package lavid.com.cineacesso.activities;
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.ConnectivityManager;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.View;
+import android.widget.Toast;
+
+import lavid.com.cineacesso.R;
+import lavid.com.cineacesso.utils.CineAcessoAPI;
+import lavid.com.cineacesso.utils.CineAcessoDB;
+import lavid.com.cineacesso.utils.NetworkReceiver;
+import lavid.com.cineacesso.utils.RetainedSession;
+
+
+public class AuxTypeActivity extends AppCompatActivity implements View.OnClickListener{
+
+ //private static final String TAG = AuxTypeActivity.class.getSimpleName();
+
+ private ProgressDialog mProgressDialog;
+ private AlertDialog alertDialog;
+ private String auxType;
+
+ private NetworkReceiver receiver = new NetworkReceiver();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_aux_type);
+
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ assert getSupportActionBar() != null;
+ getSupportActionBar().setDisplayShowTitleEnabled(false);
+
+ alertDialog = new AlertDialog.Builder(this)
+ .setTitle(getString(R.string.wait))
+ .setMessage(getString(R.string.content_unavaliable))
+ .setPositiveButton(getString(R.string.ok), (dialogInterface, view) -> dialogInterface.dismiss())
+ .create();
+
+ startTimedLoading(getString(R.string.checking_connection), 3000);
+ if (!WifiActivity.isValidSSID(this)) {
+ if (mProgressDialog.isShowing()) {
+ mProgressDialog.dismiss();
+ }
+ startActivity(new Intent(this, WifiActivity.class));
+ }
+
+ IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
+ receiver = new NetworkReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ super.onReceive(context, intent);
+ if (!WifiActivity.isValidSSID(AuxTypeActivity.this)) {
+ startActivity(new Intent(AuxTypeActivity.this, WifiActivity.class));
+ }
+ }
+ };
+ this.registerReceiver(receiver, filter);
+
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if (!WifiActivity.isValidSSID(this)) {
+ startActivity(new Intent(this, WifiActivity.class));
+ }
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ if (alertDialog != null) {
+ alertDialog.dismiss();
+ }
+ if (receiver != null) {
+ this.unregisterReceiver(receiver);
+ }
+ }
+
+ @Override
+ public void onClick(View v) {
+
+ Intent intent = new Intent(this, ContentActivity.class);
+
+ switch (v.getId()) {
+
+ case R.id.btn_libras:
+ intent.putExtra(CineAcessoDB.CONTENT_TYPE, CineAcessoDB.CONTENT_TYPE_LIBRAS);
+ auxType = CineAcessoDB.CONTENT_TYPE_LIBRAS;
+ break;
+
+ case R.id.btn_libras_subtitle:
+ Toast.makeText(this, getString(R.string.soon), Toast.LENGTH_SHORT).show();
+ return;
+ //intent.putExtra(CineAcessoDB.CONTENT_TYPE, CineAcessoDB.CONTENT_TYPE_LIBRAS_SUB);
+ //break;
+
+ case R.id.btn_subtitle:
+ Toast.makeText(this, getString(R.string.soon), Toast.LENGTH_SHORT).show();
+ return;
+ //intent.putExtra(CineAcessoDB.CONTENT_TYPE, CineAcessoDB.CONTENT_TYPE_SUBS);
+ //break;
+
+ case R.id.btn_audio:
+ intent.putExtra(CineAcessoDB.CONTENT_TYPE, CineAcessoDB.CONTENT_TYPE_AUDIO);
+ auxType = CineAcessoDB.CONTENT_TYPE_AUDIO;
+ break;
+ }
+
+ startLoading();
+ CineAcessoAPI.getServerInfo(this, auxType, (success, map) -> {
+
+ if (!success) {
+ if (!alertDialog.isShowing() && !isFinishing()) {
+ alertDialog.show();
+ }
+ }
+ else {
+ /*Log.d(TAG, "SERVER_UID = " + map.get(CineAcessoDB.SERVER_UID)
+ + "\nSERVER_CONTENT = " + map.get(CineAcessoDB.CONTENT)
+ + "\nSERVER_PTS = " + map.get(CineAcessoDB.PTS)
+ + "\nSERVER_TITLE = " + map.get(CineAcessoDB.CONTENT_TITLE)
+ + "\nSERVER_YEAR = " + map.get(CineAcessoDB.CONTENT_YEAR)
+ + "\nSERVER_AUTHOR = " + map.get(CineAcessoDB.CONTENT_AUTHOR)
+ + "\nSERVER_IMAGE = " + map.get(CineAcessoDB.CONTENT_IMG));*/
+
+ String serverUid = map.get(CineAcessoDB.SERVER_UID);
+ String contentUrl = CineAcessoDB.BASE_URL + map.get(CineAcessoDB.CONTENT);
+ String imageUrl = CineAcessoDB.BASE_URL + map.get(CineAcessoDB.CONTENT_IMG);
+ String author = map.get(CineAcessoDB.CONTENT_AUTHOR);
+ String title = map.get(CineAcessoDB.CONTENT_TITLE) + " (" + map.get(CineAcessoDB.CONTENT_YEAR) + ")";
+
+ RetainedSession.put(this, CineAcessoDB.CONTENT_TYPE, auxType);
+ RetainedSession.put(this, CineAcessoDB.SERVER_UID, serverUid);
+ RetainedSession.put(this, CineAcessoDB.CONTENT_URL, contentUrl);
+ RetainedSession.put(this, CineAcessoDB.CONTENT_IMG_URL, imageUrl);
+ RetainedSession.put(this, CineAcessoDB.CONTENT_AUTHOR, author);
+ RetainedSession.put(this, CineAcessoDB.CONTENT_TITLE, title);
+
+ startActivity(intent);
+ }
+
+ endLoading();
+ });
+ }
+
+ private void startLoading() {
+ mProgressDialog = new ProgressDialog(this);
+ mProgressDialog.setTitle(getString(R.string.loading));
+ mProgressDialog.setCancelable(false);
+ mProgressDialog.show();
+ }
+
+ private void startTimedLoading(String message, long millis) {
+ mProgressDialog = new ProgressDialog(this);
+ mProgressDialog.setTitle(getString(R.string.loading));
+ mProgressDialog.setCancelable(false);
+ if (message != null) mProgressDialog.setMessage(message);
+ mProgressDialog.show();
+ new Handler().postDelayed(() -> mProgressDialog.dismiss(), millis);
+ }
+
+ private void endLoading() {
+ if (mProgressDialog != null) {
+ mProgressDialog.cancel();
+ }
+ }
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/activities/ContentActivity.java b/app/src/main/java/lavid/com/cineacesso/activities/ContentActivity.java
new file mode 100644
index 0000000..b3bbd77
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/activities/ContentActivity.java
@@ -0,0 +1,90 @@
+package lavid.com.cineacesso.activities;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.ConnectivityManager;
+import android.os.Bundle;
+import android.support.design.widget.FloatingActionButton;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.widget.TextView;
+
+import com.android.volley.toolbox.NetworkImageView;
+
+import lavid.com.cineacesso.R;
+import lavid.com.cineacesso.utils.CineAcessoDB;
+import lavid.com.cineacesso.utils.NetworkReceiver;
+import lavid.com.cineacesso.utils.RetainedSession;
+import lavid.com.cineacesso.utils.VolleySingleton;
+
+
+public class ContentActivity extends AppCompatActivity {
+
+ private NetworkReceiver receiver = new NetworkReceiver();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_content);
+
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ assert getSupportActionBar() != null;
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayShowTitleEnabled(false);
+ //toolbar.setNavigationOnClickListener((view -> finish()));
+
+ FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
+ assert fab != null;
+ fab.setOnClickListener(view -> {
+ startActivity(new Intent(ContentActivity.this, PlayerActivity.class));
+ finish();
+ });
+
+ //image
+ NetworkImageView ivImage = (NetworkImageView) findViewById(R.id.iv_content_image);
+ ivImage.setDefaultImageResId(R.drawable.content_image_default);
+ ivImage.setErrorImageResId(R.drawable.content_image_default);
+ ivImage.setImageUrl(RetainedSession.get(this, CineAcessoDB.CONTENT_IMG_URL),
+ VolleySingleton.getInstance(this).getImageLoader());
+
+ //content
+ TextView tvAuxType = (TextView) findViewById(R.id.tv_aux_type);
+ assert tvAuxType != null;
+ String resourceName = getIntent().getStringExtra(CineAcessoDB.CONTENT_TYPE);
+ int resourceId = getResources().getIdentifier(resourceName, "string", getPackageName());
+ tvAuxType.setText(getString(resourceId));
+
+ //title
+ TextView textView = (TextView) findViewById(R.id.tv_content_title);
+ textView.setText(RetainedSession.get(this, CineAcessoDB.CONTENT_TITLE));
+
+ //author
+ String text = getString(R.string.direction) + ": " + RetainedSession.get(this, CineAcessoDB.CONTENT_AUTHOR);
+ textView = (TextView) findViewById(R.id.tv_content_subtitle1);
+ textView.setText(text);
+
+ IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
+ receiver = new NetworkReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ super.onReceive(context, intent);
+ if (!WifiActivity.isValidSSID(ContentActivity.this)) {
+ finish();
+ startActivity(new Intent(ContentActivity.this, WifiActivity.class));
+ }
+ }
+ };
+ this.registerReceiver(receiver, filter);
+
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ if (receiver != null) {
+ unregisterReceiver(receiver);
+ }
+ }
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/activities/PlayerActivity.java b/app/src/main/java/lavid/com/cineacesso/activities/PlayerActivity.java
new file mode 100644
index 0000000..cd6f981
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/activities/PlayerActivity.java
@@ -0,0 +1,410 @@
+package lavid.com.cineacesso.activities;
+
+import android.app.AlertDialog;
+import android.app.ProgressDialog;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.ServiceConnection;
+import android.media.MediaPlayer;
+import android.net.ConnectivityManager;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+import android.support.v7.app.AppCompatActivity;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.View;
+import android.widget.Toast;
+
+import java.io.IOException;
+
+import lavid.com.cineacesso.R;
+import lavid.com.cineacesso.player.CineAcessoPlayer;
+import lavid.com.cineacesso.player.CineAcessoPlayerSynchronizer;
+import lavid.com.cineacesso.utils.CineAcessoDB;
+import lavid.com.cineacesso.utils.NetworkReceiver;
+import lavid.com.cineacesso.utils.RetainedSession;
+
+
+public class PlayerActivity extends AppCompatActivity implements
+ SurfaceHolder.Callback,
+ MediaPlayer.OnPreparedListener,
+ CineAcessoPlayerSynchronizer.OnMessageReceivedListener,
+ CineAcessoPlayer.OnAudioBecomingNoisyListener {
+
+ //private static final String TAG = PlayerActivity.class.getSimpleName();
+ private static final String START = "START";
+ private static final String STOP = "STOP";
+ private static final String SYNC = "SYNC";
+
+ private CineAcessoPlayer mPlayer;
+ private CineAcessoPlayerSynchronizer mSynchronizer;
+ //private CineAcessoPlayerService mService;
+
+ private NetworkReceiver receiver = new NetworkReceiver();
+
+ private boolean mBound;
+
+ private AlertDialog alertDialog;
+
+ private boolean startReceived;
+ private boolean playerPrepared;
+
+ private long startTime;
+
+ private View mDecorView;
+ private Handler mHideSystemUiHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ hideSystemUI();
+ }
+ };
+
+ private ServiceConnection mConnection = new ServiceConnection() {
+ @Override
+ public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
+ //CineAcessoPlayerService.LocalBinder binder = (CineAcessoPlayerService.LocalBinder) iBinder;
+ //mService = binder.getService();
+ mBound = true;
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName componentName) {
+ mBound = false;
+ }
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_player);
+
+ //Log.d(TAG, "onCreate()");
+
+ final GestureDetector clickDetector = new GestureDetector(this,
+ new GestureDetector.SimpleOnGestureListener() {
+ @Override
+ public boolean onSingleTapUp(MotionEvent e) {
+ boolean visible = (mDecorView.getSystemUiVisibility()
+ & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
+ if (visible) {
+ hideSystemUI();
+ } else {
+ showSystemUI();
+ }
+ return true;
+ }
+ });
+
+ mDecorView = getWindow().getDecorView();
+ mDecorView.setOnTouchListener((view, motionEvent) -> clickDetector.onTouchEvent(motionEvent));
+// {
+// mDecorView.setOnSystemUiVisibilityChangeListener(flags -> {
+// boolean visible = (flags & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
+// if (controller != null) {
+// if (visible && !PlayerActivity.this.isFinishing()) {
+// controller.show();
+// } else {
+// controller.hide();
+// }
+// }
+// });
+// }
+
+ SurfaceView surface = (SurfaceView) findViewById(R.id.video_surface);
+ assert surface != null;
+ surface.getHolder().addCallback(this);
+
+ IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
+ receiver = new NetworkReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ super.onReceive(context, intent);
+ if (!WifiActivity.isValidSSID(PlayerActivity.this)) {
+ finish();
+ startActivity(new Intent(PlayerActivity.this, WifiActivity.class));
+ }
+ }
+ };
+ this.registerReceiver(receiver, filter);
+
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ //Log.d(TAG, "onResume()");
+ mPlayer = CineAcessoPlayer.getInstance(this);
+ mPlayer.setOnAudioBecomingNoisyListener(this);
+ mPlayer.setContentType(RetainedSession.get(this, CineAcessoDB.CONTENT_TYPE));
+ mPlayer.setOnCompletionListener(mp -> {
+ finish();
+ mSynchronizer.finish();
+ });
+ mPlayer.setOnPreparedListener(this);
+ //mPlayer.setOnVideoSizeChangedListener(this);
+
+ if (mSynchronizer == null) {
+ //Log.d(TAG, "NEW INSTANCE SYNCHRONIZER");
+ mSynchronizer = new CineAcessoPlayerSynchronizer(RetainedSession.get(this, CineAcessoDB.SERVER_UID));
+ mSynchronizer.setOnMessageReceivedListener(this);
+ mSynchronizer.start();
+ }
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ //Log.d(TAG, "onStop()");
+ if (alertDialog != null) {
+ alertDialog.dismiss();
+ }
+ mPlayer.release();
+ mSynchronizer.finish();
+ finish();
+// if (!mPlayer.getContentType().equals(CineAcessoDB.CONTENT_TYPE_AUDIO)) {
+// mPlayer.release();
+// mSynchronizer.finish();
+// finish();
+// }
+// else {
+// NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
+// .setSmallIcon(R.mipmap.ic_launcher)
+// .setContentTitle(getString(R.string.app_name))
+// .setContentText(RetainedSession.get(this, CineAcessoDB.CONTENT_TITLE));
+//
+// Intent resultIntent = new Intent(this, PlayerActivity.class);
+// PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+//
+// mBuilder.setContentIntent(pendingIntent);
+//
+// NotificationManager mNotfManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+// mNotfManager.notify(NOTIFICATION_ID, mBuilder.build());
+// }
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ //Log.d(TAG, "onDestroy()");
+
+ if (alertDialog != null) {
+ alertDialog.dismiss();
+ }
+
+ if (!isChangingConfigurations() /*|| !mPlayer.getContentType().equals(CineAcessoDB.CONTENT_TYPE_AUDIO)*/) {
+ mPlayer.release();
+ mSynchronizer.finish();
+ }
+
+ if(mBound) {
+ unbindService(mConnection);
+ }
+ if (receiver != null) {
+ unregisterReceiver(receiver);
+ }
+ }
+
+ @Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ super.onWindowFocusChanged(hasFocus);
+ //Log.d(TAG, "onWindowFocusChanged()");
+ if (hasFocus) {
+ delayedHide(0);
+ } else {
+ mHideSystemUiHandler.removeMessages(0);
+ }
+ }
+
+ @Override
+ public void surfaceCreated(SurfaceHolder holder) {
+ //Log.d(TAG, "surfaceCreated()");
+ String url = RetainedSession.get(this, CineAcessoDB.CONTENT_URL);
+ //Log.d(TAG, "CONTENT URL = " + url);
+ try {
+ mPlayer.setup(holder, url);
+ mPlayer.prepareAsync();
+// if (mPlayer.getContentType().equals(CineAcessoDB.CONTENT_TYPE_AUDIO)) {
+// Intent intent = new Intent(this, CineAcessoPlayerService.class);
+// bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
+// }
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ startActivity(new Intent(this, AuxTypeActivity.class));
+ finish();
+ Toast.makeText(this, getString(R.string.player_setup_error), Toast.LENGTH_LONG).show();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @Override
+ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+ //Log.d(TAG, "surfaceChanged(): format = " + format + " width = " + width + " height = " + height);
+ }
+
+ @Override
+ public void surfaceDestroyed(SurfaceHolder holder) {
+ //Log.d(TAG, "surfaceDestroyed()");
+ }
+
+// @Override
+// public void onVideoSizeChanged(MediaPlayer mediaPlayer, int videoWidth, int videoHeight) {
+// if (mediaPlayer != null) {
+// DisplayMetrics metrics = new DisplayMetrics();
+// getWindowManager().getDefaultDisplay().getMetrics(metrics);
+//
+// int screenHeight = metrics.heightPixels;
+// int screenWidth = metrics.widthPixels;
+//
+// ViewGroup.LayoutParams params = surface.getLayoutParams();
+//
+// if (videoWidth > videoHeight) {
+// params.width = screenWidth;
+// params.height = screenWidth * videoHeight / videoWidth;
+// }
+// else {
+// params.width = screenHeight * videoWidth / videoHeight;
+// params.height = screenHeight;
+// }
+//
+// surface.setLayoutParams(params);
+// }
+// Log.d(TAG, "onVideoSizeChanged(): width = " + videoWidth + " height = " + videoHeight);
+// }
+
+ @Override
+ public void onPrepared(MediaPlayer mp) {
+ playerPrepared = true;
+ mPlayer.acquireWifiLock();
+ if (startReceived) {
+ long time_buffering = System.currentTimeMillis() - startTime;
+ mPlayer.start(parseInt(time_buffering));
+ }
+ else {
+ alertDialog = new ProgressDialog.Builder(this)
+ .setTitle(getString(R.string.wait_start_title))
+ .setMessage(getString(R.string.wait_start_message))
+ .setCancelable(true)
+ .setIcon(R.mipmap.ic_launcher)
+ .create();
+ alertDialog.show();
+
+ }
+
+ //Log.d(TAG, "prepared()");
+ }
+
+ private void showSystemUI() {
+ mDecorView.setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ );
+ }
+
+ private void hideSystemUI() {
+ mDecorView.setSystemUiVisibility(
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ );
+ }
+
+ private void delayedHide(int delayMillis) {
+ mHideSystemUiHandler.removeMessages(0);
+ mHideSystemUiHandler.sendEmptyMessageDelayed(0, delayMillis);
+ }
+
+ @Override
+ public void onMessageReceived(String type, long pts) {
+
+ //Log.d(TAG, "[INFO] message " + type + " received");
+
+ switch (type) {
+ case START:
+ startTime = System.currentTimeMillis() + startTime;
+ if (alertDialog.isShowing()) {
+ alertDialog.dismiss();
+ }
+ startMedia();
+ break;
+
+ case STOP:
+ stopMedia();
+ startActivity(new Intent(this, AuxTypeActivity.class));
+ finish();
+ break;
+
+ case SYNC:
+ try {
+ if (alertDialog != null && alertDialog.isShowing()) {
+ alertDialog.dismiss();
+ }
+ if (mPlayer.isPlaying()) {
+ try {
+ mPlayer.adjustPlayback((int) pts);
+ } catch (InterruptedException e) {
+ Toast.makeText(this, getString(R.string.error_occured), Toast.LENGTH_LONG).show();
+ finish();
+ }
+ }
+ else if (!startReceived){
+ startTime = System.currentTimeMillis() - pts;
+ try {
+ startMedia(parseInt(pts));
+ } catch (IllegalArgumentException e) {
+ finish();
+ }
+ }
+ }
+ catch(IllegalStateException ise) {
+ ise.printStackTrace();
+ finish();
+ }
+ break;
+ }
+
+ }
+
+ private void startMedia() {
+ if (playerPrepared) {
+ startReceived = true;
+ mPlayer.start();
+ }
+ }
+
+ private void startMedia(int offset) {
+ if (playerPrepared) {
+ startReceived = true;
+ mPlayer.start(offset);
+ }
+ }
+
+ private void stopMedia() {
+ mPlayer.release();
+ mSynchronizer.finish();
+ }
+
+ private int parseInt(long value) {
+ if (value < Integer.MIN_VALUE || value > Integer.MAX_VALUE) {
+ throw new IllegalArgumentException("[" + value + "] Cannot be cast to int without changing its value.");
+ }
+ return (int) value;
+ }
+
+ @Override
+ public void onAudioBecomingNoisy() {
+ finish();
+ }
+}
+
+
diff --git a/app/src/main/java/lavid/com/cineacesso/activities/SplashActivity.java b/app/src/main/java/lavid/com/cineacesso/activities/SplashActivity.java
new file mode 100644
index 0000000..c8b03fd
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/activities/SplashActivity.java
@@ -0,0 +1,22 @@
+package lavid.com.cineacesso.activities;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.v7.app.AppCompatActivity;
+
+
+public class SplashActivity extends AppCompatActivity {
+
+ private static final long SPLASH_VISIBLE_TIME = 2000;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ new Handler().postDelayed(() -> {
+ startActivity(new Intent(this, AuxTypeActivity.class));
+ finish();
+ }, SPLASH_VISIBLE_TIME);
+ }
+
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/activities/WifiActivity.java b/app/src/main/java/lavid/com/cineacesso/activities/WifiActivity.java
new file mode 100644
index 0000000..bcf637a
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/activities/WifiActivity.java
@@ -0,0 +1,110 @@
+package lavid.com.cineacesso.activities;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.ConnectivityManager;
+import android.net.wifi.WifiManager;
+import android.os.Bundle;
+import android.provider.Settings;
+import android.support.design.widget.FloatingActionButton;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.widget.TextView;
+
+import java.util.concurrent.ScheduledExecutorService;
+
+import lavid.com.cineacesso.R;
+import lavid.com.cineacesso.utils.CineAcessoDB;
+import lavid.com.cineacesso.utils.NetworkReceiver;
+
+
+public class WifiActivity extends AppCompatActivity {
+
+ //private static final String TAG = WifiActivity.class.getSimpleName();
+
+ private ScheduledExecutorService scheduler;
+ private NetworkReceiver receiver = new NetworkReceiver();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_wifi);
+
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+ assert getSupportActionBar() != null;
+ getSupportActionBar().setDisplayShowTitleEnabled(false);
+
+ TextView tvSSID = (TextView) findViewById(R.id.tv_ssid);
+ tvSSID.setText(CineAcessoDB.NETWORK_SSID);
+
+ FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab_wifi);
+ assert fab != null;
+ fab.setOnClickListener(view -> startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)));
+
+ IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
+ receiver = new NetworkReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ super.onReceive(context, intent);
+ if (isValidSSID(WifiActivity.this)) {
+ finish();
+ }
+ }
+ };
+ this.registerReceiver(receiver, filter);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if (isValidSSID(this)) {
+ finish();
+ }
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ //Log.d(TAG, "onPause()");
+
+// if (scheduler == null) {
+// scheduler = Executors.newScheduledThreadPool(1);
+//
+// Runnable ssidValidator = () -> {
+// if (isValidSSID(this)) {
+// scheduler.shutdown();
+// finish();
+// }
+// };
+//
+// scheduler.scheduleAtFixedRate(ssidValidator, 0, 2000, TimeUnit.MILLISECONDS);
+// }
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ //Log.d(TAG, "onDestroy()");
+// try {
+// scheduler.shutdown();
+// } catch (NullPointerException npe) {
+// npe.printStackTrace();
+// }
+ if (receiver != null) {
+ this.unregisterReceiver(receiver);
+ }
+ }
+
+ public static boolean isValidSSID(Context ctx) {
+
+ WifiManager wifiManager = (WifiManager) ctx.getSystemService(Context.WIFI_SERVICE);
+ //Log.d(TAG, "THREAD: " + Thread.currentThread().getId());
+ //Log.d(TAG, "NETWORK_SSID: " + wifiManager.getConnectionInfo().getSSID());
+ //Log.d(TAG, "INTENT_SSID: " + ssid);
+ return wifiManager.isWifiEnabled() && wifiManager.getConnectionInfo().getSSID().contains(CineAcessoDB.NETWORK_SSID);
+ }
+
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayer.java b/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayer.java
new file mode 100644
index 0000000..7f40528
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayer.java
@@ -0,0 +1,243 @@
+package lavid.com.cineacesso.player;
+
+import android.content.Context;
+import android.media.AudioManager;
+import android.media.MediaPlayer;
+import android.net.wifi.WifiManager;
+import android.os.PowerManager;
+import android.util.Log;
+import android.view.SurfaceHolder;
+
+import java.io.IOException;
+import java.util.Timer;
+import java.util.TimerTask;
+
+
+public class CineAcessoPlayer extends MediaPlayer implements
+ MediaPlayer.OnErrorListener,
+ AudioManager.OnAudioFocusChangeListener {
+
+ private static final String TAG = CineAcessoPlayer.class.getSimpleName();
+
+ private static final int VIDEO_FPS_SYNC_TARGET = 200;
+
+ private boolean synchd = false;
+ private long startTimeSynchd;
+
+ private OnAudioBecomingNoisyListener onAudioBecomingNoisyListener;
+
+ private static CineAcessoPlayer instance;
+ private String contentType = "";
+
+ //private Context context;
+ private WifiManager.WifiLock wifiLock;
+
+ private class ResumePlayerTask extends TimerTask {
+ @Override
+ public void run() {
+ start();
+ }
+ }
+
+ private Timer currentTimer;
+
+ private CineAcessoPlayer(Context context) {
+ //this.context = context;
+ this.wifiLock = ((WifiManager) context.getSystemService(Context.WIFI_SERVICE))
+ .createWifiLock(WifiManager.WIFI_MODE_FULL, "cineAcessoPlayerLock");
+
+ setOnErrorListener(this);
+
+// if (!(contentType = RetainedSession.get(context, CineAcessoDB.AUX_TYPE))
+// .equals(CineAcessoDB.CONTENT_TYPE_AUDIO)) {
+//
+// setWakeMode(context, PowerManager.PARTIAL_WAKE_LOCK);
+// setScreenOnWhilePlaying(true);
+// }
+// else {
+// setAudioStreamType(AudioManager.STREAM_MUSIC);
+// }
+ setWakeMode(context, PowerManager.PARTIAL_WAKE_LOCK);
+ setAudioStreamType(AudioManager.STREAM_MUSIC);
+ }
+
+ public static synchronized CineAcessoPlayer getInstance(Context context) {
+ if (instance == null) {
+ instance = new CineAcessoPlayer(context.getApplicationContext());
+ }
+ return instance;
+ }
+
+ public static synchronized CineAcessoPlayer getInstance() {
+ return instance;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public String getContentType() {
+ return this.contentType;
+ }
+
+ public void setup(SurfaceHolder sh, String url) throws IOException, IllegalStateException {
+ try {
+ setDisplay(sh);
+ setDataSource(url);
+ setScreenOnWhilePlaying(true);
+ }
+ catch (IllegalStateException e) {
+ e.printStackTrace();
+ //Log.d(TAG, "URL: " + url);
+ }
+ }
+
+ public void acquireWifiLock() {
+ if (wifiLock != null && !wifiLock.isHeld()) {
+ wifiLock.acquire();
+ }
+ //Log.d(TAG, "prepared()");
+ }
+
+ @Override
+ public void start() throws IllegalStateException {
+ if (wifiLock != null && !wifiLock.isHeld()) {
+ wifiLock.acquire();
+ }
+ super.start();
+ //Log.d(TAG, "start()");
+ }
+
+ public void start(int offset) {
+ if (wifiLock != null && !wifiLock.isHeld()) {
+ wifiLock.acquire();
+ }
+ if (offset > 0) {
+ seekTo(offset + VIDEO_FPS_SYNC_TARGET);
+ }
+ super.start();
+ //Log.d(TAG, "start()");
+ }
+
+ @Override
+ public void stop() throws IllegalStateException {
+
+ if (wifiLock != null && wifiLock.isHeld()) {
+ wifiLock.release();
+ super.stop();
+ }
+ //Log.d(TAG, "stop()");
+ }
+
+ @Override
+ public void release() {
+ if (currentTimer != null) {
+ currentTimer.cancel();
+ }
+ //Log.d(TAG, "RELEASING PLAYER");
+ if (instance != null) {
+ super.release();
+ if (wifiLock != null && wifiLock.isHeld()) {
+ wifiLock.release();
+ }
+ instance = null;
+ //Log.d(TAG, "release()");
+ }
+ }
+
+ @Override
+ public boolean onError(MediaPlayer mp, int what, int extra) {
+ //TODO
+ // ... react appropriately ...
+ // The MediaPlayer has moved to the Error state, must be reset!
+ return false;
+ }
+
+ //todo use
+// private boolean requestAudioFocus() {
+// AudioManager audioManager = ( AudioManager ) context.getSystemService(Context.AUDIO_SERVICE);
+// int result = audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
+//
+// if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
+// Log.i(TAG, "AUDIOFOCUS_REQUEST_GRANTED");
+// return true;
+// }
+// else {
+// Log.i(TAG, "AUDIOFOCUS_REQUEST_FAILED");
+// return false;
+// }
+// }
+
+ @Override
+ public void onAudioFocusChange(int focusChange) {
+
+ switch (focusChange) {
+ case AudioManager.AUDIOFOCUS_GAIN:
+ // resume playback
+ //TODO
+ //Log.d(TAG, "AUDIOFOCUS_GAIN");
+ break;
+
+ case AudioManager.AUDIOFOCUS_LOSS:
+ if (isPlaying()) release();
+ //Log.d(TAG, "AUDIOFOCUS_LOSS");
+ break;
+
+ case AudioManager.AUDIOFOCUS_GAIN_TRANSIENT:
+ if (isPlaying()) stop();
+ //Log.d(TAG, "AUDIOFOCUS_GAIN_TRANSIENT");
+ break;
+
+ case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK:
+ if (isPlaying()) setVolume(0.1f, 0.1f);
+ //Log.d(TAG, "AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK");
+ break;
+ }
+
+ }
+
+ public void adjustPlayback(int ptsServer) throws InterruptedException {
+
+ int playerCurrentTime = getCurrentPosition();
+
+ if (!synchd) {
+ Log.d(TAG, "PLAYER TIME : " + playerCurrentTime
+ + " SERVER TIME: " + ptsServer);
+ long driftTime;
+ if ( (ptsServer - playerCurrentTime) > VIDEO_FPS_SYNC_TARGET ) {
+ driftTime = (ptsServer - playerCurrentTime) << 1;
+ Log.d(TAG, "seek()");
+ this.seekTo(playerCurrentTime + (int) driftTime);
+ }
+ else {
+ if ( (playerCurrentTime - ptsServer) > VIDEO_FPS_SYNC_TARGET ) {
+ driftTime = (playerCurrentTime - ptsServer) >> 1;
+ this.pause();
+ Log.d(TAG, "delay()");
+ currentTimer = new Timer();
+ currentTimer.schedule(new ResumePlayerTask(), driftTime);
+ }
+ else {
+ synchd = true;
+ startTimeSynchd = ptsServer;
+ }
+ }
+ }
+ else if ((ptsServer - startTimeSynchd) > VIDEO_FPS_SYNC_TARGET /*1m*/) {
+ synchd = false;
+ }
+
+ }
+
+ public void setOnAudioBecomingNoisyListener(OnAudioBecomingNoisyListener listener) {
+ this.onAudioBecomingNoisyListener = listener;
+ }
+
+ public OnAudioBecomingNoisyListener getAudioBecomingNoisyListener() {
+ return this.onAudioBecomingNoisyListener;
+ }
+
+ public interface OnAudioBecomingNoisyListener {
+ void onAudioBecomingNoisy();
+ }
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayerController.java b/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayerController.java
new file mode 100644
index 0000000..d5e1d56
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayerController.java
@@ -0,0 +1,82 @@
+package lavid.com.cineacesso.player;
+
+import android.content.Context;
+import android.media.MediaPlayer;
+import android.widget.MediaController;
+
+
+public class CineAcessoPlayerController extends MediaController implements MediaController.MediaPlayerControl{
+
+ private MediaPlayer player;
+
+ public CineAcessoPlayerController(Context context) {
+ super(context);
+ }
+
+ public CineAcessoPlayerController(Context context, MediaPlayer player) {
+ super(context, false);
+ this.player = player;
+ setMediaPlayer(this);
+ }
+
+ @Override
+ public void start() {
+ if (player != null) {
+ player.start();
+ }
+ }
+
+ @Override
+ public void pause() {
+ if (player != null) {
+ player.pause();
+ }
+ }
+
+ @Override
+ public int getDuration() {
+ return player != null ? player.getDuration() : 0;
+ }
+
+ @Override
+ public int getCurrentPosition() {
+ return player != null ? player.getCurrentPosition() : 0;
+ }
+
+ @Override
+ public void seekTo(int pos) {
+ if (player != null) {
+ player.seekTo(pos);
+ }
+ }
+
+ @Override
+ public boolean isPlaying() {
+ return player != null && player.isPlaying();
+ }
+
+ @Override
+ public int getBufferPercentage() {
+ return 0;
+ }
+
+ @Override
+ public boolean canPause() {
+ return true;
+ }
+
+ @Override
+ public boolean canSeekBackward() {
+ return false;
+ }
+
+ @Override
+ public boolean canSeekForward() {
+ return false;
+ }
+
+ @Override
+ public int getAudioSessionId() {
+ return player != null ? player.getAudioSessionId() : 0;
+ }
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayerService.java b/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayerService.java
new file mode 100644
index 0000000..5e59de9
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayerService.java
@@ -0,0 +1,43 @@
+package lavid.com.cineacesso.player;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.Binder;
+import android.os.IBinder;
+import android.support.annotation.Nullable;
+
+/**
+ * Created by Ademir on 24/07/2016.
+ */
+public class CineAcessoPlayerService extends Service {
+
+ private static final String TAG = CineAcessoPlayerService.class.getSimpleName();
+
+ private final IBinder mBinder = new LocalBinder();
+
+ private CineAcessoPlayer mPlayer = CineAcessoPlayer.getInstance();
+
+ public class LocalBinder extends Binder {
+ public CineAcessoPlayerService getService() {
+ return CineAcessoPlayerService.this;
+ }
+ }
+
+ @Nullable
+ @Override
+ public IBinder onBind(Intent intent) {
+ return mBinder;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ //Log.d(TAG, "onCreate()");
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ //Log.d(TAG, "onDestroy()");
+ }
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayerSynchronizer.java b/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayerSynchronizer.java
new file mode 100644
index 0000000..5f79a74
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/player/CineAcessoPlayerSynchronizer.java
@@ -0,0 +1,118 @@
+package lavid.com.cineacesso.player;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.DatagramSocket;
+import java.net.SocketException;
+
+
+public class CineAcessoPlayerSynchronizer extends Thread {
+
+ private static final String TAG = CineAcessoPlayerSynchronizer.class.getSimpleName();
+
+ private static final String RESP_MESSAGE_TYPE = "type";
+ private static final String RESP_SERVER_UID = "server_uid";
+ private static final String RESP_OFFSET = "offset";
+ private static final String RESP_PTS = "pts";
+ private static final String RESP_MESSAGE_START = "START";
+ private static final String RESP_MESSAGE_STOP = "STOP";
+ private static final String RESP_MESSAGE_SYNC = "SYNC";
+
+ private static final int CLIENT_DEFAULT_PORT = 5054;
+ private static final int BUFFER_LENGTH = 1024;
+
+ private DatagramSocket socket;
+ private int clientPort;
+ private boolean socketOpened;
+
+ private String serverUid;
+
+ private OnMessageReceivedListener mOnMessageReceivedListener;
+
+
+ public CineAcessoPlayerSynchronizer(String serverUid) {
+ this(CLIENT_DEFAULT_PORT, serverUid);
+ }
+
+ private CineAcessoPlayerSynchronizer(int clientPort, String serverUid) {
+ this.clientPort = clientPort;
+ this.serverUid = serverUid;
+ socketOpened = true;
+ }
+
+ @Override
+ public void run() {
+
+ try {
+ socket = new DatagramSocket(clientPort);
+ byte[] buffer;
+ DatagramPacket packet;
+ JSONObject jsonObject;
+
+ while(socketOpened) {
+ buffer = new byte[BUFFER_LENGTH];
+ packet = new DatagramPacket(buffer, buffer.length);
+
+ //Log.d(TAG, "WAITING SERVER MESSAGE");
+ socket.receive(packet);
+
+ String message = new String(packet.getData());
+ jsonObject = new JSONObject(message);
+ //Log.d(TAG, "MESSAGE RECEIVED = " + jsonObject.toString());
+
+ String responseServerUid = jsonObject.has(RESP_SERVER_UID) ? jsonObject.getString(RESP_SERVER_UID) : null;
+ if (responseServerUid != null && responseServerUid.equals(serverUid)
+ && jsonObject.has(RESP_MESSAGE_TYPE)) {
+
+ String messageType = jsonObject.getString(RESP_MESSAGE_TYPE);
+ //Log.d(TAG, "RESP_MESSAGE_" + messageType);
+ switch (messageType) {
+ case RESP_MESSAGE_START:
+ mOnMessageReceivedListener.onMessageReceived(RESP_MESSAGE_START, jsonObject.getLong(RESP_OFFSET));
+ break;
+
+ case RESP_MESSAGE_STOP:
+ mOnMessageReceivedListener.onMessageReceived(RESP_MESSAGE_STOP, -1);
+ break;
+
+ case RESP_MESSAGE_SYNC:
+ mOnMessageReceivedListener.onMessageReceived(RESP_MESSAGE_SYNC, jsonObject.getLong(RESP_PTS));
+ break;
+ }
+
+ }
+ }
+
+ } catch (SocketException se) {
+ se.printStackTrace();
+ //Log.d(TAG, "SOCKET_EXCEPTION");
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ //Log.d(TAG, "IO_EXCEPTION");
+ } catch (JSONException jse) {
+ jse.printStackTrace();
+ //Log.d(TAG, "JSON_EXCEPTION");
+ }
+
+ }
+
+ public void finish() {
+ socketOpened = false;
+ if (socket != null) {
+ socket.close();
+ socket = null;
+ }
+ }
+
+ public void setOnMessageReceivedListener(OnMessageReceivedListener mOnMessageReceivedListener) {
+ this.mOnMessageReceivedListener = mOnMessageReceivedListener;
+ }
+
+ public interface OnMessageReceivedListener {
+ void onMessageReceived(String type, long offset);
+ }
+
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/utils/BarcodeListener.java b/app/src/main/java/lavid/com/cineacesso/utils/BarcodeListener.java
new file mode 100644
index 0000000..019ada5
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/utils/BarcodeListener.java
@@ -0,0 +1,10 @@
+package lavid.com.cineacesso.utils;
+
+import com.google.android.gms.vision.barcode.Barcode;
+
+/**
+ * Created by Ademir on 07/07/2016.
+ */
+public interface BarcodeListener {
+ void onDetected(Barcode barcode);
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/utils/BarcodeTrackerFactory.java b/app/src/main/java/lavid/com/cineacesso/utils/BarcodeTrackerFactory.java
new file mode 100644
index 0000000..18e9a45
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/utils/BarcodeTrackerFactory.java
@@ -0,0 +1,24 @@
+package lavid.com.cineacesso.utils;
+
+import com.google.android.gms.vision.MultiProcessor;
+import com.google.android.gms.vision.Tracker;
+import com.google.android.gms.vision.barcode.Barcode;
+
+/**
+ * Created by Ademir on 07/07/2016.
+ */
+public class BarcodeTrackerFactory implements MultiProcessor.Factory {
+
+ private BarcodeListener barcodeListener;
+
+ public BarcodeTrackerFactory(BarcodeListener barcodeListener) {
+ this.barcodeListener = barcodeListener;
+ }
+
+ @Override
+ public synchronized Tracker create(Barcode barcode) {
+ barcodeListener.onDetected(barcode);
+ return new Tracker<>();
+ }
+
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/utils/CineAcessoAPI.java b/app/src/main/java/lavid/com/cineacesso/utils/CineAcessoAPI.java
new file mode 100644
index 0000000..21fddcf
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/utils/CineAcessoAPI.java
@@ -0,0 +1,104 @@
+package lavid.com.cineacesso.utils;
+
+import android.content.Context;
+import android.net.Uri;
+
+import com.android.volley.Request;
+import com.android.volley.toolbox.JsonObjectRequest;
+
+import org.json.JSONException;
+
+import java.util.HashMap;
+
+import lavid.com.cineacesso.R;
+
+
+public class CineAcessoAPI {
+
+ public static void getServerInfo(final Context context, String auxType, final GetServerInfoCallback cbk) {
+
+ String reqEntry = "";
+ switch (auxType) {
+ case CineAcessoDB.CONTENT_TYPE_LIBRAS:
+ reqEntry = CineAcessoDB.REQ_ENTRY_DEAF;
+ break;
+
+ case CineAcessoDB.CONTENT_TYPE_AUDIO:
+ reqEntry = CineAcessoDB.REQ_ENTRY_BLIND;
+ break;
+
+ case CineAcessoDB.CONTENT_TYPE_SUBS:
+ reqEntry = CineAcessoDB.REQ_ENTRY_SUBS;
+ break;
+
+ }
+
+ String url = Uri.parse(CineAcessoDB.BASE_URL).buildUpon()
+ .appendEncodedPath(reqEntry).build().toString();
+
+ JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.GET, url, null, response -> {
+
+ HashMap ret = new HashMap<>();
+ try {
+ ret.put(CineAcessoDB.SERVER_UID, response.getString(CineAcessoDB.UID));
+ ret.put(CineAcessoDB.CONTENT, response.getString(CineAcessoDB.CONTENT));
+ ret.put(CineAcessoDB.PTS, String.valueOf(response.getInt(CineAcessoDB.PTS)));
+ if (response.has(CineAcessoDB.CONTENT_AUTHOR)){
+ ret.put(CineAcessoDB.CONTENT_AUTHOR, response.getString(CineAcessoDB.CONTENT_AUTHOR));
+ } else {
+ ret.put(CineAcessoDB.CONTENT_AUTHOR, context.getString(R.string.unknown));
+ }
+ if (response.has(CineAcessoDB.CONTENT_YEAR)) {
+ ret.put(CineAcessoDB.CONTENT_YEAR, response.getString(CineAcessoDB.CONTENT_YEAR));
+ } else {
+ ret.put(CineAcessoDB.CONTENT_YEAR, context.getString(R.string.unknown));
+ }
+ if (response.has(CineAcessoDB.CONTENT_TITLE)) {
+ ret.put(CineAcessoDB.CONTENT_TITLE, response.getString(CineAcessoDB.CONTENT_TITLE));
+ } else {
+ ret.put(CineAcessoDB.CONTENT_TITLE, context.getString(R.string.unknown));
+ }
+ if (response.has(CineAcessoDB.CONTENT_IMG)) {
+ ret.put(CineAcessoDB.CONTENT_IMG, response.getString(CineAcessoDB.CONTENT_IMG));
+ } else {
+ ret.put(CineAcessoDB.CONTENT_IMG, null);
+ }
+ cbk.run(true, ret);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }, error -> cbk.run(false, null));
+
+ VolleySingleton.getInstance(context).addToRequestQueue(jsonObjReq);
+ }
+
+
+// private static class DefaultErrorListener implements Response.ErrorListener {
+// private Context ctx;
+//
+// public DefaultErrorListener(Context ctx) {
+// super();
+// this.ctx = ctx;
+// }
+//
+// @Override
+// public void onErrorResponse(VolleyError error) {
+//
+// if (error instanceof TimeoutError || error instanceof NoConnectionError) {
+// //Toast.makeText(ctx, R.string.network_timeout, Toast.LENGTH_LONG).show();
+// } else if (error instanceof AuthFailureError) {
+// //Toast.makeText(ctx, R.string.auth_failure, Toast.LENGTH_LONG).show();
+// } else if (error instanceof ServerError) {
+// //Toast.makeText(ctx, R.string.server_error, Toast.LENGTH_LONG).show();
+// } else if (error instanceof NetworkError) {
+// //Toast.makeText(ctx, R.string.network_error, Toast.LENGTH_LONG).show();
+// } else if (error instanceof ParseError) {
+// //Toast.makeText(ctx, R.string.parse_error, Toast.LENGTH_LONG).show();
+// }
+// }
+// }
+
+ public interface GetServerInfoCallback {
+ void run(boolean success, HashMap map);
+ }
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/utils/CineAcessoDB.java b/app/src/main/java/lavid/com/cineacesso/utils/CineAcessoDB.java
new file mode 100644
index 0000000..5052207
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/utils/CineAcessoDB.java
@@ -0,0 +1,36 @@
+package lavid.com.cineacesso.utils;
+
+/**
+ * Created by Ademir on 12/07/2016.
+ */
+public class CineAcessoDB {
+
+ public static final String LAST_SESSION = "last_session";
+
+ public static final String SERVER_UID = "server_uid";
+ //public static final String AUX_TYPE = "aux_type";
+ public static final String BASE_URL = "http://192.168.0.100:5053";
+ public static final String NETWORK_SSID = "CINEACESSO-01";
+
+ public static final String CONTENT_URL = "content_url";
+ public static final String CONTENT_IMG = "img";
+ public static final String CONTENT_IMG_URL = "img_url";
+ public static final String CONTENT_TITLE = "title";
+ public static final String CONTENT_AUTHOR = "author";
+ public static final String CONTENT_YEAR = "year";
+ public static final String CONTENT_TYPE = "type";
+ public static final String CONTENT_TYPE_LIBRAS = "libras";
+ //public static final String CONTENT_TYPE_LIBRAS_SUB = "libras_subtitles";
+ public static final String CONTENT_TYPE_SUBS = "subtitles";
+ public static final String CONTENT_TYPE_AUDIO = "audio";
+
+ public static final String REQ_ENTRY_DEAF = "api/entry/deaf";
+ public static final String REQ_ENTRY_BLIND = "api/entry/blind";
+ public static final String REQ_ENTRY_SUBS = "api/entry/subs";
+ //public static final String REQ_ENTRY_LIBRAS_SUBS = "api/entry/libras_subs";
+
+ public static final String UID = "uid";
+ public static final String CONTENT = "content";
+ public static final String PTS = "pts";
+
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/utils/IntentReceiver.java b/app/src/main/java/lavid/com/cineacesso/utils/IntentReceiver.java
new file mode 100644
index 0000000..c042068
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/utils/IntentReceiver.java
@@ -0,0 +1,29 @@
+package lavid.com.cineacesso.utils;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.media.AudioManager;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+
+import lavid.com.cineacesso.activities.WifiActivity;
+import lavid.com.cineacesso.player.CineAcessoPlayer;
+
+
+/**
+ * Created by Ademir on 10/07/2016.
+ */
+public class IntentReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(AudioManager.ACTION_AUDIO_BECOMING_NOISY)) {
+ CineAcessoPlayer player;
+ if ((player = CineAcessoPlayer.getInstance()) != null) {
+ if (player.getContentType().equals(CineAcessoDB.CONTENT_TYPE_AUDIO)) {
+ player.getAudioBecomingNoisyListener().onAudioBecomingNoisy();
+ }
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/utils/NetworkReceiver.java b/app/src/main/java/lavid/com/cineacesso/utils/NetworkReceiver.java
new file mode 100644
index 0000000..297af6d
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/utils/NetworkReceiver.java
@@ -0,0 +1,18 @@
+package lavid.com.cineacesso.utils;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.ConnectivityManager;
+
+import lavid.com.cineacesso.activities.WifiActivity;
+
+/**
+ * Created by Cinema_2 on 11/08/2016.
+ */
+public class NetworkReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+
+ }
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/utils/RetainedSession.java b/app/src/main/java/lavid/com/cineacesso/utils/RetainedSession.java
new file mode 100644
index 0000000..46f04b9
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/utils/RetainedSession.java
@@ -0,0 +1,39 @@
+package lavid.com.cineacesso.utils;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+/**
+ * Created by Ademir on 15/07/2016.
+ */
+public class RetainedSession {
+
+ private RetainedSession() {
+
+ }
+
+ public static void put(Context c,String key, String value) {
+ SharedPreferences prefs = c.getSharedPreferences(CineAcessoDB.LAST_SESSION, Context.MODE_PRIVATE);
+ SharedPreferences.Editor editor = prefs.edit();
+
+ editor.putString(key, value).apply();
+ }
+
+ public static boolean has(Context c, String key) {
+ SharedPreferences prefs = c.getSharedPreferences(CineAcessoDB.LAST_SESSION, Context.MODE_PRIVATE);
+ return prefs.contains(key);
+ }
+
+ public static String get(Context c, String key) {
+ SharedPreferences prefs = c.getSharedPreferences(CineAcessoDB.LAST_SESSION, Context.MODE_PRIVATE);
+ return prefs.getString(key, null);
+ }
+
+ public static void clear(Context c) {
+ SharedPreferences prefs = c.getSharedPreferences(CineAcessoDB.LAST_SESSION, Context.MODE_PRIVATE);
+ SharedPreferences.Editor editor = prefs.edit();
+
+ editor.clear().apply();
+ }
+
+}
diff --git a/app/src/main/java/lavid/com/cineacesso/utils/VolleySingleton.java b/app/src/main/java/lavid/com/cineacesso/utils/VolleySingleton.java
new file mode 100644
index 0000000..4213eb5
--- /dev/null
+++ b/app/src/main/java/lavid/com/cineacesso/utils/VolleySingleton.java
@@ -0,0 +1,68 @@
+package lavid.com.cineacesso.utils;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.support.v4.util.LruCache;
+
+import com.android.volley.DefaultRetryPolicy;
+import com.android.volley.Request;
+import com.android.volley.RequestQueue;
+import com.android.volley.toolbox.ImageLoader;
+import com.android.volley.toolbox.Volley;
+
+/**
+ * Created by Ademir on 17/07/2016.
+ */
+public class VolleySingleton {
+
+ private static VolleySingleton mInstance;
+ private static Context mContext;
+ private static RequestQueue mRequestQueue;
+ private static ImageLoader mImageLoader;
+
+
+ private VolleySingleton(Context context) {
+ mContext = context;
+ mRequestQueue = getRequestQueue();
+ mImageLoader = new ImageLoader(mRequestQueue, new ImageLoader.ImageCache() {
+ private final LruCache cache = new LruCache<>(20);
+
+ @Override
+ public Bitmap getBitmap(String url) {
+ return cache.get(url);
+ }
+
+ @Override
+ public void putBitmap(String url, Bitmap bitmap) {
+ cache.put(url, bitmap);
+ }
+ });
+ }
+
+ public static synchronized VolleySingleton getInstance(Context context) {
+ if (mInstance == null) {
+ mInstance = new VolleySingleton(context);
+ }
+ return mInstance;
+ }
+
+ private RequestQueue getRequestQueue() {
+ if (mRequestQueue == null) {
+ mRequestQueue = Volley.newRequestQueue(mContext.getApplicationContext());
+ }
+ return mRequestQueue;
+ }
+
+ public void addToRequestQueue(Request req) {
+ req.setRetryPolicy(new DefaultRetryPolicy(
+ 20000,
+ DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
+ DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
+ getRequestQueue().add(req);
+ //Log.d("VolleyRequestLog", "url: " + req.getUrl());
+ }
+
+ public ImageLoader getImageLoader() {
+ return mImageLoader;
+ }
+}
diff --git a/app/src/main/res/drawable-hdpi/arrow_back.png b/app/src/main/res/drawable-hdpi/arrow_back.png
new file mode 100644
index 0000000..f21e4f7
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/arrow_back.png differ
diff --git a/app/src/main/res/drawable-hdpi/arrow_back_blue.png b/app/src/main/res/drawable-hdpi/arrow_back_blue.png
new file mode 100644
index 0000000..25185db
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/arrow_back_blue.png differ
diff --git a/app/src/main/res/drawable-hdpi/cineacesso_logo_splash.png b/app/src/main/res/drawable-hdpi/cineacesso_logo_splash.png
new file mode 100644
index 0000000..bc15859
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/cineacesso_logo_splash.png differ
diff --git a/app/src/main/res/drawable-hdpi/play_shape.png b/app/src/main/res/drawable-hdpi/play_shape.png
new file mode 100644
index 0000000..88bb3d7
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/play_shape.png differ
diff --git a/app/src/main/res/drawable-hdpi/qr_shape.png b/app/src/main/res/drawable-hdpi/qr_shape.png
new file mode 100644
index 0000000..4c50196
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/qr_shape.png differ
diff --git a/app/src/main/res/drawable-hdpi/wifi_shape.png b/app/src/main/res/drawable-hdpi/wifi_shape.png
new file mode 100644
index 0000000..61906ea
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/wifi_shape.png differ
diff --git a/app/src/main/res/drawable-mdpi/arrow_back.png b/app/src/main/res/drawable-mdpi/arrow_back.png
new file mode 100644
index 0000000..8015860
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/arrow_back.png differ
diff --git a/app/src/main/res/drawable-mdpi/arrow_back_blue.png b/app/src/main/res/drawable-mdpi/arrow_back_blue.png
new file mode 100644
index 0000000..39e9660
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/arrow_back_blue.png differ
diff --git a/app/src/main/res/drawable-mdpi/play_shape.png b/app/src/main/res/drawable-mdpi/play_shape.png
new file mode 100644
index 0000000..1655bdb
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/play_shape.png differ
diff --git a/app/src/main/res/drawable-mdpi/qr_shape.png b/app/src/main/res/drawable-mdpi/qr_shape.png
new file mode 100644
index 0000000..1fdbac2
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/qr_shape.png differ
diff --git a/app/src/main/res/drawable-mdpi/wifi_shape.png b/app/src/main/res/drawable-mdpi/wifi_shape.png
new file mode 100644
index 0000000..3d95a22
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/wifi_shape.png differ
diff --git a/app/src/main/res/drawable-xhdpi/arrow_back.png b/app/src/main/res/drawable-xhdpi/arrow_back.png
new file mode 100644
index 0000000..b954b7a
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/arrow_back.png differ
diff --git a/app/src/main/res/drawable-xhdpi/arrow_back_blue.png b/app/src/main/res/drawable-xhdpi/arrow_back_blue.png
new file mode 100644
index 0000000..bfeebec
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/arrow_back_blue.png differ
diff --git a/app/src/main/res/drawable-xhdpi/cineacesso_logo_splash.png b/app/src/main/res/drawable-xhdpi/cineacesso_logo_splash.png
new file mode 100644
index 0000000..0b23853
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/cineacesso_logo_splash.png differ
diff --git a/app/src/main/res/drawable-xhdpi/play_shape.png b/app/src/main/res/drawable-xhdpi/play_shape.png
new file mode 100644
index 0000000..bc410c3
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/play_shape.png differ
diff --git a/app/src/main/res/drawable-xhdpi/qr_shape.png b/app/src/main/res/drawable-xhdpi/qr_shape.png
new file mode 100644
index 0000000..c6ce590
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/qr_shape.png differ
diff --git a/app/src/main/res/drawable-xhdpi/wifi_shape.png b/app/src/main/res/drawable-xhdpi/wifi_shape.png
new file mode 100644
index 0000000..f9b1541
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/wifi_shape.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/arrow_back.png b/app/src/main/res/drawable-xxhdpi/arrow_back.png
new file mode 100644
index 0000000..b51035b
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/arrow_back.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/arrow_back_blue.png b/app/src/main/res/drawable-xxhdpi/arrow_back_blue.png
new file mode 100644
index 0000000..1d5e80f
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/arrow_back_blue.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/cineacesso_logo_splash.png b/app/src/main/res/drawable-xxhdpi/cineacesso_logo_splash.png
new file mode 100644
index 0000000..3190266
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/cineacesso_logo_splash.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/play_shape.png b/app/src/main/res/drawable-xxhdpi/play_shape.png
new file mode 100644
index 0000000..c6d762c
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/play_shape.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/qr_shape.png b/app/src/main/res/drawable-xxhdpi/qr_shape.png
new file mode 100644
index 0000000..bda3492
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/qr_shape.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/wifi_shape.png b/app/src/main/res/drawable-xxhdpi/wifi_shape.png
new file mode 100644
index 0000000..e829c08
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/wifi_shape.png differ
diff --git a/app/src/main/res/drawable/about_govfederal.png b/app/src/main/res/drawable/about_govfederal.png
new file mode 100644
index 0000000..1b50407
Binary files /dev/null and b/app/src/main/res/drawable/about_govfederal.png differ
diff --git a/app/src/main/res/drawable/about_lavid.png b/app/src/main/res/drawable/about_lavid.png
new file mode 100644
index 0000000..4e6c400
Binary files /dev/null and b/app/src/main/res/drawable/about_lavid.png differ
diff --git a/app/src/main/res/drawable/about_minc.png b/app/src/main/res/drawable/about_minc.png
new file mode 100644
index 0000000..00dffb3
Binary files /dev/null and b/app/src/main/res/drawable/about_minc.png differ
diff --git a/app/src/main/res/drawable/about_mjc.png b/app/src/main/res/drawable/about_mjc.png
new file mode 100644
index 0000000..de05674
Binary files /dev/null and b/app/src/main/res/drawable/about_mjc.png differ
diff --git a/app/src/main/res/drawable/about_mpdg.png b/app/src/main/res/drawable/about_mpdg.png
new file mode 100644
index 0000000..58989d6
Binary files /dev/null and b/app/src/main/res/drawable/about_mpdg.png differ
diff --git a/app/src/main/res/drawable/about_rnp.png b/app/src/main/res/drawable/about_rnp.png
new file mode 100644
index 0000000..dfba71b
Binary files /dev/null and b/app/src/main/res/drawable/about_rnp.png differ
diff --git a/app/src/main/res/drawable/about_sadv.png b/app/src/main/res/drawable/about_sadv.png
new file mode 100644
index 0000000..6f30500
Binary files /dev/null and b/app/src/main/res/drawable/about_sadv.png differ
diff --git a/app/src/main/res/drawable/about_sti.png b/app/src/main/res/drawable/about_sti.png
new file mode 100644
index 0000000..61e49e0
Binary files /dev/null and b/app/src/main/res/drawable/about_sti.png differ
diff --git a/app/src/main/res/drawable/about_ufpb.png b/app/src/main/res/drawable/about_ufpb.png
new file mode 100644
index 0000000..11ce13d
Binary files /dev/null and b/app/src/main/res/drawable/about_ufpb.png differ
diff --git a/app/src/main/res/drawable/aux_audiodesc.png b/app/src/main/res/drawable/aux_audiodesc.png
new file mode 100644
index 0000000..a50e43f
Binary files /dev/null and b/app/src/main/res/drawable/aux_audiodesc.png differ
diff --git a/app/src/main/res/drawable/aux_libras.png b/app/src/main/res/drawable/aux_libras.png
new file mode 100644
index 0000000..5768289
Binary files /dev/null and b/app/src/main/res/drawable/aux_libras.png differ
diff --git a/app/src/main/res/drawable/aux_libras_subtitles.png b/app/src/main/res/drawable/aux_libras_subtitles.png
new file mode 100644
index 0000000..e7b0cac
Binary files /dev/null and b/app/src/main/res/drawable/aux_libras_subtitles.png differ
diff --git a/app/src/main/res/drawable/aux_subtitles.png b/app/src/main/res/drawable/aux_subtitles.png
new file mode 100644
index 0000000..994c0e0
Binary files /dev/null and b/app/src/main/res/drawable/aux_subtitles.png differ
diff --git a/app/src/main/res/drawable/by_vlibras.png b/app/src/main/res/drawable/by_vlibras.png
new file mode 100644
index 0000000..9d52cf3
Binary files /dev/null and b/app/src/main/res/drawable/by_vlibras.png differ
diff --git a/app/src/main/res/drawable/cineacesso_logo.png b/app/src/main/res/drawable/cineacesso_logo.png
new file mode 100644
index 0000000..3190266
Binary files /dev/null and b/app/src/main/res/drawable/cineacesso_logo.png differ
diff --git a/app/src/main/res/drawable/cineacesso_logo_no_name.png b/app/src/main/res/drawable/cineacesso_logo_no_name.png
new file mode 100644
index 0000000..25954fd
Binary files /dev/null and b/app/src/main/res/drawable/cineacesso_logo_no_name.png differ
diff --git a/app/src/main/res/drawable/cineacesso_name.png b/app/src/main/res/drawable/cineacesso_name.png
new file mode 100644
index 0000000..f9565a8
Binary files /dev/null and b/app/src/main/res/drawable/cineacesso_name.png differ
diff --git a/app/src/main/res/drawable/content_image_default.png b/app/src/main/res/drawable/content_image_default.png
new file mode 100644
index 0000000..6a17202
Binary files /dev/null and b/app/src/main/res/drawable/content_image_default.png differ
diff --git a/app/src/main/res/drawable/qr_code_delim.png b/app/src/main/res/drawable/qr_code_delim.png
new file mode 100644
index 0000000..bb82971
Binary files /dev/null and b/app/src/main/res/drawable/qr_code_delim.png differ
diff --git a/app/src/main/res/drawable/rnp_teste.png b/app/src/main/res/drawable/rnp_teste.png
new file mode 100644
index 0000000..9b63bae
Binary files /dev/null and b/app/src/main/res/drawable/rnp_teste.png differ
diff --git a/app/src/main/res/drawable/splash_screen_bg.xml b/app/src/main/res/drawable/splash_screen_bg.xml
new file mode 100644
index 0000000..5702029
--- /dev/null
+++ b/app/src/main/res/drawable/splash_screen_bg.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/wifi_shape_big.png b/app/src/main/res/drawable/wifi_shape_big.png
new file mode 100644
index 0000000..ca848ec
Binary files /dev/null and b/app/src/main/res/drawable/wifi_shape_big.png differ
diff --git a/app/src/main/res/layout-v21/activity_content.xml b/app/src/main/res/layout-v21/activity_content.xml
new file mode 100644
index 0000000..64a32f6
--- /dev/null
+++ b/app/src/main/res/layout-v21/activity_content.xml
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_aux_type.xml b/app/src/main/res/layout/activity_aux_type.xml
new file mode 100644
index 0000000..a63391d
--- /dev/null
+++ b/app/src/main/res/layout/activity_aux_type.xml
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_content.xml b/app/src/main/res/layout/activity_content.xml
new file mode 100644
index 0000000..279fa6c
--- /dev/null
+++ b/app/src/main/res/layout/activity_content.xml
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_player.xml b/app/src/main/res/layout/activity_player.xml
new file mode 100644
index 0000000..f520e2d
--- /dev/null
+++ b/app/src/main/res/layout/activity_player.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_wifi.xml b/app/src/main/res/layout/activity_wifi.xml
new file mode 100644
index 0000000..0ce7836
--- /dev/null
+++ b/app/src/main/res/layout/activity_wifi.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..836e594
--- /dev/null
+++ b/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,9 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..6094b7b
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c8b7c31
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..c12fab4
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..d9f2450
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..026bc75
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/raw/beep.wav b/app/src/main/res/raw/beep.wav
new file mode 100644
index 0000000..015e1f6
Binary files /dev/null and b/app/src/main/res/raw/beep.wav differ
diff --git a/app/src/main/res/values-v19/styles.xml b/app/src/main/res/values-v19/styles.xml
new file mode 100644
index 0000000..0506460
--- /dev/null
+++ b/app/src/main/res/values-v19/styles.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 0000000..ca9d67c
--- /dev/null
+++ b/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..90bf001
--- /dev/null
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..d114325
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,15 @@
+
+
+ #3B8CCC
+ #3B8CCC
+ #448AFF
+
+ #1F8AC3
+ #3D96C3
+ #5396B7
+ #65A4C3
+
+ #FFFFFF
+ #000000
+
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..36aad7d
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,4 @@
+
+
+ 16dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..678b728
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,63 @@
+
+ CineAcesso
+
+ Tela de captura do qr code
+ Tela configuração wifi
+ Tela principal
+ Tela informações do conteúdo
+
+ OK
+ Voltar
+ Cancelar
+
+ Acesso à camera necessário para detecção
+ É necessário a permissão de camera.
+ Permitir uso da camera
+
+ Faça a leitura do QR Code
+ Escanear código QR
+ Mire corretamente no QR code e aguarde pela vibração. Você irá automaticamente para o próximo passo.
+ Você precisa estar conectado na nossa rede Wifi. Conecte em alguma rede com o prefixo:
+ CINEACESSO-XX
+ Escolher função
+ Escolha um dos auxílios abaixo para acompanhar o vídeo ou o filme
+ Sobre
+ libras
+ libras e legendas
+ legendas
+ audiodescrição
+ Desenvolvido por NPE/LAVID\nhttp://lavid.ufpb.br\ncontato@lavid.ufpb.br
+ Realizadores
+ Sessão salva!
+
+ Ocorreu um problema ao localizar o vídeo. Tente novamente.
+ QR Code inválido
+ O QR Code escaneado é inválido.
+ Play
+ Escanear qr Code
+ Escolher rede sem fio
+ Aguardando início
+ Ao iniciar o filme, o conteúdo será reproduzido automaticamente.
+
+ Desconhecido
+ O conteúdo ainda não está disponível.
+ Aguarde
+ Direção
+ Ocorreu um erro, conecte-se novamente.
+ A sua ultima sessão ainda não acabou! Aperte OK para voltar ou cancelar para escanear um novo código.
+ Carregando
+ Em breve!
+ Governo federal
+ Ministério da cultura
+ Secretaria do audiovisual
+ Secretaria de tecnologia da informação
+ Ministério do planejamento, desenvolvimento e gestão
+ Ministério da justiça e cidadania
+ Rede nacional de ensino e pesquisa
+ Laboratório de aplicações de vídeo digital
+ Universidade federal da paraíba
+ Você irá acompanhar o filme em:
+ CineAcesso
+ Verificando conexão
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..16912db
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/test/java/lavid/com/cineacesso/ExampleUnitTest.java b/app/src/test/java/lavid/com/cineacesso/ExampleUnitTest.java
new file mode 100644
index 0000000..3c6c7a6
--- /dev/null
+++ b/app/src/test/java/lavid/com/cineacesso/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package lavid.com.cineacesso;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..aff4f41
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,23 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.1.2'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/build/generated/mockable-android-24.jar b/build/generated/mockable-android-24.jar
new file mode 100644
index 0000000..4f38f6e
Binary files /dev/null and b/build/generated/mockable-android-24.jar differ
diff --git a/build/intermediates/jack-cache/cache.xml b/build/intermediates/jack-cache/cache.xml
new file mode 100644
index 0000000..cde1f98
--- /dev/null
+++ b/build/intermediates/jack-cache/cache.xml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cine.iml b/cine.iml
new file mode 100644
index 0000000..ab9cacd
--- /dev/null
+++ b/cine.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/cineacesso_key.jks b/cineacesso_key.jks
new file mode 100644
index 0000000..c4659e3
Binary files /dev/null and b/cineacesso_key.jks differ
diff --git a/cineacesso_keystore_key_infos.txt b/cineacesso_keystore_key_infos.txt
new file mode 100644
index 0000000..d6b5c9d
--- /dev/null
+++ b/cineacesso_keystore_key_infos.txt
@@ -0,0 +1,6 @@
+CineAcesso
+
+KeyStore-password : l4v1d-l1v3
+
+Key - Alias : CineAcessoKey
+ - Password: l4v1d-l1v3
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..13372ae
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..122a0dc
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Dec 28 10:00:20 PST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..9d82f78
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/keystore.properties b/keystore.properties
new file mode 100644
index 0000000..c0821d3
--- /dev/null
+++ b/keystore.properties
@@ -0,0 +1,4 @@
+storePassword=l4v1d-l1v3
+keyPassword=l4v1d-l1v3
+keyAlias=CineAcessoKey
+storeFile=C:\\Users\\Ademir\\Desktop\\cine\\CineAcesso\\cineacesso_key.jks
\ No newline at end of file
diff --git a/local.properties b/local.properties
new file mode 100644
index 0000000..a19a4e6
--- /dev/null
+++ b/local.properties
@@ -0,0 +1,11 @@
+## This file is automatically generated by Android Studio.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+#
+# Location of the SDK. This is only used by Gradle.
+# For customization when using a Version Control System, please read the
+# header note.
+#Tue Aug 02 11:19:41 BRT 2016
+sdk.dir=C\:\\Users\\Cinema_2\\AppData\\Local\\Android\\sdk
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/volley/.gitignore b/volley/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/volley/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/volley/build.gradle b/volley/build.gradle
new file mode 100644
index 0000000..46b54b1
--- /dev/null
+++ b/volley/build.gradle
@@ -0,0 +1,25 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 24
+ buildToolsVersion "24.0.0"
+
+ defaultConfig {
+ minSdkVersion 16
+ targetSdkVersion 24
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:appcompat-v7:24.0.0'
+}
diff --git a/volley/proguard-rules.pro b/volley/proguard-rules.pro
new file mode 100644
index 0000000..91c45b1
--- /dev/null
+++ b/volley/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\Ademir\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/volley/src/androidTest/java/lavid/com/volley/ApplicationTest.java b/volley/src/androidTest/java/lavid/com/volley/ApplicationTest.java
new file mode 100644
index 0000000..978484d
--- /dev/null
+++ b/volley/src/androidTest/java/lavid/com/volley/ApplicationTest.java
@@ -0,0 +1,13 @@
+package lavid.com.volley;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/volley/src/main/AndroidManifest.xml b/volley/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..dba204b
--- /dev/null
+++ b/volley/src/main/AndroidManifest.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
diff --git a/volley/src/main/res/values/strings.xml b/volley/src/main/res/values/strings.xml
new file mode 100644
index 0000000..47a0462
--- /dev/null
+++ b/volley/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ Volley
+
diff --git a/volley/src/test/java/lavid/com/volley/ExampleUnitTest.java b/volley/src/test/java/lavid/com/volley/ExampleUnitTest.java
new file mode 100644
index 0000000..11dcd4e
--- /dev/null
+++ b/volley/src/test/java/lavid/com/volley/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package lavid.com.volley;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
--
libgit2 0.21.2