Skip to content

Commit

Permalink
Change main font to encode sans.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenumir committed Feb 18, 2018
1 parent 3543778 commit da5a395
Show file tree
Hide file tree
Showing 18 changed files with 97 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "com.wt.pinger"
minSdkVersion versions.minSdkVersion
targetSdkVersion versions.targetSdkVersion
versionCode 82
versionName "3.3.4"
versionCode 83
versionName "3.3.5"

resConfigs "en", "pl"
vectorDrawables.useSupportLibrary = true
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/wt/pinger/activity/PingActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
Expand Down Expand Up @@ -61,6 +63,7 @@ public static void show(@NonNull Context ctx, @NonNull AddressItem item) {
@BindView(R.id.recycler) RecyclerView recycler;
@BindView(R.id.fabAction) FloatingActionButton fabAction;
@BindView(R.id.placeholder) View placeholder;
@BindView(R.id.toolbar_layout) CollapsingToolbarLayout toolbar_layout;

private SimpleCursorRecyclerAdapter adapter;
private MenuItem playPauseMenu;
Expand Down Expand Up @@ -96,6 +99,8 @@ public void onClick(View view) {
startStopService();
}
});
toolbar_layout.setCollapsedTitleTypeface(ResourcesCompat.getFont(this, R.font.regular));
toolbar_layout.setExpandedTitleTypeface(ResourcesCompat.getFont(this, R.font.regular));

playPauseMenu = toolbar.getMenu()
.add(R.string.label_start_stop)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/wt/pinger/dialog/AddressDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v4.content.res.ResourcesCompat;
import android.widget.EditText;
import android.widget.Toast;

Expand Down Expand Up @@ -66,6 +67,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
.customView(R.layout.dialog_address_form, true)
.positiveText(R.string.label_ok)
.negativeText(R.string.label_cancel)
.typeface(ResourcesCompat.getFont(getActivity(), R.font.medium), ResourcesCompat.getFont(getActivity(), R.font.regular))
.neutralText(item._id != null ? R.string.label_delete : 0)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/wt/pinger/fragment/ConsoleFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.widget.SimpleCursorAdapter;
import android.text.method.TextKeyListener;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -128,6 +129,7 @@ public void onResult(Cursor cursor) {
.title(R.string.label_list_of_commands)
.items(commands)
.autoDismiss(false)
.typeface(ResourcesCompat.getFont(getActivity(), R.font.medium), ResourcesCompat.getFont(getActivity(), R.font.regular))
.itemsCallback(new MaterialDialog.ListCallback() {
@Override
public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/wt/pinger/fragment/MoreFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.content.res.ResourcesCompat;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -69,6 +70,7 @@ public class MoreFragment extends Fragment {
new MaterialDialog.Builder(getActivity())
.title(R.string.open_source_libs)
.items(R.array.lib_names)
.typeface(ResourcesCompat.getFont(getActivity(), R.font.medium), ResourcesCompat.getFont(getActivity(), R.font.regular))
.positiveText(R.string.label_ok)
.autoDismiss(false)
.onPositive(new MaterialDialog.SingleButtonCallback() {
Expand All @@ -95,6 +97,7 @@ public void onSelection(MaterialDialog dialog, View view, int which, CharSequenc
new MaterialDialog.Builder(getActivity())
.title(R.string.suggestions)
.content(R.string.suggestions_desc)
.typeface(ResourcesCompat.getFont(getActivity(), R.font.medium), ResourcesCompat.getFont(getActivity(), R.font.regular))
.inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE)
.input(R.string.suggestions_hint, 0, new MaterialDialog.InputCallback() {
@Override
Expand Down
Binary file added app/src/main/res/font/encodesans_bold.ttf
Binary file not shown.
Binary file added app/src/main/res/font/encodesans_medium.ttf
Binary file not shown.
Binary file added app/src/main/res/font/encodesans_regular.ttf
Binary file not shown.
14 changes: 14 additions & 0 deletions app/src/main/res/font/medium.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<font
android:fontStyle="normal"
android:fontWeight="400"
android:font="@font/encodesans_medium"
app:fontStyle="normal"
app:fontWeight="400"
app:font="@font/encodesans_medium"
/>

</font-family>
13 changes: 13 additions & 0 deletions app/src/main/res/font/monospace.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<font
android:fontStyle="normal"
android:fontWeight="400"
android:font="@font/robotomono_regular"
app:fontStyle="normal"
app:fontWeight="400"
app:font="@font/robotomono_regular"
/>
</font-family>
21 changes: 21 additions & 0 deletions app/src/main/res/font/regular.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<font-family
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<font
android:fontStyle="normal"
android:fontWeight="400"
android:font="@font/encodesans_regular"
app:fontStyle="normal"
app:fontWeight="400"
app:font="@font/encodesans_regular"
/>
<font
android:fontStyle="normal"
android:fontWeight="700"
android:font="@font/encodesans_bold"
app:fontStyle="normal"
app:fontWeight="700"
app:font="@font/encodesans_bold"
/>
</font-family>
Binary file added app/src/main/res/font/robotomono_regular.ttf
Binary file not shown.
5 changes: 4 additions & 1 deletion app/src/main/res/layout/activity_ping.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:expandedTitleTextAppearance="@style/AppTheme.ToolbarTextStyle"
app:collapsedTitleTextAppearance="@style/AppTheme.ToolbarTextStyle">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:titleTextAppearance="@style/AppTheme.ToolbarTextStyle"
app:navigationIcon="@drawable/ic_arrow_back_white_24dp"
app:title="Ping details"
app:layout_collapseMode="pin"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/item_cmd.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/CommandItem"
android:id="@+id/cmd_item"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:fontFamily="monospace"/>
android:paddingRight="@dimen/activity_horizontal_margin"/>
1 change: 1 addition & 0 deletions app/src/main/res/layout/item_my_ip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
android:id="@+id/ip_text1"/>

<TextView
style="@style/CommandItem"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/item_ping.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/CommandItem"
android:id="@+id/ping_text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:fontFamily="monospace" />
android:paddingBottom="4dp" />
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings_app.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<item>QueryBuilder</item>
<item>ErrorReportAdapter</item>
<item>EventClip</item>
<item>Encode Sans Font</item>
<item>Roboto Mono Font</item>
</string-array>

<string-array tools:ignore="all" name="lib_urls">
Expand All @@ -38,5 +40,7 @@
<item>https://github.com/Hivedi/QueryBuilder</item>
<item>https://github.com/Hivedi/ErrorReportAdapter</item>
<item>https://github.com/kenumir/EventClip</item>
<item>https://fonts.google.com/specimen/Encode+Sans</item>
<item>https://fonts.google.com/specimen/Roboto+Mono</item>
</string-array>
</resources>
25 changes: 22 additions & 3 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:fontFamily" tools:targetApi="jelly_bean">@font/regular</item>
<item name="fontFamily">@font/regular</item>
<item name="toolbarStyle">@style/AppTheme.Toolbar</item>
<item name="android:toolbarStyle" tools:targetApi="lollipop">@style/AppTheme.Toolbar</item>
</style>

<style name="AppTheme.Toolbar" parent="Widget.AppCompat.Toolbar">
<item name="titleTextAppearance">@style/AppTheme.ToolbarTextStyle</item>
<item name="android:titleTextAppearance" tools:targetApi="lollipop">@style/AppTheme.ToolbarTextStyle</item>
</style>

<style name="AppTheme.ToolbarTextStyle" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:fontFamily" tools:targetApi="jelly_bean">@font/regular</item>
<item name="fontFamily">@font/regular</item>
</style>

<style name="StartTheme" parent="Theme.AppCompat.NoActionBar">
Expand All @@ -26,9 +40,9 @@
<item name="android:layout_marginTop">16dp</item>
<item name="android:layout_marginBottom">16dp</item>
<item name="android:layout_marginLeft">@dimen/activity_horizontal_margin</item>
<item name="android:layout_marginStart">@dimen/activity_horizontal_margin</item>
<item name="android:layout_marginStart" tools:targetApi="jelly_bean_mr1">@dimen/activity_horizontal_margin</item>
<item name="android:layout_marginRight">@dimen/activity_horizontal_margin</item>
<item name="android:layout_marginEnd">@dimen/activity_horizontal_margin</item>
<item name="android:layout_marginEnd" tools:targetApi="jelly_bean_mr1">@dimen/activity_horizontal_margin</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/colorAccent</item>
</style>
Expand Down Expand Up @@ -72,4 +86,9 @@
<item name="expandedTitleGravity">start|bottom</item>
</style>

<style name="CommandItem">
<item name="android:fontFamily" tools:targetApi="jelly_bean">@font/monospace</item>
<item name="fontFamily">@font/monospace</item>
</style>

</resources>

0 comments on commit da5a395

Please sign in to comment.