Sunday, 29 December 2013

How get rid off annoying bin gen folders from git repository - intellij / android studio

There two ways to get rid off it:
Case 1: you have just created new project and didn't commit first changes:
It's better because you have clean plate and you can define what should be ignored.

I'm using this text which is saved in .gitignore file placed in main project, but if you are using another libraries you can put .gitignore also there.

 ### Android ###  
 # built application files  
 # files for the dex VM  
 # Java class files  
 # generated files  
 # Local configuration file (sdk path, etc)  
 # Eclipse project files  
 # Proguard folder generated by Eclipse  
 # Intellij project files  

I know there are sometimes problems with gitignore files, please try save file by notepad++ and it should be good solution for windows users.

Case 2:
You have commited some changes and forgot to put .gitignore

Well this is the hard part because even you commited own .gitignore file - not all filles will be ignored anyway... You might think it doesn't work but this is how it works: all filles which were commited goes to "checking file list" and if you change them, they will be also raported as changed..

What to do then? In few steps:

for example with bin folder (it was commited and you forgot to ignore it)
0. Put own .gitignore file by placing it in proper main project folder and commit changes
1. Remove or move out of project bin folder (just make sure bin is gone while doing this operation, intellij tends to autogenerate bin and gen folders, so make sure intellij is closed)
2. if you write now git status inconsole, you will see bin folder was deleted
3. Commit changes - bin will be removed so there will be no checking this folder/files in future
4. Put bin folder back or let intellij generate new bin folder
5. Check if git found bin folder by writting in console git status, if there is no any information about bin folder, it means it is now ignored by git:)

Friday, 27 December 2013

Intellij regular expressions samples

Will be here bunch of samples what to write to find what you want:

  • Find declaration of anonymous AsyncTask starting by new AsyncTask
  •  (?<=\t)new AsyncTask

Wednesday, 25 December 2013

HoloEverywhere Library - dialog layout is wrong on Sony devices Android 2.3.x

Few days ago I posted short question/topic on about problems with holoeverywhere and sony phone family. There is probably problem with linear layouts and measuring heights. So far the main developer and owner of this library didn't responded on my issue answer .

Actually what can you do is just replace linear layouts to relative in places where it is major.
So to be sure if your app works fine just try it on devices from sony family with android lower than 4, mainly it happens on android 2.3.x.

Wednesday, 11 December 2013

Noobrom Apk Latest Addition - announcement

Hi, temporary I don't have time to fix problem with high end devices like Nexus 5 (there were also rumors with S3). Problem is connected with large heap because I need to parse so much elements (above > ~2k items). I will back to this project asap. So please be patient and stop rating 1 :D At least please wait with commening in few/several days. I will appreciate this.

I am planning store datas in databases as remote cloud place for speed up loading releases. But this is still in planning.


Thursday, 5 December 2013

Adb multiple devices - how to connect

In few example words...

1. Command "adb devices -l"

C:\Users\XXX>adb devices -l
List of devices attached
HT1AWVZ11641           device
01e010f522900141       device product:occam model:Nexus_4 device:mako

2. Command "adb -s <serial number> shell"

C:\Users\XXX>adb -s 01e010f522900141 shell
shell@mako:/ $

Monday, 2 December 2013

Clickable text in TextView + text bold + text color (ClickableSpan + Span bold color)

Here is short example how to use spannables.
My TextView was named "text_terms_link", so you should use your own view or rename like mine.

 ClickableSpan cs = new ClickableSpan() {  
   public void onClick(View view) {  
     //action stuff here  
 //getting text from xml = "Terms and Conditions"  
 String text_terms_string = getResources().getString(R.string.register_terms_text);  
 SpannableString ss = new SpannableString(text_terms_string);  
 //we need find oud position of "Terms" text: first index and the last  
 int termStart = text_terms_string.indexOf("Terms");  
 int termStop = termStart + "term".length();  
 //we set here clickable our text  
 ss.setSpan(cs, termStart, termStop, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);  
 //we set here our color i.e. #cccccc in this example I take color from xml  
 ss.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.aquaBlue)),  
 //we set here text to be bolded    
 ss.setSpan(new StyleSpan(Typeface.BOLD),termStart,termStop,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);  
 //I set here spannable text to my previous declared TextView  
 //We set here clickable text, this is important !!