mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-06-05 17:00:23 +02:00
really change the font size based on settings
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user