Assignment 4: SDPEncryptor Spring 2024 In this assignment, you will develop a simple Android app, SDPEncryptor, that encrypts messages using a simple substitution cipher. INPUTS: 1. Entry Text: message to
be encoded. • This input should be a non-empty string and must contain at least one letter or number. • This input should be provided to the app through an EditText widget, initially blank. 2. Arg Input 1: first encryption parameter. • This input should be provided to the app through an EditText widget, initially set to '1'. ● This input should be an integer coprime to 62 between 0 and 62: 1, 3, 5, 7, 9, 11, 13, 15, ... 61 3. Arg Input 2: second encryption parameter. • This input should be an integer >= 1 and < 62. • This input should be provided to the app through an EditText widget, initially set to '1'. OUTPUT: 1. Text Encrypted, the text resulting from applying the following cipher: ● Each character in the alphabet is assigned a numeric value between 0 and 61 based on its position in the alphabet (i.e., "0"=0, "1"=1, ..., "9"=9, "A"=10, "B"=11, ..., "Z"=35, "a"=36, "b"=37, ..., "z"=61). Note that the alphabet contains letters and numbers. • For each character in the alphabet, where the numeric value is x, the encoded value of the letter is defined as E(x) (ax + b) % 62 where a and b are the values of Arg Input 1 and Arg Input 2 respectively, as in an Affine Cipher. • The encoded character for the input character is calculated by taking the encoded number, which is a value between 0 and 61, and translating it back into a character (again, where "0"=0, "1"=1, ..., "9"=9, "A"=10, "B"=11, ..., "Z"=35, "a"=36, "b"=37, ..., "z"=61). = ● All non-alphanumeric characters must remain unchanged. • The output should be shown using a non-editable TextView that is initially blank and (re)computed when the "Encrypt Entry Text" button is pressed. If any input is invalid when the button is pressed, the output should then be set to (i.e., the empty string), and all applicable error messages should be generated (see below). EXAMPLE • Inputs: O Entry Text = "Cat & 5 DogS" O Arg Input 1 O Arg Input 2 = 3 • Output: ● = 5 O Text Encrypted = "1xU & S 65RJ" Explanation: O "C" has value 12, (12 * 5 + 3) % 62 = 1, 1 corresponds to "1". "a" has value 36, (36 * 5 + 3) % 62 = 59, 59 corresponds to "x". "&", and " are unchanged "5" has value 5, (5 * 5 + 3) % 62 = 28, 28 corresponds to "S". " " is unchanged ERROR MESSAGES The app should generate suitable error messages by calling Edit Text's setError method (inherited from TextView) on the appropriate EditText widget when the computation is triggered i (i.e., the button is pressed). If done correctly, this will result in (1) an error mark ( ) on the right-hand side of the text field and (2) a floating error message whenever the field has focus, as shown in the error screenshots below. It is possible to have more than one error active at the same time, as also shown in the screenshots below. There are three error situations: 1. "Invalid Entry Text", related to the Entry Text field, for an empty or letter- or number-less entry. 2. "Invalid Arg Input 1", related to the Arg Input 1 field, for a blank or unacceptable value (i.e., not coprime to 62). 3. "Invalid Arg Input 2", related to the Arg Input 2 field, for a blank or out-of-range value. Note: You may either limit the input in the numerical fields to positive numbers or provide the same errors if negative numbers or non-numerical input are entered. For illustration, we are providing several mockups for a possible implementation of the app: SDP Encryptor Spring 2024 Entry Text Arg Input 1 Arg Input 2 Entry Text Encrypt Entry Text Arg Input 1 SDP Encryptor Spring 2024 Arg Input 2 Cat & 5 DogS Entry Text Encrypted 1xU & S 65RJ 5 Entry Text 3 Arg Input 1 Arg Input 2 $% 0 Encrypt Entry Text 0 Entry Text Encrypted SDP Encryptor Spring 2024 Invalid Arg Input 1 Cat & 5 DogS 5 3 ! Encrypt Entry Text Entry Text Encrypted 1xU & S 65RJ SDP Encryptor Spring 2024 Entry Text Arg Input 1 Arg Input 2 Entry Text %abcdefg # Encrypt Entry Text 5 Arg Input 1 1 Entry Text Encrypted %v05AFKP # SDP Encryptor Spring 2024 Arg Input 2 $% 0 0 Invalid Entry Text Encrypt Entry Text Entry Text Encrypted entry TextID argInput1ID arginput2ID encryptButtonID ! textEncryptedID SDP Encryptor Spring 2024 Entry Text Arg Input 1 Arg Input 2 Entry Text XYZabcABCxyz Encrypt Entry Text 23 Arg Input 1 Entry Text Encrypted Yvlf2P1OICZw SDP Encryptor Spring 2024 Arg Input 2 Be sure to include both semester and year in the title 19 $% 0 0 Encry Entry Text Encrypted ! ! Invalid Arg Input 2 We suggest that you try to generate a user interface (UI) similar to the one shown above, but you don't have to. However, you must make sure to use the exact same identifiers we provide below for your widgets. This is very important, as we will use these identifiers to check and auto-grade your app. IDENTIFIERS • entry TextID • argInput1ID • argInput2ID • encryptButton ID • textEncrypted ID PRO-TIP: The identifiers are typed here for you. Just copy and paste them to be safe! For example, in the XML layout file for your app, the entry for the text field used to input the Entry Text should have the following ID: android:id="@+id/entry TextID" INSTRUCTIONS 1. Make sure to watch the Android Studio demo (part of the lessons on Android). 2. In the root of the assigned, private GitHub repository that we made for you (https://github.gatech.edu/gt-omscs-se-2024 spring/6300Spring24.git), create a directory called "Assignment4". Hereafter, we will refer to this directory in your local repo as . 3. Create an Android app project called "SDPEncryptor" in . (Make sure that this results in a directory called SDPEncryptor in , as shown in the "Configure Your Project" snapshot below--you will likely need to manually modify the "Save location" entry for this to happen.)¹ ¹ We performed our testing using Android Studio Hedgehog | 2023.1.1. Your windows may look slightly different from the ones we provide if you are using a different version. O Choose "Empty Views Activity" as your project template. New Project Templates Phone and Tablet Wear OS Android TV Automotive Empty Views Activity Creates a new empty activity Name Package name Save location Language Minimum SDK • O ← No Activity Bottom Navigation Views Activity SDPEncryptor Java I New Project edu.gatech.seclass.sdpencryptor ← Empty Activity Build configuration language Groovy DSL (build.gradle) ← Empty Views Activity Cancel /Users/gpburdell/6300Fall24gpburdell1/Assignment4/SDPEncryptor API 33 ("Tiramisu"; Android 13.0) ✪ Your app will run on approximately 22.4% of devices. Help me choose Cancel Previous ← Navigation Drawer Views Activity Previous Basic Views Activity C++ ⠀ Next Next Finish Finish