SD-211 - show all recordings and play them
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package com.safemobile.adapters;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -11,7 +10,6 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.safemobile.activities.AbstractRecordingsActivity;
|
||||
import com.safemobile.lib.AppParams;
|
||||
import com.safemobile.lib.R;
|
||||
import com.safemobile.lib.Recording;
|
||||
import com.safemobile.lib.SM;
|
||||
@ -27,14 +25,12 @@ public class RecordingsGridViewAdapter extends BaseAdapter {
|
||||
private final ArrayList<Boolean> recordingExists;
|
||||
private final ArrayList<Boolean> playingPositions;
|
||||
private final Activity activity;
|
||||
private final Context context;
|
||||
|
||||
private final Hashtable<Integer, View> hash = new Hashtable<>();
|
||||
|
||||
public RecordingsGridViewAdapter(Activity activity, Context context, ArrayList<Recording> listRecordings, ArrayList<Boolean> recordingExists) {
|
||||
public RecordingsGridViewAdapter(Activity activity, ArrayList<Recording> listRecordings, ArrayList<Boolean> recordingExists) {
|
||||
super();
|
||||
this.activity = activity;
|
||||
this.context = context;
|
||||
this.listRecordings = listRecordings;
|
||||
this.recordingExists = recordingExists;
|
||||
|
||||
@ -129,12 +125,12 @@ public class RecordingsGridViewAdapter extends BaseAdapter {
|
||||
if (convertView == null) {
|
||||
view = new ViewHolder();
|
||||
convertView = layoutInflater.inflate(R.layout.row_recordings, null);
|
||||
view.setLayoutRecording((LinearLayout) convertView.findViewById(R.id.layoutRecording));
|
||||
view.setImageViewPlay((ImageView) convertView.findViewById(R.id.imageViewPlay));
|
||||
view.setTextViewSender((TextView) convertView.findViewById(R.id.textViewSender));
|
||||
view.setTextViewDuration((TextView) convertView.findViewById(R.id.textViewDuration));
|
||||
view.setTextViewDate((TextView) convertView.findViewById(R.id.textViewDate));
|
||||
view.setImageViewRecycle((ImageView) convertView.findViewById(R.id.imageViewRecycle));
|
||||
view.setLayoutRecording(convertView.findViewById(R.id.layoutRecording));
|
||||
view.setImageViewPlay(convertView.findViewById(R.id.imageViewPlay));
|
||||
view.setTextViewSender(convertView.findViewById(R.id.textViewSender));
|
||||
view.setTextViewDuration(convertView.findViewById(R.id.textViewDuration));
|
||||
view.setTextViewDate(convertView.findViewById(R.id.textViewDate));
|
||||
view.setImageViewRecycle(convertView.findViewById(R.id.imageViewRecycle));
|
||||
view.getImageViewRecycle().setVisibility(View.GONE);
|
||||
convertView.setTag(view);
|
||||
} else {
|
||||
@ -155,25 +151,25 @@ public class RecordingsGridViewAdapter extends BaseAdapter {
|
||||
}
|
||||
|
||||
/* change icon according to call type [outgoing or incoming] */
|
||||
SM.Exception("REC TYPE : " + listRecordings.get(position).type);
|
||||
switch (listRecordings.get(position).type) {
|
||||
case AppParams.AllCall:
|
||||
if (listRecordings.get(position).destinationRadioID == 0)
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_received_all);
|
||||
else
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_made_all);
|
||||
SM.Exception("REC TYPE : " + listRecordings.get(position).callType);
|
||||
switch (listRecordings.get(position).callType) {
|
||||
case 6:
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_received_all);
|
||||
break;
|
||||
case AppParams.PrivateCall:
|
||||
if (listRecordings.get(position).destinationRadioID == 0)
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_received);
|
||||
else
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_made);
|
||||
case 2:
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_made_all);
|
||||
break;
|
||||
case AppParams.GroupCall:
|
||||
if (listRecordings.get(position).destinationRadioID == 0)
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_received_group);
|
||||
else
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_made_group);
|
||||
case 4:
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_received);
|
||||
break;
|
||||
case 0:
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_made);
|
||||
break;
|
||||
case 5:
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_received_group);
|
||||
break;
|
||||
case 1:
|
||||
view.getImageViewPlay().setImageResource(R.drawable.call_made_group);
|
||||
break;
|
||||
default:
|
||||
view.getImageViewPlay().setImageResource(R.drawable.alert);
|
||||
@ -193,14 +189,8 @@ public class RecordingsGridViewAdapter extends BaseAdapter {
|
||||
((AbstractRecordingsActivity) activity).deleteSelected(position);
|
||||
});
|
||||
|
||||
// set recording image
|
||||
if (getItem(position).NameForDisplay.equals(AppParams.USERNAME))
|
||||
view.getImageViewPlay().setImageDrawable(context.getResources().getDrawable(R.drawable.call_made_group));
|
||||
else
|
||||
view.getImageViewPlay().setImageDrawable(context.getResources().getDrawable(R.drawable.call_received_group));
|
||||
|
||||
view.getTextViewSender().setText(getItem(position).NameForDisplay);
|
||||
view.textViewDuration.setText("[" + getItem(position).duration + " sec]");
|
||||
view.getTextViewSender().setText(String.format("%s -> %s", getItem(position).userWhoCalled, getItem(position).userWhoWasCalled));
|
||||
view.textViewDuration.setText(String.format("[%d sec]", getItem(position).duration));
|
||||
|
||||
/* Add call Date */
|
||||
Date date = new Date();
|
||||
|
@ -285,7 +285,7 @@ public class DatabaseCommunication {
|
||||
while (cursor.isAfterLast() == false)
|
||||
{
|
||||
Recording rec = new Recording();
|
||||
rec.ID =cursor.getInt(0);
|
||||
rec.id =cursor.getInt(0);
|
||||
rec.sourceRadioID = cursor.getInt(1);
|
||||
rec.destinationRadioID = cursor.getInt(2);
|
||||
rec.date = cursor.getInt(3);
|
||||
@ -315,7 +315,7 @@ public class DatabaseCommunication {
|
||||
if(cursor.getCount() > 0)
|
||||
{
|
||||
Recording rec = new Recording();
|
||||
rec.ID =cursor.getInt(0);
|
||||
rec.id =cursor.getInt(0);
|
||||
rec.sourceRadioID = cursor.getInt(1);
|
||||
rec.destinationRadioID = cursor.getInt(2);
|
||||
rec.date = cursor.getInt(3);
|
||||
@ -364,7 +364,7 @@ public class DatabaseCommunication {
|
||||
values.put("duration", rec.duration);
|
||||
values.put("filename", rec.filename);
|
||||
values.put("type", rec.type);
|
||||
id = database.delete("Recordings", "_id=" + rec.ID, null);
|
||||
id = database.delete("Recordings", "_id=" + rec.id, null);
|
||||
SM.Debug("DBQuery","Database Remove result: " + id);
|
||||
}
|
||||
//INSERT into SMS (timeGMT, imei_sour, imei_dest, mess, status) VALUES( 1324016412, 0, 101, 'two', 1)
|
||||
|
@ -4,36 +4,43 @@ import java.util.ArrayList;
|
||||
|
||||
public class RecordMSG extends TCPmsg {
|
||||
|
||||
public ArrayList<Recording> recordList;
|
||||
public static int count=0;
|
||||
public RecordMSG(TCPmsg tcp)
|
||||
{
|
||||
super(tcp);
|
||||
recordList = new ArrayList<Recording>();
|
||||
private ArrayList<Recording> recordList;
|
||||
|
||||
public RecordMSG(TCPmsg tcp) {
|
||||
super(tcp);
|
||||
setRecordList(new ArrayList<>());
|
||||
String date4parsing = super.data;
|
||||
//SM.Debug("SMS date4parsing:"+date4parsing);
|
||||
String[] tempArr = date4parsing.split(";");
|
||||
|
||||
//SM.Debug("SMS tempArr.length:" +tempArr.length);
|
||||
for(int i =0; i<tempArr.length;i++)
|
||||
{
|
||||
String[] tempRec = tempArr[i].split("&");
|
||||
if(tempRec.length<7)
|
||||
|
||||
for (String s : tempArr) {
|
||||
String[] tempRec = s.split("&", -1);
|
||||
if (tempRec.length < 11)
|
||||
continue;
|
||||
|
||||
Recording RecValue = new Recording();
|
||||
RecValue.ID = Long.parseLong(tempRec[0]);
|
||||
RecValue.startGMT = Integer.parseInt(tempRec[1]);
|
||||
RecValue.endGMT = Integer.parseInt(tempRec[2]);
|
||||
RecValue.gwID = Integer.parseInt(tempRec[3]);
|
||||
RecValue.radioGWID = Integer.parseInt(tempRec[4]);
|
||||
RecValue.subID = Integer.parseInt(tempRec[5]);
|
||||
RecValue.typeID = Integer.parseInt(tempRec[6]);
|
||||
|
||||
recordList.add(RecValue);
|
||||
|
||||
Recording recValue = new Recording();
|
||||
recValue.id = Long.parseLong(tempRec[0]);
|
||||
recValue.startGMT = Integer.parseInt(tempRec[1]);
|
||||
recValue.endGMT = Integer.parseInt(tempRec[2]);
|
||||
recValue.gwID = Integer.parseInt(tempRec[3]);
|
||||
recValue.radioGWID = Integer.parseInt(tempRec[4]);
|
||||
recValue.subID = (tempRec[5] == null || tempRec[5].isEmpty()) ? 0 : Integer.parseInt(tempRec[5]);
|
||||
recValue.typeID = Integer.parseInt(tempRec[6]);
|
||||
recValue.callType = Integer.parseInt(tempRec[7]);
|
||||
recValue.groupCpsId = (tempRec[8] == null || tempRec[8].isEmpty()) ? 0 : Integer.parseInt(tempRec[8]);
|
||||
recValue.dispatcherId = (tempRec[9] == null || tempRec[9].isEmpty()) ? 0 : Integer.parseInt(tempRec[9]);
|
||||
recValue.groupName = tempRec[10];
|
||||
|
||||
getRecordList().add(recValue);
|
||||
}
|
||||
|
||||
count +=this.recordList.size();
|
||||
SM.Debug("alarmList size:" +this.recordList.size() + " total:" +count);
|
||||
|
||||
SM.Debug("alarmList size:" + this.getRecordList().size() + " total:" + this.getRecordList().size());
|
||||
}
|
||||
|
||||
public ArrayList<Recording> getRecordList() {
|
||||
return recordList;
|
||||
}
|
||||
|
||||
public void setRecordList(ArrayList<Recording> recordList) {
|
||||
this.recordList = recordList;
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,20 @@
|
||||
package com.safemobile.lib;
|
||||
|
||||
public class Recording {
|
||||
public long ID;
|
||||
public long id;
|
||||
public int startGMT;
|
||||
public int endGMT;
|
||||
public int gwID;
|
||||
public int radioGWID;
|
||||
public int callType;
|
||||
public int groupCpsId;
|
||||
public int dispatcherId;
|
||||
public int subID;
|
||||
public int typeID;
|
||||
public String NameForDisplay="";
|
||||
|
||||
public String userWhoCalled="";
|
||||
public String userWhoWasCalled = "";
|
||||
public String groupName = "";
|
||||
|
||||
/** RadioPad */
|
||||
public long date;
|
||||
public int duration;
|
||||
@ -18,13 +23,8 @@ public class Recording {
|
||||
public long sourceRadioID;
|
||||
public int type;
|
||||
|
||||
public Recording()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "ID: " + ID + " | start: " + startGMT + " | end: " + endGMT + " | gwID: " + gwID + " | radioGWID: " + radioGWID + " | subID: " + subID + " | typeID: " + typeID;
|
||||
return "id: " + id + " | start: " + startGMT + " | end: " + endGMT + " | gwID: " + gwID + " | radioGWID: " + radioGWID + " | subID: " + subID + " | typeID: " + typeID;
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ public class TCPhandler implements Runnable {
|
||||
/**
|
||||
* Send a message through the TCP Socket
|
||||
*
|
||||
* @param seqID The messages's sequence ID (a number of order)
|
||||
* @param seqID The messages's sequence id (a number of order)
|
||||
* @param msg The messages which will be sent
|
||||
* @return True if the message was sent
|
||||
*/
|
||||
@ -310,7 +310,7 @@ public class TCPhandler implements Runnable {
|
||||
cmdok = "#" + Integer.toString(tmp) + cmdok;
|
||||
|
||||
byte[] mess = encryptTEA(cmdok);
|
||||
Thread gfgThread = new Thread(() -> {
|
||||
Thread tcpThread = new Thread(() -> {
|
||||
try {
|
||||
output.write(mess);
|
||||
output.flush();
|
||||
@ -319,15 +319,14 @@ public class TCPhandler implements Runnable {
|
||||
}
|
||||
});
|
||||
|
||||
gfgThread.start();
|
||||
tcpThread.start();
|
||||
|
||||
|
||||
SM.Debug(" ", new String(mess));
|
||||
return true;
|
||||
//} catch (IOException e) {
|
||||
// SM.Exception("TCPClient[Send]", e.toString());
|
||||
} catch (InterruptedException e) {
|
||||
SM.Exception("TCPClient[Send]", e.toString());
|
||||
Thread.currentThread().interrupt();
|
||||
} catch (NoSuchElementException e) {
|
||||
SM.Exception("TCPClient[Send]", e.toString());
|
||||
}
|
||||
@ -335,7 +334,7 @@ public class TCPhandler implements Runnable {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SM.Debug("TCPhandler Write Procedure:" + e.toString());
|
||||
SM.Debug("TCPhandler Write Procedure:" + e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user