Add a user manual screen

This commit is contained in:
2024-11-22 17:44:08 +01:00
parent 6abc48c121
commit 7f60898dd8
10 changed files with 116 additions and 26 deletions
+11 -1
View File
@@ -47,13 +47,23 @@
</service>
<activity
android:name=".SettingsActivity"
android:name=".activities.SettingsActivity"
android:exported="false"
android:label="@string/preferences_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".activities.ManualActivity"
android:exported="true"
android:label="@string/manual_name">
<intent-filter>
<action android:name="eur.cfpifpsi.titanboard.intent.SHOW_MANUAL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
@@ -51,9 +51,6 @@ public class KeymapManager {
loadDeviceKeymaps(context.getResources().getXml(R.xml.keymaps_titan));
}
/**
* @noinspection BreakStatement
*/
private void loadDeviceKeymaps(XmlPullParser parser) {
Keymap keymap = null;
int code = 0;
@@ -202,25 +199,16 @@ public class KeymapManager {
String latchedCode;
String lockedCode;
/**
* @noinspection ReturnOfNull
*/
public ArrayList<String> getSymbolsBase(int keyCode) {
Key key = mMap.get(keyCode);
return key == null ? null : key.symbolsBase;
}
/**
* @noinspection ReturnOfNull
*/
public ArrayList<String> getSymbolsAlt(int keyCode) {
Key key = mMap.get(keyCode);
return key == null ? null : key.symbolsAlt;
}
/**
* @noinspection ReturnOfNull
*/
public ArrayList<String> getSymbolsShift(int keyCode) {
Key key = mMap.get(keyCode);
return key == null ? null : key.symbolsShift;
@@ -0,0 +1,40 @@
/*
* An input method for physical keyboard phones
* Copyright (C) 2024 Emil Kosz
*
* 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 <https://www.gnu.org/licenses/>.
*/
package eur.cfpifpsi.titanboard.activities;
import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.widget.TextView;
import eur.cfpifpsi.titanboard.R;
public class ManualActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manual);
// Convert the HTML manual into a TextView format
String htmlString = getString(R.string.user_manual_html);
Spanned htmlSpanned = Html.fromHtml(htmlString);
TextView tv = findViewById(R.id.manual_text);
tv.setText(htmlSpanned);
}
}
@@ -16,11 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package eur.cfpifpsi.titanboard;
package eur.cfpifpsi.titanboard.activities;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import eur.cfpifpsi.titanboard.R;
/**
* @noinspection deprecation
*/
@@ -18,7 +18,6 @@
package eur.cfpifpsi.titanboard.views;
import android.annotation.TargetApi;
import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
@@ -35,8 +34,8 @@ import java.util.ArrayList;
import eur.cfpifpsi.titanboard.KeymapManager;
import eur.cfpifpsi.titanboard.MetaKeyManager;
import eur.cfpifpsi.titanboard.R;
import eur.cfpifpsi.titanboard.SettingsActivity;
import eur.cfpifpsi.titanboard.TitanboardIME;
import eur.cfpifpsi.titanboard.activities.SettingsActivity;
public final class InputView extends RelativeLayout {
private final int[] buttonStateToggled = {R.attr.state_toggled};
@@ -103,9 +102,6 @@ public final class InputView extends RelativeLayout {
});
}
/**
* @noinspection FeatureEnvy
*/
public void updateStateText() {
MetaKeyManager metaManager = mTitanboardIME.mMetaKeyManager;
KeymapManager keymapManager = mTitanboardIME.mKeymapManager;
+1 -2
View File
@@ -16,8 +16,7 @@
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
<item app:state_toggled="true">
<shape android:shape="rectangle">
<solid android:color="@color/button_toggled" />
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ An input method for physical keyboard phones
~ Copyright (C) 2024 Emil Kosz
~
~ 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 <https://www.gnu.org/licenses/>.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/manual_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/default_space">
</TextView>
+28 -3
View File
@@ -19,6 +19,7 @@
<resources>
<string name="app_name">Titanboard</string>
<string name="preferences_name">Titanboard preferences</string>
<string name="manual_name">Titanboard manual</string>
<string name="keymap_default">en</string>
<string name="cycle_speed_default">500</string>
@@ -40,16 +41,40 @@
<string name="preferences_label_cycle_speed">Symbol cycling speed/timeout</string>
<string name="preferences_label_clipboard_size">Clipboard size</string>
<string name="preferences_label_keymaps">Languages</string>
<string name="preferences_label_copyright_info">
Copyleft 🄯 Emil Kosz, 2024. License: GPLv3
</string>
<string name="preferences_label_user_manual">User manual</string>
<string name="preferences_summary_cycle_manual">
Overrides the default behaviour of long pressing to cycle
</string>
<string name="preferences_summary_copyright_info">
Copyleft 🄯 Emil Kosz, 2024. License: GPLv3
</string>
<string name="preferences_key_cycle_manual">cycle_manual</string>
<string name="preferences_key_keymaps">selected_keymaps</string>
<string name="preferences_key_cycle_speed">cycle_speed</string>
<string name="preferences_key_clipboard_size">clipboard_size</string>
<string name="user_manual_html">
<![CDATA[
<h1>Titanboard manual</h1>
<h2>First steps</h2>
<p>
Thank you for trying out Titanboard! There are a few things in this program that can
make your typing experience better. First, set up your settings to fit what you want:
</p>
<ol>
<li>
Pick your device from the device list. This will make sure that all characters on
the physical keyboard can be used, such as alt symbols.
</li>
<li>Pick the languages you use from the language list</li>
<li>
Choose your symbol inputting method. This applies to alphabetic and twelve key
keyboards only, as full keyboards use the shift and alt keys to access alternate
symbols.
</li>
</ol>
]]>
</string>
</resources>
+1 -1
View File
@@ -19,7 +19,7 @@
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:settingsActivity="eur.cfpifpsi.titanboard.SettingsActivity">
android:settingsActivity="eur.cfpifpsi.titanboard.activities.SettingsActivity">
<!-- Needed for higher Android version so it can be the only used input method.
None of these subtypes are actually used. -->
<subtype
+6 -1
View File
@@ -43,7 +43,12 @@
android:entryValues="@array/preferences_keymaps"
android:key="@string/preferences_key_keymaps"
android:title="@string/preferences_label_keymaps" />
<Preference android:title="@string/preferences_label_user_manual">
<intent
android:action="eur.cfpifpsi.titanboard.intent.SHOW_MANUAL"
android:targetClass="eur.cfpifpsi.titanboard.activities.ManualActivity" />
</Preference>
<Preference
android:selectable="false"
android:summary="@string/preferences_label_copyright_info" />
android:summary="@string/preferences_summary_copyright_info" />
</PreferenceScreen>