Skip to content

Commit

Permalink
some translations in germany,
Browse files Browse the repository at this point in the history
little gui improvments
notificatoion
  • Loading branch information
amarradi committed Jul 27, 2023
1 parent 9f46ed2 commit 035706e
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ protected void onCreate(Bundle savedInstanceState) {
this.name = (TextView) findViewById(R.id.editor_name);
this.list = (ListView) findViewById(R.id.editor_list);

name.setTextColor(getResources().getColor(R.color.white));


// check if contact id is valid
this.db = new Database(getContentResolver());
int contactId = getIntent().getIntExtra(CONTACT_ID, NO_CONTACT_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
Expand Down Expand Up @@ -52,7 +51,6 @@ public class BirthdayReminder extends ListActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
createNotificationChannel();
getListView().setFastScrollEnabled(true);



Expand Down Expand Up @@ -111,6 +109,7 @@ protected void onResume() {

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSIONS_REQUEST_READ_CONTACTS) {
if (isContactsPermissionGranted()) {
updateView();
Expand All @@ -122,17 +121,19 @@ public void onRequestPermissionsResult(int requestCode, String[] permissions, in

private void updateView() {
// create new list adapter
Log.d("updateView", "true");
MultiListAdapter listAdapter = new MultiListAdapter();

MultiListAdapter listAdapter = new MultiListAdapter();
List<ListAdapter> adapterList = listAdapter.getListAdapters();



// load birthday and contact information
List<Contact> contacts = this.db.getAllContacts();
List<BirthContact> birthContacts = BirthContactHelper.createBirthContactList(contacts);

// group all contacts by known and unknown birthday
SortedSet<BirthContact> knownBirthdays = new TreeSet<BirthContact>(new BirthContactBirthdayComparator());

SortedSet<BirthContact> unknownBirthdays = new TreeSet<BirthContact>(new BirthContactNameComparator());

for (BirthContact birthContact : birthContacts) {
Expand All @@ -156,22 +157,28 @@ private void updateView() {

currentBirthContactAdapter = new BirthContactAdapter(this);
adapterList.add(new CategoryAdapter(this, monthStrs[currentMonth]));


adapterList.add(currentBirthContactAdapter);
}

currentBirthContactAdapter.add(birthContact);


}

adapterList.add(new CategoryAdapter(this, getResources().getString(R.string.unknownBirthdays)));

adapterList.add(new BirthContactAdapter(this, unknownBirthdays));


setListAdapter(listAdapter);
}

@SuppressLint("ResourceAsColor")
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
BirthContact birthContact = (BirthContact) l.getAdapter().getItem(position);

Intent editorIntent = new Intent(this, BirthdayEditor.class);
editorIntent.putExtra(BirthdayEditor.CONTACT_ID, birthContact.getContact().getId());
startActivity(editorIntent);
Expand Down Expand Up @@ -201,4 +208,5 @@ public boolean onOptionsItemSelected(MenuItem item) {

return super.onOptionsItemSelected(item);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.PreferenceActivity;

import androidx.preference.Preference;

import de.ubuntix.android.birthdayreminder.database.Preferences;
import de.ubuntix.android.birthdayreminder.service.BirthdayBroadcastReceiver;

Expand All @@ -19,6 +22,7 @@ public class PreferenceWindow extends PreferenceActivity implements OnSharedPref
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private void notifyBirthdays(Context context) {
builder.setWhen(System.currentTimeMillis());
builder.setContentTitle(titleText);
builder.setColorized(true);
builder.setColor(res.getColor(R.color.br_blue_notification));
builder.setColor(res.getColor(R.color.blue));
builder.setCategory(Notification.CATEGORY_REMINDER);
builder.setPriority(Notification.PRIORITY_HIGH);
builder.setVisibility(Notification.VISIBILITY_PUBLIC);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package de.ubuntix.android.birthdayreminder.view.adapter;



import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import de.ubuntix.android.birthdayreminder.R;

public class CategoryAdapter extends BaseAdapter {

private final String name;
Expand Down Expand Up @@ -36,6 +41,7 @@ public long getItemId(int position) {
return position;
}

@SuppressLint("ResourceAsColor")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView categoryView;
Expand All @@ -44,7 +50,6 @@ public View getView(int position, View convertView, ViewGroup parent) {
} else {
categoryView = (TextView) convertView;
}

categoryView.setText(this.name);
return categoryView;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

import java.util.ArrayList;
import java.util.List;
import java.util.SortedSet;

import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;

import de.ubuntix.android.birthdayreminder.view.helper.BirthContact;

public class MultiListAdapter extends BaseAdapter {

private final List<ListAdapter> listAdapters = new ArrayList<ListAdapter>();
Expand Down Expand Up @@ -47,6 +50,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
int positionOffset = 0;
for (ListAdapter listAdapter : this.listAdapters) {
if (position - positionOffset < listAdapter.getCount()) {

return listAdapter.getView(position - positionOffset, convertView, parent);
}
positionOffset += listAdapter.getCount();
Expand Down
30 changes: 16 additions & 14 deletions app/src/main/res/layout/birth_contact.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black"
android:orientation="vertical"
android:padding="5dp">

android:orientation="vertical"
android:padding="5dp">
<TextView
android:id="@+id/name"
android:textColor="@color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
android:id="@+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/lightgreen" />

</LinearLayout>
7 changes: 5 additions & 2 deletions app/src/main/res/layout/editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

android:orientation="vertical">
android:background="@color/black"
android:orientation="vertical"
android:gravity="end">

<TextView
android:id="@+id/editor_name"
Expand All @@ -15,6 +16,8 @@

<ListView
android:id="@+id/editor_list"

android:background="@color/black"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical" />
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/res/layout/editor_account.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

android:background="@color/black"
android:orientation="horizontal" >

<ImageView
Expand All @@ -16,17 +16,20 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/black"
android:orientation="vertical"
android:paddingLeft="5dp" >

<TextView
android:id="@+id/editor_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/grey"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:id="@+id/editor_name"
android:textColor="@color/grey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" />
Expand All @@ -35,7 +38,7 @@
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"

android:background="@color/black"
android:gravity="right|center_vertical" >

<Button
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/editor_dateofbirth.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="9dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
android:textColor="@color/white"
android:textAppearance="?android:attr/textAppearanceMedium" />
12 changes: 10 additions & 2 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="preferences_name">Birthday Reminder Einstellungen</string>

<string name="title">%s</string>
<string name="knownBirthdays">Bevorstehende Geburtstage</string>
<string name="unknownBirthdays">Geburtstage unbekannt</string>
Expand Down Expand Up @@ -28,11 +30,17 @@

<string name="ok">OK</string>
<string name="cancel">Abbrechen</string>
<string name="add_date_of_birth">Geburtstag hinzufügen</string>

<string name="new_birthday">+</string>
<string name="editor_phone">Telefon</string>
<string name="no_contacts_permission">Keine Berechtigung zum Lesen und Ändern von Kontakten</string>
<string name="daysbefore">Anzahl der Tage vor der Benachrichtigung</string>
<string name="hideNotification">Benachrichtigung nach dem öffnen verschwinden lassen</string>
<string name="daysbefore">Erinnerung wie viel Tage vorher</string>
<string name="hideNotification">Benachrichtigung</string>
<string name="notificationTime">Zeit der Benachrichtigung</string>
<string name="activate_summaryOn">Benachrichtigung ist eingeschaltet</string>
<string name="activate_summaryOff">Benachrichtigung ist ausgeschaltet</string>
<string name="hideNotification_summaryOff">Die Benachrichtigung wird nicht ausgeblendet</string>
<string name="hideNotification_summaryOn">Die Benachrichtigung wird ausgeblendet</string>

</resources>
8 changes: 6 additions & 2 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="br_blue_notification">#0d65c0</color>
</resources>
<color name="blue">#0d65c0</color>
<color name="black">#000000</color>
<color name="grey">#a0a0a0</color>
<color name="lightgreen">#22AA22</color>
<color name="white">#FFFFFF</color>
</resources>
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
<string name="activate_reminder_service">Activate reminder service</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="account_icon">account icon</string>
<string name="account_icon" translatable="false">account icon</string>
<string name="add_date_of_birth">add date of birth</string>
<string name="new_birthday">+</string>
<string name="editor_phone">Phone</string>
<string name="no_contacts_permission">No permission to read and write contacts</string>


<string name="notificationChannelName" translatable="false">BirthdayReminderNotification</string>
<string name="notificationChannelName" translatable="false">Birthday Reminder notification</string>
<string name="notificationDescription" translatable="false">Notification to show the next birthdays</string>
<string name="daysbefore">Days before reminder</string>
<string name="hideNotification">Hide notification after confirmation</string>
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
>

<CheckBoxPreference
android:defaultValue="true"
Expand Down Expand Up @@ -30,4 +31,5 @@
android:summary="You will be notified at @value o&apos;clock"
android:title="@string/notificationTime" />


</PreferenceScreen>

0 comments on commit 035706e

Please sign in to comment.