Skip to content

Commit

Permalink
Merge branch 'titlesize'
Browse files Browse the repository at this point in the history
  • Loading branch information
spacecowboy committed Sep 2, 2015
2 parents 8ba17fc + a2d35fd commit dd15700
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 42 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ repositories {

// Version number
def versionMajor = 5 // Major UI overhauls
def versionMinor = 5 // Some new functionality
def versionPatch = 6 // Bug fixes
def versionMinor = 6 // Some new functionality
def versionPatch = 0 // Bug fixes
def versionBuild = 0 // Bump for dogfood builds, public betas, etc.

// Version name from git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ void setListeners() {
final SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(getActivity());

taskText.setTitleRelativeLarger(prefs.getBoolean(
getString(R.string.pref_editor_biggertitles), true));
taskText.setTitleFontFamily(Integer.parseInt(prefs.getString(
getString(R.string.pref_editor_title_fontfamily), "2")));
taskText.setTitleFontStyle(Integer.parseInt(prefs.getString(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
/*
* Copyright (c) 2014 Jonas Kalderstam.
* Copyright (c) 2015 Jonas Kalderstam.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* http://www.apache.org/licenses/LICENSE-2.0
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.nononsenseapps.utils.views;
Expand Down Expand Up @@ -54,6 +55,7 @@ public class StyledEditText extends EditText {
private int mBodyFontFamily;
private int mTitleFontStyle;
private boolean mLinkify;
private boolean mTitleLarger = true;

public StyledEditText(Context context, AttributeSet attrs) {
super(context, attrs);
Expand All @@ -75,7 +77,7 @@ public StyledEditText(Context context, AttributeSet attrs) {
a.recycle();
}

titleSizeSpan = new RelativeSizeSpan(mTitleRelativeSize);
setTitleRelativeLarger(mTitleLarger);

setTitleFontFamily(mTitleFontFamily);

Expand Down Expand Up @@ -108,6 +110,15 @@ public void afterTextChanged(Editable s) {
}
});
}

/**
*
* @param larger true will use layout defined size, else same size
*/
public void setTitleRelativeLarger(final boolean larger) {
mTitleLarger = larger;
titleSizeSpan = new RelativeSizeSpan(larger ? mTitleRelativeSize : 1.0f);
}

/**
*
Expand Down
28 changes: 15 additions & 13 deletions app/src/main/res/values/constants.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013 Jonas Kalderstam
Copyright (c) 2015 Jonas Kalderstam.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<!-- Provides constants and default values -->
<resources>
<integer name="layout_horizontal">0</integer>
Expand Down Expand Up @@ -61,6 +62,7 @@
<string name="pref_editor_body_fontfamily">pref_editor_body_fontfamily</string>
<string name="pref_editor_links">pref_editor_links</string>
<string name="pref_editor_fontsize">pref_editor_fontsize</string>
<string name="pref_editor_biggertitles">pref_editor_biggertitles</string>

<string name="pref_list_title_fontfamily">pref_restart_list_title_fontfamily</string>
<string name="pref_list_title_fontstyle">pref_restart_list_title_fontstyle</string>
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2014 Jonas Kalderstam.
Copyright (c) 2015 Jonas Kalderstam.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -297,5 +297,7 @@
<string name="dropbox_sync_summary">Keep your tasks and notes synchronized with text files in your Dropbox.</string>
<string name="cannot_write_to_directory">Cannot write to directory</string>
<string name="wait_for_dropbox">Please wait for Dropbox to finish its initialization.</string>
<string name="bigger_titles">Title larger</string>
<string name="bigger_titles_summary">The title is the first line</string>

</resources>
35 changes: 20 additions & 15 deletions app/src/main/res/xml/app_pref_main.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012 Jonas Kalderstam
Copyright (c) 2015 Jonas Kalderstam.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:robobunny="http://robobunny.com"
android:key="preference_screen" >
android:key="preference_screen">

<PreferenceCategory android:title="@string/dashclock_pref_header_general" >

Expand Down Expand Up @@ -65,6 +65,11 @@
android:entryValues="@array/fontsize_values"
android:summary="Selected option should be here"
android:title="@string/text_size" />
<com.nononsenseapps.notepad.prefs.FixedSwitchPreference
android:key="@string/pref_editor_biggertitles"
android:defaultValue="true"
android:title="@string/bigger_titles"
android:summary="@string/bigger_titles_summary" />
<ListPreference
android:key="@string/pref_editor_title_fontstyle"
android:defaultValue="0"
Expand Down

0 comments on commit dd15700

Please sign in to comment.