Skip to content

Commit 5e785d2

Browse files
committed
init
1 parent 35e0f08 commit 5e785d2

File tree

96 files changed

+9684
-22
lines changed

Some content is hidden

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

96 files changed

+9684
-22
lines changed

.gitignore

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
# Compiled class file
2-
*.class
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/libraries
5+
/.idea/modules.xml
6+
/.idea/workspace.xml
7+
.DS_Store
8+
/build
9+
/captures
10+
.externalNativeBuild
311

4-
# Log file
5-
*.log
6-
7-
# BlueJ files
8-
*.ctxt
9-
10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
12-
13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.nar
17-
*.ear
18-
*.zip
19-
*.tar.gz
20-
*.rar
21-
22-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23-
hs_err_pid*

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 28
5+
defaultConfig {
6+
applicationId "com.ve.acpp"
7+
minSdkVersion 21
8+
targetSdkVersion 28
9+
versionCode 1
10+
versionName "1.0"
11+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12+
}
13+
buildTypes {
14+
release {
15+
minifyEnabled false
16+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17+
}
18+
}
19+
compileOptions {
20+
targetCompatibility 1.8
21+
sourceCompatibility 1.8
22+
}
23+
}
24+
25+
dependencies {
26+
implementation fileTree(dir: 'libs', include: ['*.jar'])
27+
implementation 'com.android.support:appcompat-v7:28.0.0'
28+
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
29+
testImplementation 'junit:junit:4.12'
30+
31+
androidTestImplementation 'com.android.support.test:runner:1.0.1'
32+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
33+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.ve.acpp;
2+
3+
import android.content.Context;
4+
import android.graphics.Paint;
5+
import android.support.test.InstrumentationRegistry;
6+
import android.support.test.runner.AndroidJUnit4;
7+
8+
import com.ve.view.editor.MeasureCache;
9+
10+
import org.junit.Test;
11+
import org.junit.runner.RunWith;
12+
13+
import static org.junit.Assert.*;
14+
15+
/**
16+
* Instrumented test, which will execute on an Android device.
17+
*
18+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
19+
*/
20+
@RunWith(AndroidJUnit4.class)
21+
public class ExampleInstrumentedTest {
22+
@Test
23+
public void useAppContext() {
24+
// Context of the app under test.
25+
Context appContext = InstrumentationRegistry.getTargetContext();
26+
27+
MeasureCache cache=new MeasureCache(new Paint());
28+
assertEquals(cache.getWidth('s'),cache.getWidth('s'),0.001);
29+
}
30+
}

app/src/main/AndroidManifest.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.ve.acpp">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package com.ve.acpp;
2+
3+
import android.os.Bundle;
4+
import android.support.v7.app.AppCompatActivity;
5+
import android.view.View;
6+
7+
import com.ve.view.editor.Editor;
8+
import com.ve.view.editor.out.Config;
9+
import com.ve.view.editor.out.TextInterface;
10+
import com.ve.view.ext.ClipboardPanel;
11+
12+
import java.util.Random;
13+
14+
public class MainActivity extends AppCompatActivity {
15+
16+
Editor editor;
17+
18+
ClipboardPanel clipboardPanel;
19+
@Override
20+
protected void onCreate(Bundle savedInstanceState) {
21+
super.onCreate(savedInstanceState);
22+
setContentView(R.layout.activity_main);
23+
editor = findViewById(R.id.activity_main_editor);
24+
Config config=new Config();
25+
config.showNonPrinting=true;
26+
config.wordWrap=false;
27+
editor.applyConfig(config);
28+
clipboardPanel=new ClipboardPanel(editor);
29+
editor.getOperator().setSelectionChangedListener((active, selStart, selEnd) -> {
30+
if (active){
31+
clipboardPanel.show();
32+
}else {
33+
clipboardPanel.hide();
34+
}
35+
});
36+
37+
test();
38+
}
39+
40+
private void test() {
41+
StringBuffer stringBuffer = new StringBuffer();
42+
Random random=new Random();
43+
for (int i = 0; i < 20; i++) {
44+
if (random.nextBoolean()) {
45+
stringBuffer.append(" asfgweilfuWEF72QWDFYFregargaergnwderghwaefwsefweg数的rnwd文档发给nueffgeriugiesgier\n");
46+
}
47+
stringBuffer.append(" asfgweilfuWEF72G\nQWDFYF、nwdwefgGAGDGSDFGHAWERGHWERHERREGRAGEsddnwd、nuef\nefgeriugiesgier\n");
48+
49+
}
50+
51+
TextInterface textInterface = editor.getTextInterface();
52+
textInterface.paste(stringBuffer.toString());
53+
textInterface.replaceText(0,textInterface.getLength()-1,"Good!");
54+
}
55+
56+
public void onRedo(View view) {
57+
editor.getTextInterface().redo();
58+
}
59+
60+
public void onUndo(View view) {
61+
editor.getTextInterface().undo();
62+
}
63+
}

0 commit comments

Comments
 (0)