Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Krishna Vemulavada
/
vera_2.1_app
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1526e0f2
authored
Mar 07, 2018
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fixed - Permission crash issue.
parent
e88590d9
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
20 additions
and
121 deletions
app/src/arrow/java/com/vsoft/servicenow/chat/ChatActivity.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/AnimatorBarRms.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/AnimatorIdle.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/AnimatorRms.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/AnimatorRotating.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/AnimatorTransform.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/DroidSpeech.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/DroidSpeechPermissions.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/Extensions.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/LanguageReceiver.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/OnBarParamsAnimListener.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/OnDSListener.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/OnDSPermissionsListener.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/OnLanguageDetailsListener.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/Properties.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/RecognitionBarView.java
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/RecognitionProgressView.java
app/src/arrow/java/com/vsoft/servicenow/ui/HomeScreen.java
app/src/arrow/java/com/vsoft/servicenow/chat/ChatActivity.java
View file @
1526e0f2
package
com
.
vsoft
.
servicenow
.
chat
;
import
android.app.Activity
;
import
android.app.Fragment
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.os.Bundle
;
...
...
@@ -20,11 +17,9 @@ import android.text.TextUtils;
import
android.text.TextWatcher
;
import
android.util.Log
;
import
android.view.KeyEvent
;
import
android.view.LayoutInflater
;
import
android.view.MenuItem
;
import
android.view.MotionEvent
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.inputmethod.EditorInfo
;
import
android.widget.EditText
;
import
android.widget.ImageButton
;
...
...
@@ -38,7 +33,6 @@ import com.vsoft.servicenow.R;
import
com.vsoft.servicenow.speechRecognizer.DroidSpeech
;
import
com.vsoft.servicenow.speechRecognizer.OnDSListener
;
import
com.vsoft.servicenow.speechRecognizer.OnDSPermissionsListener
;
import
com.vsoft.servicenow.utils.CatalogueLog
;
import
com.vsoft.servicenow.utils.PrefManager
;
import
org.json.JSONException
;
...
...
@@ -47,8 +41,6 @@ import org.json.JSONObject;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
android
.
app
.
Activity
.
RESULT_OK
;
/**
* A chat Activity containing messages view and input form.
...
...
@@ -167,7 +159,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
}
});
droidSpeech
=
new
DroidSpeech
(
this
,
getFragmentManager
());
droidSpeech
=
new
DroidSpeech
(
this
,
get
Support
FragmentManager
());
droidSpeech
.
setOnDroidSpeechListener
(
this
);
droidSpeech
.
setShowRecognitionProgressView
(
true
);
...
...
@@ -229,7 +221,6 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
}
private
void
addMessage
(
String
username
,
String
message
)
{
CatalogueLog
.
e
(
"message: "
+
message
);
if
(
username
.
isEmpty
()
||
message
.
isEmpty
())
return
;
if
(
CURRENT_STATE
==
VOICE_STATE
&&
!
username
.
equals
(
PrefManager
.
getSharedPref
(
this
,
PrefManager
.
PREFERENCE_FIRST_NAME
)))
{
...
...
@@ -402,9 +393,6 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
Log
.
e
(
TAG
,
e
.
getMessage
());
return
;
}
// addLog(getResources().getString(R.string.message_user_left, username));
// addParticipantsLog(numUsers);
removeTyping
(
username
);
}
});
...
...
@@ -493,7 +481,6 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
speaker
.
getTTS
().
setOnUtteranceProgressListener
(
new
UtteranceProgressListener
()
{
@Override
public
void
onDone
(
String
utteranceId
)
{
Log
.
e
(
"MainActivity"
,
"onDone: Continuous: "
+
droidSpeech
.
getContinuousSpeechRecognition
());
if
(
droidSpeech
!=
null
)
{
if
(
speaker
!=
null
&&
speaker
.
isSpeaking
())
{
speaker
.
stop
();
...
...
@@ -510,12 +497,10 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
@Override
public
void
onError
(
String
utteranceId
)
{
Log
.
e
(
"MainActivity"
,
"onError"
);
}
@Override
public
void
onStart
(
String
utteranceId
)
{
Log
.
e
(
"MainActivity"
,
"onStart"
);
if
(
droidSpeech
!=
null
)
{
droidSpeech
.
closeDroidSpeechOperations
();
}
...
...
@@ -538,7 +523,6 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
RecyclerView
.
OnItemTouchListener
mOnItemTouchListener
=
new
RecyclerView
.
OnItemTouchListener
()
{
@Override
public
boolean
onInterceptTouchEvent
(
RecyclerView
rv
,
MotionEvent
e
)
{
CatalogueLog
.
e
(
"onInterceptTouchEvent"
);
if
(
speaker
!=
null
&&
speaker
.
isSpeaking
())
{
speaker
.
stop
();
if
(
droidSpeech
!=
null
)
{
...
...
@@ -609,21 +593,7 @@ public class ChatActivity extends AppCompatActivity implements OnDSListener, OnD
// Permissions error
Toast
.
makeText
(
this
,
errorMsgIfAny
,
Toast
.
LENGTH_LONG
).
show
();
}
// stop.post(new Runnable() {
// @Override
// public void run() {
// // Stop listening
// stop.performClick();
// }
// });
}
}
// @Override
// public void onBackPressed() {
// super.onBackPressed();
// finish();
// }
}
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/AnimatorBarRms.java
View file @
1526e0f2
...
...
@@ -8,7 +8,7 @@ import java.util.Random;
/**
* AnimatorBarRms
*
* @author
Vikram Ezhil
* @author
Kunj
*/
class
AnimatorBarRms
implements
OnBarParamsAnimListener
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/AnimatorIdle.java
View file @
1526e0f2
...
...
@@ -5,7 +5,7 @@ import java.util.List;
/**
* AnimatorIdle
*
* @author
Vikram Ezhil
* @author
Kunj
*/
class
AnimatorIdle
implements
OnBarParamsAnimListener
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/AnimatorRms.java
View file @
1526e0f2
...
...
@@ -6,7 +6,7 @@ import java.util.List;
/**
* AnimatorRms
*
* @author
Vikram Ezhil
* @author
Kunj
*/
class
AnimatorRms
implements
OnBarParamsAnimListener
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/AnimatorRotating.java
View file @
1526e0f2
...
...
@@ -9,7 +9,7 @@ import java.util.List;
/**
* AnimatorRotating
*
* @author
Vikram Ezhil
* @author
Kunj
*/
class
AnimatorRotating
implements
OnBarParamsAnimListener
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/AnimatorTransform.java
View file @
1526e0f2
...
...
@@ -8,7 +8,7 @@ import java.util.List;
/**
* AnimatorTransform
*
* @author
Vikram Ezhil
* @author
Kunj
*/
class
AnimatorTransform
implements
OnBarParamsAnimListener
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/DroidSpeech.java
View file @
1526e0f2
...
...
@@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
...
...
@@ -17,7 +16,7 @@ import android.os.Handler;
import
android.speech.RecognitionListener
;
import
android.speech.RecognizerIntent
;
import
android.speech.SpeechRecognizer
;
import
android.app.FragmentManager
;
import
android.
support.v4.
app.FragmentManager
;
import
android.util.Log
;
import
android.view.KeyEvent
;
import
android.view.LayoutInflater
;
...
...
@@ -33,7 +32,7 @@ import java.util.List;
/**
* Droid Speech
*
* @author
Vikram Ezhil
* @author
Kunj
*/
public
class
DroidSpeech
{
...
...
@@ -170,35 +169,6 @@ public class DroidSpeech {
recognitionProgressView
.
setLayoutParams
(
new
LayoutParams
(
LayoutParams
.
WRAP_CONTENT
,
Extensions
.
PV_HEIGHT
));
recognitionProgressMsg
=
speechProgressView
.
findViewById
(
R
.
id
.
recognitionProgressMsg
);
// confirmLayout = speechProgressView.findViewById(R.id.confirmLayout);
// confirm = speechProgressView.findViewById(R.id.confirm);
// confirm.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//
// // Sending an update with the droid speech result
// droidSpeechListener.onDroidSpeechFinalResult(dsProperties.oneStepVerifySpeechResult);
//
// if (dsProperties.continuousSpeechRecognition) {
// // Start droid speech recognition again
// startDroidSpeechRecognition();
// } else {
// // Closing the droid speech operations entirely
// closeDroidSpeechOperations();
// }
// }
// });
//
// retry = speechProgressView.findViewById(R.id.retry);
// retry.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//
// // Start droid speech recognition again as user didn't
// // get the desired result
// startDroidSpeechRecognition();
// }
// });
speechProgressAlertDialog
=
speechProgressBuilder
.
create
();
speechProgressAlertDialog
.
getWindow
().
setBackgroundDrawable
(
new
ColorDrawable
(
Color
.
TRANSPARENT
));
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/DroidSpeechPermissions.java
View file @
1526e0f2
package
com
.
vsoft
.
servicenow
.
speechRecognizer
;
import
android.Manifest
;
import
android.app.Fragment
;
import
android.content.Context
;
import
android.content.pm.PackageManager
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.support.v4.app.Fragment
;
import
com.vsoft.servicenow.R
;
/**
* Droid Speech Permissions - Non UI Fragment
*
* @author
Vikram Ezhil
* @author
Kunj
*/
public
class
DroidSpeechPermissions
extends
Fragment
{
...
...
@@ -62,23 +62,18 @@ public class DroidSpeechPermissions extends Fragment {
@Override
public
void
onRequestPermissionsResult
(
int
requestCode
,
String
[]
permissions
,
int
[]
grantResults
)
{
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
switch
(
requestCode
)
{
case
REQUEST_AUDIO_PERMISSIONS:
for
(
int
result
:
grantResults
)
{
if
(
result
!=
PackageManager
.
PERMISSION_GRANTED
)
{
// Audio permission not granted
// if(droidSpeechPermissionsListener != null)
droidSpeechPermissionsListener
.
onDroidSpeechAudioPermissionStatus
(
false
,
getResources
().
getString
(
R
.
string
.
ds_mic_permissions_required
));
droidSpeechPermissionsListener
.
onDroidSpeechAudioPermissionStatus
(
false
,
getResources
().
getString
(
R
.
string
.
ds_mic_permissions_required
));
return
;
}
}
// Audio permission granted
droidSpeechPermissionsListener
.
onDroidSpeechAudioPermissionStatus
(
true
,
null
);
break
;
}
}
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/Extensions.java
View file @
1526e0f2
...
...
@@ -8,7 +8,7 @@ import android.net.NetworkInfo;
/**
* Droid Speech Extensions
*
* @author
Vikram Ezhil
* @author
Kunj
*/
class
Extensions
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/LanguageReceiver.java
View file @
1526e0f2
...
...
@@ -13,7 +13,7 @@ import java.util.List;
/**
* Droid Speech Language Receiver
*
* @author
Vikram Ezhil
* @author
Kunj
*/
class
LanguageReceiver
extends
BroadcastReceiver
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/OnBarParamsAnimListener.java
View file @
1526e0f2
...
...
@@ -3,7 +3,7 @@ package com.vsoft.servicenow.speechRecognizer;
/**
* Bar Animation Listener
*
* @author
Vikram Ezhil
* @author
Kunj
*/
interface
OnBarParamsAnimListener
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/OnDSListener.java
View file @
1526e0f2
...
...
@@ -5,7 +5,7 @@ import java.util.List;
/**
* Droid Speech Listener
*
* @author
Vikram Ezhil
* @author
Kunj
*/
public
interface
OnDSListener
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/OnDSPermissionsListener.java
View file @
1526e0f2
...
...
@@ -3,7 +3,7 @@ package com.vsoft.servicenow.speechRecognizer;
/**
* Droid Speech Permissions Listener
*
* @author
Vikram Ezhil
* @author
Kunj
*/
public
interface
OnDSPermissionsListener
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/OnLanguageDetailsListener.java
View file @
1526e0f2
...
...
@@ -5,7 +5,7 @@ import java.util.List;
/**
* Droid Speech Language Details Listener
*
* @author
Vikram Ezhil
* @author
Kunj
*/
interface
OnLanguageDetailsListener
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/Properties.java
View file @
1526e0f2
...
...
@@ -6,7 +6,7 @@ import java.util.List;
/**
* Droid Speech Properties
*
* @author
Vikram Ezhil
* @author
Kunj
*/
class
Properties
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/RecognitionBarView.java
View file @
1526e0f2
...
...
@@ -5,7 +5,7 @@ import android.graphics.RectF;
/**
* Recognition Bar View
*
* @author
Vikram Ezhil
* @author
Kunj
*/
class
RecognitionBarView
{
...
...
app/src/arrow/java/com/vsoft/servicenow/speechRecognizer/RecognitionProgressView.java
View file @
1526e0f2
...
...
@@ -13,7 +13,7 @@ import java.util.List;
/**
* Recognition Progress View
*
* @author
Vikram Ezhil
* @author
Kunj
*/
class
RecognitionProgressView
extends
View
{
...
...
app/src/arrow/java/com/vsoft/servicenow/ui/HomeScreen.java
View file @
1526e0f2
...
...
@@ -33,7 +33,6 @@ import butterknife.OnItemClick;
public
class
HomeScreen
extends
AppCompatActivity
{
@BindView
(
R
.
id
.
tool_bar_view
)
Toolbar
mToolbar
;
@BindView
(
R
.
id
.
home_screen_grid_view
)
GridView
mGridView
;
private
Socket
mSocket
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -42,9 +41,6 @@ public class HomeScreen extends AppCompatActivity {
setContentView
(
R
.
layout
.
home_screen
);
CatalogueApplication
app
=
(
CatalogueApplication
)
getApplication
();
mSocket
=
app
.
getSocket
();
ButterKnife
.
bind
(
this
);
...
...
@@ -58,14 +54,6 @@ public class HomeScreen extends AppCompatActivity {
TypedArray
gridViewIcons
=
getResources
().
obtainTypedArray
(
R
.
array
.
home_screen_icon_array
);
HomeScreenAdapter
adapter
=
new
HomeScreenAdapter
(
this
,
gridValuesArray
,
gridViewIcons
);
mGridView
.
setAdapter
(
adapter
);
// mSocket.on("login", onLogin);
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
// mSocket.off("login", onLogin);
}
@OnItemClick
(
R
.
id
.
home_screen_grid_view
)
...
...
@@ -81,10 +69,6 @@ public class HomeScreen extends AppCompatActivity {
}
else
if
(
position
==
4
)
{
// perform the user login attempt.
String
userFirstName
=
PrefManager
.
getSharedPref
(
HomeScreen
.
this
,
PrefManager
.
PREFERENCE_FIRST_NAME
);
// CatalogueLog.e("Socket is connect: "+mSocket.connected());
// if(!mSocket.connected())
// mSocket.connect();
// mSocket.emit("add user", userFirstName);
Intent
intent
=
new
Intent
(
HomeScreen
.
this
,
ChatActivity
.
class
);
intent
.
putExtra
(
"username"
,
userFirstName
);
startActivity
(
intent
);
...
...
@@ -119,24 +103,4 @@ public class HomeScreen extends AppCompatActivity {
AlertDialog
alert
=
builder
.
create
();
alert
.
show
();
}
private
Emitter
.
Listener
onLogin
=
new
Emitter
.
Listener
()
{
@Override
public
void
call
(
Object
...
args
)
{
JSONObject
data
=
(
JSONObject
)
args
[
0
];
int
numUsers
;
try
{
numUsers
=
data
.
getInt
(
"numUsers"
);
}
catch
(
JSONException
e
)
{
return
;
}
Intent
intent
=
new
Intent
();
intent
.
putExtra
(
"username"
,
PrefManager
.
getSharedPref
(
HomeScreen
.
this
,
PrefManager
.
PREFERENCE_FIRST_NAME
));
intent
.
putExtra
(
"numUsers"
,
numUsers
);
setResult
(
RESULT_OK
,
intent
);
finish
();
}
};
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment