Browse Source

merged multipleUser

Simon Hammer 3 years ago
parent
commit
3807b667fa

+ 1 - 1
.gitignore

@@ -1,7 +1,7 @@
 *.iml
 /.idea
 .gradle
-/local.properties
+local.properties
 /.idea/caches
 /.idea/libraries
 /.idea/modules.xml

+ 5 - 0
app/build.gradle

@@ -57,6 +57,8 @@ android {
 
 dependencies {
 
+    implementation 'com.google.code.gson:gson:2.8.7'
+
     implementation 'androidx.appcompat:appcompat:1.2.0'
     implementation 'com.google.android.material:material:1.3.0'
     implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
@@ -82,4 +84,7 @@ dependencies {
     testImplementation 'junit:junit:4.+'
     androidTestImplementation 'androidx.test.ext:junit:1.1.2'
     androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+
+
+
 }

+ 31 - 0
app/src/main/java/com/noahvogt/miniprojekt/MailServerCredentials.java

@@ -0,0 +1,31 @@
+package com.noahvogt.miniprojekt;
+
+public class MailServerCredentials {
+    private String mImapHost;
+    private String mSmtpHost;
+    private String mUsername;
+    private String mPassword;
+    private int mImapPort;
+    private String mName;
+    private String mSignature;
+
+    public String getImapHost () {return this.mImapHost;}
+    public String getSmtpHost () {return this.mSmtpHost;}
+    public String getUsername () {return this.mUsername;}
+    public String getPassword () {return this.mPassword;}
+    public int getImapPort () {return this.mImapPort;}
+    public String getName () {return this.mName;}
+    public String getSignature () {return this.mSignature;}
+
+    public MailServerCredentials(String name, String username, String password, String imapHost, String smtpHost, int imapPort, String signature) {
+        mName = name;
+        mUsername = username;
+        mPassword = password;
+
+        mImapHost = imapHost;
+        mImapPort = imapPort;
+        mSmtpHost = smtpHost;
+
+        mSignature = signature;
+    }
+}

+ 97 - 40
app/src/main/java/com/noahvogt/miniprojekt/MainActivity.java

@@ -1,6 +1,7 @@
 package com.noahvogt.miniprojekt;
 
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.os.Bundle;
@@ -17,6 +18,7 @@ import androidx.drawerlayout.widget.DrawerLayout;
 import androidx.fragment.app.DialogFragment;
 
 
+import com.google.android.material.dialog.MaterialAlertDialogBuilder;
 import com.google.android.material.floatingactionbutton.FloatingActionButton;
 import com.noahvogt.miniprojekt.DataBase.Message;
 
@@ -43,8 +45,14 @@ import com.noahvogt.miniprojekt.data.MailFunctions;
 import com.noahvogt.miniprojekt.ui.show.MessageShowFragment;
 
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
+import com.google.gson.Gson;
+
+
 
 import static com.noahvogt.miniprojekt.R.id.drawer_layout;
 
@@ -59,7 +67,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
     private AlertDialog dialog;
     private EditText newemail_name, newemail_email, newemail_password; /* may not be private */
 
-    SharedPreferences preferences;
+    SharedPreferences preferences, mailServerCredentials;
 
     /* empty descriptor */
     public MainActivity() {}
@@ -109,6 +117,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
         /* invoke preferences */
         preferences = getSharedPreferences("UserPreferences", Context.MODE_PRIVATE);
 
+        mailServerCredentials = getSharedPreferences("Credentials", Context.MODE_PRIVATE);
+
         /* invoke toolbar */
         Toolbar toolbar = findViewById(R.id.toolbar);
         setSupportActionBar(toolbar);
@@ -169,6 +179,11 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
 
             }
         });
+
+        /* start python instance right on startup */
+        if (! Python.isStarted()) {
+            Python.start(new AndroidPlatform(this));
+        }
     }
 
 
@@ -218,7 +233,54 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
     /* better leave empty to avoid any listener disambiguity */
     public void onClick(View view) { }
 
+    public void changeMailServerSettingsDialog(String name, String email, String password) {
+        // define View window
+        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
+        final View changeMailServerSettingsView = getLayoutInflater().inflate(R.layout.mail_credentials_customizer, null);
+
+        EditText incomingServerObject = (EditText) changeMailServerSettingsView.findViewById(R.id.custom_mail_server_incoming_server_text);
+        EditText outgoingServerObject = (EditText) changeMailServerSettingsView.findViewById(R.id.custom_mail_server_outgoing_server_text);
+        EditText incomingPortObject = (EditText) changeMailServerSettingsView.findViewById(R.id.custom_mail_server_incoming_port_text);
+        EditText outgoingPortObject = (EditText) changeMailServerSettingsView.findViewById(R.id.custom_mail_server_outgoing_port_text);
+        EditText serverUsernameObject = (EditText) changeMailServerSettingsView.findViewById(R.id.custom_mail_server_username_text);
+        EditText passwordObject = (EditText) changeMailServerSettingsView.findViewById(R.id.custom_mail_server_password_text);
+
+        incomingServerObject.setText(MailFunctions.getImapHostFromEmail(email));
+        outgoingServerObject.setText(MailFunctions.getSmtpHostFromEmail(email));
+        incomingPortObject.setText("993");
+        outgoingPortObject.setText("587");
+        serverUsernameObject.setText(email);
+        passwordObject.setText(password);
+
+        /* open View window */
+        dialogBuilder.setView(changeMailServerSettingsView);
+        dialog = dialogBuilder.create();
+        dialog.show();
+    }
 
+    public void askForChangeMailServerSettingsDialog(String name, String email, String password) {
+        /* define View window */
+        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
+
+        /* open View window */
+        dialogBuilder.setTitle("failed to connect :(");
+        dialogBuilder
+                .setMessage("Do you want to further customize your mail server settings?")
+                .setPositiveButton("Yes",new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog, int id) {
+                        /*if this button is clicked, close the whole fragment */
+                        changeMailServerSettingsDialog(name, email, password);
+                    }
+                })
+                .setNegativeButton("No",new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog,int id) {
+                        /* if this button is clicked, close the hole fragment */
+                        dialog.dismiss();
+                    }
+                });
+        dialog = dialogBuilder.create();
+        dialog.show();
+    }
 
     public void createNewEmailDialog(){
         /* define View window */
@@ -242,6 +304,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
         dialog.show();
 
         SharedPreferences.Editor preferencesEditor = preferences.edit();
+        SharedPreferences.Editor credentialsEditor = mailServerCredentials.edit();
 
         if (! Python.isStarted()) {
             Python.start(new AndroidPlatform(this));
@@ -263,64 +326,58 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
 
                 /* connect to mail server and print various debugging output */
                 showToast("Probe Connection ...");
-                if (MailFunctions.canConnect(name, email, password) == Boolean.TRUE) {
+                if (MailFunctions.canConnect(MailFunctions.getImapHostFromEmail(email), email, password) == Boolean.TRUE) {
                     showToast("was able to connect");
-                    List folders =  MailFunctions.listMailboxes(MailFunctions.getIMAPConnection(name, email, password));
+
+                    List folders =  MailFunctions.listMailboxes(MailFunctions.getIMAPConnection(MailFunctions.getImapHostFromEmail(email), email, password));
                     for (int i = 0; i < folders.size(); i++) {
                         showToast(folders.get(i).toString());
                         // TODO: select right folder to store, Synchronization
                         /*gives list of Message Objects/dictionaries */
-                        List messages = MailFunctions.fetchMailsFromBox(MailFunctions.getIMAPConnection(name, email, password), folders.get(i).toString(), "list");
-                        System.out.println(folders.get(i).toString());
-                        System.out.println(messages.toString());
-
-
-                        for (int k = 0; k < messages.size(); k++) {
-                            System.out.println(messages.get(k));
-                                /*work now, but list of Messages not */
-                                System.out.println(MailFunctions.fetchSubject(k));
-                                System.out.println(MailFunctions.fetchFrom(k));
-                                System.out.println(MailFunctions.fetchCC(k));
-                                System.out.println(MailFunctions.fetchBcc(k));
-                                System.out.println(MailFunctions.fetchTo(k));
-                                System.out.println(MailFunctions.fetchDate(k));
-                                System.out.println(MailFunctions.fetchContent(k));
-
+                        /*List p = MailFunctions.fetchMailsFromBox(MailFunctions.getIMAPConnection(name, email, password), l.get(i).toString(), "list");
+                        System.out.println(l.get(i).toString());
+                        System.out.println(p);*/
+                    }
 
 
-                        }
 
-                    }
 
-                    /*Message word = new Message(
-                            messageCreateFragment.replyIntent.getStringExtra(messageCreateFragment.EXTRA_TO),
-                            null,
-                            null,
-                            messageCreateFragment.replyIntent.getStringExtra(messageCreateFragment.EXTRA_FROM),
-                            ft.format(dNow),
-                            messageCreateFragment.replyIntent.getStringExtra(messageCreateFragment.EXTRA_SUBJECT),
-                            messageCreateFragment.replyIntent.getStringExtra(messageCreateFragment.EXTRA_MESSAGE),
-                            "Draft",false);
-                    mEmailViewModel.insert(word);
-
-                     */
                     preferencesEditor.putString("name", name);
                     preferencesEditor.putString("email", email);
                     preferencesEditor.putString("password", password);
                     preferencesEditor.apply();
-                } else {
-                    showToast("failed to connect");
 
-                    /* show all strings the user gave, this will later be stored to a secure database and checked for validation */
-                    showToast(name);
-                    showToast(email);
-                    showToast(password);
-                }
+                    /* ArrayList<String> newUserSettings = new ArrayList<String>();
+                    newUserSettings.add(name);
+                    newUserSettings.add(email);
+                    newUserSettings.add(password);
+                    System.out.println("newUserSettings: " + newUserSettings);
+
+
+                    //Retrieve the values
+                    Set<String> oldSet = mailServerCredentials.getStringSet("UserSettings", null);
 
+                    //Set the values
+                    Set<String> newSet = new HashSet<String>();
+                    newSet.addAll(newUserSettings);
+                    credentialsEditor.putStringSet("UserSettings", newSet);
+                    credentialsEditor.commit();*/
 
+                    Gson gson = new Gson();
+                    MailServerCredentials newMailServerCredentials = new MailServerCredentials(
+                            name, password, email, MailFunctions.getImapHostFromEmail(email), MailFunctions.getSmtpHostFromEmail(email), 993, "");
+                    String newCredentialsJson = gson.toJson(newMailServerCredentials);
+                    System.out.println(newCredentialsJson);
+                    credentialsEditor.putString("data", newCredentialsJson);
+                    credentialsEditor.apply();
+
+                } else {
+                    askForChangeMailServerSettingsDialog(name, email, password);
+                }
             }
         });
 
+
         newemail_cancel_button.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {

+ 1 - 1
app/src/main/java/com/noahvogt/miniprojekt/MessageCreateFragment.java

@@ -138,7 +138,7 @@ public class MessageCreateFragment extends DialogFragment implements PopupMenu.O
                     dismiss();
                 }
                 else {
-                    /* setup dialog */
+                    /* setup dialog for saving draft message */
                     AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
                     alertDialogBuilder.setTitle("Warning");
                     alertDialogBuilder

+ 19 - 0
app/src/main/java/com/noahvogt/miniprojekt/data/MailFunctions.java

@@ -92,6 +92,25 @@ public class MailFunctions {
         }
     }
 
+    public static String getImapHostFromEmail(String email) {
+        String topLevelHost = email.substring(email.lastIndexOf("@") + 1);
+        if (topLevelHost.endsWith("edubs.ch")) {
+            return "teamwork.edubs.ch";
+        } else {
+            return "imap." + topLevelHost;
+        }
+    }
+
+    public static String getSmtpHostFromEmail(String email) {
+        String topLevelHost = email.substring(email.lastIndexOf("@") + 1);
+        if (topLevelHost.equals("noahvogt.com")) {
+            return "mail.noahvogt.com";
+        } else {
+            return "smtp." + topLevelHost;
+        }
+    }
+
+
     public static boolean validateEmail(EditText emailAddress) {
         String email = emailAddress.getText().toString().trim();
 

+ 106 - 9
app/src/main/python/mailFunctions.py

@@ -1,4 +1,4 @@
-import imaplib, smtplib, ssl, email, os
+import imaplib, smtplib, ssl, email, os, json
 from itertools import chain
 
 mSubject = ""
@@ -23,7 +23,20 @@ def stringCompiling(inputIterable):
     try:
         for item in unitered:
             if item is not None:
-                nonNoneList.append(item)
+                if type(item) is not str:
+                    try:
+                        nonNoneList.append(str(item.decode("utf-8")))
+                    except UnicodeDecodeError:
+                        nonNoneList.append(str(item.decode("iso-8859-1")))
+                    except AttributeError:
+                        print(item)
+                        print(type(item))
+                        print(inputIterable)
+                        print(nonNoneList)
+                        exit()
+                else:
+                    nonNoneList.append(item)
+
     except TypeError:
         return ""
 
@@ -75,16 +88,33 @@ def listMailboxes(connection):
     connection.logout()
     return formatted_mailbox_list
 
-def fetchMails(connection, inbox, outputType):
-    #print("###" + inbox + "###")
-    #print(type(inbox))
+    # check that there are no bytes anymore that cannot be dumped into a json
+def verifyNoBytes(messages, output_list):
+    for messages in output_list:
+        for item in messages:
+            print(type(item))
+            print(item)
+            print(messages["{}".format(item)])
+            if type(messages["{}".format(item)]) is not str:
+                print("ERROREXIT: .format failed")
+                print(messages["{}".format(item)])
+                print(type(messages["{}".format(item)]))
+
+                exit()
+            if type(item) is not str:
+                print("ERROREXIT")
+                exit()
+
+def fetchMails(connection, inbox):
+    print("###" + inbox + "###")
+    print(type(inbox))
     try:
         status, messages = connection.select(inbox)
     except:
         return []
 
-    #print("status-------\n" + status)
-    #print("messages-------\n" + str(messages))
+    print("status-------\n" + status)
+    print("messages-------\n" + str(messages))
     # number of top emails to fetch
     #N = 3
     # total number of emails
@@ -141,7 +171,67 @@ def fetchMails(connection, inbox, outputType):
         except AttributeError:
             subject=""
 
-        #print("subject: {}".format(subject))
+    output_list = []
+
+    for seentype in ['(UNSEEN)', '(SEEN)']:
+        typ, data = connection.search(None, 'ALL', seentype)
+        for num in data[0].split():
+            output_dict = {}
+            typ, data = connection.fetch(num, '(RFC822)')
+
+            msg = email.message_from_bytes(data[0][1])
+
+            print(num)
+
+            raw_string = email.header.decode_header(msg['Subject'])[0]
+            print("raw_string: " + str(raw_string))
+            raw_from = email.header.decode_header(msg['From'])
+            print("raw_from" + str(raw_from))
+            try:
+                raw_to = email.header.decode_header(msg['To'])
+            except TypeError:
+                raw_to = [""]
+            try:
+                raw_cc = email.header.decode_header(msg['CC'])
+            except TypeError:
+                raw_cc = [""]
+            try:
+                raw_bcc = email.header.decode_header(msg['BCC'])
+            except TypeError:
+                raw_bcc = [""]
+            print("raw_to" + str(raw_to))
+            raw_date = email.header.decode_header(msg['Date'])[0]
+            print("raw_to" + str(raw_date))
+
+            raw_msg = str(msg)
+
+            primitive_body = raw_msg[raw_msg.find('\n\n'):].strip()
+
+            #raw_body = email.header.decode_header(msg['Body'])[0][0]
+
+            # set subject to an empty string when not found
+            try:
+                if raw_string[1] == 'utf-8':
+                    subject = raw_string[0].raw_string('utf-8')
+                else:
+                    subject = raw_string[0].decode("iso-8859-1")
+                            #nonNoneList.append(str(item.decode("iso-8859-1")))
+            except AttributeError:
+                subject=""
+
+            output_dict['subject'] = subject
+            output_dict['from'] = stringCompiling(raw_from)
+            output_dict['cc'] = stringCompiling(raw_cc)
+            output_dict['bcc'] = stringCompiling(raw_bcc)
+            output_dict['to'] = stringCompiling(raw_to)
+            output_dict['date'] = stringCompiling(raw_date)
+            output_dict['content'] = primitive_body
+            if seentype == '(SEEN)':
+                output_dict['seen'] = "True"
+            else:
+                output_dict['seen'] = "False"
+                # make sure the fetch command doesn't add a SEEN flag
+                connection.store(num, '-FLAGS', '(\Seen)')
 
         if outputType == "dict":
             output_dict['subject'] = subject
@@ -174,11 +264,18 @@ def fetchMails(connection, inbox, outputType):
             mDate = stringCompiling(raw_date)
             mContent = primitive_body
 
+            output_list.append(output_dict)
+
 
     connection.close()
     connection.logout()
 
-    return output_list
+    verifyNoBytes(messages, output_list)
+
+    print("Finstep")
+
+    return json.dumps(output_list)
+
 
 def printSubject(messageIndex):
     print(output_list[messageIndex][0])

+ 10 - 0
app/src/main/res/drawable/ic_baseline_call_made_24.xml

@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24"
+    android:tint="?attr/colorControlNormal">
+  <path
+      android:fillColor="@android:color/white"
+      android:pathData="M9,5v2h6.59L4,18.59 5.41,20 17,8.41V15h2V5z"/>
+</vector>

+ 11 - 0
app/src/main/res/drawable/ic_baseline_call_received_24.xml

@@ -0,0 +1,11 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24"
+    android:tint="?attr/colorControlNormal"
+    android:autoMirrored="true">
+  <path
+      android:fillColor="@android:color/white"
+      android:pathData="M20,5.41L18.59,4 7,15.59V9H5v10h10v-2H8.41z"/>
+</vector>

+ 230 - 0
app/src/main/res/layout/mail_credentials_customizer.xml

@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <TextView
+        android:id="@+id/textView3"
+
+        style="@style/TextAppearance.AppCompat.Widget.TextView.SpinnerItem"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="32dp"
+        android:layout_marginLeft="32dp"
+        android:layout_marginTop="32dp"
+        android:layout_marginEnd="32dp"
+        android:layout_marginRight="32dp"
+
+        android:gravity="center_horizontal"
+        android:text="Customizing Email Connection Settings"
+        android:textSize="24sp"
+
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ScrollView
+        android:id="@+id/scrollView2"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_marginTop="128dp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/textView3"
+        >
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical"
+            android:layout_marginBottom="100dp"
+            >
+
+            <com.google.android.material.textfield.TextInputLayout
+                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
+                android:id="@+id/custom_mail_server_incoming_server_layout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="32dp"
+                android:layout_marginLeft="32dp"
+                android:layout_marginTop="32dp"
+                android:layout_marginEnd="32dp"
+                android:layout_marginRight="32dp"
+
+                android:hint="Incoming Server"
+                app:startIconDrawable="@drawable/ic_baseline_call_received_24"
+
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toBottomOf="parent">
+
+                <com.google.android.material.textfield.TextInputEditText
+                    android:id="@+id/custom_mail_server_incoming_server_text"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content" />
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
+                android:id="@+id/custom_mail_server_outgoing_server_layout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="32dp"
+                android:layout_marginLeft="32dp"
+                android:layout_marginTop="32dp"
+                android:layout_marginEnd="32dp"
+                android:layout_marginRight="32dp"
+
+                android:hint="Outgoing Server"
+                app:startIconDrawable="@drawable/ic_baseline_call_made_24"
+
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/custom_mail_server_incoming_server_layout">
+
+                <com.google.android.material.textfield.TextInputEditText
+                    android:id="@+id/custom_mail_server_outgoing_server_text"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content" />
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
+                android:id="@+id/custom_mail_server_incoming_port_layout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="32dp"
+                android:layout_marginLeft="32dp"
+                android:layout_marginTop="32dp"
+                android:layout_marginEnd="32dp"
+                android:layout_marginRight="32dp"
+
+                android:hint="Incoming Port"
+                app:startIconDrawable="@drawable/ic_baseline_call_received_24"
+
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/custom_mail_server_outgoing_server_layout">
+
+                <com.google.android.material.textfield.TextInputEditText
+                    android:id="@+id/custom_mail_server_incoming_port_text"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content" />
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
+                android:id="@+id/custom_mail_server_outgoing_port_layout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="32dp"
+                android:layout_marginLeft="32dp"
+                android:layout_marginTop="32dp"
+                android:layout_marginEnd="32dp"
+                android:layout_marginRight="32dp"
+
+                android:hint="Outgoing Port"
+                app:startIconDrawable="@drawable/ic_baseline_call_made_24"
+
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/custom_mail_server_incoming_port_layout">
+
+                <com.google.android.material.textfield.TextInputEditText
+                    android:id="@+id/custom_mail_server_outgoing_port_text"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content" />
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
+                android:id="@+id/custom_mail_server_username_layout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="32dp"
+                android:layout_marginLeft="32dp"
+                android:layout_marginTop="32dp"
+                android:layout_marginEnd="32dp"
+                android:layout_marginRight="32dp"
+
+                android:hint="Server Username"
+                app:startIconDrawable="@drawable/ic_mail_outline"
+
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/custom_mail_server_outgoing_port_layout">
+
+                <com.google.android.material.textfield.TextInputEditText
+                    android:id="@+id/custom_mail_server_username_text"
+                    android:inputType="textEmailAddress"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content" />
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <com.google.android.material.textfield.TextInputLayout
+                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
+                android:id="@+id/custom_mail_server_password_layout"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="32dp"
+                android:layout_marginLeft="32dp"
+                android:layout_marginTop="32dp"
+                android:layout_marginEnd="32dp"
+                android:layout_marginRight="32dp"
+
+                android:hint="Server Password"
+                app:startIconDrawable="@drawable/ic_lock"
+
+                android:paddingBottom="50dp"
+
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/custom_mail_server_username_layout">
+
+                <com.google.android.material.textfield.TextInputEditText
+                    android:id="@+id/custom_mail_server_password_text"
+                    android:inputType="textPassword"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content" />
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <RelativeLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+                <Button
+                    android:id="@+id/cancelCustomizeButton"
+
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+
+                    android:layout_alignParentLeft="true"
+                    android:layout_centerVertical="true"
+                    android:layout_marginStart="42dp"
+                    android:layout_marginLeft="42dp"
+                    android:text="Save" />
+
+                <Button
+                    android:id="@+id/saveCustomizeButton"
+
+                    android:layout_marginEnd="42dp"
+                    android:layout_marginRight="42dp"
+
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_alignBottom="@+id/cancelCustomizeButton"
+                    android:layout_alignParentRight="true"
+                    android:text="Cancel" />
+
+            </RelativeLayout>
+
+        </LinearLayout>
+
+
+    </ScrollView>
+
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 2
app/src/main/res/layout/popup.xml

@@ -84,9 +84,7 @@
 
         <com.google.android.material.textfield.TextInputEditText
             android:id="@id/popup_material_name_asking_text"
-
             android:inputType="textPersonName"
-
             android:layout_width="match_parent"
             android:layout_height="wrap_content" />
     </com.google.android.material.textfield.TextInputLayout>