Compare commits

..

No commits in common. "e1bcc44fbe0708da6dbc474f96f6b6d82af28a80" and "ab0108fab997fc00e56f18278db8b44a0a678d78" have entirely different histories.

5 changed files with 105 additions and 78 deletions

View File

@ -66,7 +66,6 @@ public class AlarmActivity extends Activity {
setContentView(R.layout.tabalarm); setContentView(R.layout.tabalarm);
gridView = findViewById(R.id.gridViewAlarms); gridView = findViewById(R.id.gridViewAlarms);
gridView.setNestedScrollingEnabled(true);
adapter = new AlertGridViewAdapter(this, getAllAlarms(), context, acknowledged); adapter = new AlertGridViewAdapter(this, getAllAlarms(), context, acknowledged);
gridView.setAdapter(adapter); gridView.setAdapter(adapter);
@ -172,10 +171,7 @@ public class AlarmActivity extends Activity {
if (param.equals(ALARM)) { if (param.equals(ALARM)) {
// set adapter // set adapter
adapter = new AlertGridViewAdapter(this, getAllAlarms(), context, acknowledged); adapter = new AlertGridViewAdapter(this, getAllAlarms(), context, acknowledged);
int position = gridView.getFirstVisiblePosition();
gridView.setAdapter(adapter); gridView.setAdapter(adapter);
gridView.setSelection(position);
} else { } else {
adapter.changeACK(ackPosition); adapter.changeACK(ackPosition);
SM.Debug("Set ACK: " + ackPosition + " | " + (Boolean.TRUE.equals(acknowledged.get(ackPosition)) ? "true" : "false")); SM.Debug("Set ACK: " + ackPosition + " | " + (Boolean.TRUE.equals(acknowledged.get(ackPosition)) ? "true" : "false"));

View File

@ -168,9 +168,8 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
private void setDate() { private void setDate() {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
endDate = calendar.getTime(); endDate = calendar.getTime();
calendar.add(Calendar.DATE, -2); calendar.add(Calendar.DATE, -1);
startDate = calendar.getTime(); startDate = calendar.getTime();
TextView textViewStartDate = findViewById(R.id.textViewStartDate); TextView textViewStartDate = findViewById(R.id.textViewStartDate);
@ -280,5 +279,6 @@ public class HistoryActivity extends AppCompatActivity implements OnMapReadyCall
this.googleMap.getUiSettings().setMapToolbarEnabled(false); this.googleMap.getUiSettings().setMapToolbarEnabled(false);
parentTab.demoPositionsList(); parentTab.demoPositionsList();
// displayButton.performClick();
} }
} }

View File

@ -26,7 +26,6 @@ import com.safemobile.lib.AppParams;
import com.safemobile.lib.OperationCodes; import com.safemobile.lib.OperationCodes;
import com.safemobile.lib.Recording; import com.safemobile.lib.Recording;
import com.safemobile.lib.SM; import com.safemobile.lib.SM;
import com.safemobile.lib.Vehicle;
import com.safemobile.lib.radio.RadioGW; import com.safemobile.lib.radio.RadioGW;
import com.safemobile.lib.sound.RecordingHandle; import com.safemobile.lib.sound.RecordingHandle;
@ -296,27 +295,9 @@ public class RecordingsActivity extends Activity {
private void updateResultsInUi() { private void updateResultsInUi() {
// clear played items // clear played items
playingPositions = new ArrayList<>(); playingPositions = new ArrayList<>();
ArrayList<Recording> recordings = getAllRecordings();
ArrayList<Recording> filteredList = new ArrayList<>();
ArrayList<Vehicle> vehicles = getParentTab().getAllVehicle();
for (Recording recording : recordings) {
if (recording.callType == 0 || recording.callType == 4) {
for (Vehicle vehicle : vehicles)
if (vehicle.imei.equals(String.valueOf(recording.subID))) {
filteredList.add(recording);
break;
}
} else {
filteredList.add(recording);
}
}
setAllRecordings(filteredList);
for (int i = 0; i < getAllRecordings().size(); i++) for (int i = 0; i < getAllRecordings().size(); i++)
playingPositions.add(true); playingPositions.add(true);
// set adapter - where playingPositions stores exists values
adapter = new RecordingsGridViewAdapter(activity, getAllRecordings(), playingPositions); adapter = new RecordingsGridViewAdapter(activity, getAllRecordings(), playingPositions);
// playing positions need to be false because no recording is played // playing positions need to be false because no recording is played

View File

@ -2,13 +2,16 @@ package com.safemobile.safedispatch;
import java.util.Locale; import java.util.Locale;
/** fix import */
import com.safemobile.adapters.LanguageSpinnerAdapter; import com.safemobile.adapters.LanguageSpinnerAdapter;
import com.safemobile.lib.AppParams; import com.safemobile.lib.AppParams;
import com.safemobile.lib.SM; import com.safemobile.lib.SM;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
@ -70,49 +73,52 @@ public class SetupActivity extends Activity {
setContentView(R.layout.tabsetup); setContentView(R.layout.tabsetup);
layoutSpinnerLanguage = findViewById(R.id.layoutSpinnerLanguage); layoutSpinnerLanguage = (LinearLayout) findViewById(R.id.layoutSpinnerLanguage);
layoutSpinnerLanguage.setOnClickListener(LanguageListener); layoutSpinnerLanguage.setOnClickListener(LanguageListener);
imageLanguage = findViewById(R.id.imageLanguage); imageLanguage = (ImageView) findViewById(R.id.imageLanguage);
textViewSpinnerLanguage = findViewById(R.id.textViewSpinnerLanguage); textViewSpinnerLanguage = (TextView) findViewById(R.id.textViewSpinnerLanguage);
// change spinner icon and selected language according to tmpLanguage // change spinner icon and selected language according to tmpLanguage
switch (AppParams.LANGUAGETMP) { if (AppParams.LANGUAGETMP.equals("en")){
case "en": imageLanguage.setImageResource(R.drawable.en);
imageLanguage.setImageResource(R.drawable.en); textViewSpinnerLanguage.setText(getString(R.string.en));
textViewSpinnerLanguage.setText(getString(R.string.en)); }
break; else if (AppParams.LANGUAGETMP.equals("de")){
case "de": imageLanguage.setImageResource(R.drawable.de);
imageLanguage.setImageResource(R.drawable.de); textViewSpinnerLanguage.setText(getString(R.string.de));
textViewSpinnerLanguage.setText(getString(R.string.de)); }
break; else if (AppParams.LANGUAGETMP.equals("tr")){
case "tr": imageLanguage.setImageResource(R.drawable.tr);
imageLanguage.setImageResource(R.drawable.tr); textViewSpinnerLanguage.setText(getString(R.string.tr));
textViewSpinnerLanguage.setText(getString(R.string.tr)); }
break; else if (AppParams.LANGUAGETMP.equals("ro")){
case "ro": imageLanguage.setImageResource(R.drawable.ro);
imageLanguage.setImageResource(R.drawable.ro); textViewSpinnerLanguage.setText(getString(R.string.ro));
textViewSpinnerLanguage.setText(getString(R.string.ro)); }
break; else if(AppParams.LANGUAGETMP.equals("es")){
case "es": imageLanguage.setImageResource(R.drawable.es);
imageLanguage.setImageResource(R.drawable.es); textViewSpinnerLanguage.setText(getString(R.string.es));
textViewSpinnerLanguage.setText(getString(R.string.es)); }
break; else if(AppParams.LANGUAGETMP.equals("ru")){
case "ru": imageLanguage.setImageResource(R.drawable.ru);
imageLanguage.setImageResource(R.drawable.ru); textViewSpinnerLanguage.setText(getString(R.string.ru));
textViewSpinnerLanguage.setText(getString(R.string.ru));
break;
} }
// get visual elements // get visual elements
appServerIP = findViewById(R.id.appServerIP); appServerIP = (EditText) findViewById(R.id.appServerIP);
appServerPort = findViewById(R.id.appServerPort); appServerPort = (EditText) findViewById(R.id.appServerPort);
// hide path layout used only on Pad/Pod // hide path layout used only on Pad/Pod
layoutPath = findViewById(R.id.layoutPath); layoutPath = (LinearLayout) findViewById(R.id.layoutPath);
layoutPath.setVisibility(View.GONE); layoutPath.setVisibility(View.GONE);
btn_save = findViewById(R.id.btn_save); btn_save = (Button) findViewById(R.id.btn_save);
btn_save.setOnClickListener(v -> saveSettings()); btn_save.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
saveSettings();
}
});
// set values // set values
if(!AppParams.IP.equals("n/a")) if(!AppParams.IP.equals("n/a"))
@ -128,31 +134,46 @@ public class SetupActivity extends Activity {
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(getString(R.string.exit)) builder.setMessage(getString(R.string.exit))
.setCancelable(false) .setCancelable(false)
.setNeutralButton(getString(R.string.logout), (dialog, id) -> parentTab.whenBackPressed(AppParams.ActivityResult.logout)) .setNeutralButton(getString(R.string.logout), new DialogInterface.OnClickListener() {
.setPositiveButton(getString(R.string.ext), (dialog, id) -> parentTab.whenBackPressed(AppParams.ActivityResult.exit)) public void onClick(DialogInterface dialog, int id) {
.setNegativeButton(getString(R.string.cancel), (dialog, id) -> dialog.cancel()); parentTab.whenBackPressed(AppParams.ActivityResult.logout);
}
})
.setPositiveButton(getString(R.string.ext), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
parentTab.whenBackPressed(AppParams.ActivityResult.exit);
}
})
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create(); AlertDialog alert = builder.create();
alert.show(); alert.show();
} }
// listener when select language pressed // listener when select language pressed
private final OnClickListener LanguageListener = new OnClickListener() { private OnClickListener LanguageListener = new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
final LanguageSpinnerAdapter adapter = new LanguageSpinnerAdapter(context, android.R.layout.simple_spinner_item, Languages, getLayoutInflater()); final LanguageSpinnerAdapter adapter = new LanguageSpinnerAdapter(context, android.R.layout.simple_spinner_item, Languages, getLayoutInflater());
AlertDialog.Builder builder = new AlertDialog.Builder(context); AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(getString(R.string.selLanguage)); builder.setTitle(getString(R.string.selLanguage));
builder.setAdapter(adapter , (dialog, which) -> { builder.setAdapter(adapter , new DialogInterface.OnClickListener() {
textViewSpinnerLanguage.setText(adapter.getItem(which)); @Override
switch(which) public void onClick(DialogInterface dialog, int which) {
{ textViewSpinnerLanguage.setText(adapter.getItem(which));
case 0: imageLanguage.setImageResource(R.drawable.en); AppParams.LANGUAGETMP = "en"; onCreate(savedInstanceState); parentTab.changeLanguage(); break; switch(which)
case 1: imageLanguage.setImageResource(R.drawable.de); AppParams.LANGUAGETMP = "de"; onCreate(savedInstanceState); parentTab.changeLanguage(); break; {
case 2: imageLanguage.setImageResource(R.drawable.tr); AppParams.LANGUAGETMP = "tr"; onCreate(savedInstanceState); parentTab.changeLanguage(); break; case 0: imageLanguage.setImageResource(R.drawable.en); AppParams.LANGUAGETMP = "en"; onCreate(savedInstanceState); parentTab.changeLanguage(); break;
case 3: imageLanguage.setImageResource(R.drawable.ro); AppParams.LANGUAGETMP = "ro"; onCreate(savedInstanceState); parentTab.changeLanguage(); break; case 1: imageLanguage.setImageResource(R.drawable.de); AppParams.LANGUAGETMP = "de"; onCreate(savedInstanceState); parentTab.changeLanguage(); break;
case 4: imageLanguage.setImageResource(R.drawable.ru); AppParams.LANGUAGETMP = "ru"; onCreate(savedInstanceState); parentTab.changeLanguage(); break; case 2: imageLanguage.setImageResource(R.drawable.tr); AppParams.LANGUAGETMP = "tr"; onCreate(savedInstanceState); parentTab.changeLanguage(); break;
case 5: imageLanguage.setImageResource(R.drawable.es); AppParams.LANGUAGETMP = "es"; onCreate(savedInstanceState); parentTab.changeLanguage(); break; case 3: imageLanguage.setImageResource(R.drawable.ro); AppParams.LANGUAGETMP = "ro"; onCreate(savedInstanceState); parentTab.changeLanguage(); break;
case 4: imageLanguage.setImageResource(R.drawable.ru); AppParams.LANGUAGETMP = "ru"; onCreate(savedInstanceState); parentTab.changeLanguage(); break;
case 5: imageLanguage.setImageResource(R.drawable.es); AppParams.LANGUAGETMP = "es"; onCreate(savedInstanceState); parentTab.changeLanguage(); break;
}
} }
}); });
@ -194,12 +215,12 @@ public class SetupActivity extends Activity {
String oldIP = AppParams.IP; String oldIP = AppParams.IP;
String oldPort = AppParams.PORT; String oldPort = AppParams.PORT;
editor.putString("ip", appServerIP.getText().toString()); editor.putString("ip", appServerIP.getText().toString());
editor.putString("port", appServerPort.getText().toString()); editor.putString("port", appServerPort.getText().toString());
editor.putString("language", AppParams.LANGUAGETMP); editor.putString("language", AppParams.LANGUAGETMP);
boolean result = editor.commit(); Boolean result = editor.commit();
// saved completed // saved completed
if (result) if(result)
Toast.makeText(context, "Settings saved successfully.", Toast.LENGTH_LONG).show(); Toast.makeText(context, "Settings saved successfully.", Toast.LENGTH_LONG).show();
else else
Toast.makeText(context, "Settings failed to complete!", Toast.LENGTH_LONG).show(); Toast.makeText(context, "Settings failed to complete!", Toast.LENGTH_LONG).show();
@ -244,4 +265,31 @@ public class SetupActivity extends Activity {
//showDialog(result); //showDialog(result);
} }
public void showDialog(Boolean result)
{
Dialog dialog = new Dialog(context);
if(result)
dialog.setTitle("Save Completed");
else
dialog.setTitle("Save Failed");
dialog.setContentView(R.layout.dialog);
dialog.setCancelable(true);
dialog.setCanceledOnTouchOutside(true);
TextView text = (TextView) dialog.findViewById(R.id.text);
ImageView image = (ImageView) dialog.findViewById(R.id.image);
if(result)
{
image.setImageResource(R.drawable.error);
text.setText("Settings saved successfully.");
}
else
{
image.setImageResource(R.drawable.error);
text.setText("Settings failed to complete!");
}
dialog.show();
}
} }

View File

@ -737,6 +737,8 @@ public class TabLayoutActivity extends AbstractSDParentActivity {
getBaseContext().getResources().updateConfiguration(configuration, getBaseContext().getResources().updateConfiguration(configuration,
getBaseContext().getResources().getDisplayMetrics()); getBaseContext().getResources().getDisplayMetrics());
if (getHistoryActivity() != null)
getHistoryActivity().onCreate(getHistoryActivity().savedInstanceState);
// change UI for RadioActivity and MessageActivity // change UI for RadioActivity and MessageActivity
if (getRadioActivity() != null) if (getRadioActivity() != null)
getRadioActivity().onCreate(getRadioActivity().savedInstanceState); getRadioActivity().onCreate(getRadioActivity().savedInstanceState);