cleanup
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="de.joel.zoomhelper">
|
||||
<queries>
|
||||
<package android:name="us.zoom.videomeetings" />
|
||||
</queries>
|
||||
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
||||
@@ -1,28 +1,23 @@
|
||||
package de.joel.zoomhelper;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Base64;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListPopupWindow;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.EOFException;
|
||||
@@ -33,7 +28,7 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
class InstantAutoComplete extends AutoCompleteTextView {
|
||||
class InstantAutoComplete extends androidx.appcompat.widget.AppCompatAutoCompleteTextView {
|
||||
|
||||
public InstantAutoComplete(Context context) {
|
||||
super(context);
|
||||
@@ -66,8 +61,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
catch (IndexOutOfBoundsException e) {
|
||||
AlertDialog.Builder dialog=new AlertDialog.Builder(this);
|
||||
dialog.setMessage("Daten wurden zurückgesetzt, da die Config-Struktur nochmal verändert wurde.");
|
||||
dialog.setTitle("Hinweis");
|
||||
dialog.setMessage(R.string.resetDataText);
|
||||
dialog.setTitle(R.string.hint);
|
||||
AlertDialog alertDialog=dialog.create();
|
||||
alertDialog.show();
|
||||
setLastMeeting(-1);
|
||||
@@ -83,9 +78,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private void watchShareIcon() {
|
||||
ImageView ShareIcon = findViewById(R.id.imageShare);
|
||||
ShareIcon.setOnClickListener(v -> {
|
||||
shareMeeting(createCurrMeetingFromUI());
|
||||
});
|
||||
ShareIcon.setOnClickListener(v -> shareMeeting(createCurrMeetingFromUI()));
|
||||
}
|
||||
|
||||
private void shareMeeting(Meeting meeting) {
|
||||
@@ -100,23 +93,17 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private void watchNewIcon() {
|
||||
ImageView AddIcon = findViewById(R.id.imageAdd);
|
||||
AddIcon.setOnClickListener(v -> {
|
||||
fillBlank();
|
||||
});
|
||||
AddIcon.setOnClickListener(v -> fillBlank());
|
||||
}
|
||||
|
||||
private void watchAttIcon() {
|
||||
ImageView AttIcon = findViewById(R.id.imageAttend);
|
||||
AttIcon.setOnClickListener(v -> {
|
||||
btnJoin_onClick(null);
|
||||
});
|
||||
AttIcon.setOnClickListener(v -> btnJoin_onClick(null));
|
||||
}
|
||||
|
||||
private void watchDeleteIcon() {
|
||||
ImageView trashIcon = findViewById(R.id.imageTrash);
|
||||
trashIcon.setOnClickListener(v -> {
|
||||
removeMeeting(getLastMeeting());
|
||||
});
|
||||
trashIcon.setOnClickListener(v -> removeMeeting(getLastMeeting()));
|
||||
}
|
||||
|
||||
private void removeMeeting(int meeting) {
|
||||
@@ -160,9 +147,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private void watchSaveIcon() {
|
||||
ImageView saveIcon = findViewById(R.id.imageSave);
|
||||
saveIcon.setOnClickListener(v -> {
|
||||
saveAllMeetings();
|
||||
});
|
||||
saveIcon.setOnClickListener(v -> saveAllMeetings());
|
||||
}
|
||||
|
||||
public void watchMeetingNameBox() {
|
||||
@@ -194,7 +179,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
AutoCompleteTextView textMeetingName = findViewById(R.id.TextMeetingName);
|
||||
ImageView dropdown = findViewById(R.id.image);
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, meetingNames);
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, meetingNames);
|
||||
textMeetingName.setAdapter(adapter);
|
||||
|
||||
textMeetingName.setOnTouchListener((View.OnTouchListener) (paramView, paramMotionEvent) -> {
|
||||
@@ -203,9 +188,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
return false;
|
||||
});
|
||||
|
||||
textMeetingName.setOnItemClickListener((arg0, view, arg2, arg3) -> {
|
||||
fillWithSelectedMeeting();
|
||||
});
|
||||
textMeetingName.setOnItemClickListener((arg0, view, arg2, arg3) -> fillWithSelectedMeeting());
|
||||
|
||||
dropdown.setOnClickListener(v -> {
|
||||
textMeetingName.showDropDown();
|
||||
@@ -217,19 +200,17 @@ public class MainActivity extends AppCompatActivity {
|
||||
Meeting meeting = getMeetings().get(meetingIndex);
|
||||
ArrayList<Attendee> attendees = meeting.attendees;
|
||||
|
||||
String attNames[] = new String[attendees.size()];
|
||||
String[] attNames = new String[attendees.size()];
|
||||
for (int i = 0; i < attendees.size(); i++) {
|
||||
attNames[i] = attendees.get(i).name;
|
||||
}
|
||||
|
||||
AutoCompleteTextView textName = findViewById(R.id.textBoxName);
|
||||
ImageView dropdown = findViewById(R.id.image2);
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, attNames);
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_dropdown_item_1line, attNames);
|
||||
textName.setAdapter(adapter);
|
||||
|
||||
textName.setOnItemClickListener((arg0, view, arg2, arg3) -> {
|
||||
fillWithSelectedAtt();
|
||||
});
|
||||
textName.setOnItemClickListener((arg0, view, arg2, arg3) -> fillWithSelectedAtt());
|
||||
|
||||
dropdown.setOnClickListener(v -> {
|
||||
textName.showDropDown();
|
||||
@@ -291,6 +272,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
for (Object obj : listMeetings) {
|
||||
|
||||
try {
|
||||
if (objOutputStream == null) throw new AssertionError();
|
||||
objOutputStream.writeObject(obj);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -302,6 +284,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (objOutputStream == null) throw new AssertionError();
|
||||
objOutputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -313,7 +296,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
public ArrayList<Meeting> stringToMeetings(String string) {
|
||||
byte[] bytes = Base64.decode(string, 0);
|
||||
|
||||
ArrayList<Meeting> listMeetings = new ArrayList();
|
||||
ArrayList<Meeting> listMeetings = new ArrayList<>();
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
|
||||
ObjectInputStream obj = null;
|
||||
try {
|
||||
@@ -324,19 +307,19 @@ public class MainActivity extends AppCompatActivity {
|
||||
try {
|
||||
while (bis.available() != -1) {
|
||||
//Read object from file
|
||||
if (obj == null) throw new AssertionError();
|
||||
Meeting meeting = (Meeting) obj.readObject();
|
||||
listMeetings.add(meeting);
|
||||
}
|
||||
} catch (EOFException ex) {
|
||||
//ex.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ClassNotFoundException e) {
|
||||
} catch (IOException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return listMeetings;
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
public void saveMeetingList(ArrayList<Meeting> meetingList) {
|
||||
SharedPreferences mPrefs = getPreferences(MODE_PRIVATE);
|
||||
SharedPreferences.Editor prefsEditor = mPrefs.edit();
|
||||
@@ -344,6 +327,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
prefsEditor.commit();
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
public void setLastMeeting(int id) {
|
||||
SharedPreferences mPrefs = getPreferences(MODE_PRIVATE);
|
||||
SharedPreferences.Editor prefsEditor = mPrefs.edit();
|
||||
@@ -399,8 +383,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
EditText editName = findViewById(R.id.textBoxName);
|
||||
EditText editAtt = findViewById(R.id.editAtt);
|
||||
|
||||
Meeting currMeeting = new Meeting(editMeetingName.getText().toString(), editID.getText().toString(), editPW.getText().toString(), editName.getText().toString(), editAtt.getText().toString());
|
||||
return currMeeting;
|
||||
return new Meeting(editMeetingName.getText().toString(), editID.getText().toString(), editPW.getText().toString(), editName.getText().toString(), editAtt.getText().toString());
|
||||
}
|
||||
|
||||
public void saveAllMeetings() {
|
||||
|
||||
@@ -12,5 +12,7 @@
|
||||
<string name="MeetingID">Meeting-ID:</string>
|
||||
<string name="Password">Kenncode:</string>
|
||||
<string name="MeetingName">Meeting Name:</string>
|
||||
<string name="resetDataText">Daten wurden zurückgesetzt, da die Config-Struktur nochmal verändert wurde.</string>
|
||||
<string name="hint">Hinweis</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user