-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Siy-Wu
committed
May 14, 2018
1 parent
dcff647
commit 06a6bc6
Showing
36 changed files
with
1,805 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
/.idea | ||
/.gradle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 27 | ||
|
||
defaultConfig { | ||
applicationId "com.siyer.test" | ||
minSdkVersion 16 | ||
targetSdkVersion 27 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
lintOptions { | ||
abortOnError false | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
exclude group: 'com.android.support', module: 'support-annotations' | ||
}) | ||
implementation 'com.android.support:design:27.1.1' | ||
implementation 'com.android.support:appcompat-v7:27.1.1' | ||
testImplementation 'junit:junit:4.12' | ||
implementation project(':pwdview') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in D:\Android\android-sdk-windows/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
26 changes: 26 additions & 0 deletions
26
app/src/androidTest/java/com/siyer/test/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.siyer.test; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumentation test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.payeco.tls", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.siyer.test"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.AppCompat"> | ||
<activity android:name="com.siyer.test.MainActivity" | ||
android:theme="@style/Theme.AppCompat"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
package com.siyer.test; | ||
|
||
import android.app.Activity; | ||
import android.content.Context; | ||
import android.graphics.Color; | ||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.util.TypedValue; | ||
import android.view.View; | ||
|
||
import com.siy.pwdview.PwdView; | ||
|
||
/** | ||
* Created by Siy on 2018/4/23. | ||
* | ||
* @author Siy | ||
* @date 2018/4/23. | ||
*/ | ||
public class MainActivity extends Activity implements View.OnClickListener { | ||
private PwdView pv; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
pv = findViewById(R.id.pwdviewId); | ||
|
||
findViewById(R.id.num1).setOnClickListener(this); | ||
findViewById(R.id.num2).setOnClickListener(this); | ||
findViewById(R.id.num3).setOnClickListener(this); | ||
findViewById(R.id.num4).setOnClickListener(this); | ||
findViewById(R.id.showOrg).setOnClickListener(this); | ||
findViewById(R.id.showCursor).setOnClickListener(this); | ||
findViewById(R.id.setBorderColor).setOnClickListener(this); | ||
findViewById(R.id.setBorderWidth).setOnClickListener(this); | ||
findViewById(R.id.setPwdLen).setOnClickListener(this); | ||
findViewById(R.id.setPwdWidth).setOnClickListener(this); | ||
findViewById(R.id.setPwdColor).setOnClickListener(this); | ||
findViewById(R.id.setContentColor).setOnClickListener(this); | ||
findViewById(R.id.setContentBoardColor).setOnClickListener(this); | ||
findViewById(R.id.setContentMargin).setOnClickListener(this); | ||
findViewById(R.id.setContentBoardWidth).setOnClickListener(this); | ||
findViewById(R.id.bg).setOnClickListener(this); | ||
findViewById(R.id.setSplitLineColor).setOnClickListener(this); | ||
findViewById(R.id.setBorderRadius).setOnClickListener(this); | ||
findViewById(R.id.setContentRadius).setOnClickListener(this); | ||
findViewById(R.id.setCursorColor).setOnClickListener(this); | ||
findViewById(R.id.delete).setOnClickListener(this); | ||
findViewById(R.id.setCursorMargin).setOnClickListener(this); | ||
} | ||
|
||
@Override | ||
public void onClick(View v) { | ||
int id = v.getId(); | ||
switch (id) { | ||
case R.id.bg: | ||
pv.setBackgroundColor(Color.parseColor("#232224")); | ||
break; | ||
case R.id.num1: | ||
pv.setAppendText("1"); | ||
break; | ||
case R.id.num2: | ||
pv.setAppendText("2"); | ||
break; | ||
case R.id.num3: | ||
pv.setAppendText("3"); | ||
break; | ||
case R.id.num4: | ||
pv.setAppendText("4"); | ||
break; | ||
case R.id.showOrg: | ||
pv.showPwdText(!pv.isShowPwdText()); | ||
break; | ||
case R.id.showCursor: | ||
if (pv.isShowCursor()) { | ||
pv.hideCursor(); | ||
} else { | ||
pv.showCursor(); | ||
} | ||
break; | ||
case R.id.setBorderColor: | ||
pv.setBorderColor(Color.TRANSPARENT); | ||
break; | ||
case R.id.setBorderWidth: | ||
pv.setBorderWidth(5); | ||
break; | ||
case R.id.setPwdLen: | ||
pv.setPwdLen(pv.getPwdLen() + 1); | ||
break; | ||
case R.id.setPwdColor: | ||
pv.setPwdColor(Color.WHITE); | ||
break; | ||
case R.id.setPwdWidth: | ||
pv.setPwdWidth(18); | ||
break; | ||
case R.id.setContentColor: | ||
pv.setContentColor(Color.parseColor("#141414")); | ||
break; | ||
case R.id.setContentBoardColor: | ||
pv.setContentBoardColor(Color.parseColor("#33FFFFFF")); | ||
break; | ||
case R.id.setContentBoardWidth: | ||
pv.setContentBoardWidth(2); | ||
break; | ||
case R.id.setContentMargin: | ||
pv.setContentMargin(dip2px(this, 10)); | ||
break; | ||
case R.id.setSplitLineColor: | ||
pv.setSplitLineColor(Color.TRANSPARENT); | ||
break; | ||
case R.id.setContentRadius: | ||
pv.setContentRadius(6); | ||
break; | ||
case R.id.setBorderRadius: | ||
pv.setBorderRadius(6); | ||
break; | ||
case R.id.setCursorColor: | ||
pv.setCursorColor(Color.WHITE); | ||
break; | ||
case R.id.delete: | ||
pv.deleteLast(); | ||
break; | ||
case R.id.setCursorMargin: | ||
pv.setCursorMargin(dip2px(this,20)); | ||
break; | ||
default: | ||
} | ||
} | ||
|
||
/** | ||
* 密度无关像素 装换成 像素 | ||
* | ||
* @param context | ||
* @param dipValue | ||
* @return | ||
*/ | ||
public static int dip2px(Context context, float dipValue) { | ||
return (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, context.getResources().getDisplayMetrics()) + 0.5f); | ||
} | ||
} |
Oops, something went wrong.