Matur Journal

Noah Vogt & Simon Hammer

2021

March

Wensday, March 31st, 2021

How to make an App interface ? How to make a app as fast as possible ? How to make connection to a server ?

April

Thursday, April 1st, 2021

Today I instaled this diary.

Thursday, April 3st, 2021

I set up Android Studio and tried to install a KVM (i think it means Kernal Virtual Mashine) with https://help.ubuntu.com/community/KVM/Installation

how to creat a android app with androidstudio https://developer.android.com/training/basics/firstapp/creating-project

fundamentals how android apps works https://developer.android.com/guide/components/fundamentals

How does an app get permissions for camera etc. https://developer.android.com/guide/topics/permissions/overview

Activities https://developer.android.com/guide/components/activities/intro-activities

Services https://developer.android.com/guide/components/services

Notifications https://developer.android.com/guide/topics/ui/notifiers/notifications

Content providers https://developer.android.com/guide/topics/providers/content-providers Each Android app lives in its own security sandbox, protected by the following Android security features:

• The Android operating system is a multi-user Linux system in which each app is a different user.

• By default, the system assigns each app a unique Linux user ID (the ID is used only by the system and is unknown to the app). The system sets permissions for all the files in an app so that only the user ID assigned to that app can access them.

• Each process has its own virtual machine (VM), so an app’s code runs in isolation from other apps.

• By default, every app runs in its own Linux process.

The Android system starts the process when any of the app’s components need to be executed, and then shuts down the process when it’s no longer needed or when the system must recover memory for other apps.

However, there are ways for an app to share data with other apps and for an app to access system services:

• It’s possible to arrange for two apps to share the same Linux user ID, in which case they are able to access each other’s files. To conserve system resources, apps with the same user ID can also arrange to run in the same Linux process and share the same VM. The apps must also be signed with the same certificate.

• An app can request permission to access device data such as the device’s location, camera, and Bluetooth connection. The user has to explicitly grant these permissions. For more information, see Working with System Permissions.

There are four different types of app components:

Activities Services Broadcast receivers Content providers

Activities An activity is the entry point for interacting with the user. It represents a single screen with a user interface. For example, an email app might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails. Activities can be stopped and run again. And they can be started from other apps.

An activity facilitates the following key interactions between system and app:

• Keeping track of what the user currently cares about (what is on screen) to ensure that the system keeps running the process that is hosting the activity.

• Knowing that previously used processes contain things the user may return to (stopped activities), and thus more highly prioritize keeping those processes around.

• Helping the app handle having its process killed so the user can return to activities with their previous state restored.

• Providing a way for apps to implement user flows between each other, and for the system to coordinate these flows. (The most classic example here being share.)

Services A service is a general-purpose entry point for keeping an app running in the background for all kinds of reasons. It is a component that runs in the background to perform long-running operations or to perform work for remote processes. A service does not provide a user interface.

For example, a service might play music in the background while the user is in a different app, or it might fetch data over the network without blocking user interaction with an activity. Another component, such as an activity, can start the service and let it run or bind to it in order to interact with it.

Syncing data in the background or playing music also represent two different types of started services that modify how the system handles them:

• Music playback is something the user is directly aware of, so the app tells the system this by saying it wants to be foreground with a notification to tell the user about it; in this case the system knows that it should try really hard to keep that service’s process running, because the user will be unhappy if it goes away.

• A regular background service is not something the user is directly aware as running, so the system has more freedom in managing its process. It may allow it to be killed (and then restarting the service sometime later) if it needs RAM for things that are of more immediate concern to the user.

Bound services run because some other app (or the system) has said that it wants to make use of the service. This is basically the service providing an API to another process. If one service is importent the bound service will also be important.

Broadcast receivers A broadcast receiver is a component that enables the system to deliver events to the app outside of a regular user flow, allowing the app to respond to system-wide broadcast announcements. Because broadcast receivers are another well-defined entry into the app, the system can deliver broadcasts even to apps that aren’t currently running. Apps can kinda communicate with broadcast reciever. More commonly, though, a broadcast receiver is just a gateway to other components and is intended to do a very minimal amount of work. For instance, it might schedule a JobService to perform some work based on the event with JobScheduler

Content provider A content provider manages a shared set of app data that you can store in the file system, in a SQLite database, on the web, or on any other persistent storage location that your app can access. Through the content provider, other apps can query or modify the data if the content provider allows it.

To the system, a content provider is an entry point into an app for publishing named data items, identified by a URI scheme. Thus an app can decide how it wants to map the data it contains to a URI namespace, handing out those URIs to other entities which can in turn use them to access the data. There are a few particular things this allows the system to do in managing an app:

• Assigning a URI doesn’t require that the app remain running, so URIs can persist after their owning apps have exited. The system only needs to make sure that an owning app is still running when it has to retrieve the app’s data from the corresponding URI.

• These URIs also provide an important fine-grained security model. For example, an app can place the URI for an image it has on the clipboard, but leave its content provider locked up so that other apps cannot freely access it. When a second app attempts to access that URI on the clipboard, the system can allow that app to access the data via a temporary URI permission grant so that it is allowed to access the data only behind that URI, but nothing else in the second app.

April 3st, 2021  7

Content providers are also useful for reading and writing data that is private to your app and not shared. A content provider is implemented as a subclass of ContentProvider and must implement a standard set of APIs that enable other apps to perform transactions. For more information, see the Content Providers developer guide.

A unique aspect of the Android system design is that any app can start another app’s component. For example, if you want the user to capture a photo with the device camera, there’s probably another app that does that and your app can use it instead of developing an activity to capture a photo yourself. You don’t need to incorporate or even link to the code from the camera app. Instead, you can simply start the activity in the camera app that captures a photo. When complete, the photo is even returned to your app so you can use it. To the user, it seems as if the camera is actually a part of your app.

When the system starts a component, it starts the process for that app if it’s not already running and instantiates the classes needed for the component. For example, if your app starts the activity in the camera app that captures a photo, that activity runs in the process that belongs to the camera app, not in your app’s process. Therefore, unlike apps on most other systems, Android apps don’t have a single entry point (there’s no main() function).

Because the system runs each app in a separate process with file permissions that restrict access to other apps, your app cannot directly activate a component from another app. However, the Android system can. To activate a component in another app, deliver a message to the system that specifies your intent to start a particular component. The system then activates the component for you.

Thursday, April 5st, 2021

I started a dictionary

Thursday, April 11st, 2021

I’m imforming myself about git. https://www.youtube.com/watch?v=2sjqTHE0zok

Thursday, April 12st, 2021

So right now i’m kindy angry at my self because I didn’t look up what I have to learn to programm a App. Like i have to know the basics of Android UI and Android (I guess its a Ligary.) So now i’m on for a complete tutorial how to make a app https://abhiandroid.com/createandroidapp/

for a quick tutorial how to make a calculater https://abhiandroid.com/createandroidapp/create-calculator-app i just played around a little bit and relized XML is not that hard, just I just have to remeber alot /home/liquid/AndroidStudioProjects/calculater

learning Android https://abhiandroid.com/programming/

Android UI,Layout and Material Design Tutorial, Examples And Code https://abhiandroid.com/ui/

Thursday Simon, April 13st, 2021

We arranged that we work independent till Sunday (18.4.21) on research for the GUI. So that in the end we can exchange our knowlege. and we arranged that we work on Hello world

Thursday, April 13st Noah, 2021

I successfully installed both NDK and SDK on my Arch Linux Desktop PC. Now Android Studio won’t crash on startup.

Thursday, April 14st Simon, 2021

Apps provide multiple entry points The ”main” activity starts when the user taps your app’s icon. You can also direct the user to an activity from elsewhere, such as from a notification or even from a different app. Other components, such as broadcast receivers and services, allow your app to perform background tasks without a UI. After you build your first app, you can learn more about the other app components at Application fundamentals. Apps adapt to different devices Android allows you to provide different resources for different devices. For example, you can create different layouts for different screen sizes. The system determines which layout to use based on the screen size of the current device.

If any of your app’s features need specific hardware, such as a camera, you can query at runtime whether the device has that hardware or not, and then disable the corresponding features if it doesn’t. You can specify that your app requires certain hardware so that Google Play won’t allow the app to be installed on devices without them. After you build your first app, learn more about device configurations at Device compatibility overview. https://developer.android.com/training/basics/firstapp Installed java 8 so i can compile the build.gradle file but for this wasn’t enough time

Wednesday, April 14st Noah, 2021

I sucessfully managed to compile the app https://github.com/aario/snotepad on Arch Linux using the

jdk8-openjdk package.

Also I installed Ubuntu, so I could use the same environment as Simon.

I wrote the adb guide https://noahvogt.com/resources/adb-guide.html and corrected all the errors Simon pointed out to me.

Thursday, April 15st Simon, 2021

I finally could compile the testapp to an apk file.

Monday, April 19st Noah, 2021

Figure 1: Hello World I updated the adb guide as requested from Simon to include the Activation of the Android USB Debbing. I also made some additional changes.

I made a Hello World Program, installed it via adb on my phone and captured this screenshot of it also using adb.

Also, I made a private github repo https://github.com/noahvogt/mini-project.

On there it is planned to work on features in seperate branches that will only be merged into the master branch, when they are in a usable state.

Figure 2: Drawer Navigation Menu I then made the app more functional, so that you have a base GUI with a drawer, a menu in the bottom and in the drawer navigation menu you can tap on the ^{≪}Add Email^{≫} Button and a popup window will come up asking you for name, email and password. Even the save and cancel button work. Now we only need a functionality to save this information to a string somewhere in the main activity.

For this I created a new branch called newemail-popup.

Monday, April 19st Simon, 2021

Interfaces specify what a class must do and not how. It is the blueprint of the class. An Interface is about capabilities like a Player may be an interface and any class implementing Player must be able to (or must implement) move(). So it specifies a set of methods that the class has to implement. If a class implements an interface and does not provide method bodies for all functions specified in the interface, then the class must be declared abstract. A Java library example is Comparator Interface. If a class implements this interface, then it can be used to sort a collection.

Thursday, April 20st Simon, 2021

I’m working on a searchbutton and found a nice website with tutorials https://www.tutorialkart.com/kotlinandroid/android-text-to-speech-kotlin-example/ I found a tutorial for the searchbutton and function https://developer.android.com/guide/topics/search/searchdialog For the mail list https://developer.android.com/guide/topics/ui/layout/recyclerview I downloaded a Programm from git that is an example for a RecycleView /schulmaterial/matur/flower-Poject/

Thursday, April 21st Simon, 2021

1- The RecyclerView object: The overall container for your user interface is a RecylerView object that you add to your layout(You can add this object to your layout after adding its dependency to your build.gradle file). 2- Layout manager: The RecyclerView fills itself with views provided by a layout manager. There are 3 different types of layout managers that can be used: LinearLayoutManager which lays out items vertically or horizontally GridLayoutManager that lays out items in a grid StaggeredGridLayoutManager which lays out items in a staggered grid formation Also, we can implement our own layout manager 3- ViewHolder: The views in the list are represented by the view holder. Each view holder is in charge of displaying a single item with a view. We create a view holder object by extending our class from ReclerView.ViewHolder.

4- Adapter: An adapter manages the ViewHolder objects. It creates not only ViewHolders as needed, but also binds the ViewHolders with their data. We create an adapter by extending our class from RecyclerView.Adapter. 5- List of datasets: A list of datasets that we want to show in our RecyclerView. In this tutorial, we use a list of Strings. I tried to add some tutorials in the emailprogramm for the recycleView but nothing worked https://tutorial.eyehunts.com/android/create-cardview-list-with-recyclerview-android-example/ mostly i tried this one but the implitation of ’com.android.support:design:28.0.0-alpha1’ in build.gradle (:app) didn’t work even when i search on google docs like it say in the tutorial. https://developer.android.com/codelabs/basic-android-kotlin-training-affirmations-app?hl=en#1 was my triy with the impementation https://medium.com/swlh/android-recyclerview-part-1-creating-a-simple-list-d84392c268b0 from there i got a lot of information. I ”Played” alot with /schulmaterial/matur/flowerPoject/views-widgets-samples/RecyclerView/ but I was not able to take Program into the right parts. But now at 9:30 a clock I se a RecyclerViewSimple folder. So maybe tomorrow i my day.

Wednesday, April 20 Noah, 2021

I continued my work on newemail-popup and looked up more ways how we could implement this. I am not sure yet, what we will go for right now.

I also applied the GNU General Public License v3 on all upstream branches. I think it is useful to choose a free license right away, instead of waiting too long.

Wednesday, April 21 Noah, 2021

After Simon mentioned to me that he couldn’t install the unsigned release apk from our build, I tried it myself. It turned out you would have to sign this jar/apk, before your android phone will accept to install it.

So I searched ways how to do it outside of anroid studio, just on the command line. I did try out some software projects and shell scripts, but none of them worked. ADB told me now, that instead of no certificates, I would have inconsistent ones.

So I have successfully wasted 1 - 3 hours on finding out how to sign a apk. But I consider this issue not relevant right now, and in the worst case will be solvable by just using android studio. So I decided to ignore this issue for now and just use the debug apk for now.

Thursday, April 26st Simon, 2021

I deleted the miniProjekt folder and installed the github files again. Also I puted the RecycleViewSimple in the programm but it is not finished yet. The List of the emails starts under the app bar and i think it is not interactive.

Thursday, April 28st Simon, 2021

I’m stil trying to make the RecycleView work. It cannot find the Adapter but i’m working on it. But what came in my mind is that this Recycleviewer is not interactive. So it would just be a list where you can’t click anything so I look in the other examples and found DataBindingDataBoundRecyclerView/ and that might be what we are looking for. Not exactly but there are buttons.

Thursday, April 29st Simon, 2021

implementation ”com.android.support:cardview-v7:28.0.0” implementation ”com.android.support:appcompatv7:28.0.0” I copied this into the build.gradle file for this classes import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView;

Thursday, May 2st Simon, 2021

I saw we have alot of androidx in our programm and I hope everything works with that. minSdkVersion 16 targetSdkVersion 30

these are the versions of our programm. minSdkVersion tells googleplay wich version is as minimum required and tergetSdkVersion is the version we use to programm in. I think thats a little high but it is a little bit late to change that now. But when we want to upload the programm to googleplay we need to have this version.

https://www.c-sharpcorner.com/article/recyclerview-in-andriod-with-java/ I finally unterstand how the important things like CustomAdapter or the data insert works with this example programm. And I now know how the RecyclerView example programm works. What I didn’t had in mind was that it is java and I know how java works and I don’t have to find a example to put in. I just have to unterstand how the classes works and where they are going to be used. I was confuced from the form of coding and the libarys. I made a new xml file called recycler view frag.xml with some things from activity main in it.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/sample_main_layout">
<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <!--android:layout_marginLeft="@dimen/margin_medium"
    android:layout_marginRight="@dimen/margin_medium"
    android:gravity="center_vertical"-->
    <androidx.recyclerview.widget.RecyclerView
       android:id="@+id/recyclerView"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" />
    <!--android:text="@string/element_text"-->
</FrameLayout><!--RelativeLayout from
   https://www.c-sharpcorner.com/article/recyclerview-in-andriod-with-java/
                  and FrameLayout was befor from
                     https://developer.android.com/guide/topics/ui/layout/recyclerview#java-->
</LinearLayout><!-- -->

this is what i added to MainActivity.java The second block is the important one

protected String[] data;
private static final int DATASET_COUNT = 60; //declares how far recyclerview count

//imported by simon 2.mai
//idk realy but it kinda uses the adapter
RecyclerView recyclerView = findViewById(R.id.recyclerView);
CustomAdapter adapter = new CustomAdapter(data);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
/**
 * Generates Strings for RecyclerView's adapter. This data would usually come
 * from a local content provider or remote server.
 * implemented from simon 2.may

 */

private void initDataset() {
    data = new String[DATASET_COUNT];
    for (int i = 0; i < DATASET_COUNT; i++) {
       data[i] = "This is element #" + i;

    }

May 2st Simon, 2021  16

    }

The problem right now at 23:46 is that the app crashes all the time I found some things that made the programm crash.

1. initialing the data maybe has to be done in a finished overitten method

2. all the important things like Adapter defining has to be done in onCreateView and not onCreate.

Thursday, May 5st Simon, 2021

I tried to fix the crash problem in the MainAktivity.java file and the cause for that was that the data variable wasen’t detected because the onCreate() method was just protected and not public. But now it crashes without an error message so idk what the problem is.

May

Thursday, May 20st Simon, 2021

onCreateView(): After the onCreate() is called (in the Fragment), the Fragment’s onCreateView() is called. You can assign your View variables and do any graphical initialisations. You are expected to return a View from this method, and this is the main UI view, but if your Fragment does not use any layouts or graphics, you can return null (happens by default if you don’t override). Noah and were looking for my bug. And the conclusion was that the proble is how the RecyclerView is invoket in the MainActivity. The other problem is i can’t copie it from the programm I used to. So I will look out how you use onCreatView in the Fragment or in oure term I think it is AppCompatActivity but that is not a Fragment so I have to look up somethings.

Thursday, May 23st Simon, 2021

I tried to fix the crash problem with the tutorial from this website: https://guides.codepath.com/android/Usingthe-RecyclerView I changed the CustomAdapter a little bit and somethinks in the xml files. It worked after I changed the +id in the manactifity to recyclerView and the one in recycler view frag.xml to idk tha dosent exist.

Monday, May 24st Noah, 2021

I changed popup.xml to use the Material Design “TextInputLayout” instead of the default “TextEdit”. This allows for much more styling usefule extra features. This lead to me restyling the newemailpopup.

Then I added input validation: For the Name and Password I only have to check that the string is not empty, but for the email I additionaly used a regex the see if the email is valid. It looks like this:

When the Input is correct, a new windows will popup that I styled in provider database checker.xml. I named it that at first, because between the first popup and this it should check if the email domain is in the database of providers. Whatever, in this email you can customize the exact connection settings like port, imap/smtp server and SSL Encryption.

I also added two functions to “MainActivity.java”, namely “showSnackbar” and “showToast”. These are very useful for different debugging output purposes.

Tuesday, May 25st Noah, 2021

I merged the Emailpopup Branch - without the last commit into master. Actually I used git rebase, but next time I think I may just create a new branch out of this commit and git merge this one instead.

After making sure both mini-project and texdiary repos on github were public, I wrote an initial readme for the main repo.

As the SSD om my main desktop PC just randomly broke, I had to setup NoRiSA (my arch bootstrapping scripts) on a other unused SSD I had around to setup a new Android Development Environment.

IIRC, I made some general cleanup and bugfixing too.

Wednesday, May 26st Simon, 2021

On Sunday I fixed the problems with the RecyclerViewer. I changed the CustomAdapter and I made a Data class for the Adapter. I also just have two filles now with the Layout and one with the RecyclerViewer and not three.

Juli

Wednesday, Juli 14st, 2021 Simon

I’m reading a book right now about Database and I’m making the setting Fragment. The Recyclerviewer is a little bit annoying because I don’t want to make a pop-up Window but I don’t know how to get rid of the Recyclerviewer. And I’m not sure in what design I want to make the Settings. Also i should borrow a Book for Interface Standarts. https://source.android.com/devices/tech/settings/settings-guidelines This is a guidline to how to make Settings but I’m not sure if this should be our Desingtype

Saturday, Juli 17st, 2021 Simon

The last days I added a Settings Fragment. You can see through because there is no Background and when you press the back button on the phone the App closes. So you can’t close the Settings. Also I think we shoul make the Settings at the end because we don’t have all functions. With android.R.id.content in this use getSupportFragmentManager() .beginTransaction() .replace(android.R.id.content, new SettingsFragment()) .commit(); I can replace an old Fragment, without knowing the ID of it, with the new one in de SettingsFragment() class.

Monday, Juli 19st, 2021 Simon

Today I had success in adding settings to the app. I used this Tutorial an added the .SettingsAvtivity to the AndroidManifesf with this line ¡activity android:name=”.ui.home.SettingsActivity”/¿ https://www.geeksforgeeks.org/how-to-implement-preferences-settings-screen-in-android/ And I put every raw text into the String file. I wanted to do the same with the dimens but we are not shure how we make the default layout sizes so i thought i might leave it for now.

August

Wednesday, August 11st, 2021 Simon

I started a Database branch and the day befor I read the Database from InboxPager and read the Book. I finished the fist 4 chapters and i think chapter 11 and 9

Thursday, August 12st, 2021 Simon

Today Noah and I want to find the best Database and IMAP Libarys and make some tests to add data from a file in the Adapter and the recyclerviewer

Tuesday, August 13st, 2021 Simon

Today I started writting the matur and I asked Yaki and Bühli some Questions about how I schould write the text etc.

Sunday, August 22st, 2021 Simon

The last days I added an Message Class wich has the variables for one Message and I added the function to change the Input of the Customadapter dependent on the Directory the user is in. I did that with the functions setDraft, setGallery, setSent and the class Message

Wednesday, August 25st, 2021 Simon

I am making a database example app with https://developer.android.com/codelabs/android-room-with-a-view#11 and had a error where the dp were left in a dimen but nothing told me that. Also they use a different button there to add things. We might want to use that one

Monday, August 30st, 2021 Simon

The last days I worked on the example app and could add the Database there for Messages and it was possible to write a message and safe it in the Draft Now I’m adding these to our Programm and I had to delete the Customadapter because it was not necessary

September

Tuesday, September 7st, 2021 Simon

Yesterday I added a changing Recyclerviewer when you click a different folder. At the beginning I hab big problems because the Recyclerviewer was called in the MainActivity in the onCreate function wich was just called when you start the App so I couldn’t use a boolean wich was set true when the fragments are called. So i figured out how I can call the Recyclerviewer from the Fragment. So every time the user clicks on a Folder an new Recyclerviewer is called and reads in the Data. I’m not sure if it reads in the Database every time. Maybe it just reads in the UI created by the ViewModel. Still the Programm uses a lot of Memory and it might be because of the different LiveDatas or the different observer because not idk how often the look for changes. Also i cant use a different Database read in function without wiping the Data from the Virtual machine Today I added new Folders called Spam and Archive. They work the same way like the other Folders.

Wednesday, September 8st, 2021 Simon

Today I managed to read the data from the eamailwriter into the Database by starting the Intent in the messageCreateFragment and reading in the String from there. Adding them to these spezial Strings and calling these String with the data from the MainActivity. Sadly I still use the NewDraftActivity but idk why I have to. Maybe somthing with the Intent or how the obActivityResult is called.