Skip to content

Commit 6833424

Browse files
committed
change keyboard icon
1 parent 1e8ead8 commit 6833424

File tree

19 files changed

+59
-42
lines changed

19 files changed

+59
-42
lines changed

.idea/modules.xml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/duy/ccppcompiler/console/ConsoleActivity.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
import android.support.v7.widget.Toolbar;
3030
import android.text.TextUtils;
3131
import android.util.TypedValue;
32+
import android.view.Menu;
3233
import android.view.MenuItem;
34+
import android.view.inputmethod.InputMethodManager;
3335

3436
import com.duy.ccppcompiler.R;
3537
import com.duy.ccppcompiler.console.services.TermuxService;
36-
import com.duy.ccppcompiler.console.services.TermuxViewClient;
3738
import com.termux.terminal.TerminalSession;
3839
import com.termux.view.TerminalView;
3940

@@ -55,12 +56,19 @@ protected void onCreate(Bundle savedInstanceState) {
5556
setContentView(R.layout.activity_console);
5657
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
5758
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
59+
setTitle(R.string.title_activity_console);
5860

5961
computeFontSize();
6062
initView();
6163
startService();
6264
}
6365

66+
@Override
67+
public boolean onCreateOptionsMenu(Menu menu) {
68+
getMenuInflater().inflate(R.menu.menu_console, menu);
69+
return super.onCreateOptionsMenu(menu);
70+
}
71+
6472
private void computeFontSize() {
6573
float dipInPixels = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, this.getResources().getDisplayMetrics());
6674
MIN_FONTSIZE = (int) (4f * dipInPixels);
@@ -120,12 +128,25 @@ protected void onDestroy() {
120128

121129
@Override
122130
public boolean onOptionsItemSelected(MenuItem item) {
123-
if (item.getItemId() == android.R.id.home) {
124-
finish();
131+
int itemId = item.getItemId();
132+
switch (itemId) {
133+
case android.R.id.home:
134+
finish();
135+
break;
136+
case R.id.action_toggle_keyboard:
137+
showKeyboard();
138+
break;
125139
}
126140
return super.onOptionsItemSelected(item);
127141
}
128142

143+
private void showKeyboard() {
144+
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
145+
if (imm != null) {
146+
imm.showSoftInput(mEmulatorView, InputMethodManager.SHOW_IMPLICIT);
147+
}
148+
}
149+
129150
@Override
130151
public void onServiceConnected(ComponentName componentName, IBinder service) {
131152
mTermService = ((TermuxService.LocalBinder) service).service;

app/src/main/java/com/duy/ccppcompiler/console/IConsole.java

Lines changed: 0 additions & 25 deletions
This file was deleted.

app/src/main/java/com/duy/ccppcompiler/console/services/TermuxViewClient.java renamed to app/src/main/java/com/duy/ccppcompiler/console/TermuxViewClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.duy.ccppcompiler.console.services;
17+
package com.duy.ccppcompiler.console;
1818

1919
import android.content.Context;
2020
import android.media.AudioManager;
@@ -24,7 +24,7 @@
2424
import android.view.MotionEvent;
2525
import android.view.inputmethod.InputMethodManager;
2626

27-
import com.duy.ccppcompiler.console.ConsoleActivity;
27+
import com.duy.ccppcompiler.console.services.TermuxService;
2828
import com.termux.terminal.KeyHandler;
2929
import com.termux.terminal.TerminalEmulator;
3030
import com.termux.terminal.TerminalSession;

app/src/main/res/layout/editor.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
android:scrollbarTrackVertical="@null"
1818
android:scrollbars="vertical" />
1919

20-
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
20+
<android.support.v4.widget.ContentLoadingProgressBar
2121
android:id="@+id/progress_view"
2222
android:layout_width="40dp"
2323
android:layout_height="40dp"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--
2+
~ Copyright 2018 Mr Duy
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
18+
xmlns:app="http://schemas.android.com/apk/res-auto"
19+
xmlns:tools="http://schemas.android.com/tools">
20+
<item
21+
android:id="@+id/action_toggle_keyboard"
22+
android:icon="@drawable/ic_keyboard_white_24dp"
23+
android:title="Toggle soft keyboard"
24+
app:showAsAction="always"
25+
tools:ignore="AlwaysShowAction" />
26+
27+
</menu>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<string name="app_name">C/C++ Compiler</string>
33
<string name="installing_system">Installing system</string>
44
<string name="title_compiling">Compiling…</string>
5+
<string name="title_activity_console">Console</string>
56
</resources>
191 Bytes
Loading
196 Bytes
Loading
124 Bytes
Loading

0 commit comments

Comments
 (0)