Revision 440f8e33
Added by Leszek Koltunski about 1 year ago
src/main/java/org/distorted/objectlib/helpers/BlockController.java | ||
---|---|---|
12 | 12 |
import java.util.Timer; |
13 | 13 |
import java.util.TimerTask; |
14 | 14 |
|
15 |
import android.app.Activity; |
|
16 |
|
|
17 | 15 |
import org.distorted.library.message.EffectMessageSender; |
18 | 16 |
import org.distorted.objectlib.main.ObjectPreRender; |
19 | 17 |
|
... | ... | |
62 | 60 |
|
63 | 61 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
64 | 62 |
|
65 |
public BlockController(Activity act, ObjectPreRender pre)
|
|
63 |
public BlockController(ObjectPreRender pre) |
|
66 | 64 |
{ |
67 | 65 |
mPre = pre; |
68 | 66 |
|
... | ... | |
73 | 71 |
@Override |
74 | 72 |
public void run() |
75 | 73 |
{ |
76 |
act.runOnUiThread(new Runnable() |
|
77 |
{ |
|
78 |
@Override |
|
79 |
public void run() |
|
80 |
{ |
|
81 |
checkingThread(); |
|
82 |
} |
|
83 |
}); |
|
74 |
checkingThread(); |
|
84 | 75 |
} |
85 | 76 |
}, 0, 1000); |
86 | 77 |
} |
src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java | ||
---|---|---|
27 | 27 |
void reportBlockProblem(int type, int place, long pause, long resume, long time); |
28 | 28 |
void reportProblem(String problem, boolean reportException); |
29 | 29 |
void reportJSONError(String error, int ordinal); |
30 |
|
|
31 |
int getScreenDensity(); |
|
30 | 32 |
} |
src/main/java/org/distorted/objectlib/json/JsonReader.java | ||
---|---|---|
13 | 13 |
import static org.distorted.objectlib.scrambling.ScrambleStateBandagedCuboid.MAX_SUPPORTED_SIZE; |
14 | 14 |
|
15 | 15 |
import java.io.BufferedReader; |
16 |
import java.io.File; |
|
17 |
import java.io.FileInputStream; |
|
18 | 16 |
import java.io.IOException; |
19 | 17 |
import java.io.InputStream; |
20 | 18 |
import java.io.InputStreamReader; |
21 | 19 |
import java.nio.charset.StandardCharsets; |
22 | 20 |
|
23 |
import android.content.Context; |
|
24 |
|
|
25 | 21 |
import org.distorted.objectlib.helpers.ObjectFaceShape; |
26 | 22 |
import org.distorted.objectlib.helpers.ObjectSignature; |
27 | 23 |
import org.distorted.objectlib.helpers.ObjectStickerOverride; |
... | ... | |
749 | 745 |
|
750 | 746 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
751 | 747 |
|
752 |
public void readNumScramblesAndPrice(Context context, String fileName) throws IOException, JSONException
|
|
748 |
public void readNumScramblesAndPrice(InputStream stream) throws IOException, JSONException
|
|
753 | 749 |
{ |
754 |
File file = new File(context.getFilesDir(), fileName); |
|
755 |
InputStream stream = new FileInputStream(file); |
|
756 | 750 |
BufferedReader br = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8)); |
757 | 751 |
|
758 | 752 |
StringBuilder contents = new StringBuilder(); |
src/main/java/org/distorted/objectlib/main/ObjectControl.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package org.distorted.objectlib.main; |
11 | 11 |
|
12 |
import android.app.Activity; |
|
13 | 12 |
import android.content.SharedPreferences; |
14 |
import android.util.DisplayMetrics; |
|
15 | 13 |
import android.view.MotionEvent; |
16 | 14 |
|
17 | 15 |
import org.distorted.library.main.QuatHelper; |
... | ... | |
505 | 503 |
// PUBLIC API |
506 | 504 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
507 | 505 |
|
508 |
public ObjectControl(Activity act, ObjectLibInterface actioner)
|
|
506 |
public ObjectControl(ObjectLibInterface actioner) |
|
509 | 507 |
{ |
510 | 508 |
mIsAutomatic = false; |
511 | 509 |
|
... | ... | |
527 | 525 |
mMeshState =-1; |
528 | 526 |
mIconMode =-1; |
529 | 527 |
|
530 |
DisplayMetrics dm = new DisplayMetrics(); |
|
531 |
act.getWindowManager().getDefaultDisplay().getMetrics(dm); |
|
528 |
mDensity = actioner.getScreenDensity(); |
|
532 | 529 |
|
533 |
mDensity = dm.densityDpi; |
|
534 |
|
|
535 |
mPreRender = new ObjectPreRender(act,this,actioner); |
|
530 |
mPreRender = new ObjectPreRender(this,actioner); |
|
536 | 531 |
mInterface = actioner; |
537 | 532 |
} |
538 | 533 |
|
src/main/java/org/distorted/objectlib/main/ObjectPreRender.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package org.distorted.objectlib.main; |
11 | 11 |
|
12 |
import android.app.Activity; |
|
13 | 12 |
import android.content.SharedPreferences; |
14 | 13 |
|
15 | 14 |
import org.distorted.library.message.EffectListener; |
... | ... | |
67 | 66 |
|
68 | 67 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
69 | 68 |
|
70 |
public ObjectPreRender(Activity act, ObjectControl controller, ObjectLibInterface actioner)
|
|
69 |
public ObjectPreRender(ObjectControl controller, ObjectLibInterface actioner) |
|
71 | 70 |
{ |
72 | 71 |
mInterface = actioner; |
73 | 72 |
mController = controller; |
... | ... | |
94 | 93 |
|
95 | 94 |
mEffectID = new long[BaseEffect.Type.LENGTH]; |
96 | 95 |
|
97 |
mBlockController = new BlockController(act,this);
|
|
96 |
mBlockController = new BlockController(this); |
|
98 | 97 |
unblockEverything(); |
99 | 98 |
} |
100 | 99 |
|
Also available in: Unified diff
remove all references to android.Context and android.Activity from distorted-objectlib