Skip to content

Commit c115820

Browse files
committed
1.处理所有getExternalStorageDirectory
2.解决谷歌fire库build不起来的bug
1 parent baf6d91 commit c115820

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+901
-817
lines changed

build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ ext {
9696
buildToolsVersion = '29.0.2'
9797

9898
// firebase related https://firebase.google.com/docs/android/setup
99-
firebaseCore = "com.google.firebase:firebase-core:16.0.6"
100-
firebaseMsg = "com.google.firebase:firebase-messaging:17.3.4"
99+
firebaseCore = "com.google.firebase:firebase-core:16.0.7"
100+
firebaseMsg = "com.google.firebase:firebase-messaging:18.0.0"
101+
firebaseIid = "com.google.firebase:firebase-iid:17.0.4"
101102
firebaseAuth = "com.google.firebase:firebase-auth:16.1.0"
102-
firebaseDatabase = "com.google.firebase:firebase-database:16.0.5"
103+
firebaseDatabase = "com.google.firebase:firebase-database:16.0.6"
103104

104105
// https://developers.google.com/android/guides/setup
105106
googlePlayServiceAuth = "com.google.android.gms:play-services-auth:16.0.1"

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.os.Environment;
44

55
import com.quseit.config.BASE_CONF;
6+
import com.quseit.util.FileUtils;
67

78
public interface QPyConstants extends BASE_CONF {
89

@@ -33,9 +34,10 @@ public interface QPyConstants extends BASE_CONF {
3334
final String KEY_NOTEBOOK2_RES = "setting.notebook2resource.path";
3435

3536

36-
String ABSOLUTE_PATH = Environment.getExternalStorageDirectory().getPath() + "/" + BASE_PATH;
37-
String PY_CACHE_PATH = ABSOLUTE_PATH+"/"+PY_CACHE;
38-
String ABSOLUTE_LOG = ABSOLUTE_PATH + "/log/last.log";
37+
// String ABSOLUTE_PATH = Environment.getExternalStorageDirectory().getPath() + "/" + BASE_PATH;
38+
// String ABSOLUTE_PATH = FileUtils.getPath().getPath() + "/" + BASE_PATH;
39+
// String PY_CACHE_PATH = ABSOLUTE_PATH+"/"+PY_CACHE;
40+
// String ABSOLUTE_LOG = ABSOLUTE_PATH + "/log/last.log";
3941

4042
String PYTHON_2 = "2.x";
4143

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

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ public void playQScript(final String script) {
9494
mArguments.add(script);
9595
String[] argumentsArray = mArguments.toArray(new String[mArguments.size()]);
9696

97-
final File mLog = new File(String.format("%s", QPyConstants.ABSOLUTE_LOG));
97+
final File mLog = new File(String.format("%s", com.quseit.util.FileUtils.getAbsoluteLogPath(context.getApplicationContext())));
9898
File logDir = mLog.getParentFile();
9999

100-
mFd = Exec.createSubprocess(binaryPath, argumentsArray, getEnvironmentArray(f.getParentFile() + ""), Environment.getExternalStorageDirectory() + "/", pid);
100+
mFd = Exec.createSubprocess(binaryPath, argumentsArray, getEnvironmentArray(f.getParentFile() + ""), com.quseit.util.FileUtils.getPath(context.getApplicationContext()) + "/", pid);
101101
final AtomicInteger mPid = new AtomicInteger(PID_INIT_VALUE);
102102

103103
mPid.set(pid[0]);
@@ -106,34 +106,32 @@ public void playQScript(final String script) {
106106
long mStartTime = System.currentTimeMillis();
107107

108108

109-
new Thread(new Runnable() {
110-
public void run() {
111-
int returnValue = Exec.waitFor(mPid.get());
112-
//long mEndTime = System.currentTimeMillis();
113-
int pid = mPid.getAndSet(PID_INIT_VALUE);
114-
Log.d("", "out:" + mFd.out.toString());
109+
new Thread(() -> {
110+
int returnValue = Exec.waitFor(mPid.get());
111+
//long mEndTime = System.currentTimeMillis();
112+
int pid1 = mPid.getAndSet(PID_INIT_VALUE);
113+
Log.d("", "out:" + mFd.out.toString());
115114

116-
Message msg = new Message();
117-
msg.what = returnValue;
118-
msg.obj = mArguments.get(0);
115+
Message msg = new Message();
116+
msg.what = returnValue;
117+
msg.obj = mArguments.get(0);
119118

120-
Log.d(TAG, "Process " + pid + " exited with result code " + returnValue + ".");
119+
Log.d(TAG, "Process " + pid1 + " exited with result code " + returnValue + ".");
121120

122-
try {
123-
mIn.close();
124-
} catch (IOException e) {
125-
Log.e(TAG, e.getMessage());
126-
}
121+
try {
122+
mIn.close();
123+
} catch (IOException e) {
124+
Log.e(TAG, e.getMessage());
125+
}
127126

128-
try {
129-
mOut.close();
130-
} catch (IOException e) {
131-
Log.e(TAG, e.getMessage());
132-
}
127+
try {
128+
mOut.close();
129+
} catch (IOException e) {
130+
Log.e(TAG, e.getMessage());
131+
}
133132

134-
//context.updateNotify(msg);
133+
//context.updateNotify(msg);
135134

136-
}
137135
}).start();
138136
}
139137

@@ -149,7 +147,7 @@ private String[] getEnvironmentArray(String pyPath) {
149147
environmentVariables.add("PYTHONHOME=" + filesDir);
150148
environmentVariables.add("ANDROID_PRIVATE=" + filesDir);
151149

152-
File externalStorage = new File(Environment.getExternalStorageDirectory(), "org.qpython.qpy");
150+
File externalStorage = new File(com.quseit.util.FileUtils.getPath(context.getApplicationContext()), "org.qpython.qpy");
153151

154152
environmentVariables.add("PYTHONPATH=" + externalStorage + "/lib/python2.7/site-packages/:"
155153
+ filesDir + "/lib/python2.7/site-packages/:"

0 commit comments

Comments
 (0)