mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Compare commits
2 Commits
alpha-1.5.
...
checkstyle
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c42af1489 | ||
|
|
4496df723a |
@@ -5,6 +5,7 @@ targetCompatibility = 1.8
|
||||
apply plugin: 'ru.vyarus.animalsniffer'
|
||||
apply plugin: 'witness'
|
||||
apply from: 'witness.gradle'
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
dependencies {
|
||||
implementation "com.google.dagger:dagger:$dagger_version"
|
||||
|
||||
@@ -7,6 +7,7 @@ apply plugin: 'idea'
|
||||
apply plugin: 'witness'
|
||||
apply from: 'witness.gradle'
|
||||
apply from: '../dagger.gradle'
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
dependencies {
|
||||
implementation project(path: ':bramble-api', configuration: 'default')
|
||||
|
||||
@@ -9,9 +9,9 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
@NotNullByDefault
|
||||
interface UrlConverter {
|
||||
|
||||
/**
|
||||
* Converts a raw onion address, excluding the .onion suffix, into an
|
||||
* HTTP URL.
|
||||
*/
|
||||
String convertOnionToBaseUrl(String onion);
|
||||
/**
|
||||
* Converts a raw onion address, excluding the .onion suffix, into an
|
||||
* HTTP URL.
|
||||
*/
|
||||
String convertOnionToBaseUrl(String onion);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ apply plugin: 'idea'
|
||||
apply plugin: 'witness'
|
||||
apply from: 'witness.gradle'
|
||||
apply from: '../dagger.gradle'
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
configurations {
|
||||
tor
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'witness'
|
||||
apply from: 'witness.gradle'
|
||||
apply plugin: 'checkstyle'
|
||||
// Need to manually apply this as the Java plugin is not applied to this module hence this is not
|
||||
// done automatically.
|
||||
apply from: "${rootProject.rootDir}/gradle/checkstyle.gradle"
|
||||
|
||||
def getStdout = { command, defaultValue ->
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
|
||||
@@ -16,48 +16,48 @@ import androidx.annotation.UiThread;
|
||||
|
||||
public class QrCodeView extends FrameLayout {
|
||||
|
||||
private final ImageView qrCodeImageView;
|
||||
private boolean fullscreen = false;
|
||||
private FullscreenListener listener;
|
||||
private final ImageView qrCodeImageView;
|
||||
private boolean fullscreen = false;
|
||||
private FullscreenListener listener;
|
||||
|
||||
public QrCodeView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.qr_code_view, this, true);
|
||||
qrCodeImageView = findViewById(R.id.qr_code);
|
||||
ImageView fullscreenButton = findViewById(R.id.fullscreen_button);
|
||||
fullscreenButton.setOnClickListener(v -> {
|
||||
fullscreen = !fullscreen;
|
||||
if (!fullscreen) {
|
||||
fullscreenButton.setImageResource(
|
||||
R.drawable.ic_fullscreen_black_48dp);
|
||||
} else {
|
||||
fullscreenButton.setImageResource(
|
||||
R.drawable.ic_fullscreen_exit_black_48dp);
|
||||
}
|
||||
if (listener != null)
|
||||
listener.setFullscreen(fullscreen);
|
||||
}
|
||||
);
|
||||
}
|
||||
public QrCodeView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.qr_code_view, this, true);
|
||||
qrCodeImageView = findViewById(R.id.qr_code);
|
||||
ImageView fullscreenButton = findViewById(R.id.fullscreen_button);
|
||||
fullscreenButton.setOnClickListener(v -> {
|
||||
fullscreen = !fullscreen;
|
||||
if (!fullscreen) {
|
||||
fullscreenButton.setImageResource(
|
||||
R.drawable.ic_fullscreen_black_48dp);
|
||||
} else {
|
||||
fullscreenButton.setImageResource(
|
||||
R.drawable.ic_fullscreen_exit_black_48dp);
|
||||
}
|
||||
if (listener != null)
|
||||
listener.setFullscreen(fullscreen);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public void setQrCode(Bitmap qrCode) {
|
||||
qrCodeImageView.setImageBitmap(qrCode);
|
||||
// Simple fade-in animation
|
||||
AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f);
|
||||
anim.setDuration(200);
|
||||
qrCodeImageView.startAnimation(anim);
|
||||
}
|
||||
@UiThread
|
||||
public void setQrCode(Bitmap qrCode) {
|
||||
qrCodeImageView.setImageBitmap(qrCode);
|
||||
// Simple fade-in animation
|
||||
AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f);
|
||||
anim.setDuration(200);
|
||||
qrCodeImageView.startAnimation(anim);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
public void setFullscreenListener(FullscreenListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
@UiThread
|
||||
public void setFullscreenListener(FullscreenListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public interface FullscreenListener {
|
||||
void setFullscreen(boolean fullscreen);
|
||||
}
|
||||
public interface FullscreenListener {
|
||||
void setFullscreen(boolean fullscreen);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ targetCompatibility = 1.8
|
||||
apply plugin: 'ru.vyarus.animalsniffer'
|
||||
apply plugin: 'witness'
|
||||
apply from: 'witness.gradle'
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
dependencies {
|
||||
implementation project(path: ':bramble-api', configuration: 'default')
|
||||
|
||||
@@ -7,6 +7,7 @@ apply plugin: 'idea'
|
||||
apply plugin: 'witness'
|
||||
apply from: 'witness.gradle'
|
||||
apply from: '../dagger.gradle'
|
||||
apply plugin: 'checkstyle'
|
||||
|
||||
dependencies {
|
||||
implementation project(path: ':briar-api', configuration: 'default')
|
||||
|
||||
19
config/checkstyle/checkstyle.xml
Normal file
19
config/checkstyle/checkstyle.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<module name="Checker">
|
||||
<property name="tabWidth" value="4"/>
|
||||
<property name="charset" value="UTF-8"/>
|
||||
<module name="LineLength">
|
||||
<property name="fileExtensions" value="java"/>
|
||||
<property name="max" value="1000"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
<module name="TreeWalker">
|
||||
<module name="RegexpSinglelineJava">
|
||||
<property name="format" value="^\t* +\t*\S"/>
|
||||
<property name="message" value="Line has leading space characters; indentation should be performed with tabs only."/>
|
||||
<property name="ignoreComments" value="true"/>
|
||||
</module>
|
||||
</module>
|
||||
</module>
|
||||
29
gradle/checkstyle.gradle
Normal file
29
gradle/checkstyle.gradle
Normal file
@@ -0,0 +1,29 @@
|
||||
task checkstyleMain(type: Checkstyle) {
|
||||
source 'src/main/java'
|
||||
include '**/*.java'
|
||||
classpath = files()
|
||||
reports {
|
||||
xml {
|
||||
destination file("build/reports/checkstyle/main.xml")
|
||||
}
|
||||
html {
|
||||
destination file("build/reports/checkstyle/main.html")
|
||||
}
|
||||
}
|
||||
check.dependsOn it
|
||||
}
|
||||
|
||||
task checkstyleTest(type: Checkstyle) {
|
||||
source 'src/test/java'
|
||||
include '**/*.java'
|
||||
classpath = files()
|
||||
reports {
|
||||
xml {
|
||||
destination file("build/reports/checkstyle/test.xml")
|
||||
}
|
||||
html {
|
||||
destination file("build/reports/checkstyle/test.html")
|
||||
}
|
||||
}
|
||||
check.dependsOn it
|
||||
}
|
||||
Reference in New Issue
Block a user