1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-09-20 03:39:08 -05:00

Add dark theme (#133)

This commit is contained in:
Mikołaj Pich 2018-06-14 11:40:46 +02:00 committed by Rafał Borcz
parent b63e28f9a9
commit 11578aa735
49 changed files with 221 additions and 108 deletions

View File

@ -14,7 +14,6 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/WulkanowyTheme">
<activity
android:name=".ui.splash.SplashActivity"
@ -31,20 +30,20 @@
android:name=".ui.login.LoginActivity"
android:configChanges="orientation|screenSize"
android:label="@string/title_activity_login"
android:theme="@style/WulkanowyTheme.LoginTheme"
android:theme="@style/WulkanowyTheme.DarkActionBar"
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".ui.main.MainActivity"
android:configChanges="orientation|screenSize"
android:label="@string/activity_dashboard_text"
android:launchMode="singleTop"
android:theme="@style/WulkanowyTheme" />
/>
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/WulkanowyTheme.LoginTheme" />
android:theme="@style/WulkanowyTheme.DarkActionBar" />
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:theme="@style/WulkanowyTheme.LoginTheme" />
android:theme="@style/WulkanowyTheme.DarkActionBar" />
<service
android:name=".services.jobs.SyncJob"

View File

@ -21,6 +21,8 @@ public interface SharedPrefContract {
boolean isShowAttendancePresent();
int getCurrentTheme();
int getServicesInterval();
boolean isMobileDisable();

View File

@ -69,6 +69,11 @@ public class SharedPrefRepository implements SharedPrefContract {
return settingsSharedPref.getBoolean(SettingsFragment.SHARED_KEY_ATTENDANCE_PRESENT, false);
}
@Override
public int getCurrentTheme() {
return Integer.parseInt(settingsSharedPref.getString(SettingsFragment.SHARED_KEY_THEME, "1"));
}
@Override
public int getServicesInterval() {
return Integer.parseInt(settingsSharedPref.getString(SettingsFragment.SHARED_KEY_SERVICES_INTERVAL, "60"));

View File

@ -54,5 +54,6 @@ public abstract class BaseActivity extends DaggerAppCompatActivity implements Ba
if (unbinder != null) {
unbinder.unbind();
}
invalidateOptionsMenu();
}
}

View File

@ -2,7 +2,6 @@ package io.github.wulkanowy.ui.main;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.AppBarLayout;
@ -19,6 +18,7 @@ import javax.inject.Named;
import butterknife.BindView;
import io.github.wulkanowy.R;
import io.github.wulkanowy.data.RepositoryContract;
import io.github.wulkanowy.services.jobs.SyncJob;
import io.github.wulkanowy.ui.base.BaseActivity;
import io.github.wulkanowy.ui.base.BasePagerAdapter;
@ -27,6 +27,7 @@ import io.github.wulkanowy.ui.main.exams.ExamsFragment;
import io.github.wulkanowy.ui.main.grades.GradesFragment;
import io.github.wulkanowy.ui.main.settings.SettingsFragment;
import io.github.wulkanowy.ui.main.timetable.TimetableFragment;
import io.github.wulkanowy.utils.CommonUtils;
public class MainActivity extends BaseActivity implements MainContract.View,
AHBottomNavigation.OnTabSelectedListener, OnFragmentIsReadyListener {
@ -52,6 +53,9 @@ public class MainActivity extends BaseActivity implements MainContract.View,
@Inject
MainContract.Presenter presenter;
@Inject
RepositoryContract repository;
public static Intent getStartIntent(Context context) {
return new Intent(context, MainActivity.class);
}
@ -93,6 +97,7 @@ public class MainActivity extends BaseActivity implements MainContract.View,
public boolean onTabSelected(int position, boolean wasSelected) {
presenter.onTabSelected(position, wasSelected);
appBar.setExpanded(true, true);
invalidateOptionsMenu();
return true;
}
@ -124,8 +129,8 @@ public class MainActivity extends BaseActivity implements MainContract.View,
R.drawable.ic_menu_other_24dp));
bottomNavigation.setAccentColor(getResources().getColor(R.color.colorPrimary));
bottomNavigation.setInactiveColor(Color.BLACK);
bottomNavigation.setBackgroundColor(getResources().getColor(R.color.colorBackgroundBottomNav));
bottomNavigation.setInactiveColor(CommonUtils.getThemeAttrColor(this, android.R.attr.textColorTertiary));
bottomNavigation.setDefaultBackgroundColor(CommonUtils.getThemeAttrColor(this, R.attr.bottomNavBackground));
bottomNavigation.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW);
bottomNavigation.setOnTabSelectedListener(this);
bottomNavigation.setCurrentItem(tabPosition);

View File

@ -78,7 +78,7 @@ public class AttendanceDialogFragment extends DialogFragment {
description.setText(lesson.getDescription());
if (lesson.getAbsenceUnexcused()) {
description.setTextColor(getResources().getColor(R.color.colorPrimaryDark));
description.setTextColor(getResources().getColor(R.color.colorPrimary));
}
return view;

View File

@ -14,7 +14,6 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.List;
import butterknife.BindColor;
import butterknife.BindView;
import butterknife.ButterKnife;
import eu.davidea.flexibleadapter.FlexibleAdapter;
@ -23,6 +22,7 @@ import eu.davidea.flexibleadapter.items.IFlexible;
import eu.davidea.viewholders.ExpandableViewHolder;
import io.github.wulkanowy.R;
import io.github.wulkanowy.data.db.dao.entities.Day;
import io.github.wulkanowy.utils.CommonUtils;
public class AttendanceHeader
extends AbstractExpandableHeaderItem<AttendanceHeader.HeaderViewHolder, AttendanceSubItem> {
@ -86,15 +86,6 @@ public class AttendanceHeader
@BindView(R.id.attendance_header_free_name)
TextView freeName;
@BindColor(R.color.secondary_text)
int secondaryColor;
@BindColor(R.color.free_day)
int backgroundFreeDay;
@BindColor(android.R.color.black)
int black;
private Context context;
HeaderViewHolder(View view, FlexibleAdapter adapter) {
@ -117,16 +108,15 @@ public class AttendanceHeader
setInactiveHeader(item.getAttendanceLessons().isEmpty());
}
private void setInactiveHeader(boolean inactive) {
((FrameLayout) getContentView()).setForeground(inactive ? null : getSelectableDrawable());
dayName.setTextColor(inactive ? secondaryColor : black);
dayName.setTextColor(CommonUtils.getThemeAttrColor(context,
inactive ? android.R.attr.textColorSecondary : android.R.attr.textColorPrimary));
if (inactive) {
getContentView().setBackgroundColor(backgroundFreeDay);
getContentView().setBackgroundColor(CommonUtils.getThemeAttrColor(context, R.attr.colorControlHighlight));
} else {
getContentView().setBackgroundDrawable(context.getResources()
.getDrawable(R.drawable.ic_border));
getContentView().setBackgroundDrawable(context.getResources().getDrawable(R.drawable.ic_border));
}
}

View File

@ -88,7 +88,9 @@ public class GradesFragment extends BaseFragment implements GradesContract.View
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
inflater.inflate(R.menu.grades_action_menu, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override

View File

@ -5,6 +5,7 @@ import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatDelegate;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceFragmentCompat;
import android.widget.Toast;
@ -14,6 +15,7 @@ import com.google.android.gms.oss.licenses.OssLicensesMenuActivity;
import io.github.wulkanowy.BuildConfig;
import io.github.wulkanowy.R;
import io.github.wulkanowy.services.jobs.SyncJob;
import io.github.wulkanowy.ui.main.MainActivity;
import io.github.wulkanowy.utils.AppConstant;
public class SettingsFragment extends PreferenceFragmentCompat
@ -25,6 +27,8 @@ public class SettingsFragment extends PreferenceFragmentCompat
public static final String SHARED_KEY_ATTENDANCE_PRESENT = "attendance_present";
public static final String SHARED_KEY_THEME = "theme";
public static final String SHARED_KEY_SERVICES_ENABLE = "services_enable";
public static final String SHARED_KEY_NOTIFY_ENABLE = "notify_enable";
@ -39,6 +43,10 @@ public class SettingsFragment extends PreferenceFragmentCompat
public static final String SHARED_KEY_ABOUT_REPO = "about_repo";
private boolean isStarted;
private boolean isVisible;
private Preference.OnPreferenceClickListener onProgrammerListener = new Preference.OnPreferenceClickListener() {
private int clicks = 0;
@ -93,6 +101,20 @@ public class SettingsFragment extends PreferenceFragmentCompat
launchServices(sharedPreferences.getBoolean(SHARED_KEY_SERVICES_ENABLE, true),
sharedPreferences);
}
if (key.equals(SHARED_KEY_THEME)) {
setCurrentTheme(sharedPreferences);
}
}
private void setCurrentTheme(SharedPreferences sharedPreferences) {
AppCompatDelegate.setDefaultNightMode(Integer.parseInt(sharedPreferences.getString(SHARED_KEY_THEME, "1")));
getActivity().finish();
startActivity(MainActivity
.getStartIntent(getContext())
.putExtra(MainActivity.EXTRA_CARD_ID_KEY, 4)
);
getActivity().overridePendingTransition(0, 0);
}
private void launchServices(boolean start, SharedPreferences sharedPref) {
@ -107,12 +129,26 @@ public class SettingsFragment extends PreferenceFragmentCompat
}
}
@Override
public void setMenuVisibility(boolean menuVisible) {
super.setMenuVisibility(menuVisible);
if (menuVisible) {
private void setTitle() {
getActivity().setTitle(R.string.settings_text);
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
isVisible = isVisibleToUser;
if (isVisible && isStarted) {
setTitle();
}
}
@Override
public void onStart() {
super.onStart();
isStarted = true;
if (isVisible) {
setTitle();
}
}
@Override
@ -128,4 +164,10 @@ public class SettingsFragment extends PreferenceFragmentCompat
getPreferenceScreen().getSharedPreferences()
.unregisterOnSharedPreferenceChangeListener(this);
}
@Override
public void onStop() {
super.onStop();
isStarted = false;
}
}

View File

@ -14,7 +14,6 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.List;
import butterknife.BindColor;
import butterknife.BindView;
import butterknife.ButterKnife;
import eu.davidea.flexibleadapter.FlexibleAdapter;
@ -23,6 +22,7 @@ import eu.davidea.flexibleadapter.items.IFlexible;
import eu.davidea.viewholders.ExpandableViewHolder;
import io.github.wulkanowy.R;
import io.github.wulkanowy.data.db.dao.entities.Day;
import io.github.wulkanowy.utils.CommonUtils;
public class TimetableHeader
extends AbstractExpandableHeaderItem<TimetableHeader.HeaderViewHolder, TimetableSubItem> {
@ -83,15 +83,6 @@ public class TimetableHeader
@BindView(R.id.timetable_header_free_name)
TextView freeName;
@BindColor(R.color.secondary_text)
int secondaryColor;
@BindColor(R.color.free_day)
int backgroundFreeDay;
@BindColor(android.R.color.black)
int black;
private Context context;
HeaderViewHolder(View view, FlexibleAdapter adapter) {
@ -112,13 +103,13 @@ public class TimetableHeader
private void setInactiveHeader(boolean inactive) {
((FrameLayout) getContentView()).setForeground(inactive ? null : getSelectableDrawable());
dayName.setTextColor(inactive ? secondaryColor : black);
dayName.setTextColor(CommonUtils.getThemeAttrColor(context,
inactive ? android.R.attr.textColorSecondary : android.R.attr.textColorPrimary));
if (inactive) {
getContentView().setBackgroundColor(backgroundFreeDay);
getContentView().setBackgroundColor(CommonUtils.getThemeAttrColor(context, R.attr.colorControlHighlight));
} else {
getContentView().setBackgroundDrawable(context.getResources()
.getDrawable(R.drawable.ic_border));
getContentView().setBackgroundDrawable(context.getResources().getDrawable(R.drawable.ic_border));
}
}

View File

@ -1,6 +1,7 @@
package io.github.wulkanowy.ui.splash;
import android.os.Bundle;
import android.support.v7.app.AppCompatDelegate;
import javax.inject.Inject;
@ -38,6 +39,10 @@ public class SplashActivity extends BaseActivity implements SplashContract.View
finish();
}
public void setCurrentThemeMode(int mode) {
AppCompatDelegate.setDefaultNightMode(mode);
}
@Override
public void cancelNotifications() {
new NotificationService(getApplicationContext()).cancelAll();

View File

@ -11,6 +11,8 @@ public interface SplashContract {
void openMainActivity();
void cancelNotifications();
void setCurrentThemeMode(int mode);
}
interface Presenter extends BaseContract.Presenter<View> {

View File

@ -18,6 +18,7 @@ public class SplashPresenter extends BasePresenter<SplashContract.View>
@Override
public void attachView(@NonNull SplashContract.View view) {
super.attachView(view);
getView().setCurrentThemeMode(getRepository().getSharedRepo().getCurrentTheme());
getView().cancelNotifications();
if (getRepository().getSharedRepo().isUserLoggedIn()) {

View File

@ -1,7 +1,11 @@
package io.github.wulkanowy.utils;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.net.Uri;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
import android.support.customtabs.CustomTabsIntent;
import io.github.wulkanowy.R;
@ -37,4 +41,14 @@ public final class CommonUtils {
return R.string.noColor_text;
}
}
@ColorInt
public static int getThemeAttrColor(Context context, @AttrRes int colorAttr) {
final TypedArray array = context.obtainStyledAttributes(null, new int[]{colorAttr});
try {
return array.getColor(0, 0);
} finally {
array.recycle();
}
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:centerColor="@android:color/transparent"
android:centerX="0.01"
android:startColor="#494949" />
</shape>

View File

@ -5,7 +5,7 @@
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#ffffff"
android:fillColor="#000"
android:pathData="M22 13l-1 1-2-2 1-1 2 2m-10 6l6-6 2 2-6
6h-2v-2M4 2h14a2 2 0 0 1 2 2v4l-4 4h-4v4l-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 4v4h6V6H4m8
0v4h6V6h-6m-8 6v4h6v-4H4z" />

View File

@ -4,7 +4,7 @@
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#FFF"
android:fillColor="#000"
android:pathData="M17,12h-5v5h5v-5zM16,1v2L8,3L8,1L6,1v2L5,3a2,2 0,0 0,-2 2v14c0,1.1 0.9,2
2,2h14a2,2 0,0 0,2 -2L21,5a2,2 0,0 0,-2 -2h-1L18,1h-2zM19,19L5,19L5,8h14v11z" />
</vector>

View File

@ -4,7 +4,7 @@
android:viewportHeight="26"
android:viewportWidth="26">
<path
android:fillColor="#FFF"
android:fillColor="#000"
android:pathData="M13 11h2v2h-2m0 2h2a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2h-2V7h4V5h-4a2 2 0 0 0-2
2v6c0 1.1 0.9 2 2 2m8 2H7V3h14m0-2H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V3a2
2 0 0 0-2-2M3 5H1v16a2 2 0 0 0 2 2h16v-2H3V5z" />

View File

@ -5,7 +5,7 @@
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#ffffff"
android:fillColor="#000"
android:pathData="M19.4 13l 0.1-1-0.1-1 2.1-1.5c 0.2-0.1 0.3-0.4 0.1-0.7l-2-3.5c-0.1-0.3-0.4
-0.4-0.6-0.3l-2.4 1.1c-0.5-0.4-1.2-0.8-1.8-1l-0.3-2.6c0-0.3-0.2-0.5-0.5-0.5h-4c-0.3 0-0.5
0.2-0.5 0.5L9.2 5c-0.7 0.3-1.3 0.6-1.8 1L5 5a 0.5 0.5 0 0 0-0.6 0.2l-2 3.5c-0.2 0.3-0.2 0.6

View File

@ -5,7 +5,7 @@
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#ffffff"
android:fillColor="#000"
android:pathData="M14 14H7v2h7m5 3H5V8h14m0-5h-1V1h-2v2H8V1H6v2H5a2
2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m-2 7H7v2h10v-2z" />
</vector>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#000000"
android:pathData="M6 2l4 4-1 3-3 1-4-4c0 2 0 5 2 7 3 2 6 0 7 1l6 7h4v-4l-7-6c-1-1
1-4-1-7-2-2-5-2-7-2zm14 17l-1 1-1-1 1-1 1 1z" />
</vector>

View File

@ -144,6 +144,7 @@
android:background="?attr/selectableItemBackground"
android:focusable="true"
android:text="@string/generic_dialog_close"
android:textColor="?android:attr/android:textColorSecondary"
android:textAllCaps="true"
android:textSize="15sp" />

View File

@ -39,7 +39,7 @@
android:layout_marginTop="5dp"
android:maxLines="1"
android:text="@string/app_name"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="14sp" />
<TextView
@ -54,7 +54,7 @@
android:layout_marginTop="5dp"
android:maxLines="1"
android:text="@string/app_name"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="14sp" />
<TextView
@ -69,7 +69,7 @@
android:gravity="end"
android:maxLines="2"
android:text="@string/attendance_no_entries"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="16sp" />
<ImageView

View File

@ -13,7 +13,6 @@
android:foreground="?attr/selectableItemBackgroundBorderless"
card_view:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -61,7 +60,7 @@
android:layout_alignStart="@id/attendance_subItem_lesson"
android:maxLines="1"
android:text="@string/grades_text"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="12sp" />
<ImageView

View File

@ -4,5 +4,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="@color/colorPrimaryDark"
android:textColor="?attr/colorPrimary"
android:textSize="14sp" />

View File

@ -169,6 +169,7 @@
android:background="?attr/selectableItemBackground"
android:focusable="true"
android:text="@string/generic_dialog_close"
android:textColor="?android:attr/android:textColorSecondary"
android:textAllCaps="true"
android:textSize="15sp" />

View File

@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#EEE"
android:background="?attr/colorControlHighlight"
android:minHeight="40dp"
android:paddingBottom="10dp"
android:paddingLeft="20dp"

View File

@ -1,6 +1,6 @@
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/attendance_tab_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -25,7 +25,7 @@
android:layout_height="match_parent"
android:gravity="center">
<ImageView
<android.support.v7.widget.AppCompatImageView
android:id="@+id/attendance_tab_fragment_no_item_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -34,7 +34,7 @@
android:layout_marginTop="40dp"
android:minHeight="100dp"
android:minWidth="100dp"
android:tint="@android:color/black"
app:tint="?android:attr/textColorPrimary"
app:srcCompat="@drawable/ic_menu_attendance_24dp"
tools:ignore="contentDescription" />
@ -43,8 +43,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="46dp"
android:text="@string/attendance_no_entries"
android:gravity="center"
android:text="@string/attendance_no_entries"
android:textSize="20sp" />
</RelativeLayout>

View File

@ -25,7 +25,7 @@
android:layout_height="match_parent"
android:gravity="center">
<ImageView
<android.support.v7.widget.AppCompatImageView
android:id="@+id/exams_tab_fragment_no_item_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -34,8 +34,8 @@
android:layout_marginTop="40dp"
android:minHeight="100dp"
android:minWidth="100dp"
android:tint="@android:color/black"
app:srcCompat="@drawable/ic_menu_exams_24dp"
app:tint="?android:attr/textColorPrimary"
tools:ignore="contentDescription" />
<TextView

View File

@ -144,7 +144,7 @@
android:layout_height="match_parent"
android:gravity="center">
<ImageView
<android.support.v7.widget.AppCompatImageView
android:id="@+id/grade_fragment_no_item_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -153,8 +153,8 @@
android:layout_marginTop="40dp"
android:minHeight="100dp"
android:minWidth="100dp"
android:tint="@android:color/black"
app:srcCompat="@drawable/ic_menu_grade_26dp"
app:tint="?android:attr/textColorPrimary"
tools:ignore="contentDescription" />
<TextView

View File

@ -25,7 +25,7 @@
android:layout_height="match_parent"
android:gravity="center">
<ImageView
<android.support.v7.widget.AppCompatImageView
android:id="@+id/timetable_tab_fragment_no_item_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -34,8 +34,8 @@
android:layout_marginTop="40dp"
android:minHeight="100dp"
android:minWidth="100dp"
android:tint="@android:color/black"
app:srcCompat="@drawable/ic_menu_timetable_24dp"
app:tint="?android:attr/textColorPrimary"
tools:ignore="contentDescription" />
<TextView
@ -53,8 +53,8 @@
android:layout_height="wrap_content"
android:layout_below="@id/timetable_tab_fragment_no_item_image"
android:layout_marginTop="15dp"
android:gravity="center_horizontal"
android:text="@string/app_name"
android:textAlignment="center"
android:textSize="20sp" />
</RelativeLayout>

View File

@ -177,6 +177,7 @@
android:background="?attr/selectableItemBackground"
android:focusable="true"
android:text="@string/generic_dialog_close"
android:textColor="?android:attr/android:textColorSecondary"
android:textAllCaps="true"
android:textSize="15sp" />

View File

@ -29,7 +29,7 @@
android:layout_below="@+id/grade_header_subject_text"
android:layout_marginTop="5dp"
android:text="@string/app_name"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="12sp" />
<TextView
@ -43,7 +43,7 @@
android:layout_toEndOf="@+id/grade_header_average_text"
android:layout_toRightOf="@+id/grade_header_average_text"
android:text="@string/app_name"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="12sp" />
<TextView
@ -55,7 +55,7 @@
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:text="@string/info_grades_predicted_rating"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="12sp" />
<TextView
@ -67,7 +67,7 @@
android:layout_toEndOf="@+id/grade_header_predicted_rating_text"
android:layout_toRightOf="@+id/grade_header_predicted_rating_text"
android:text="@string/info_grades_final_rating"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="12sp" />
<ImageView

View File

@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#EEE"
android:background="?attr/colorControlHighlight"
android:paddingBottom="7dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"

View File

@ -48,7 +48,7 @@
android:layout_below="@+id/timetable_dialog_details"
android:layout_marginTop="10dp"
android:text="@string/timetable_dialog_description"
android:textColor="@color/colorPrimaryDark"
android:textColor="@color/colorPrimary"
android:textSize="17sp" />
<TextView
@ -60,7 +60,7 @@
android:layout_below="@+id/timetable_dialog_description"
android:layout_marginTop="3dp"
android:text="@string/generic_app_no_data"
android:textColor="@color/colorPrimaryDark"
android:textColor="@color/colorPrimary"
android:textIsSelectable="true"
android:textSize="12sp" />
@ -192,6 +192,7 @@
android:background="?attr/selectableItemBackground"
android:focusable="true"
android:text="@string/generic_dialog_close"
android:textColor="?android:attr/android:textColorSecondary"
android:textAllCaps="true"
android:textSize="15sp" />

View File

@ -39,7 +39,7 @@
android:layout_marginTop="5dp"
android:maxLines="1"
android:text="@string/app_name"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="14sp" />
<TextView
@ -54,7 +54,7 @@
android:gravity="end"
android:maxLines="2"
android:text="@string/app_name"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="16sp" />
<ImageView

View File

@ -13,7 +13,6 @@
android:foreground="?attr/selectableItemBackgroundBorderless"
card_view:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -61,7 +60,7 @@
android:layout_alignStart="@id/timetable_subItem_lesson"
android:maxLines="1"
android:text="@string/grades_text"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="12sp" />
<TextView
@ -77,7 +76,7 @@
android:layout_toRightOf="@+id/timetable_subItem_time"
android:maxLines="1"
android:text="@string/grades_text"
android:textColor="@color/secondary_text"
android:textColor="?android:attr/android:textColorSecondary"
android:textSize="12sp"
tool:ignore="all"/>

View File

@ -0,0 +1,17 @@
<resources>
<style name="WulkanowyTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="bottomNavBackground">@color/bottom_nav_background</item>
</style>
<style name="WulkanowyTheme.DarkActionBar" parent="@style/Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
</style>
</resources>

View File

@ -9,4 +9,10 @@
<item>12 godzin</item>
<item>24 godzin</item>
</string-array>
<string-array name="theme_entries">
<item>Wyłączony</item>
<item>Włączony</item>
<item>Automatyczny</item>
<item>Używaj ustawień systemowych</item>
</string-array>
</resources>

View File

@ -129,6 +129,7 @@
<string name="pref_grades_summary_line_show">Pokazuj podsumowanie w ocenach</string>
<string name="pref_attendance_present_show">Pokazuj obecność we frekwencji</string>
<string name="required_restart">Wymagany restart</string>
<string name="pref_view_theme_dark">Ciemny motyw (Beta)</string>
<string name="pref_notify_header">Powiadomienia</string>
<string name="pref_notify_switch">Pokazuj powiadomienia</string>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="bottomNavBackground" format="reference" />
</resources>

View File

@ -10,8 +10,11 @@
<color name="three_grade">#FFE68C</color>
<color name="two_grade">#CE9AD2</color>
<color name="one_grade">#d32f2f</color>
<color name="default_grade">#cdcdcd</color>
<color name="secondary_text">#4c4c4c</color>
<color name="second_text_color">#333</color>
<color name="default_grade">#cdcdcd</color>
<color name="free_day">#eee</color>
<color name="bottom_nav_background">#303030</color>
<color name="bottom_nav_background_inverse">#ffffff</color>
</resources>

View File

@ -12,6 +12,20 @@
<item>2</item>
<item>3</item>
</string-array>
<string-array name="theme_entries">
<item>Off</item>
<item>On</item>
<item>Auto</item>
<item>Follow system settings</item>
</string-array>
<string-array name="theme_values" translatable="false">
<item>1</item>
<item>2</item>
<item>0</item>
<item>-1</item>
</string-array>
<string-array name="services_interval_entries">
<item>10 minutes</item>
<item>30 minutes</item>

View File

@ -125,6 +125,8 @@
<string name="pref_attendance_present_show">Show present in attendance</string>
<string name="required_restart">Required restart</string>
<string name="pref_view_theme_dark">Dark theme (Beta)</string>
<string name="pref_notify_header">Notifications</string>
<string name="pref_notify_switch">Show the notifications</string>

View File

@ -1,6 +1,6 @@
<resources>
<style name="WulkanowyTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
<style name="WulkanowyTheme" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
@ -14,9 +14,10 @@
<item name="subtitleTextColor">@android:color/primary_text_dark</item>
<item name="android:colorBackground">@android:color/white</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
<item name="bottomNavBackground">@color/bottom_nav_background_inverse</item>
</style>
<style name="WulkanowyTheme.LoginTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<style name="WulkanowyTheme.DarkActionBar" parent="@style/Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>

View File

@ -18,6 +18,13 @@
android:key="attendance_present"
android:summary="@string/required_restart"
android:title="@string/pref_attendance_present_show" />
<ListPreference
android:defaultValue="1"
android:entries="@array/theme_entries"
android:entryValues="@array/theme_values"
android:key="theme"
android:summary="%s"
android:title="@string/pref_view_theme_dark" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_services_header">
<SwitchPreference