Explorar o código

Library updates, connected to artifactory server

Berislav %!s(int64=9) %!d(string=hai) anos
pai
achega
1a20031209

+ 4 - 1
.idea/misc.xml

@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
+  <component name="EntryPointsManager">
+    <entry_points version="2.0" />
+  </component>
   <component name="NullableNotNullManager">
     <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
     <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
@@ -34,7 +37,7 @@
     <ConfirmationsSetting value="0" id="Add" />
     <ConfirmationsSetting value="0" id="Remove" />
   </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/build/classes" />
   </component>
   <component name="ProjectType">

+ 41 - 4
app/build.gradle

@@ -1,13 +1,19 @@
 apply plugin: 'com.android.library'
+apply plugin: 'com.jfrog.artifactory'
+apply plugin: 'maven-publish'
+
+def libraryGroupId = 'hr.tacitus.components'
+def libraryArtifactId = 'tankers-components'
+def libraryVersion = '0.0.1'
 
 android {
-    compileSdkVersion 26
+    compileSdkVersion 25
     buildToolsVersion "25.0.3"
     defaultConfig {
         minSdkVersion 19
-        targetSdkVersion 26
+        targetSdkVersion 25
         versionCode 1
-        versionName "1.0"
+        versionName libraryVersion
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
     }
     buildTypes {
@@ -23,6 +29,37 @@ dependencies {
     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
         exclude group: 'com.android.support', module: 'support-annotations'
     })
-    compile 'com.android.support:appcompat-v7:26.+'
+    compile 'com.android.support:appcompat-v7:25.+'
     testCompile 'junit:junit:4.12'
 }
+
+publishing {
+    publications {
+        aar(MavenPublication) {
+            groupId libraryGroupId
+            version libraryVersion
+            artifactId libraryArtifactId
+
+            artifact("$buildDir/outputs/aar/app-release.aar")
+        }
+    }
+}
+
+artifactory {
+    contextUrl = 'http://knut-hetzner.ddns.net:8081/artifactory'
+    publish {
+        repository {
+            repoKey = 'libs-release-local'
+
+            username = artifactory_username
+            password = artifactory_password
+        }
+        defaults {
+            publications('aar')
+            publishArtifacts = true
+
+            properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
+            publishPom = true
+        }
+    }
+}

+ 0 - 9
app/src/main/AndroidManifest.xml

@@ -2,14 +2,5 @@
 
     package="hr.tacitus.componentpack">
 
-    <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/AppTheme">
-
-    </application>
 
 </manifest>

+ 107 - 0
app/src/main/java/hr/tacitus/componentpack/ArcView.java

@@ -0,0 +1,107 @@
+package hr.tacitus.componentpack;
+
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.LinearGradient;
+import android.graphics.Paint;
+import android.graphics.RectF;
+import android.graphics.Shader;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewTreeObserver;
+
+/**
+ * Created by Bero on 6.7.2017..
+ */
+
+public class ArcView extends View {
+
+    private int beginColor = Color.GREEN;
+    private int endColor = Color.RED;
+    private int backgroundColor = Color.BLACK;
+    private float arcWidthInPixels = 32;
+
+    private Paint arcPaint;
+    private Paint canvasPaint;
+    private RectF arcRect, subArcRect;
+
+    public ArcView(Context context) {
+        super(context);
+        init(context, null);
+    }
+
+    public ArcView(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        init(context, attrs);
+    }
+
+    public ArcView(Context context, AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        init(context, attrs);
+    }
+
+
+    private void readAttributes(AttributeSet attributeSet) {
+        TypedArray a = getContext().obtainStyledAttributes(attributeSet, R.styleable.ArcView);
+        if (a != null) {
+            try {
+                beginColor = a.getColor(R.styleable.ArcView_startColor, beginColor);
+                endColor = a.getColor(R.styleable.ArcView_endColor, endColor);
+                backgroundColor = a.getColor(R.styleable.ArcView_backgroundColor, backgroundColor);
+                arcWidthInPixels = a.getDimension(R.styleable.ArcView_arcWidth, arcWidthInPixels);
+            } finally {
+                a.recycle();
+            }
+        }
+    }
+
+    private void init(Context context, AttributeSet attributeSet) {
+        if (attributeSet != null) {
+            readAttributes(attributeSet);
+        }
+
+        arcPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+
+        canvasPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+        canvasPaint.setColor(backgroundColor);
+
+        getRootView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+            @Override
+            public void onGlobalLayout() {
+                getRootView().getViewTreeObserver().removeOnGlobalLayoutListener(this);
+
+                float left = getPaddingLeft();
+                float top = getPaddingTop();
+                float right = getWidth() - getPaddingRight();
+                float height = (getHeight() - (getPaddingTop() + getPaddingBottom())) * 2;
+                float bottom = top + height;
+
+                arcRect = new RectF(left, top, right, bottom);
+
+                Shader shader = new LinearGradient(left, 0, right, 0, beginColor, endColor,
+                        Shader.TileMode.CLAMP);
+                arcPaint.setShader(shader);
+
+                left += arcWidthInPixels;
+                top += arcWidthInPixels;
+                right -= arcWidthInPixels;
+                bottom -= arcWidthInPixels;
+
+                subArcRect = new RectF(left, top, right, bottom);
+            }
+        });
+    }
+
+    @Override
+    public void onDraw(Canvas canvas) {
+        canvas.drawPaint(canvasPaint);
+
+        if (arcRect != null) {
+            canvas.drawArc(arcRect, 180, 180, true, arcPaint);
+            canvas.drawArc(subArcRect, 180, 180, true, canvasPaint);
+        }
+    }
+}

BIN=BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png


BIN=BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png


BIN=BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png


BIN=BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png


BIN=BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png


BIN=BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png


BIN=BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png


BIN=BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png


BIN=BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png


BIN=BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png


+ 8 - 0
app/src/main/res/values/attrs.xml

@@ -0,0 +1,8 @@
+<resources>
+    <declare-styleable name="ArcView">
+        <attr name="startColor" format="color" />
+        <attr name="endColor" format="color" />
+        <attr name="arcWidth" format="dimension" />
+        <attr name="backgroundColor" format="color" />
+    </declare-styleable>
+</resources>

+ 0 - 6
app/src/main/res/values/colors.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-    <color name="colorPrimary">#3F51B5</color>
-    <color name="colorPrimaryDark">#303F9F</color>
-    <color name="colorAccent">#FF4081</color>
-</resources>

+ 0 - 3
app/src/main/res/values/strings.xml

@@ -1,3 +0,0 @@
-<resources>
-    <string name="app_name">ComponentPack</string>
-</resources>

+ 0 - 11
app/src/main/res/values/styles.xml

@@ -1,11 +0,0 @@
-<resources>
-
-    <!-- Base application theme. -->
-    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
-        <!-- Customize your theme here. -->
-        <item name="colorPrimary">@color/colorPrimary</item>
-        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
-        <item name="colorAccent">@color/colorAccent</item>
-    </style>
-
-</resources>

+ 1 - 0
build.gradle

@@ -6,6 +6,7 @@ buildscript {
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:2.3.3'
+        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.1"
 
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files

+ 2 - 1
componentsactivity/build.gradle

@@ -23,11 +23,12 @@ android {
 }
 
 dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
+    compile fileTree(include: ['*.jar'], dir: 'libs')
     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
         exclude group: 'com.android.support', module: 'support-annotations'
     })
     compile 'com.android.support:appcompat-v7:26.+'
     compile 'com.android.support.constraint:constraint-layout:1.0.2'
     testCompile 'junit:junit:4.12'
+    compile project(':app')
 }

+ 15 - 4
componentsactivity/src/main/res/layout/activity_main.xml

@@ -5,9 +5,20 @@
     xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
     android:layout_height="match_parent" tools:context="hr.tacitus.componentsactivity.MainActivity">
 
-    <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
-        android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+    <hr.tacitus.componentpack.ArcView
+        android:paddingTop="6dp"
+        android:paddingStart="10dp"
+        android:paddingEnd="10dp"
+        android:paddingBottom="6dp"
+        android:layout_width="150dp"
+        android:layout_height="80dp"
+        app:layout_constraintTop_toTopOf="parent"
+        app:backgroundColor="?android:colorBackground"
+        app:arcWidth="8dp"
+        android:layout_marginTop="37dp"
+        android:layout_marginRight="8dp"
+        app:layout_constraintRight_toRightOf="parent"
+        android:layout_marginLeft="8dp"
+        app:layout_constraintLeft_toLeftOf="parent" />
 
 </android.support.constraint.ConstraintLayout>