Skip to content

Commit

Permalink
Update resources
Browse files Browse the repository at this point in the history
  • Loading branch information
riverfor committed Feb 6, 2020
1 parent 197a572 commit b5e05b2
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 75 deletions.
2 changes: 1 addition & 1 deletion qpysdk/src/main/java/org/qpython/qpysdk/QPySDK.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void extractRes(File file, File target, boolean forceExtrac) {
if ((int) (Double.parseDouble(data_version) - Double.parseDouble(disk_version)) > 0 || disk_version.equals("0") || forceExtrac) {
target.mkdirs();
if (!new FileExtract().extractTar(file, target.getAbsolutePath())) {
Toast.makeText(this.context, "Could not extract " + fileName + " data.", Toast.LENGTH_SHORT).show();
Log.d(TAG,"Could not extract " + fileName + " data.");
}
}

Expand Down
Binary file modified qpython/src/main/assets/private1.mp3
Binary file not shown.
Binary file modified qpython/src/main/assets/private32.mp3
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

}

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
public void enableNotebookFromSetting() {
new AlertDialog.Builder(this)
.setTitle(R.string.dialog_alert)
Expand Down Expand Up @@ -252,50 +253,6 @@ private void createServer() {

}


private boolean checkNotebook() {
boolean isInstall, isRelease, isExtra;
isInstall = isJupyterInstall();
isRelease = NotebookUtil.isNotebookInstall(this);
isExtra = NotebookUtil.isNotebookLibInstall(this);


if (!isInstall && !isExtra) {
mBinding.errorTv.setText(Html.fromHtml(getResources().getString(R.string.jupyter_not_install)));
mBinding.errorTv.setOnClickListener(v -> linkToStore());
mBinding.errorTv.setVisibility(View.VISIBLE);
return false;
}

if (!isRelease && !isExtra) {
mBinding.errorTv.setText(R.string.jupyter_not_release);
mBinding.errorTv.setVisibility(View.VISIBLE);
return false;
}

if (!isExtra) {
if (!NotebookUtil.extraData(this)) {
mBinding.errorTv.setText(R.string.install_package_fail);
mBinding.errorTv.setVisibility(View.VISIBLE);
return false;
}
}
return true;
}

/**
* 通过包名检查jupyter是否安装
*/
private boolean isJupyterInstall() {
PackageManager pm = getPackageManager();
try {
pm.getPackageInfo(getString(R.string.notebook_app_id), PackageManager.GET_ACTIVITIES);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}

public static final String URL = "url";
public static final String ACT = "act";
protected static final String TAG = "NotebookActivity";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ private void initList() {
binding.swipeList.setLayoutManager(new LinearLayoutManager(getContext()));
binding.swipeList.setSwipeMenuCreator(getTypeMenu());

if (isAIPyInstall()) {
View description = getActivity().getLayoutInflater().inflate(R.layout.header_lib_description, binding.swipeList, false);
binding.swipeList.addHeaderView(description);
}
// if (isAIPyInstall()) {
// View description = getActivity().getLayoutInflater().inflate(R.layout.header_lib_description, binding.swipeList, false);
// binding.swipeList.addHeaderView(description);
// }

if (adapter != null) {
adapter.setClick(position -> binding.swipeList.smoothOpenRightMenu(position));
Expand All @@ -88,15 +88,6 @@ private void initList() {
}
}

private boolean isAIPyInstall() {
PackageManager pm = getActivity().getPackageManager();
try {
pm.getPackageInfo(getString(R.string.aipy_app_id), PackageManager.GET_ACTIVITIES);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}

@Override
public void refresh(boolean forceRefresh) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,18 +311,7 @@ private void initListener() {

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

if (NotebookUtil.isNotebookInstall(getActivity()) && !NotebookUtil.isNotebookLibInstall(getActivity())) {

releaseNotebook(preference);
/*new AlertDialog.Builder(getActivity(), R.style.MyDialog)
.setTitle(R.string.notice)
.setMessage(R.string.notebook_first)
.setPositiveButton(R.string.ok, (dialog1, which) -> )
.create()
.show();*/


} else if (NotebookUtil.isNotebookLibInstall(getActivity())){
if (NotebookUtil.isNotebookLibInstall(getActivity())){

if ((boolean)newValue) {
NotebookUtil.startNotebookService2(getActivity());
Expand All @@ -338,7 +327,7 @@ private void initListener() {
new AlertDialog.Builder(getActivity(), R.style.MyDialog)
.setTitle(R.string.notice)
.setMessage(R.string.install_notebook_first)
.setPositiveButton(R.string.ok, (dialog1, which) -> dialog1.dismiss())
.setPositiveButton(R.string.ok, (dialog1, which) -> releaseNotebook(preference))
.create()
.show();
notebook_run.setChecked(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public static boolean isNotebookLibInstall(Context context) {
return common & new File(context.getFilesDir().getAbsoluteFile()+"/bin/jupyter").exists();
} else {
return common & new File(context.getFilesDir().getAbsoluteFile()+"/bin/jupyter2").exists();

}
}

Expand Down
3 changes: 0 additions & 3 deletions qpython/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
<string name="arvr" translatable="false">AR/VR</string>
<string name="action_from_python_three" translatable="false">from_python_three</string>
<string name="key_saver" translatable="false">saver</string>
<string name="aipy_app_id" translatable="false">org.aipy.app</string>
<string name="notebook_app_id" translatable="false">org.qpython.notebook</string>
<string name="python3_app_id" translatable="false">org.qpython.qpy36</string>
<string name="lib_cache_folder_name" translatable="false">.lib_cache</string>
<string name="aipy" translatable="false">AIPy</string>
<string name="slash_project_node" translatable="false">/projects</string>
Expand Down
4 changes: 4 additions & 0 deletions qpython/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">127.0.0.1</domain>
<domain includeSubdomains="true">localhost</domain>
<domain includeSubdomains="true">apu2.quseit.com</domain>
<domain includeSubdomains="true">qpy.io</domain>
<domain includeSubdomains="true">dl.qpy.io</domain>
<domain includeSubdomains="true">gist.qpy.io</domain>
<domain includeSubdomains="true">qpython.org</domain>
<domain includeSubdomains="true">gist.qpython.org</domain>
<domain includeSubdomains="true">edu.qpython.org</domain>
<domain includeSubdomains="true">www.qpython.org</domain>
<domain includeSubdomains="true">qpypi.qpython.org</domain>
<domain includeSubdomains="true">qpypi3.qpython.org</domain>

</domain-config>
</network-security-config>

0 comments on commit b5e05b2

Please sign in to comment.