Skip to content

Commit 1524c4b

Browse files
committed
Revert "推送 QPython 3C 3.9.6"
This reverts commit 05caa5e.
1 parent 6b32ff4 commit 1524c4b

11 files changed

Lines changed: 57 additions & 74 deletions

File tree

QPython修改版说明.doc

-1 KB
Binary file not shown.

qpysl4a/src/main/java/org/qpython/qsl4a/qsl4a/facade/PreferencesFacade.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.qpython.qsl4a.qsl4a.facade;
22

33
import android.app.Service;
4-
import android.content.Context;
54
import android.content.SharedPreferences;
65
import android.content.SharedPreferences.Editor;
76
import android.preference.PreferenceManager;
@@ -35,15 +34,10 @@
3534
public class PreferencesFacade extends RpcReceiver {
3635

3736
private Service mService;
38-
private final AndroidFacade mAndroidFacade;
39-
private final Context context;
4037

4138
public PreferencesFacade(FacadeManager manager) {
4239
super(manager);
43-
mAndroidFacade = manager.getReceiver(AndroidFacade.class);
44-
context = mAndroidFacade.context;
4540
mService = manager.getService();
46-
4741
}
4842

4943
@Rpc(description = "Read a value from shared preferences")
@@ -58,12 +52,12 @@ public Object prefGetValue(
5852
public void prefPutValue(
5953
@RpcParameter(name = "key") String key,
6054
@RpcParameter(name = "value") Object value,
61-
@RpcParameter(name = "filename", description = "Desired preferences file. If not defined, uses the default Shared Preferences.") @RpcOptional String filename) {
62-
SharedPreferences p;
55+
@RpcParameter(name = "filename", description = "Desired preferences file. If not defined, uses the default Shared Preferences.") @RpcOptional String filename)
56+
throws IOException {
6357
if (filename == null || filename.equals("")) {
64-
//throw new IOException("Can't write to default preferences.");
65-
p = PreferenceManager.getDefaultSharedPreferences(context);
66-
} else p = getPref(filename);
58+
throw new IOException("Can't write to default preferences.");
59+
}
60+
SharedPreferences p = getPref(filename);
6761
Editor e = p.edit();
6862
if (value instanceof Boolean) {
6963
e.putBoolean(key, (Boolean) value);
@@ -78,7 +72,7 @@ public void prefPutValue(
7872
} else {
7973
e.putString(key, value.toString());
8074
}
81-
e.apply();
75+
e.commit();
8276
}
8377

8478
@Rpc(description = "Get list of Shared Preference Values", returns = "Map of key,value")

qpython/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apply plugin: 'com.jakewharton.butterknife'
33
apply plugin: 'realm-android'
44

55
//获取系统时间
6-
static def releaseTime() {
6+
def releaseTime() {
77
return new Date().format("yyyyMMdd-HHmmss")
88
}
99

@@ -14,8 +14,8 @@ android {
1414
defaultConfig {
1515
minSdkVersion rootProject.ext.minSdkVersion
1616
targetSdkVersion rootProject.ext.targetSdkVersion
17-
versionCode 356
18-
versionName "3.5.6"
17+
versionCode 355
18+
versionName "3.5.5"
1919
multiDexEnabled true
2020
vectorDrawables.useSupportLibrary = true
2121

-809 KB
Binary file not shown.

qpython/src/main/java/org/qpython/qpy/console/TermActivity.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,16 +1163,14 @@ private TermSession createPyTermSession(String[] mArgs) throws IOException {
11631163
String shell_type = intent.getStringExtra(TYPE);
11641164
if (shell_type==null) {
11651165
if (mArgs!=null) shell_type = "";
1166-
else shell_type = "color";
1166+
else shell_type = "1";
11671167
}
1168-
if (shell_type.equals("color"))
1168+
if (shell_type.equals("1"))
11691169
mArgs = new String[]{CONF.qpyccs, CONF.qpyccs};
11701170
else if (shell_type.endsWith(".py")) {
11711171
shell_type = CONF.binDir + shell_type;
11721172
mArgs = new String[]{shell_type, shell_type};
1173-
} else if (shell_type.equals("shell"))
1174-
session = createTermSession(this, settings, "cd && cat text/" + getString(R.string.lang_flag) + "/shell", CONF.filesDir);
1175-
else
1173+
} else
11761174
session = createTermSession(this, settings, CONF.binDir + shell_type + " && exit", CONF.filesDir);
11771175
if (mArgs != null) {
11781176
//String content = FileHelper.getFileContents(mArgs[0]);

qpython/src/main/java/org/qpython/qpy/main/activity/HomeMainActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private void initListener() {
185185
.setItems(chars, (dialog, which) -> {
186186
switch (which) {
187187
case 0:
188-
startShell("color");
188+
startShell("1");
189189
break;
190190
case 1:
191191
startShell("ipython.py");
@@ -197,10 +197,10 @@ private void initListener() {
197197
playPy("browserConsole");
198198
break;
199199
case 4:
200-
startShell("shell");
200+
startShell("shell.sh");
201201
break;
202202
case 5:
203-
startShell("qpython.sh");
203+
startShell("blackConsole.py");
204204
break;
205205
case 6:
206206
startShell("shell.py");

qpython/src/main/java/org/qpython/qpy/main/fragment/SettingFragment.java

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class SettingFragment extends PreferenceFragment {
5959

6060
private SharedPreferences settings;
6161
private Resources resources;
62-
private Preference mPassWordPref, username_pref, portnum_pref, chroot_pref, lastlog, ipaddress;
62+
private Preference mPassWordPref, username_pref, portnum_pref, chroot_pref, lastlog;
6363
private CheckBoxPreference sl4a, running_state, root, display_pwd, qpy_protect;//, notebook_run;
6464

6565
//private PreferenceScreen py_inter,notebook_page;
@@ -75,21 +75,17 @@ private void viewWebSite(int resId) {
7575
@Override
7676
public void onReceive(Context context, Intent intent) {
7777
Log.v(TAG, "FTPServerService action received: " + intent.getAction());
78-
switch (intent.getAction()) {
79-
case FTPServerService.ACTION_STARTED:
80-
running_state.setChecked(true);
81-
// Fill in the FTP server address
82-
setFtpAddress();
83-
break;
84-
case FTPServerService.ACTION_STOPPED:
85-
running_state.setChecked(false);
86-
running_state.setSummary(org.swiftp.R.string.running_summary_stopped);
87-
break;
88-
case FTPServerService.ACTION_FAILEDTOSTART:
89-
running_state.setChecked(false);
90-
running_state.setSummary(org.swiftp.R.string.running_summary_failed);
91-
Toast.makeText(getActivity(), R.string.ip_address_need_wifi_or_ap, Toast.LENGTH_LONG).show();
92-
break;
78+
if (intent.getAction().equals(FTPServerService.ACTION_STARTED)) {
79+
running_state.setChecked(true);
80+
// Fill in the FTP server address
81+
setFtpAddress();
82+
} else if (intent.getAction().equals(FTPServerService.ACTION_STOPPED)) {
83+
running_state.setChecked(false);
84+
running_state.setSummary(org.swiftp.R.string.running_summary_stopped);
85+
} else if (intent.getAction().equals(FTPServerService.ACTION_FAILEDTOSTART)) {
86+
running_state.setChecked(false);
87+
running_state.setSummary(org.swiftp.R.string.running_summary_failed);
88+
Toast.makeText(getActivity(),R.string.ip_address_need_wifi_or_ap,Toast.LENGTH_LONG).show();
9389
}
9490
}
9591
};
@@ -132,7 +128,8 @@ public void onResume() {
132128
super.onResume();
133129
}
134130

135-
private boolean showIpAddress(){
131+
private void initSettings() {
132+
Preference ipaddress = findPreference("ipaddress");
136133
InetAddress ip;
137134
try {
138135
ip = FTPServerService.getWifiAndApIp();
@@ -142,18 +139,10 @@ private boolean showIpAddress(){
142139
}
143140
if (ip!=null) {
144141
ipaddress.setSummary(ip.getHostAddress());
145-
return true;
146142
} else {
147143
ipaddress.setSummary(R.string.ip_address_need_wifi_or_ap);
148-
return false;
149144
}
150-
}
151-
152-
private void initSettings() {
153-
ipaddress = findPreference("ipaddress");
154-
showIpAddress();
155-
156-
lastlog = findPreference("lastlog");
145+
lastlog = (Preference) findPreference("lastlog");
157146
//py_inter = (PreferenceScreen) findPreference(getString(R.string.key_py_inter));
158147
/*notebook_page = (PreferenceScreen) findPreference(getString(R.string.key_notebook_page));
159148
notebook_page.setTitle(MessageFormat.format(getString(R.string.notebook_for_py), NAction.getPyVer(getActivity())));
@@ -236,7 +225,7 @@ private void setFtpAddress() {
236225
if (address == null) {
237226
Log.v(TAG, "Unable to retreive wifi ip address");
238227
running_state.setSummary(org.swiftp.R.string.cant_get_url);
239-
Toast.makeText(getActivity(),"FTP: "+getString(R.string.ip_address_need_wifi_or_ap),Toast.LENGTH_LONG).show();
228+
Toast.makeText(getActivity(),R.string.ip_address_need_wifi_or_ap,Toast.LENGTH_LONG).show();
240229
} else {
241230
String iptext = "ftp://" + address.getHostAddress() + ":"
242231
+ FTPServerService.getPort() + "/";
@@ -275,8 +264,6 @@ private void initListener() {
275264
return false;
276265
});
277266

278-
ipaddress.setOnPreferenceClickListener(preference -> showIpAddress());
279-
280267
/*if (!NAction.isQPy3(getActivity())) {
281268
notebook_run.setSummary(getString(R.string.notebook_py3_support));
282269
notebook_run.setEnabled(false);

qpython/src/main/res/values-zh-rCN/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
<string name="add">添加</string>
136136
<string name="sl4a_running">SL4A服务运行中</string>
137137
<string name="service_toggle">服务开关</string>
138-
<string name="qpy_description">QPython 3C是安卓设备Python小程序引擎,支持PyVer、新版SL4A、打开文件、写外置卡、加解密、图形界面、音视频播放。</string>
138+
<string name="qpy_description">QPython 3C是安卓设备Python小程序引擎,支持PyVer、新版SL4A、FileProvider、 DocumentFile、加解密、GUI、音视频播放。</string>
139139
<string name="warning">警告</string>
140140
<string name="reset_warning">将重置所有设置并删除已下载的库,确定重置吗?</string>
141141
<string name="downloading">库文件</string>
@@ -448,7 +448,7 @@
448448
<string name="use_py3">使用 Python 3</string>
449449
<string name="welcome">欢迎使用QPython 3C,享受您的手机编程之旅吧。</string>
450450
<string name="notice">提示</string>
451-
<string name="python_interpreter">传统Python解释器</string>
451+
<string name="python_interpreter">黑白Python解释器</string>
452452
<string name="shell_terminal">传统 Shell 终端</string>
453453
<string name="package_name_title">软件包名</string>
454454
<string name="bili_web_tip">教程/下载/检查更新:</string>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
<string name="sl4a_running">SL4A server is running</string>
232232
<string name="sl4a_un_running">SL4A server is not running</string>
233233
<string name="service_toggle">Server taggle</string>
234-
<string name="qpy_description">QPython 3C is the Python applet engine for Android devices. It supports PyVer, new SL4A, Open File, Write External Sdcard, Encryption and Decryption, GUI, Audio and Video Play.</string>
234+
<string name="qpy_description">QPython 3C is the Python applet engine for Android devices. It supports PyVer, new SL4A, FileProvider, DocumentFile, encryption and decryption, GUI, audio and video play.</string>
235235
<string name="warning">Warning</string>
236236
<string name="reset_warning">Reset storage will lost all setting and downloaded libs, are you sure you want to reset?</string>
237237
<string name="downloading">Library</string>
@@ -656,7 +656,7 @@
656656
<string name="key_update_qpy3" translatable="false">update_py3</string>
657657
<string name="key_update_qpy2compatible" translatable="false">update_py2compatible</string>
658658

659-
<string name="python_interpreter">Traditional Python Interpreter</string>
659+
<string name="python_interpreter">BlackWhite Python Interpreter</string>
660660
<string name="action_notebook">Notebook</string>
661661

662662
<string name="shell_terminal">Traditional Shell Terminal</string>

termemulator/src/main/java/jackpal/androidterm/emulatorview/EmulatorView.java

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@
1616

1717
package jackpal.androidterm.emulatorview;
1818

19+
import jackpal.androidterm.emulatorview.compat.ClipboardManagerCompat;
20+
import jackpal.androidterm.emulatorview.compat.ClipboardManagerCompatFactory;
21+
import jackpal.androidterm.emulatorview.compat.KeycodeConstants;
22+
import jackpal.androidterm.emulatorview.compat.Patterns;
23+
24+
import java.io.IOException;
25+
import java.util.Arrays;
26+
import java.util.Hashtable;
27+
import java.util.LinkedList;
28+
import java.util.List;
29+
1930
import android.content.Context;
2031
import android.graphics.Canvas;
2132
import android.graphics.Paint;
@@ -44,17 +55,11 @@
4455
import android.view.inputmethod.InputConnection;
4556
import android.widget.Scroller;
4657

47-
import java.io.IOException;
48-
import java.util.Arrays;
49-
import java.util.Hashtable;
50-
import java.util.LinkedList;
51-
52-
import jackpal.androidterm.emulatorview.compat.ClipboardManagerCompat;
53-
import jackpal.androidterm.emulatorview.compat.ClipboardManagerCompatFactory;
54-
import jackpal.androidterm.emulatorview.compat.KeycodeConstants;
55-
import jackpal.androidterm.emulatorview.compat.Patterns;
56-
58+
import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE;
59+
import static android.view.inputmethod.EditorInfo.IME_ACTION_NEXT;
60+
import static android.view.inputmethod.EditorInfo.IME_ACTION_NONE;
5761
import static android.view.inputmethod.EditorInfo.IME_ACTION_UNSPECIFIED;
62+
import static android.view.inputmethod.EditorInfo.IME_MASK_ACTION;
5863

5964
/**
6065
* A view on a {@link TermSession}. Displays the terminal emulator's screen,
@@ -303,7 +308,7 @@ private int createLinks(int row) {
303308
for (lineLen = 0; line[lineLen] != 0; ++lineLen) ;
304309
}
305310

306-
SpannableStringBuilder textToLinkify = new SpannableStringBuilder(new String(line, 0, lineLen - 1));//去空格
311+
SpannableStringBuilder textToLinkify = new SpannableStringBuilder(new String(line, 0, lineLen));
307312

308313
boolean lineWrap = transcriptScreen.getScriptLineWrap(row);
309314

@@ -328,7 +333,7 @@ private int createLinks(int row) {
328333
for (lineLen = 0; line[lineLen] != 0; ++lineLen) ;
329334
}
330335

331-
textToLinkify.append(new String(line, 0, lineLen-1));//去空格
336+
textToLinkify.append(new String(line, 0, lineLen));
332337

333338
//Check if line after next is wrapped
334339
lineWrap = transcriptScreen.getScriptLineWrap(nextRow);
@@ -652,7 +657,7 @@ public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
652657
private int mSelectedTextEnd;
653658

654659
private void sendText(CharSequence text) {
655-
//writeToFile("sendText",text.toString());
660+
Log.d(TAG, "sendText:"+text);
656661
int n = text.length();
657662
char c;
658663
try {
@@ -1342,7 +1347,7 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
13421347
} else if (handleFnKey(keyCode, true)) {
13431348
return true;
13441349
} else if (isSystemKey(keyCode, event)) {
1345-
if (allowSystemKey(keyCode)) {
1350+
if (!isInterceptedSystemKey(keyCode)) {
13461351
// Don't intercept the system keys
13471352
return super.onKeyDown(keyCode, event);
13481353
}
@@ -1372,8 +1377,8 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
13721377
/**
13731378
* Do we want to intercept this system key?
13741379
*/
1375-
private boolean allowSystemKey(int keyCode) {
1376-
return keyCode != KeyEvent.KEYCODE_BACK || !mBackKeySendsCharacter;
1380+
private boolean isInterceptedSystemKey(int keyCode) {
1381+
return keyCode == KeyEvent.KEYCODE_BACK && mBackKeySendsCharacter;
13771382
}
13781383

13791384
/**
@@ -1394,7 +1399,7 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {
13941399
return true;
13951400
} else if (isSystemKey(keyCode, event)) {
13961401
// Don't intercept the system keys
1397-
if (allowSystemKey(keyCode)) {
1402+
if (!isInterceptedSystemKey(keyCode)) {
13981403
return super.onKeyUp(keyCode, event);
13991404
}
14001405
}

0 commit comments

Comments
 (0)