Commit 211878bc by Krishna Vemulawada

offline handle with voice

parents 9cb09194 964f4635
......@@ -72,7 +72,7 @@ android {
vportal {
applicationId "com.vsoft.vera.vportal"
versionCode 1
versionName "0.1.6"
versionName "0.1.7"
}
}
}
......
......@@ -156,6 +156,7 @@ public class CatalogueApplication extends MultiDexApplication {
options.upgrade = true;
mSocket = IO.socket(Constants.CHAT_SERVER_URL,options);
mSocket.io().timeout(-1);
mSocket.io().reconnection(true);
mSocket.io().reconnectionDelay(0);
......
......@@ -3,12 +3,14 @@ package com.vsoft.vera.ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
......@@ -18,6 +20,7 @@ import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -69,6 +72,8 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import static com.vsoft.vera.utils.Util.convertDpToPx;
public class ADALActivity extends AppCompatActivity {
......@@ -121,6 +126,7 @@ public class ADALActivity extends AppCompatActivity {
private static final boolean sTelemetryAggregationIsRequired = true;
private LinearLayout mainLayt;
private Handler mWaitHandler = new Handler();
/* Telemetry dispatcher registration */
static {
......@@ -169,10 +175,15 @@ public class ADALActivity extends AppCompatActivity {
callGraphButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (NetworkConnectivity.haveNetworkConnection(ADALActivity.this)) {
onCallGraphClicked();
mWaitHandler.postDelayed(new Runnable() {
@Override
public void run() {
updateSuccessUI();
}
}, 5000);
} else {
DialogUtils.showNoConnectionDialog(ADALActivity .this);
......@@ -185,10 +196,8 @@ public class ADALActivity extends AppCompatActivity {
login_with_otp.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// onSignOutClicked();
Intent intent = new Intent(ADALActivity.this,OtpValidationActivity.class);
startActivity(intent);
}
});
......@@ -284,13 +293,13 @@ public class ADALActivity extends AppCompatActivity {
private void callGraphAPI() {
Log.d(TAG, "Starting volley request to graph");
mProgressDlg = new ProgressDialog(ADALActivity.this);
mProgressDlg.setMessage(getString(R.string.loading_string));
mProgressDlg.show();
mProgressDlg.setCancelable(false);
Log.d(TAG, "Starting volley request to graph");
/* Make sure we have a token to send to graph */
if (mAuthResult.getAccessToken() == null) {return;}
......@@ -317,7 +326,6 @@ public class ADALActivity extends AppCompatActivity {
/*Send broadcast to start SyncService*/
if(!isLogin){
new LoginDetailsSendToServer().execute();
}
......@@ -325,7 +333,6 @@ public class ADALActivity extends AppCompatActivity {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
......@@ -378,19 +385,24 @@ public class ADALActivity extends AppCompatActivity {
// Called on success from /me endpoint
// Removed call Graph API button and paint Sign out
callGraphButton.setVisibility(View.GONE);
login_with_otp.setVisibility(View.GONE);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(convertDpToPx(this, 300),
convertDpToPx(this, 450));
layoutParams.setMargins(convertDpToPx(this, 30), convertDpToPx(this, 30), convertDpToPx(this, 30), convertDpToPx(this, 30));
logo_banner.setLayoutParams(layoutParams);
signOutButton.setVisibility(View.GONE);
findViewById(R.id.welcome).setVisibility(View.GONE);
((TextView) findViewById(R.id.welcome)).setText("Welcome, " +
mAuthResult.getUserInfo().getGivenName());
/*((TextView) findViewById(R.id.welcome)).setText("Welcome, " +
mAuthResult.getUserInfo().getGivenName());*/
findViewById(R.id.graphData).setVisibility(View.GONE);
}
@SuppressLint("SetTextI18n")
private void updateSignedOutUI() {
signOutButton.setVisibility(View.GONE);
findViewById(R.id.welcome).setVisibility(View.INVISIBLE);
findViewById(R.id.graphData).setVisibility(View.INVISIBLE);
......@@ -427,8 +439,6 @@ public class ADALActivity extends AppCompatActivity {
/* Successfully got a token, call graph now */
Log.d(TAG, "Successfully authenticated");
/* Store the mAuthResult */
mAuthResult = authenticationResult;
......@@ -440,7 +450,6 @@ public class ADALActivity extends AppCompatActivity {
@Override
public void run() {
updateSuccessUI();
}
});
}
......@@ -522,6 +531,7 @@ public class ADALActivity extends AppCompatActivity {
updateSuccessUI();
}
});
/* set the sIntSignInInvoked boolean back to false */
sIntSignInInvoked.set(false);
}
......@@ -714,5 +724,4 @@ public class ADALActivity extends AppCompatActivity {
}
}
}
}
......@@ -208,6 +208,9 @@ public class HomeScreen extends HandleNotificationActivity {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Username: ");
stringBuilder.append(userFullName);
stringBuilder.append("\n");
stringBuilder.append("\n");
stringBuilder.append("Version: "+BuildConfig.VERSION_NAME);
builder.setMessage(stringBuilder.toString())
.setTitle("User Details")
......
......@@ -1160,9 +1160,16 @@ public class Util {
})
// .setNegativeButton(android.R.string.no, null)
.show();
}
/**
* This method converts dp unit to equivalent pixels, depending on device density.
*
* @param dp A value in dp (density independent pixels) unit. Which we need to convert into pixels
* @param context Context to get resources and device specific display metrics
* @return A int value to represent px equivalent to dp depending on device density
*/
public static int convertDpToPx(Context context, float dp) {
return (int) (dp * context.getResources().getDisplayMetrics().density);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment