Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Import Particlesdrawable library from https://github.com/Doctoror/Par…
Browse files Browse the repository at this point in the history
  • Loading branch information
AnGgIt86 committed Sep 4, 2024
1 parent d37bdc5 commit 653a3ec
Show file tree
Hide file tree
Showing 24 changed files with 2,023 additions and 11 deletions.
Binary file removed app/libs/particlesview-1.0.9.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_server_custom_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2" />
<com.doctoror.particlesdrawable.ParticlesView
<com.neko.particlesdrawable.ParticlesView
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_server_shadowsocks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2" />
<com.doctoror.particlesdrawable.ParticlesView
<com.neko.particlesdrawable.ParticlesView
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_server_socks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2" />
<com.doctoror.particlesdrawable.ParticlesView
<com.neko.particlesdrawable.ParticlesView
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_server_trojan.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2" />
<com.doctoror.particlesdrawable.ParticlesView
<com.neko.particlesdrawable.ParticlesView
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_server_vless.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2" />
<com.doctoror.particlesdrawable.ParticlesView
<com.neko.particlesdrawable.ParticlesView
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_server_vmess.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2" />
<com.doctoror.particlesdrawable.ParticlesView
<com.neko.particlesdrawable.ParticlesView
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_server_wireguard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2" />
<com.doctoror.particlesdrawable.ParticlesView
<com.neko.particlesdrawable.ParticlesView
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_sub_edit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2" />
<com.doctoror.particlesdrawable.ParticlesView
<com.neko.particlesdrawable.ParticlesView
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_user_asset_url.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2" />
<com.doctoror.particlesdrawable.ParticlesView
<com.neko.particlesdrawable.ParticlesView
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2" />
<com.doctoror.particlesdrawable.ParticlesView
<com.neko.particlesdrawable.ParticlesView
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_settings_theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.2" />
<com.doctoror.particlesdrawable.ParticlesView
<com.neko.particlesdrawable.ParticlesView
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright (C) 2017 Yaroslav Mytkalyk
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.neko.particlesdrawable;

import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;

import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
* {@link IParticlesView} that draws on {@link Canvas}
*/
final class CanvasParticlesView implements IParticlesView {

private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG);

@Nullable
private Canvas mCanvas;

void setCanvas(@Nullable final Canvas canvas) {
mCanvas = canvas;
}

@NonNull
Paint getPaint() {
return mPaint;
}

void setColorFilter(final ColorFilter colorFilter) {
mPaint.setColorFilter(colorFilter);
}

@Override
public void drawLine(final float startX, final float startY, final float stopX,
final float stopY, final float strokeWidth, @ColorInt final int color) {
if (mCanvas == null) {
throw new IllegalStateException("Called in wrong state");
}
mPaint.setStrokeWidth(strokeWidth);
mPaint.setColor(color);
mCanvas.drawLine(startX, startY, stopX, stopY, mPaint);
}

@Override
public void fillCircle(final float cx, final float cy, final float radius,
@ColorInt final int color) {
if (mCanvas == null) {
throw new IllegalStateException("Called in wrong state");
}
mPaint.setColor(color);
mCanvas.drawCircle(cx, cy, radius, mPaint);
}
}
48 changes: 48 additions & 0 deletions library/src/main/java/com/neko/particlesdrawable/Defaults.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2017 Yaroslav Mytkalyk
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.neko.particlesdrawable;

import android.content.res.Resources;
import android.graphics.Color;
import android.util.TypedValue;

import androidx.annotation.ColorInt;

/**
* Default values are here.
*/
final class Defaults {

private Defaults() {
throw new UnsupportedOperationException();
}

static final int DEFAULT_DOT_NUMBER = 60;
static final float DEFAULT_MAX_DOT_RADIUS = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 3f, Resources.getSystem().getDisplayMetrics());
static final float DEFAULT_MIN_DOT_RADIUS = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 1f, Resources.getSystem().getDisplayMetrics());
static final float DEFAULT_LINE_THICKNESS = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 1, Resources.getSystem().getDisplayMetrics());
@ColorInt
static final int DEFAULT_DOT_COLOR = Color.WHITE;
@ColorInt
static final int DEFAULT_LINE_COLOR = Color.WHITE;
static final float DEFAULT_LINE_DISTANCE = TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, 86, Resources.getSystem().getDisplayMetrics());
static final float DEFAULT_STEP_MULTIPLIER = 1f;
static final int DEFAULT_DELAY = 10;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2017 Yaroslav Mytkalyk
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.neko.particlesdrawable;

import androidx.annotation.ColorInt;

/**
* Particles View
*/
interface IParticlesView {

void drawLine(float startX, float startY, float stopX, float stopY, float strokeWidth,
@ColorInt int color);

void fillCircle(float cx, float cy, float radius, @ColorInt int color);
}
52 changes: 52 additions & 0 deletions library/src/main/java/com/neko/particlesdrawable/Particle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (C) 2017 Yaroslav Mytkalyk
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.neko.particlesdrawable;

/**
* Represents a Particle by holding x and y coordinates, travel direction and step multiplier
*/
final class Particle {

/**
* Direction cosine
*/
float dCos;

/**
* Direction sine
*/
float dSin;

/**
* Current X
*/
float x;

/**
* Current Y
*/
float y;

/**
* Step multiplier for this dot
*/
float stepMultiplier;

/**
* Radius multiplier for this dot
*/
float radius;
}
Loading

0 comments on commit 653a3ec

Please sign in to comment.