A simple android view to create loading with a Path.
Designed for open-watch project.
<com.aghajari.axpathloading.AXPathLoadingView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="24dp"
app:alphaStart="0.68"
app:path="#createHR"
app:progressColor="#0AB28C"
app:thickness="11dp"
app:trackColor="#300AB28C" />
<com.aghajari.axpathloading.AXPathLoadingView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="24dp"
app:animationDuration="1800"
app:delay="200"
app:path="#createHeart"
app:progressColor="#C5227A"
app:thickness="16dp"
app:trackColor="#30C5227A"/>
public static Path createHR(AXPathLoadingView view) {
float h = view.getResources().getDisplayMetrics().density * 80;
float w = view.getResources().getDisplayMetrics().density * 112;
float part = w / 4;
float center = h / 2f;
Path path = new Path();
path.moveTo(0, center);
path.lineTo(part, center);
path.lineTo(part + part / 2f, h);
path.lineTo(2 * part, center);
path.lineTo(2 * part + part / 2f, 0);
path.lineTo(3 * part, center);
path.lineTo(4 * part, center);
return path;
}
Copyright 2022 Amir Hossein Aghajari
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.