refactoring MainActivity
This commit is contained in:
@@ -4,10 +4,8 @@ import android.annotation.SuppressLint;
|
|||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Base64;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@@ -27,12 +25,6 @@ import com.github.javiersantos.appupdater.enums.UpdateFrom;
|
|||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.EOFException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.ObjectInputStream;
|
|
||||||
import java.io.ObjectOutputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -43,28 +35,44 @@ import static android.content.ClipDescription.MIMETYPE_TEXT_PLAIN;
|
|||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private boolean testing;
|
|
||||||
private final MeetingsController meetingsController = new MeetingsController(this);
|
private final MeetingsController meetingsController = new MeetingsController(this);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
//get intent parameters
|
||||||
Intent myIntent = getIntent(); // gets the previously created intent
|
Intent myIntent = getIntent();
|
||||||
String action = myIntent.getAction();
|
String action = myIntent.getAction();
|
||||||
String type = myIntent.getType();
|
String type = myIntent.getType();
|
||||||
|
|
||||||
|
|
||||||
String meetingName = myIntent.getStringExtra("meetingName");
|
String meetingName = myIntent.getStringExtra("meetingName");
|
||||||
boolean joinImmediately = myIntent.getBooleanExtra("joinImmediately", false);
|
boolean joinImmediately = myIntent.getBooleanExtra("joinImmediately", false);
|
||||||
testing = myIntent.getBooleanExtra("testing", false);
|
//boolean testing = myIntent.getBooleanExtra("testing", false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
final ScrollView scrollview = findViewById(R.id.scrollArea);
|
|
||||||
|
|
||||||
|
//views
|
||||||
|
final ScrollView scrollview = findViewById(R.id.scrollArea);
|
||||||
|
final ImageView saveIcon = findViewById(R.id.imageSave);
|
||||||
|
final ImageView trashIcon = findViewById(R.id.imageTrash);
|
||||||
|
final ImageView AttIcon = findViewById(R.id.imageAttend);
|
||||||
|
final ImageView AddIcon = findViewById(R.id.imageAdd);
|
||||||
|
final EditText meetingID = findViewById(R.id.textBoxID);
|
||||||
|
final ImageView ShareIcon = findViewById(R.id.imageShare);
|
||||||
|
final ImageView ShortcutIcon = findViewById(R.id.imageCreateShortcut);
|
||||||
|
|
||||||
|
//add event listeners to views
|
||||||
|
saveIcon.setOnClickListener(v -> saveMeetingFromUI());
|
||||||
|
trashIcon.setOnClickListener(v -> meetingsController.removeMeeting(meetingsController.searchMeetingInList(meetingsController.getMeetings(), createCurrMeetingFromUI().meetingName)));
|
||||||
|
AttIcon.setOnClickListener(v -> btnJoin_onClick(null));
|
||||||
|
AddIcon.setOnClickListener(v -> {
|
||||||
|
fillBlank();
|
||||||
|
meetingID.requestFocus();
|
||||||
|
});
|
||||||
|
ShareIcon.setOnClickListener(v -> shareMeeting(createCurrMeetingFromUI()));
|
||||||
|
ShortcutIcon.setOnClickListener(v -> showCreateShortcutUI());
|
||||||
|
|
||||||
|
//show alert if meeting from shortcut not found
|
||||||
int meetingIndex = meetingsController.searchMeetingInList(meetingsController.getMeetings(), meetingName);
|
int meetingIndex = meetingsController.searchMeetingInList(meetingsController.getMeetings(), meetingName);
|
||||||
if (meetingIndex == -1) {
|
if (meetingIndex == -1) {
|
||||||
if (meetingName != null) {
|
if (meetingName != null) {
|
||||||
@@ -77,21 +85,21 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
joinImmediately = false;
|
joinImmediately = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//adjust ui for meeting from shortcut
|
||||||
if (meetingIndex <= meetingsController.getMeetings().size() && meetingIndex != -1) {
|
if (meetingIndex <= meetingsController.getMeetings().size() && meetingIndex != -1) {
|
||||||
meetingsController.setLastMeeting(meetingIndex);
|
meetingsController.setLastMeeting(meetingIndex);
|
||||||
AutoCompleteTextView textMeetingName = findViewById(R.id.TextMeetingName);
|
AutoCompleteTextView textMeetingName = findViewById(R.id.TextMeetingName);
|
||||||
textMeetingName.setEnabled(false);
|
textMeetingName.setEnabled(false);
|
||||||
textMeetingName.setAdapter(null);
|
textMeetingName.setAdapter(null);
|
||||||
ImageView imageTrash = findViewById(R.id.imageTrash);
|
trashIcon.setVisibility(View.GONE);
|
||||||
imageTrash.setVisibility(View.GONE);
|
|
||||||
TextInputLayout layoutMeetingName = findViewById(R.id.layoutMeetingName);
|
TextInputLayout layoutMeetingName = findViewById(R.id.layoutMeetingName);
|
||||||
layoutMeetingName.setEndIconMode(TextInputLayout.END_ICON_NONE);
|
layoutMeetingName.setEndIconMode(TextInputLayout.END_ICON_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//watchMeetingNameBox();
|
|
||||||
fillDropdownMeetingName();
|
fillDropdownMeetingName();
|
||||||
if (meetingsController.getLastMeeting() != -1) {
|
|
||||||
|
//fill ui with data from last selected meeting or show error if config version changed or index out of bounds
|
||||||
|
if (meetingsController.getLastMeeting() != -1) {
|
||||||
try {
|
try {
|
||||||
fillMeeting(meetingsController.getLastMeeting());
|
fillMeeting(meetingsController.getLastMeeting());
|
||||||
scrollview.post(() -> scrollview.scrollTo(0, scrollview.getChildAt(0).getHeight()));
|
scrollview.post(() -> scrollview.scrollTo(0, scrollview.getChildAt(0).getHeight()));
|
||||||
@@ -105,23 +113,20 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
meetingsController.saveMeetingList(new ArrayList<>());
|
meetingsController.saveMeetingList(new ArrayList<>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
watchSaveIcon();
|
|
||||||
watchAttIcon();
|
|
||||||
watchDeleteIcon();
|
|
||||||
watchNewIcon();
|
|
||||||
watchShareIcon();
|
|
||||||
watchShortcutIcon();
|
|
||||||
|
|
||||||
|
//handle meeting invitation text sent to ZoomHelper
|
||||||
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
||||||
if ("text/plain".equals(type)) {
|
if ("text/plain".equals(type)) {
|
||||||
handleSendText(myIntent); // Handle text being sent
|
handleSendText(myIntent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//join meeting immediately, otherwise enable app updater
|
||||||
if (joinImmediately) {
|
if (joinImmediately) {
|
||||||
Meeting currMeeting = meetingsController.getMeetings().get(meetingIndex);
|
Meeting currMeeting = meetingsController.getMeetings().get(meetingIndex);
|
||||||
new ZoomLink(this, currMeeting).launch();
|
new ZoomLink(this, currMeeting).launch();
|
||||||
} else {
|
} else {
|
||||||
|
//TODO: updatetest.xml -> update.xml when finished testing
|
||||||
AppUpdater appUpdater = new AppUpdater(this).setUpdateFrom(UpdateFrom.XML).setUpdateXML("https://baldaufwd.de/ZoomHelper/updatetest.xml");
|
AppUpdater appUpdater = new AppUpdater(this).setUpdateFrom(UpdateFrom.XML).setUpdateXML("https://baldaufwd.de/ZoomHelper/updatetest.xml");
|
||||||
APKDownloader apkDownloader = new APKDownloader();
|
APKDownloader apkDownloader = new APKDownloader();
|
||||||
appUpdater.setButtonUpdateClickListener((dialog, which) -> apkDownloader.downloadAPK(this, "ZoomHelper.apk", Uri.parse("https://baldaufwd.de/ZoomHelper/ZoomHelper.apk")));
|
appUpdater.setButtonUpdateClickListener((dialog, which) -> apkDownloader.downloadAPK(this, "ZoomHelper.apk", Uri.parse("https://baldaufwd.de/ZoomHelper/ZoomHelper.apk")));
|
||||||
@@ -131,18 +136,18 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWindowFocusChanged(boolean hasFocus) {
|
public void onWindowFocusChanged(boolean hasFocus) {
|
||||||
|
//check for importable meeting invitation from clipboard when ZoomHelper gained focus
|
||||||
super.onWindowFocusChanged(hasFocus);
|
super.onWindowFocusChanged(hasFocus);
|
||||||
if (hasFocus) {
|
if (hasFocus) {
|
||||||
importFromClipboard();
|
importFromClipboard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void importFromClipboard() {
|
private void importFromClipboard() {
|
||||||
LinearLayout layoutBegin = findViewById(R.id.layoutBegin);
|
final LinearLayout layoutBegin = findViewById(R.id.layoutBegin);
|
||||||
ClipboardManager clipboard = (ClipboardManager) getApplicationContext().getSystemService(CLIPBOARD_SERVICE);
|
final ClipboardManager clipboard = (ClipboardManager) getApplicationContext().getSystemService(CLIPBOARD_SERVICE);
|
||||||
|
|
||||||
Snackbar snackbar = Snackbar.make(layoutBegin,R.string.foundImportableMeetingClipboard,Snackbar.LENGTH_INDEFINITE).setDuration(7000);
|
Snackbar snackbar = Snackbar.make(layoutBegin, R.string.foundImportableMeetingClipboard, Snackbar.LENGTH_INDEFINITE).setDuration(7000);
|
||||||
snackbar.setAction(R.string.importMeeting, view -> {
|
snackbar.setAction(R.string.importMeeting, view -> {
|
||||||
String text = clipboard.getPrimaryClip().getItemAt(0).getText().toString();
|
String text = clipboard.getPrimaryClip().getItemAt(0).getText().toString();
|
||||||
handleSendText(text);
|
handleSendText(text);
|
||||||
@@ -176,15 +181,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
if (sharedText != null) {
|
if (sharedText != null) {
|
||||||
Matcher matcher = Pattern.compile("(?i)(?<=(Meeting-ID:)|(Meeting\\sID:)|(ID:)).+").matcher(sharedText);
|
Matcher matcher = Pattern.compile("(?i)(?<=(Meeting-ID:)|(Meeting\\sID:)|(ID:)).+").matcher(sharedText);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
meetingID = matcher.group(0).trim();
|
meetingID = Objects.requireNonNull(matcher.group(0)).trim();
|
||||||
}
|
}
|
||||||
matcher = Pattern.compile("(?i)(?<=(Kenncode:)|(Passwort:)|(Passcode:)|(Password:)).+").matcher(sharedText);
|
matcher = Pattern.compile("(?i)(?<=(Kenncode:)|(Passwort:)|(Passcode:)|(Password:)).+").matcher(sharedText);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
meetingPWD = matcher.group(0).trim();
|
meetingPWD = Objects.requireNonNull(matcher.group(0)).trim();
|
||||||
}
|
}
|
||||||
matcher = Pattern.compile("(?i)(?<=(Thema:)|(Meeting\\sName:)|(Topic:)).+").matcher(sharedText);
|
matcher = Pattern.compile("(?i)(?<=(Thema:)|(Meeting\\sName:)|(Topic:)).+").matcher(sharedText);
|
||||||
if (matcher.find()) {
|
if (matcher.find()) {
|
||||||
meetingName = matcher.group(0).trim();
|
meetingName = Objects.requireNonNull(matcher.group(0)).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
@@ -193,9 +198,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (meetingID.equals("")) {
|
if (meetingID.equals("")) {
|
||||||
builder.setMessage(R.string.importError);
|
builder.setMessage(R.string.importError);
|
||||||
builder.setPositiveButton(R.string.ok, (dialog, which) -> {
|
builder.setPositiveButton(R.string.ok, (dialog, which) -> dialog.dismiss());
|
||||||
dialog.dismiss();
|
|
||||||
});
|
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
if (!checkOnly) alert.show();
|
if (!checkOnly) alert.show();
|
||||||
return false;
|
return false;
|
||||||
@@ -226,11 +229,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void watchShortcutIcon() {
|
|
||||||
ImageView ShortcutIcon = findViewById(R.id.imageCreateShortcut);
|
|
||||||
ShortcutIcon.setOnClickListener(v -> showCreateShortcutUI());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showCreateShortcutUI() {
|
private void showCreateShortcutUI() {
|
||||||
int meeting = meetingsController.searchMeetingInList(meetingsController.getMeetings(), createCurrMeetingFromUI().meetingName);
|
int meeting = meetingsController.searchMeetingInList(meetingsController.getMeetings(), createCurrMeetingFromUI().meetingName);
|
||||||
|
|
||||||
@@ -246,11 +244,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
showCreateShortcutUI();
|
showCreateShortcutUI();
|
||||||
|
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(R.string.cancel, (dialog, which) -> {
|
builder.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||||
dialog.dismiss();
|
} else {
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
builder.setMessage(R.string.WantToJoinImmediately);
|
builder.setMessage(R.string.WantToJoinImmediately);
|
||||||
builder.setPositiveButton(R.string.joinImmediately, (dialog, which) -> {
|
builder.setPositiveButton(R.string.joinImmediately, (dialog, which) -> {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
@@ -264,12 +259,9 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
AlertDialog alert = builder.create();
|
AlertDialog alert = builder.create();
|
||||||
alert.show();
|
alert.show();
|
||||||
|
|
||||||
//createMeetingShortcut(searchMeetingInList(getMeetings(), createCurrMeetingFromUI().meetingName), false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createMeetingShortcut(int meetingIndex, boolean joinImmediately) {
|
private void createMeetingShortcut(int meetingIndex, boolean joinImmediately) {
|
||||||
|
|
||||||
Meeting meeting = meetingsController.getMeetings().get(meetingIndex);
|
Meeting meeting = meetingsController.getMeetings().get(meetingIndex);
|
||||||
|
|
||||||
if (ShortcutManagerCompat.isRequestPinShortcutSupported(this)) {
|
if (ShortcutManagerCompat.isRequestPinShortcutSupported(this)) {
|
||||||
@@ -291,12 +283,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void watchShareIcon() {
|
|
||||||
ImageView ShareIcon = findViewById(R.id.imageShare);
|
|
||||||
ShareIcon.setOnClickListener(v -> shareMeeting(createCurrMeetingFromUI()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void shareMeeting(Meeting meeting) {
|
private void shareMeeting(Meeting meeting) {
|
||||||
Intent sendIntent = new Intent();
|
Intent sendIntent = new Intent();
|
||||||
sendIntent.setAction(Intent.ACTION_SEND);
|
sendIntent.setAction(Intent.ACTION_SEND);
|
||||||
@@ -307,26 +293,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
startActivity(shareIntent);
|
startActivity(shareIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void watchNewIcon() {
|
|
||||||
ImageView AddIcon = findViewById(R.id.imageAdd);
|
|
||||||
EditText meetingID = findViewById(R.id.textBoxID);
|
|
||||||
AddIcon.setOnClickListener(v -> {
|
|
||||||
fillBlank();
|
|
||||||
meetingID.requestFocus();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void watchAttIcon() {
|
|
||||||
ImageView AttIcon = findViewById(R.id.imageAttend);
|
|
||||||
AttIcon.setOnClickListener(v -> btnJoin_onClick(null));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void watchDeleteIcon() {
|
|
||||||
ImageView trashIcon = findViewById(R.id.imageTrash);
|
|
||||||
trashIcon.setOnClickListener(v -> meetingsController.removeMeeting(meetingsController.searchMeetingInList(meetingsController.getMeetings(), createCurrMeetingFromUI().meetingName)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void fillBlank() {
|
public void fillBlank() {
|
||||||
EditText editMeetingName = findViewById(R.id.TextMeetingName);
|
EditText editMeetingName = findViewById(R.id.TextMeetingName);
|
||||||
EditText editID = findViewById(R.id.textBoxID);
|
EditText editID = findViewById(R.id.textBoxID);
|
||||||
@@ -342,21 +308,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
editAtt.setText("");
|
editAtt.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void watchSaveIcon() {
|
|
||||||
ImageView saveIcon = findViewById(R.id.imageSave);
|
|
||||||
saveIcon.setOnClickListener(v -> saveMeetingFromUI());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void watchMeetingNameBox() {
|
|
||||||
EditText meetingNameBox = findViewById(R.id.TextMeetingName);
|
|
||||||
meetingNameBox.setOnFocusChangeListener((v, hasFocus) -> {
|
|
||||||
if (!hasFocus) {
|
|
||||||
fillWithSelectedMeeting();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void fillWithSelectedMeeting() {
|
public void fillWithSelectedMeeting() {
|
||||||
AutoCompleteTextView textMeetingName = findViewById(R.id.TextMeetingName);
|
AutoCompleteTextView textMeetingName = findViewById(R.id.TextMeetingName);
|
||||||
int search = meetingsController.searchMeetingInList(meetingsController.getMeetings(), textMeetingName.getText().toString());
|
int search = meetingsController.searchMeetingInList(meetingsController.getMeetings(), textMeetingName.getText().toString());
|
||||||
@@ -395,19 +346,14 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AutoCompleteTextView textName = findViewById(R.id.textBoxName);
|
AutoCompleteTextView textName = findViewById(R.id.textBoxName);
|
||||||
//ImageView dropdown = findViewById(R.id.iconDropdownAttName);
|
|
||||||
AutoSuggestAdapter adapter = new AutoSuggestAdapter(this, android.R.layout.simple_dropdown_item_1line);
|
AutoSuggestAdapter adapter = new AutoSuggestAdapter(this, android.R.layout.simple_dropdown_item_1line);
|
||||||
|
|
||||||
adapter.setData(Arrays.asList(attNames));
|
adapter.setData(Arrays.asList(attNames));
|
||||||
textName.setAdapter(adapter);
|
textName.setAdapter(adapter);
|
||||||
|
|
||||||
textName.setOnTouchListener((paramView, paramMotionEvent) -> false);
|
textName.setOnTouchListener((paramView, paramMotionEvent) -> false);
|
||||||
|
|
||||||
textName.setOnItemClickListener((arg0, view, arg2, arg3) -> fillWithSelectedAtt(meetingIndex));
|
textName.setOnItemClickListener((arg0, view, arg2, arg3) -> fillWithSelectedAtt(meetingIndex));
|
||||||
|
|
||||||
/*dropdown.setOnClickListener(v -> {
|
|
||||||
textName.showDropDown();
|
|
||||||
adapter.getFilter().filter(null);
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillWithSelectedAtt(int meetingIndex) {
|
private void fillWithSelectedAtt(int meetingIndex) {
|
||||||
@@ -417,7 +363,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
editAtt.setText(meetingsController.getMeetings().get(meetingIndex).attendees.get(found).num);
|
editAtt.setText(meetingsController.getMeetings().get(meetingIndex).attendees.get(found).num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void fillMeeting(Meeting meeting) {
|
public void fillMeeting(Meeting meeting) {
|
||||||
EditText editMeetingName = findViewById(R.id.TextMeetingName);
|
EditText editMeetingName = findViewById(R.id.TextMeetingName);
|
||||||
EditText editID = findViewById(R.id.textBoxID);
|
EditText editID = findViewById(R.id.textBoxID);
|
||||||
@@ -441,7 +386,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
fillDropdownAttendeeName(id);
|
fillDropdownAttendeeName(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void btnSave_onClick(View view) {
|
public void btnSave_onClick(View view) {
|
||||||
saveMeetingFromUI();
|
saveMeetingFromUI();
|
||||||
}
|
}
|
||||||
@@ -462,7 +406,6 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
return new Meeting(editMeetingName.getText().toString(), editID.getText().toString(), editPW.getText().toString(), editName.getText().toString(), editAtt.getText().toString());
|
return new Meeting(editMeetingName.getText().toString(), editID.getText().toString(), editPW.getText().toString(), editName.getText().toString(), editAtt.getText().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void importMeeting(Meeting meeting, boolean updateAttendee) {
|
public void importMeeting(Meeting meeting, boolean updateAttendee) {
|
||||||
ArrayList<Meeting> listMeetings = meetingsController.getMeetings();
|
ArrayList<Meeting> listMeetings = meetingsController.getMeetings();
|
||||||
int foundCurr = meetingsController.searchMeetingInList(listMeetings, meeting.meetingName);
|
int foundCurr = meetingsController.searchMeetingInList(listMeetings, meeting.meetingName);
|
||||||
@@ -486,7 +429,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
meetingsController.saveMeetingList(listMeetings);
|
meetingsController.saveMeetingList(listMeetings);
|
||||||
fillDropdownMeetingName();
|
fillDropdownMeetingName();
|
||||||
fillDropdownAttendeeName(meetingsController.getLastMeeting());
|
fillDropdownAttendeeName(meetingsController.getLastMeeting());
|
||||||
Toast.makeText(getApplicationContext(), "Meeting gespeichert", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), R.string.meetingSaved, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void importMeeting(Meeting meeting) {
|
public void importMeeting(Meeting meeting) {
|
||||||
@@ -499,7 +442,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
if (currMeetingUI.meetingID.equals("")) {
|
if (currMeetingUI.meetingID.equals("")) {
|
||||||
EditText editID = findViewById(R.id.textBoxID);
|
EditText editID = findViewById(R.id.textBoxID);
|
||||||
editID.requestFocus();
|
editID.requestFocus();
|
||||||
editID.setError("Meeting kann nicht ohne ID gespeichert werden!");
|
editID.setError(getString(R.string.meetingWithoutID));
|
||||||
return;
|
return;
|
||||||
} else if (currMeetingUI.meetingName.equals("")) {
|
} else if (currMeetingUI.meetingName.equals("")) {
|
||||||
EditText editMName = findViewById(R.id.TextMeetingName);
|
EditText editMName = findViewById(R.id.TextMeetingName);
|
||||||
@@ -508,5 +451,4 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
importMeeting(currMeetingUI);
|
importMeeting(currMeetingUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user