mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-12 22:50:07 +01:00
really change the font size based on settings
This commit is contained in:
parent
eea3f3dc63
commit
350c22cda6
@ -47,7 +47,7 @@ public class Config {
|
||||
}
|
||||
|
||||
public int getFontSize() {
|
||||
return mPrefs.getInt(Constants.FONT_SIZE, Constants.FONT_SIZE_NORMAL);
|
||||
return mPrefs.getInt(Constants.FONT_SIZE, Constants.FONT_SIZE_MEDIUM);
|
||||
}
|
||||
|
||||
public void setFontSize(int size) {
|
||||
|
@ -15,7 +15,6 @@ public class Constants {
|
||||
|
||||
// font sizes
|
||||
public static final int FONT_SIZE_SMALL = 0;
|
||||
public static final int FONT_SIZE_NORMAL = 1;
|
||||
public static final int FONT_SIZE_MEDIUM = 1;
|
||||
public static final int FONT_SIZE_LARGE = 2;
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,26 @@
|
||||
package com.simplemobiletools.notes;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class Utils {
|
||||
public static void showToast(Context context, int resId) {
|
||||
Toast.makeText(context, context.getResources().getString(resId), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
public static float getTextSize(Context context) {
|
||||
final int fontSize = Config.newInstance(context).getFontSize();
|
||||
final Resources res = context.getResources();
|
||||
float textSize = res.getDimension(R.dimen.medium_text_size);
|
||||
switch (fontSize) {
|
||||
case Constants.FONT_SIZE_SMALL:
|
||||
textSize = res.getDimension(R.dimen.small_text_size);
|
||||
break;
|
||||
case Constants.FONT_SIZE_LARGE:
|
||||
textSize = res.getDimension(R.dimen.large_text_size);
|
||||
break;
|
||||
}
|
||||
return textSize;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
@ -41,6 +42,7 @@ public class MainActivity extends SimpleActivity {
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
invalidateOptionsMenu();
|
||||
mNotesView.setTextSize(TypedValue.COMPLEX_UNIT_PX, Utils.getTextSize(getApplicationContext()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,7 +11,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:gravity="top"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:textSize="@dimen/normal_text_size"/>
|
||||
android:padding="@dimen/activity_margin"/>
|
||||
|
||||
</ScrollView>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
android:id="@+id/notes_holder"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/notes_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:gravity="top"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:textSize="@dimen/normal_text_size"/>
|
||||
android:padding="@dimen/activity_margin"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
@ -4,8 +4,9 @@
|
||||
<dimen name="social_logo">40dp</dimen>
|
||||
<dimen name="settings_padding">8dp</dimen>
|
||||
|
||||
<dimen name="tiny_text_size">12sp</dimen>
|
||||
<dimen name="small_text_size">12sp</dimen>
|
||||
<dimen name="normal_text_size">14sp</dimen>
|
||||
<dimen name="medium_text_size">16sp</dimen>
|
||||
<dimen name="large_text_size">18sp</dimen>
|
||||
<dimen name="config_text_size">18sp</dimen>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user