当前位置: 首页>>代码示例>>Java>>正文


Java AXT类代码示例

本文整理汇总了Java中org.ligi.axt.AXT的典型用法代码示例。如果您正苦于以下问题:Java AXT类的具体用法?Java AXT怎么用?Java AXT使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AXT类属于org.ligi.axt包,在下文中一共展示了AXT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showSaveDialog

import org.ligi.axt.AXT; //导入依赖的package包/类
private void showSaveDialog() {
    final EditText fileNameET = new EditText(this);
    fileNameET.setText(App.getSettings().getRecentFileName());
    new AlertDialog.Builder(this)
            .setView(fileNameET)
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    final String fileName = fileNameET.getText().toString() + ".aj";
                    final File outFile = new File(App.getSettings().getScriptDir(), fileName);
                    AXT.at(outFile).writeString(codeEditText.getText().toString());
                    App.getSettings().setRecentFileName(fileNameET.getText().toString());
                }
            })
            .setNegativeButton(android.R.string.cancel, null)
            .show();
}
 
开发者ID:ligi,项目名称:AJShA,代码行数:18,代码来源:EditActivity.java

示例2: getBitmap

import org.ligi.axt.AXT; //导入依赖的package包/类
private File getBitmap(String tag, Uri url) {
    final File cacheDir = context.getCacheDir();

    if (!cacheDir.exists()) {
        cacheDir.mkdirs();
    }

    final File f = new File(cacheDir, tag);

    try {
        final InputStream is = getInputStreamByURL(url);
        AXT.at(is).toFile(f);
        return f;
    } catch (Exception ex) {
        ex.printStackTrace();
        return null;
    }
}
 
开发者ID:ligi,项目名称:AXT,代码行数:19,代码来源:ImageFromIntentUriToFileConverter.java

示例3: testThatBasicChatMessagesAreParsed

import org.ligi.axt.AXT; //导入依赖的package包/类
@Test
public void testThatBasicChatMessagesAreParsed() throws IOException, URISyntaxException {
    final String json = AXT.at(new File(getClass().getClassLoader().getResource("simple_server_response.json").toURI())).readToString();
    final ChatModel chatModel = new ChatModel();
    final ServerResponseProcessor tested = new ServerResponseProcessor(mock(OtherUsersLocationModel.class), mock(EventBusProvider.class), chatModel);

    tested.process(json);

    assertThat(chatModel.getSavedAndOutgoingMessages().size()).isEqualTo(2);
}
 
开发者ID:criticalmaps,项目名称:criticalmaps-android,代码行数:11,代码来源:ServerResponseProcessorTest.java

示例4: testThatBasicChatMessagesAreSorted

import org.ligi.axt.AXT; //导入依赖的package包/类
@Test
public void testThatBasicChatMessagesAreSorted() throws IOException, URISyntaxException {
    final String json = AXT.at(new File(getClass().getClassLoader().getResource("simple_server_response.json").toURI())).readToString();
    final ChatModel chatModel = new ChatModel();
    final ServerResponseProcessor tested = new ServerResponseProcessor(mock(OtherUsersLocationModel.class), mock(EventBusProvider.class), chatModel);

    tested.process(json);

    final ReceivedChatMessage message0 = (ReceivedChatMessage) chatModel.getSavedAndOutgoingMessages().get(0);
    final ReceivedChatMessage message1 = (ReceivedChatMessage) chatModel.getSavedAndOutgoingMessages().get(1);

    assertThat(message0.getTimestamp()).isBefore(message1.getTimestamp());
}
 
开发者ID:criticalmaps,项目名称:criticalmaps-android,代码行数:14,代码来源:ServerResponseProcessorTest.java

示例5: testThatEventIsFiredForValidJSON

import org.ligi.axt.AXT; //导入依赖的package包/类
@Test
public void testThatEventIsFiredForValidJSON() throws IOException, URISyntaxException {
    final String json = AXT.at(new File(getClass().getClassLoader().getResource("simple_server_response.json").toURI())).readToString();
    final EventBusProvider eventMock = mock(EventBusProvider.class);
    final ServerResponseProcessor tested = new ServerResponseProcessor(mock(OtherUsersLocationModel.class), eventMock, mock(ChatModel.class));

    tested.process(json);

    verify(eventMock, times(1)).post(Events.NEW_SERVER_RESPONSE_EVENT);
}
 
开发者ID:criticalmaps,项目名称:criticalmaps-android,代码行数:11,代码来源:ServerResponseProcessorTest.java

示例6: onProgressUpdate

import org.ligi.axt.AXT; //导入依赖的package包/类
@Override
protected void onProgressUpdate(String... values) {
    super.onProgressUpdate(values);

    try {
        final String codeString = AXT.at(new File(values[0])).readToString();
        interpreter.eval(codeString);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (EvalError evalError) {
        evalError.printStackTrace();
    }
}
 
开发者ID:ligi,项目名称:AJShA,代码行数:14,代码来源:ExecutePluginsAsyncTask.java

示例7: copyAssets

import org.ligi.axt.AXT; //导入依赖的package包/类
private void copyAssets(String path) {
    final AssetManager assetManager = activity.getAssets();
    try {
        final String toName = AXT.at(path.split("/")).last();
        final File toPath = new File(App.getSettings().getScriptDir() + "/" + toName);
        if (!toPath.exists()) {
            toPath.mkdirs();
        }
        final String[] files = assetManager.list(path);
        for (String filename : files) {
            publishProgress(filename);
            final InputStream in = assetManager.open(path + "/" + filename);
            final File outFile = new File(toPath, filename);
            if (!outFile.exists()) {
                if (!outFile.createNewFile()) {
                    continue;
                }
                final OutputStream out = new FileOutputStream(outFile);
                copyFile(in, out);
                in.close();
                out.flush();
                out.close();
            }
        }
    } catch (IOException e) {
        Log.e("tag", "Failed to get asset file list.", e);
    }

}
 
开发者ID:ligi,项目名称:AJShA,代码行数:30,代码来源:CopyAssetsAsyncTask.java

示例8: delete_recursive_should_behave_correct_when_no_dir_there

import org.ligi.axt.AXT; //导入依赖的package包/类
@Test
public void delete_recursive_should_behave_correct_when_no_dir_there() {
    File testDir = new File(EXT_DIR, DEFAULT_DIR);
    // should not exist
    assertThat(testDir.exists()).isEqualTo(false);

    // invoke and check return code
    assertThat(AXT.at(testDir).deleteRecursive()).isEqualTo(false);
}
 
开发者ID:ligi,项目名称:AXT,代码行数:10,代码来源:TheFileAXT.java

示例9: delete_recursive_should_delete_a_single_dir

import org.ligi.axt.AXT; //导入依赖的package包/类
@Test
public void delete_recursive_should_delete_a_single_dir() {
    File testDir = new File(EXT_DIR, DEFAULT_DIR);
    testDir.mkdir();

    // should exist now
    assertThat(testDir.exists()).isEqualTo(true);

    // invoke and check return code
    assertThat(AXT.at(testDir).deleteRecursive()).isEqualTo(true);

    assertThat(testDir.exists()).isEqualTo(false);
}
 
开发者ID:ligi,项目名称:AXT,代码行数:14,代码来源:TheFileAXT.java

示例10: delete_recursive_should_delete_dirs_recursively

import org.ligi.axt.AXT; //导入依赖的package包/类
@Test
public void delete_recursive_should_delete_dirs_recursively() {
    File testDirDeep = new File(EXT_DIR, DEFAULT_DIR + "/" + DEFAULT_DIR + "/" + DEFAULT_DIR);
    testDirDeep.mkdirs();

    File testDir2Remove = new File(EXT_DIR, DEFAULT_DIR);

    // should exist now
    assertThat(testDirDeep.exists()).isEqualTo(true);

    // invoke and check return code
    assertThat(AXT.at(testDir2Remove).deleteRecursive()).isEqualTo(true);

    assertThat(testDirDeep.exists()).isEqualTo(false);
}
 
开发者ID:ligi,项目名称:AXT,代码行数:16,代码来源:TheFileAXT.java

示例11: read_write_file_cycle_should_keep_data

import org.ligi.axt.AXT; //导入依赖的package包/类
@Test
public void read_write_file_cycle_should_keep_data() {
    File testFile = new File(EXT_DIR, DEFAULT_DIR + ".txt");

    AXT.at(testFile).writeString("SAMPLE");

    try {
        assertThat(AXT.at(testFile).readToString()).isEqualTo("SAMPLE");
    } catch (IOException e) {
        fail("the file should be loadable");
    }
}
 
开发者ID:ligi,项目名称:AXT,代码行数:13,代码来源:TheFileAXT.java

示例12: obj_read_write_roundtrip

import org.ligi.axt.AXT; //导入依赖的package包/类
@Test
public void obj_read_write_roundtrip() throws IOException, ClassNotFoundException {
    File testFile = new File(EXT_DIR, DEFAULT_DIR + ".obj");
    TestSerializable in = new TestSerializable();
    in.test = "TESTING";

    AXT.at(testFile).writeObject(in);

    TestSerializable out = AXT.at(testFile).loadToObject();
    assertThat(in.test).isEqualTo(out.test);
}
 
开发者ID:ligi,项目名称:AXT,代码行数:12,代码来源:TheFileAXT.java

示例13: string_read_write_roundtrip

import org.ligi.axt.AXT; //导入依赖的package包/类
@Test
public void string_read_write_roundtrip() throws IOException, ClassNotFoundException {
    File testFile = new File(EXT_DIR, "foo.txt");

    String probe = "foo\r\nbar";

    AXT.at(testFile).writeString(probe);
    final String read = AXT.at(testFile).readToString();

    assertThat(probe).isEqualTo(read);
}
 
开发者ID:ligi,项目名称:AXT,代码行数:12,代码来源:TheFileAXT.java

示例14: size_as_point_works

import org.ligi.axt.AXT; //导入依赖的package包/类
@Test
public void size_as_point_works() {
    Bitmap origBitmap = Bitmap.createBitmap(SIZE_X_PROBE, SIZE_Y_PROBE, Bitmap.Config.ARGB_8888);

    Point sizeAsPoint = AXT.at(origBitmap).getSizeAsPoint();

    Assertions.assertThat(sizeAsPoint).isEqualTo(new Point(SIZE_X_PROBE, SIZE_Y_PROBE));
}
 
开发者ID:ligi,项目名称:AXT,代码行数:9,代码来源:TheBitmapAXT.java

示例15: should_write_file_correctly

import org.ligi.axt.AXT; //导入依赖的package包/类
@Test
public void should_write_file_correctly() throws IOException {
    File file = new File(ROOT, "foo1");

    AXT.at(new StringInputStream(STRING_PROBE)).toFile(file);

    assertThat(STRING_PROBE).isEqualTo(AXT.at(file).readToString());
}
 
开发者ID:ligi,项目名称:AXT,代码行数:9,代码来源:TheInputStreamAXT.java


注:本文中的org.ligi.axt.AXT类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。