Skip to content

Commit b5e05b2

Browse files
committed
Update resources
1 parent 197a572 commit b5e05b2

File tree

9 files changed

+12
-75
lines changed

9 files changed

+12
-75
lines changed

qpysdk/src/main/java/org/qpython/qpysdk/QPySDK.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public void extractRes(File file, File target, boolean forceExtrac) {
209209
if ((int) (Double.parseDouble(data_version) - Double.parseDouble(disk_version)) > 0 || disk_version.equals("0") || forceExtrac) {
210210
target.mkdirs();
211211
if (!new FileExtract().extractTar(file, target.getAbsolutePath())) {
212-
Toast.makeText(this.context, "Could not extract " + fileName + " data.", Toast.LENGTH_SHORT).show();
212+
Log.d(TAG,"Could not extract " + fileName + " data.");
213213
}
214214
}
215215

qpython/src/main/assets/private1.mp3

12 Bytes
Binary file not shown.

qpython/src/main/assets/private32.mp3

234 Bytes
Binary file not shown.

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

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
121121

122122
}
123123

124+
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
124125
public void enableNotebookFromSetting() {
125126
new AlertDialog.Builder(this)
126127
.setTitle(R.string.dialog_alert)
@@ -252,50 +253,6 @@ private void createServer() {
252253

253254
}
254255

255-
256-
private boolean checkNotebook() {
257-
boolean isInstall, isRelease, isExtra;
258-
isInstall = isJupyterInstall();
259-
isRelease = NotebookUtil.isNotebookInstall(this);
260-
isExtra = NotebookUtil.isNotebookLibInstall(this);
261-
262-
263-
if (!isInstall && !isExtra) {
264-
mBinding.errorTv.setText(Html.fromHtml(getResources().getString(R.string.jupyter_not_install)));
265-
mBinding.errorTv.setOnClickListener(v -> linkToStore());
266-
mBinding.errorTv.setVisibility(View.VISIBLE);
267-
return false;
268-
}
269-
270-
if (!isRelease && !isExtra) {
271-
mBinding.errorTv.setText(R.string.jupyter_not_release);
272-
mBinding.errorTv.setVisibility(View.VISIBLE);
273-
return false;
274-
}
275-
276-
if (!isExtra) {
277-
if (!NotebookUtil.extraData(this)) {
278-
mBinding.errorTv.setText(R.string.install_package_fail);
279-
mBinding.errorTv.setVisibility(View.VISIBLE);
280-
return false;
281-
}
282-
}
283-
return true;
284-
}
285-
286-
/**
287-
* 通过包名检查jupyter是否安装
288-
*/
289-
private boolean isJupyterInstall() {
290-
PackageManager pm = getPackageManager();
291-
try {
292-
pm.getPackageInfo(getString(R.string.notebook_app_id), PackageManager.GET_ACTIVITIES);
293-
return true;
294-
} catch (PackageManager.NameNotFoundException e) {
295-
return false;
296-
}
297-
}
298-
299256
public static final String URL = "url";
300257
public static final String ACT = "act";
301258
protected static final String TAG = "NotebookActivity";

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

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ private void initList() {
7575
binding.swipeList.setLayoutManager(new LinearLayoutManager(getContext()));
7676
binding.swipeList.setSwipeMenuCreator(getTypeMenu());
7777

78-
if (isAIPyInstall()) {
79-
View description = getActivity().getLayoutInflater().inflate(R.layout.header_lib_description, binding.swipeList, false);
80-
binding.swipeList.addHeaderView(description);
81-
}
78+
// if (isAIPyInstall()) {
79+
// View description = getActivity().getLayoutInflater().inflate(R.layout.header_lib_description, binding.swipeList, false);
80+
// binding.swipeList.addHeaderView(description);
81+
// }
8282

8383
if (adapter != null) {
8484
adapter.setClick(position -> binding.swipeList.smoothOpenRightMenu(position));
@@ -88,15 +88,6 @@ private void initList() {
8888
}
8989
}
9090

91-
private boolean isAIPyInstall() {
92-
PackageManager pm = getActivity().getPackageManager();
93-
try {
94-
pm.getPackageInfo(getString(R.string.aipy_app_id), PackageManager.GET_ACTIVITIES);
95-
return true;
96-
} catch (PackageManager.NameNotFoundException e) {
97-
return false;
98-
}
99-
}
10091

10192
@Override
10293
public void refresh(boolean forceRefresh) {

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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -311,18 +311,7 @@ private void initListener() {
311311

312312
notebook_run.setOnPreferenceChangeListener((preference, newValue) -> {
313313

314-
if (NotebookUtil.isNotebookInstall(getActivity()) && !NotebookUtil.isNotebookLibInstall(getActivity())) {
315-
316-
releaseNotebook(preference);
317-
/*new AlertDialog.Builder(getActivity(), R.style.MyDialog)
318-
.setTitle(R.string.notice)
319-
.setMessage(R.string.notebook_first)
320-
.setPositiveButton(R.string.ok, (dialog1, which) -> )
321-
.create()
322-
.show();*/
323-
324-
325-
} else if (NotebookUtil.isNotebookLibInstall(getActivity())){
314+
if (NotebookUtil.isNotebookLibInstall(getActivity())){
326315

327316
if ((boolean)newValue) {
328317
NotebookUtil.startNotebookService2(getActivity());
@@ -338,7 +327,7 @@ private void initListener() {
338327
new AlertDialog.Builder(getActivity(), R.style.MyDialog)
339328
.setTitle(R.string.notice)
340329
.setMessage(R.string.install_notebook_first)
341-
.setPositiveButton(R.string.ok, (dialog1, which) -> dialog1.dismiss())
330+
.setPositiveButton(R.string.ok, (dialog1, which) -> releaseNotebook(preference))
342331
.create()
343332
.show();
344333
notebook_run.setChecked(false);

qpython/src/main/java/org/qpython/qpy/utils/NotebookUtil.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public static boolean isNotebookLibInstall(Context context) {
8080
return common & new File(context.getFilesDir().getAbsoluteFile()+"/bin/jupyter").exists();
8181
} else {
8282
return common & new File(context.getFilesDir().getAbsoluteFile()+"/bin/jupyter2").exists();
83-
8483
}
8584
}
8685

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333
<string name="arvr" translatable="false">AR/VR</string>
3434
<string name="action_from_python_three" translatable="false">from_python_three</string>
3535
<string name="key_saver" translatable="false">saver</string>
36-
<string name="aipy_app_id" translatable="false">org.aipy.app</string>
37-
<string name="notebook_app_id" translatable="false">org.qpython.notebook</string>
38-
<string name="python3_app_id" translatable="false">org.qpython.qpy36</string>
3936
<string name="lib_cache_folder_name" translatable="false">.lib_cache</string>
4037
<string name="aipy" translatable="false">AIPy</string>
4138
<string name="slash_project_node" translatable="false">/projects</string>

qpython/src/main/res/xml/network_security_config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
<domain-config cleartextTrafficPermitted="true">
44
<domain includeSubdomains="true">127.0.0.1</domain>
55
<domain includeSubdomains="true">localhost</domain>
6+
<domain includeSubdomains="true">apu2.quseit.com</domain>
67
<domain includeSubdomains="true">qpy.io</domain>
78
<domain includeSubdomains="true">dl.qpy.io</domain>
89
<domain includeSubdomains="true">gist.qpy.io</domain>
910
<domain includeSubdomains="true">qpython.org</domain>
1011
<domain includeSubdomains="true">gist.qpython.org</domain>
1112
<domain includeSubdomains="true">edu.qpython.org</domain>
1213
<domain includeSubdomains="true">www.qpython.org</domain>
14+
<domain includeSubdomains="true">qpypi.qpython.org</domain>
15+
<domain includeSubdomains="true">qpypi3.qpython.org</domain>
16+
1317
</domain-config>
1418
</network-security-config>

0 commit comments

Comments
 (0)