diff --git a/README.markdown b/README.markdown index 6d5d310..2a18ef1 100644 --- a/README.markdown +++ b/README.markdown @@ -15,11 +15,35 @@ If anybody figures out how to do text paths, please let me know! Installation === +Eclipse +--- + If you like you can import the project into eclipse, and use it as a library project [This is a decent tutorial on using library projects](http://www.vogella.com/blog/2011/03/03/android-library-projects/) Realistically, just copy MagicTextView.java & attrs.xml into your project and use them as your own. +Android Studio +--- + +For using it with Android Studio: + + * Add the folder into your project + * Edit build.gradle and change `apply plugin: 'android'` into `apply plugin: 'android-library'` + * Remove activity tag in AndroidManifest.xml + * Add `':MagicTextView'` in the includes of the settings.xml of your project + * Add `compile project(':MagicTextView')` in the dependencies section of the module in which you want to use the library + * Use it in this module + +You're done ! + +If you use it as a library into Android Studio, replace in your XML layout: + + xmlns:qwerjk="http://schemas.android.com/apk/res/com.qwerjk.better_text" + +By: + + xmlns:qwerjk="http://schemas.android.com/apk/res-auto" Usage === @@ -35,7 +59,7 @@ From Xml: android:drawableLeft="@android:drawable/btn_star" android:textStyle="bold" android:padding="10dp" - qwerjk:foreground="@drawable/fake_luxury_tiled" + qwerjk:mtv_foreground="@drawable/fake_luxury_tiled" qwerjk:innerShadowDy="2" qwerjk:innerShadowColor="#FF000000" qwerjk:innerShadowRadius="1" diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..96b15d4 --- /dev/null +++ b/build.gradle @@ -0,0 +1,32 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:0.8.+' + } +} + +apply plugin: 'android' + +android { + + compileSdkVersion 19 + buildToolsVersion "19.0.3" + + defaultConfig { + minSdkVersion 8 + targetSdkVersion 19 + } + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = ['src'] + resources.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + res.srcDirs = ['res'] + } + } +} \ No newline at end of file diff --git a/res/layout/main.xml b/res/layout/main.xml index f7e3300..11c757c 100644 --- a/res/layout/main.xml +++ b/res/layout/main.xml @@ -15,7 +15,7 @@ android:drawableLeft="@android:drawable/btn_star" android:textStyle="bold" android:padding="10dp" - qwerjk:foreground="@drawable/fake_luxury_tiled" + qwerjk:mtv_foreground="@drawable/fake_luxury_tiled" qwerjk:innerShadowDy="2" qwerjk:innerShadowColor="#FF000000" qwerjk:innerShadowRadius="1" diff --git a/res/values/attrs.xml b/res/values/attrs.xml index b830580..ebeb29b 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -13,8 +13,8 @@ - - + + diff --git a/src/com/qwerjk/better_text/MagicTextView.java b/src/com/qwerjk/better_text/MagicTextView.java index b7bc4f8..025d525 100644 --- a/src/com/qwerjk/better_text/MagicTextView.java +++ b/src/com/qwerjk/better_text/MagicTextView.java @@ -73,21 +73,21 @@ public void init(AttributeSet attrs){ setTypeface(tf); } - if(a.hasValue(R.styleable.MagicTextView_foreground)){ - Drawable foreground = a.getDrawable(R.styleable.MagicTextView_foreground); + if(a.hasValue(R.styleable.MagicTextView_mtv_foreground)){ + Drawable foreground = a.getDrawable(R.styleable.MagicTextView_mtv_foreground); if(foreground != null){ this.setForegroundDrawable(foreground); }else{ - this.setTextColor(a.getColor(R.styleable.MagicTextView_foreground, 0xff000000)); + this.setTextColor(a.getColor(R.styleable.MagicTextView_mtv_foreground, 0xff000000)); } } - if(a.hasValue(R.styleable.MagicTextView_background)){ - Drawable background = a.getDrawable(R.styleable.MagicTextView_background); + if(a.hasValue(R.styleable.MagicTextView_mtv_background)){ + Drawable background = a.getDrawable(R.styleable.MagicTextView_mtv_background); if(background != null){ this.setBackgroundDrawable(background); }else{ - this.setBackgroundColor(a.getColor(R.styleable.MagicTextView_background, 0xff000000)); + this.setBackgroundColor(a.getColor(R.styleable.MagicTextView_mtv_background, 0xff000000)); } }