Skip to content
This repository has been archived by the owner on Jun 20, 2021. It is now read-only.

Commit

Permalink
Okay,add an option to customize console font size
Browse files Browse the repository at this point in the history
  • Loading branch information
fengberd committed Jun 29, 2016
1 parent 9397508 commit 77b9d69
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ android {

defaultConfig {
applicationId "net.fengberd.minecraftpe_server"
minSdkVersion 9
minSdkVersion 14
targetSdkVersion 21
versionCode 5
versionName "1.0.4"
versionCode 6
versionName "1.0.5"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class ConsoleActivity extends SherlockActivity
public static Button button_command=null;
public static TextView label_log=null;
public static EditText edit_command=null;
public static float font_size=18.0f;

@Override
protected void onCreate(Bundle savedInstanceState)
Expand All @@ -31,6 +32,7 @@ protected void onCreate(Bundle savedInstanceState)
instance=this;
label_log=(TextView) findViewById(R.id.label_log);
label_log.setText(currentLog);
label_log.setTextSize(font_size);
edit_command=(EditText)findViewById(R.id.edit_command);
sv=(ScrollView) findViewById(R.id.logScrollView);
button_command = (Button)findViewById(R.id.button_send);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class MainActivity extends SherlockActivity
public static RadioButton radio_pocketmine=null,radio_nukkit=null;
public static CheckBox check_kusud=null,check_ansi=null;
public static Button button_start=null,button_stop=null,button_mount=null;
public static SeekBar seekbar_fontsize=null;
public static MenuItem menu_install_php=null,menu_install_java=null,menu_download_server=null;
public static SharedPreferences config=null;

Expand Down Expand Up @@ -72,6 +73,13 @@ public void onCreate(Bundle savedInstanceState)
radio_nukkit=(RadioButton) findViewById(R.id.radio_nukkit);
radio_pocketmine=(RadioButton) findViewById(R.id.radio_pocketmine);

seekbar_fontsize=(SeekBar)findViewById(R.id.seekbar_fontsize);

seekbar_fontsize.setProgress(config.getInt("ConsoleFontSize",18));
seekbar_fontsize.setMax(30);

ConsoleActivity.font_size=seekbar_fontsize.getProgress();

check_ansi.setChecked(ansiMode);
check_kusud.setChecked(config.getBoolean("KusudMode",false));

Expand Down Expand Up @@ -117,6 +125,28 @@ public void onClick(View v)
}
});

seekbar_fontsize.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
{
@Override
public void onProgressChanged(SeekBar p1,int p2,boolean p3)
{

}

@Override
public void onStartTrackingTouch(SeekBar p1)
{

}

@Override
public void onStopTrackingTouch(SeekBar p1)
{
ConsoleActivity.font_size=p1.getProgress();
config.edit().putInt("ConsoleFontSize",p1.getProgress()).apply();
}
});

button_mount.setOnClickListener(new OnClickListener()
{
@Override
Expand Down
33 changes: 33 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,39 @@
android:id="@+id/check_ansi"
android:text="@string/check_ansi"/>

<TextView
style="@style/ListTitleText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dip"
android:text="@string/label_console"/>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp">

<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal">

<TextView
android:layout_height="wrap_content"
android:text="@string/label_console_fontsize"
android:layout_width="wrap_content"
android:layout_gravity="center"/>

<SeekBar
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/seekbar_fontsize"/>

</LinearLayout>

</LinearLayout>

<Button
android:layout_height="wrap_content"
android:text="@string/button_mount"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

<string name="label_management">服务器管理</string>
<string name="label_type">服务器类型</string>
<string name="label_console">控制台个性化</string>
<string name="label_console_fontsize">字体大小:</string>

<string name="menu_console">控制台</string>
<string name="menu_kill">强制停止服务器</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

<string name="label_management">Server Management</string>
<string name="label_type">Server Type</string>
<string name="label_console">Console Customize</string>
<string name="label_console_fontsize">Font Size:</string>

<string name="menu_console">Console</string>
<string name="menu_kill">Kill server</string>
Expand Down

0 comments on commit 77b9d69

Please sign in to comment.