Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
automatic code reformat using Android Studio
  • Loading branch information
udenr committed Jan 18, 2024
1 parent 2fec041 commit d5b1536
Show file tree
Hide file tree
Showing 33 changed files with 215 additions and 225 deletions.
32 changes: 16 additions & 16 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"
android:xlargeScreens="true"/>
android:xlargeScreens="true" />

<application
android:name=".PFAPainDiaryApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:name=".PFAPainDiaryApplication"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">

<provider
Expand All @@ -26,17 +26,17 @@

<activity
android:name="org.secuso.privacyfriendlypaindiary.activities.SplashActivity"
android:theme="@style/SplashTheme"
android:exported="true">
android:exported="true"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="org.secuso.privacyfriendlypaindiary.tutorial.TutorialActivity"
android:theme="@style/AppTheme.NoActionBar">
</activity>
<activity
android:name="org.secuso.privacyfriendlypaindiary.tutorial.TutorialActivity"
android:theme="@style/AppTheme.NoActionBar"></activity>
<activity
android:name="org.secuso.privacyfriendlypaindiary.activities.UserDetailsActivity"
android:label="@string/user_details"
Expand All @@ -58,8 +58,7 @@
<activity
android:name="org.secuso.privacyfriendlypaindiary.activities.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
</activity>
android:theme="@style/AppTheme.NoActionBar"></activity>
<activity
android:name="org.secuso.privacyfriendlypaindiary.activities.AboutActivity"
android:label="@string/about"
Expand Down Expand Up @@ -106,8 +105,7 @@
android:process=":backup"
tools:ignore="ExportedService">
<intent-filter>
<action
android:name="org.secuso.privacyfriendlybackup.api.pfa.PFAAuthService" />
<action android:name="org.secuso.privacyfriendlybackup.api.pfa.PFAAuthService" />
</intent-filter>
</service>

Expand All @@ -117,10 +115,11 @@

</service>

<receiver android:name="org.secuso.privacyfriendlypaindiary.helpers.NotificationJobService$NotificationReceiver"
<receiver
android:name="org.secuso.privacyfriendlypaindiary.helpers.NotificationJobService$NotificationReceiver"
android:exported="false">
<intent-filter>
<action android:name="org.secuso.privacyfriendlypaindiary.action.SNOOZE"/>
<action android:name="org.secuso.privacyfriendlypaindiary.action.SNOOZE" />
</intent-filter>
</receiver>

Expand All @@ -135,8 +134,9 @@
</provider>

</application>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ License, or (at your option) any later version.
import android.os.Handler;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.view.MenuItem;
import android.view.View;

import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
Expand All @@ -31,10 +33,6 @@ License, or (at your option) any later version.
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;

import android.view.MenuItem;
import android.view.View;


import com.google.android.material.navigation.NavigationView;

import org.secuso.privacyfriendlypaindiary.R;
Expand Down Expand Up @@ -94,7 +92,7 @@ public boolean onNavigationItemSelected(MenuItem item) {

protected boolean goToNavigationItem(final int itemId) {

if(itemId == getNavigationDrawerID()) {
if (itemId == getNavigationDrawerID()) {
// just close drawer because we are already in this activity
mDrawerLayout.closeDrawer(GravityCompat.START);
return true;
Expand Down Expand Up @@ -122,7 +120,7 @@ public void run() {

// set active navigation item
private void selectNavigationItem(int itemId) {
for(int i = 0 ; i < mNavigationView.getMenu().size(); i++) {
for (int i = 0; i < mNavigationView.getMenu().size(); i++) {
boolean b = itemId == mNavigationView.getMenu().getItem(i).getItemId();
mNavigationView.getMenu().getItem(i).setChecked(b);
}
Expand All @@ -131,6 +129,7 @@ private void selectNavigationItem(int itemId) {
/**
* Enables back navigation for activities that are launched from the NavBar. See
* {@code AndroidManifest.xml} to find out the parent activity names for each activity.
*
* @param intent
*/
private void createBackStack(Intent intent) {
Expand All @@ -147,13 +146,14 @@ private void createBackStack(Intent intent) {
/**
* This method manages the behaviour of the navigation drawer
* Add your menu items (ids) to res/menu/activity_main_drawer.xml
*
* @param itemId Item that has been clicked by the user
*/
private void callDrawerItem(final int itemId) {

Intent intent;

switch(itemId) {
switch (itemId) {
case R.id.nav_main:
intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Expand Down Expand Up @@ -183,8 +183,8 @@ private void callDrawerItem(final int itemId) {
break;
case R.id.nav_settings:
intent = new Intent(this, SettingsActivity.class);
intent.putExtra( PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.GeneralPreferenceFragment.class.getName() );
intent.putExtra( PreferenceActivity.EXTRA_NO_HEADERS, true );
intent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsActivity.GeneralPreferenceFragment.class.getName());
intent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true);
createBackStack(intent);
break;
default:
Expand All @@ -196,7 +196,7 @@ protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if(getSupportActionBar() == null) {
if (getSupportActionBar() == null) {
setSupportActionBar(toolbar);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ License, or (at your option) any later version.
import com.bumptech.glide.request.transition.Transition;

import org.secuso.privacyfriendlypaindiary.R;
import org.secuso.privacyfriendlypaindiary.database.DBServiceInterface;
import org.secuso.privacyfriendlypaindiary.database.entities.enums.BodyRegion;
import org.secuso.privacyfriendlypaindiary.database.entities.enums.Condition;
import org.secuso.privacyfriendlypaindiary.database.entities.enums.PainQuality;
Expand Down Expand Up @@ -149,7 +148,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_diaryentry);

if(savedInstanceState != null) {
if (savedInstanceState != null) {
currentPage = savedInstanceState.getInt("current");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ License, or (at your option) any later version.

import android.Manifest;
import android.app.DatePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.pdf.PdfDocument;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.DatePicker;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
Expand All @@ -36,10 +38,6 @@ License, or (at your option) any later version.
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;

import android.view.View;
import android.widget.DatePicker;
import android.widget.Toast;

import com.google.android.material.textfield.TextInputLayout;

import org.secuso.privacyfriendlypaindiary.R;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ License, or (at your option) any later version.
import com.google.android.material.textfield.TextInputLayout;

import org.secuso.privacyfriendlypaindiary.R;
import org.secuso.privacyfriendlypaindiary.database.DBServiceInterface;
import org.secuso.privacyfriendlypaindiary.database.entities.enums.Gender;
import org.secuso.privacyfriendlypaindiary.database.entities.impl.AbstractPersistentObject;
import org.secuso.privacyfriendlypaindiary.database.entities.impl.User;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.secuso.privacyfriendlypaindiary.backup

import android.content.Context
import android.content.SharedPreferences
import android.database.sqlite.SQLiteDatabase
import android.preference.PreferenceManager
import android.util.JsonWriter
import android.util.Log
Expand Down Expand Up @@ -36,7 +35,7 @@ class BackupCreator : IBackupCreator {
PreferenceManager.getDefaultSharedPreferences(context.applicationContext)
writePreferences(writer, pref)
writer.name("preferences2")
val prefTutorialActivity : SharedPreferences =
val prefTutorialActivity: SharedPreferences =
context.getSharedPreferences(PrefManager.PREF_NAME, PrefManager.PRIVATE_MODE)
writePreferences(writer, prefTutorialActivity)
Log.d("PFA BackupCreator", "Writing files")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ import org.secuso.privacyfriendlypaindiary.database.entities.interfaces.DiaryEnt
import org.secuso.privacyfriendlypaindiary.database.entities.interfaces.DrugIntakeInterface
import org.secuso.privacyfriendlypaindiary.database.entities.interfaces.DrugInterface
import org.secuso.privacyfriendlypaindiary.database.entities.interfaces.UserInterface
import org.secuso.privacyfriendlypaindiary.database.model.*
import java.util.*
import org.secuso.privacyfriendlypaindiary.database.model.DiaryEntry
import org.secuso.privacyfriendlypaindiary.database.model.Drug
import org.secuso.privacyfriendlypaindiary.database.model.DrugIntake
import org.secuso.privacyfriendlypaindiary.database.model.PainDescription
import org.secuso.privacyfriendlypaindiary.database.model.User
import java.util.Calendar
import java.util.Date

class PainDiaryDatabaseService private constructor(context: Context) : DBServiceInterface {
private var database: PainDiaryDatabase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package org.secuso.privacyfriendlypaindiary.database.dao

import androidx.room.*
import org.secuso.privacyfriendlypaindiary.database.model.DiaryEntry
import org.secuso.privacyfriendlypaindiary.database.model.Drug
import java.util.*

@Dao
interface DiaryEntryDao {
@Insert
fun insert(diaryEntry: DiaryEntry) : Long
fun insert(diaryEntry: DiaryEntry): Long

@Update
fun update(diaryEntry: DiaryEntry)
Expand All @@ -29,7 +28,7 @@ interface DiaryEntryDao {
fun deleteDiaryEntryByID(id: Long)

@Query("SELECT MAX(_id) FROM diaryentries")
fun getIDOfLatestDiaryEntry() : Long
fun getIDOfLatestDiaryEntry(): Long

@Query("SELECT date FROM diaryentries WHERE date >= :startDate AND date <= :endDate ORDER BY DATE(date) asc")
fun getDatesByDateRange(startDate: Date, endDate: Date): Array<Date>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.secuso.privacyfriendlypaindiary.database.model.Drug
@Dao
interface DrugDao {
@Insert
fun insert(drug: Drug) : Long
fun insert(drug: Drug): Long

@Update
fun update(drug: Drug)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package org.secuso.privacyfriendlypaindiary.database.dao

import androidx.room.*
import org.secuso.privacyfriendlypaindiary.database.model.DiaryEntry
import org.secuso.privacyfriendlypaindiary.database.model.PainDescription

@Dao
interface PainDescriptionDao {
@Insert
fun insert(painDescription: PainDescription) : Long
fun insert(painDescription: PainDescription): Long

@Update
fun update(painDescription: PainDescription)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package org.secuso.privacyfriendlypaindiary.database.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import org.secuso.privacyfriendlypaindiary.database.model.User

@Dao
interface UserDao {
@Insert
fun insert(user: User) : Long
fun insert(user: User): Long

@Update
fun update(user: User)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ License, or (at your option) any later version.

import org.secuso.privacyfriendlypaindiary.R;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ License, or (at your option) any later version.

import org.secuso.privacyfriendlypaindiary.R;

import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ License, or (at your option) any later version.
*/
package org.secuso.privacyfriendlypaindiary.database.entities.impl;

import org.secuso.privacyfriendlypaindiary.database.entities.interfaces.DiaryEntryInterface;
import org.secuso.privacyfriendlypaindiary.database.entities.enums.Condition;
import org.secuso.privacyfriendlypaindiary.database.entities.interfaces.DiaryEntryInterface;
import org.secuso.privacyfriendlypaindiary.database.entities.interfaces.DrugIntakeInterface;
import org.secuso.privacyfriendlypaindiary.database.entities.interfaces.PainDescriptionInterface;

Expand Down Expand Up @@ -72,8 +72,8 @@ public DiaryEntry(Date date, Condition condition, PainDescriptionInterface painD
this.condition = condition;
this.painDescription = painDescription;
this.notes = notes;
if(intakes != null) {
for(DrugIntakeInterface intake : intakes) {
if (intakes != null) {
for (DrugIntakeInterface intake : intakes) {
addDrugIntake(intake);
}
}
Expand Down Expand Up @@ -138,8 +138,8 @@ public void removeDrugIntake(DrugIntakeInterface intake) {

@Override
public DrugIntakeInterface getDrugIntakeByID(long id) {
for(DrugIntakeInterface intake : intakes) {
if(intake.getObjectID() == id) {
for (DrugIntakeInterface intake : intakes) {
if (intake.getObjectID() == id) {
return intake;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ License, or (at your option) any later version.
*/
package org.secuso.privacyfriendlypaindiary.database.entities.impl;

import org.secuso.privacyfriendlypaindiary.database.entities.interfaces.UserInterface;
import org.secuso.privacyfriendlypaindiary.database.entities.enums.Gender;
import org.secuso.privacyfriendlypaindiary.database.entities.interfaces.UserInterface;

import java.util.Date;

Expand Down
Loading

0 comments on commit d5b1536

Please sign in to comment.