android-square-progressbar v.1.6.0

android-square-progressbar v.1.6.0

After I got some feedback and new ideas from the GitHub repository, I implemented the following features for the 1.6.0 build. Additionally, I finally rewrote most of the logic of the SquareProgressBar drawing method. Together with a new icon and some changes to the UI, I just released the new major version 1.6.0. Get it via gradle:

dependencies {
    compile 'ch.halcyon:squareprogressbar:1.6.0'
}

indeterminate feature

Suggested on GitHub (issue #26) was an indeterminate ProgressBar that always runs around the image to visualise a progress for which we don’t know the final duration or the current progress. You still can customise the SquareProgressBar with colours, size, opacity and so on. All these settings still work with this indeterminate ProgressBar. To activate this, simply set the following flag on the SquareProgressBar :

squareProgressBar.setIndeterminate(true)

After this is set the SquareProgressBar will behave like shown in the following video:

 

center line featureCENTER-LINE

This is a very small addition to the style settings. It simply displays a small line in the middle of the path that the SquareProgressBar has to go. You can simply set this via the following line of code:

squareProgressBar.drawCenterline(true)

You can see an example of the center line setting on the right side.

getImageView

Another request (issue #34) was to provide a getter method for the ImageView. There are android-libraries that need the ImageView to do some async loading of the images or something else. So this is available now as well on the SquareProgressBar class:

/**
* Returns the {@link ImageView} that the progress gets drawn around.
*
* @return the main ImageView
* @since 1.6.0
*/
public ImageView getImageView(){
    return imageView;
}

small changes

There are also some smaller changes to the UI. For example, there is a new image that is considerably bigger than the others in the example application. But this isn’t shown in the application anymore because the bug where the big images make the SquareProgressBar behave strangely is finally resolved. I already fixed part of the problem back in 2014, but I recently came across the right XML-setting to remove the blank spaces around an ImageView, when the Image is wider than the screen of the phone. You can see the change here commit: 513b45b. The trick was to add the following line to the XML:

android:adjustViewBounds="true"

Future changes

One thing that I want to make much simpler in the next version is the usability of text in the SquareProgressBar. I already have a good idea on how I want to achieve that, but that has to wait until I finished some other projects.

You can find the repository on GitHub as usual: android-square-progressbar

The library is available on Bintray: squareprogressbar

android-square-progressbar with gradle

Since today, you can easily use the android-square-progressbar with a working gradle environment. So to use it in your android project just simply add the following repository to your main gradle file:

allprojects {
    repositories {
        jcenter()
        maven { url "https://jcenter.bintray.com" }
    }
}

And then add the following dependency to your application module:

compile 'ch.halcyon:squareprogressbar:1.5.1'

You can find the repository on Bintray here: https://bintray.com/mrwonderman/maven/squareprogressbar

 

android-square-progressbar v.1.5.0

android-square-progressbar v.1.5.0

UPDATE: version 1.5.1

Due to a small bug in the version 1.5.0, I had to fix and rebuild the library. So the newest version is 1.5.1.

This is the newest major release of my android library. After various comments and some preparations, I finally switched the library to gradle. I also switched the structure of it accordingly to the guidelines of the Android Studio. But the most important change is the new package name.

android-square-progressbar-legacy

I always planned to have a second repository for the library when I change to gradle. That second repository should be for the people who still use the Eclipse environment. So they can easily use the library without hassling with gradle. You can find the repository here: android-square-progressbar-legacy

new package name

In the recent weeks, I was slowly migrating content from my old website (signer.pro) to halcyon.ch. I want to use this domain for my projects from now on and so I had to migrate the library as well. The other reason for the change is that as I want to push the library to the central maven repository I have to match the package name with a domain that belongs to me. But when I started developing (5 years ago) I didn’t have an own website so I then set the package name to net.yscs.android. It now turns out, that yscs.net is a Chinese company, so I can’t buy that domain. Thus, I had to change the package name anyway to publish to the central repo.

If you update to the newest version of the library you have to change the paths of the imports and the layouts accordingly (sorry!!). The old layout was:

    <net.yscs.android.square_progressbar.SquareProgressBar
        android:id="@+id/progressbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true">
    </net.yscs.android.square_progressbar.SquareProgressBar>

But with the updated version 1.5.0 you now have to use it the following way:

    <ch.halcyon.squareprogressbar.SquareProgressBar
        android:id="@+id/progressbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true">
    </ch.halcyon.squareprogressbar.SquareProgressBar>

future stuff

The biggest thing that will come in the coming month is the deployment of 1.5.0 to the maven central repository. After that is done, I will add the code of the indeterminate progressbar (see issues/26). This will be the first real deployment of a new feature with gradle and I’m kinda looking forward to that. That’s it for the moment. I will post again, as soon as the library is available at the central repository.

android-square-progressbar: https://github.com/mrwonderman/android-square-progressbar

android-square-progressbar v.1.4.1

android-square-progressbar v.1.4.1

I just found time to add a very interesting feature to the android-square-progressbar library. You now can set a in-code generated bitmap as the image. This also opens the door to display Text, where the progressbar goes around. This can’t replace a normal TextView, but its a start.

Extended Example

An example of such a usage would be the following. Maybe you want to display a dynamic text like a countdown or something like that. You can do this with a bitmap, that you can redraw (but if you have loads and loads of redraws, don’t do this!). I have added the following example to the wiki but I will repeat it here with a bit more text.

First of all, you create a new Bitmap in your code. I’ve set the height and the width of it to 250 and added this ARGB_8888 configuration, which makes it opaque.

Bitmap bmp = Bitmap.createBitmap(250, 250, Bitmap.Config.ARGB_8888);

I’m then creating a new canvas for the Bitmap. After that I’m configuring the paint for the text I want to write.

Canvas canvas = new Canvas(bmp);
Paint paint = new Paint();
paint.setTextSize(60);
paint.setTextAlign(Paint.Align.CENTER);
paint.setColor(Color.parseColor("#D11111"));
canvas.drawText("Crimbo!",125,155, paint);

On the last line, I’m actually writing the text onto the canvas. Afterwards my drawing is finished and I now can use the new method to set the Bitmap to the ImageView.

squareProgressBar.setImageBitmap(bmp);

If you then add the rest of the normal code that the library needs (see the wiki) the result is the following:

crimbo

You can find the GitHub Repository here: https://github.com/mrwonderman/android-square-progressbar

android-square-progressbar v.1.4.0

android-square-progressbar v.1.4.0

Finally a new major version of the square-progressbar library is out today. This includes some new style options that I implemented from the feedback I got from you. Also there are some UI improvements for the example-application and some changes in the GitHub repository. You can find the updated app in the play store.

GitHub

I cleaned up the whole repository (not as usual just code and images). So I wrote some pages in the wiki which include some examples and a usage-guide with all the available style-options. For each release there will be now a much more detailed changelog and there is a page about how you can contribute to the library as well here. Just take a look around: https://github.com/mrwonderman/android-square-progressbar

Changes

I try to show you the newest features and changes of the library and the example-application now.

Library

Thanks to a pull-request it’s now possible to set the ScaleType of the image. This is very important if you’re working with bigger images which don’t get displayed correctly. You can use the following line of code to set the ScaleType:

squareProgressBar.setImageScaleType(ScaleType.CENTER);

Another thing is the possibility to let the progressbar disappear when the progress hits 100%. By default this is switched off, but you can turn this on like shown here:

squareProgressBar.setClearOnHundred(true);

I extended the PercentStyle object with two new attributes. One lets you define another text that gets used instead of the default “%”-sign. The other one lets you set a different textcolor to the progresstext.

 squareProgressBar.showProgress(true);
 PercentStyle percentStyle = new PercentStyle(Align.CENTER, 280, true);
 percentStyle.setCustomText("#");
 percentStyle.setTextColor(Color.parseColor("#22A362"));
 squareProgressBar.setPercentStyle(percentStyle);

example_percentstyle

Example-application

I enhanced the user-interface a bit and added a RGB chooser. With this dialog you can set the color of the progressbar to a custom color. You can find this new dialog in the navigation drawer right above the “Style” title.

example_grayscaleTwo new style options made it into the app too. One is the grayscale option, which displays the image in different grays. The second one is the “clear at 100%”, which removes the progressbar when the progress hits 100%.

Last but not least, there is a new image that you can choose.

 

android-square-progressbar v.1.3.0

android-square-progressbar v.1.3.0

After my second holidays this year I’m finally publishing the next major version of the android-square-progressbar. This includes some new stylish effects to the library and fixes a few bugs which appeared. Thanks again for the feedback guys.

Start-/Outline

android_square_progress_startlineandroid_square_progress_outline

I added 2 more or less small tweaks for the image border, but they give an additional nice look. You can simply add them to your android-square-progressbar with the following commands:

squareProgressBar.drawStartline(true);
squareProgressBar.drawOutline(true);

Show percent

second_style

This is one of the features I was looking forward to implement. So I decided to put a bit of more effort into it, and I came up with the following usage:

There is a new object called PercentStyle which has 3 attributes:

  • Text align
  • Text size
  • Display percentsign

You can easily assign different styles to the square-progressbar. This is how you can do it:

squareProgressBar.setPercentStyle(new PercentStyle(Align.CENTER, 76, true));
squareProgressBar.showProgress(true);

In the example application I implemented a new dialog where you can play around with different combinations:

dialog_style

Opacity-Bugfix

A bug appeared while using the library and the opacity option (added with the version 1.2.0). If you didn’t set the opacity to false, there would be a NullPointerException. This is now fixed with this version.

You can find the newest code on GitHub here: https://github.com/mrwonderman/android-square-progressbar

There should be an updated example application on Google Play in the next few minutes: https://play.google.com/store/apps/details?id=net.yscs.android.square_progressbar_example

For questions and/or feedback, just drop me a line via email: yannick@signer.pro

android-square-progressbar v.1.2.0

IMG_20130811_112751

After the summer holidays I ‘m publishing the next major version of the android-square-progressbar library. This isn’t actually a really big major version to the library itself, but the example application has changed very much. I’m now using the Navigation Drawer (https://developer.android.com/design/patterns/navigation-drawer.html) and a new Holo-Theme.

Navigation Drawer

Screenshot_2013-08-11-11-35-33With the navigation drawer I was able to move all the customisation things to another layer which is still easy to access. In the Navigation Drawer you can now choose the colour, activate the new opacity style, choose another image or visit the github page right from the app.

The Navigation Drawer is really easy to use and I created a small repository on Github where I’m hosting a basic version of an application which already contains a full configured Navigation Drawer. It still needs some fine tuning, so maybe check it out here later this month: BaseNavigationDrawer (GitHub). I will use this in future projects with Navigation Drawer’s.

The only thing I miss is the possibility to set a Style (like android.R.style.Theme_Holo_Light) to it. I haven’t found a possibility to do this. But I think this is supposed to be so, as you shouldn’t but any form widgets in there like CheckBoxes or Buttons.

This is now the second application where I am using the Navigation Drawer as the main navigation possibility and I can only recommend it. The other one was the “Current and Voltage” application here.

Opacity

Back to the new things the library can do now. As you see in the next image you can now activate the opacity. This will let the image disappear if the progress is 0, but I will appear more and more when the progress gets higher. When it reaches 100% then the images is shown normally. This can be a nice way to display the progress even more.

Screenshot_2013-08-11-11-35-42Screenshot_2013-08-11-11-35-55

 

You can set the opacity to the squareProgressBar with the following command:

squareProgressBar.setOpacity(true);

The road ahead

This is now the 4th update of the library and I want to bring a next one to you in september. I want to focus on these things:

  • OpenGL
  • Handling of bigger images
  • Some progressbar features

If you have any ideas of how I can improve the library, just comment or message me.

You can find the application and the source here:

Play Store : https://play.google.com/store/apps/details?id=net.yscs.android.square_progressbar_example

Github : https://github.com/mrwonderman/android-square-progressbar/

android-square-progressbar v.1.1.0

IMG_20130628_185136

Finally the new version of the android-square-progressbar is now available.  This version has some major features like:

  • custom width of the progressbar
  • easy methods to set the colours (holo-colours, hexcoloursand RGB)
  • better algorithm
  • new example app

In the new example app I made some bigger changes. First of all the pictures are now completely different, because I don’t want to run into any copyright problems. Another big change are the new 2 elements where you can set the width of the progressbar and the colour.

You now can simply set the colour of the bar with the following code:

squareProgressBar.setColor("#C9C9C9");

or

squareProgressBar.setHoloColor(color.holo_blue_dark);

This is really helpful and a better way to set the colour as in the first version. In the app you can choose the colour like that:

newcolour

 Actually the new major feature is the possibility to set the width of the progressbar. I recommend to set it between 3 and 20 dp.

 squareProgressBar.setWidth(8);

Here are some examples:

newscreen1newscreen2

Another big improvement is the new algorithm. It is now working properly and it handles the width quite well.

Play Store : https://play.google.com/store/apps/details?id=net.yscs.android.square_progressbar_example

Github : https://github.com/mrwonderman/android-square-progressbar/

android-square-progressbar

I finally finished my first android library this night. The idea behind the android-square-progressbar library is that you can display a ProgressBar which surrounds a picture. This could be helpful if you don’t have  space for a normal ProgressBar or so.

You can find my github project here, this includes the actual library and an example app: https://github.com/mrwonderman/android-square-progressbar

You can download the library here: http://pub.signer.pro/android-square-progressbar-1.0.1.jar

And the example app here: http://pub.signer.pro/android-square-progressbar-example-1.0.1.apk

At the moment it has the possibility to set different colors. But in the future I see more features like thickness of the ProgressBar and some design things to. The library supports more or less all different shapes of images, as demonstrated in the example app.

Here are some examples how it could look like.

one two

To add this to a project, simply add the following part to your XML-Layout:

<net.yscs.android.square_progressbar.SquareProgressBar
android:id="@+id/subi1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true" />

You then can access it from the java code like that:

SquareProgressBar subi = (SquareProgressBar) findViewById(R.id.subi1);
subi.setImage(R.drawable.house);
subi.setProgress(25);