Logged-In As
ACCOUNT
Not Logged In
Fix an issue (hard) OpenIntents
Status: Closed Time to complete: 336 hrs Mentors: Peli, Friedger Müffke, Randy McEoin, aap, Manuel R. Ciosici Tags: Android, Java

The task is to fix one of the issues from the list of issues.

Your solution should consist of a patch (instructions) based on the latest version of the application. If you dont have it yet, you first need to download and install the Android SDK (instructions). Follow these instructions to build OI applications.

  • Difficulty: hard
  • Time limit: 14 days
  • Prerequisites: Download the Android SDK (instructions)
  • Requirements for completed entry:
    • IMPORTANT: Ask first whether the issue you want to work on is still available and whether you should choose an easy, medium, or hard task.
    • Send in a patch with your code modifications (instructions).
    • The code must follow our StyleGuide.
    • The code must fix the issue.
    • Depending on the number of stars of the issue, select an easy (1 star), medium (2 stars), or hard (3 or more stars) task.
Uploaded Work
File name/URL File size Date submitted
file_icons.patch 1.7 KB December 02 2011 17:26 UTC
file_icons.patch 1.7 KB December 02 2011 18:00 UTC
safe.patch 8.5 KB December 21 2011 15:09 UTC
safe.patch 5.1 KB December 22 2011 12:31 UTC
Comments
Shuhao on November 22 2011 18:12 UTC Task Claimed

I would like to work on this task.

Shuhao on November 22 2011 18:12 UTC Claim Removed

The claim on this task has been removed, someone else can claim it now.

Aviral Dasgupta on November 26 2011 13:45 UTC Task Claimed

I would like to work on this task.

Peli on November 26 2011 13:52 UTC Task Assigned

This task has been assigned to Aviral Dasgupta. You have 336 hours to complete this task, good luck!

Aviral Dasgupta on December 2 2011 17:27 UTC Implementation details.

This patch makes OI File Manager use the icon for the app chosen by the user for viewing a file type by default. Otherwise, it defaults to the "android icon".

Aviral Dasgupta on December 2 2011 17:28 UTC Ready for review

The work on this task is ready to be reviewed.

Peli on December 3 2011 10:30 UTC Comments

This task is not an easy one, as there does not seem to be a simple, fully satisfying solution.


I think we have to approach this in small steps.


The previous code you deleted was actually a better starting point in this respect. I suggest to revert to that starting point, or keep your solution as an alternative in the code.


For me, I currently see the "Save as" generic folder icon for most of the files. This is of course very confusing. So the code should:


filter out the OI File Manager "Save as" folder icon, and choose whichever icon is second-best.


Another strategy may be to "remember" which application was used for a file, and use this in the future. This would be a more involved task:


* create a custom activity picker dialog which remembers which application the user picks.


* Store this in a ContentProvider


* Use this information to set the corresponding icon for all files of this type in the future.


 


If there are questions, don't hesitate to ask in the developer forum.


(On a side-note, the formatting of white spaces of file manager is currently a mess, but new patches should not try to increase the mess, rather decrease it if possible.)

Peli on December 3 2011 10:30 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

Aviral Dasgupta on December 6 2011 20:12 UTC Claim Removed

The claim on this task has been removed, someone else can claim it now.

Darriel on December 15 2011 07:58 UTC Task Claimed

I would like to work on this task.

Darriel on December 15 2011 08:03 UTC Claim

Well, enough translations and icons, time for code :) This issue I would like to solve:


http://code.google.com/p/openintents/issues/detail?id=357&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary%20Stack%20Stars


Any instructions, as of how much can I expand the field, move it, reorganize the whole  "edit items" dialog or something like that?


Also, I've never used Subversion/TurtoiseSVN, so I might have some difficulties with them, but I think I'll manage.

aap on December 15 2011 15:18 UTC Likely to conflict with issue 340

The discussion regarding issue 340 leaves me concerned that the work done for that issue will overlap with work required for issue 357. I would hate to see two students tripping over each other.


I am marking this task as unassigned for now but please feel free to reapply: I suggest you either choose a different issue, or wait until the GCI task for issue 340 gets either resolved or unclaimed.


Regards,


-- Aaron


 

aap on December 15 2011 15:19 UTC Task Reopened

This task has been Reopened.

Darriel on December 15 2011 17:21 UTC Reply

Is it still worked on the issue you mentioned? The last post in the task is from December 5th, which is 10 days ago and the task expires in two days.. I was just wondering if the student decided not to work, but has not unclaimed?

Darriel on December 15 2011 17:25 UTC Task Claimed

I would like to work on this task.

Darriel on December 15 2011 17:25 UTC Claim Removed

The claim on this task has been removed, someone else can claim it now.

Darriel on December 15 2011 17:27 UTC oops

I found another Issue on which to work and by  mistake claimed this hard task, but I have to claim a medium task for the issue I want to work on. I think I will finish it quickly, so the other task, where the student works on issue 340 finishes too.

Darriel on December 18 2011 08:12 UTC Task Claimed

I would like to work on this task.

Darriel on December 18 2011 08:13 UTC Issue 175

Well, I hope THIS one is not worked on by another GCI student and is not dependent on the work of some task...


http://code.google.com/p/openintents/issues/detail?id=175&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary%20Stack%20Stars


 

Peli on December 18 2011 09:55 UTC Task Assigned

This task has been assigned to Darriel. You have 336 hours to complete this task, good luck!

Darriel on December 18 2011 17:49 UTC 1

Created a new string in strings.xml - "lock_timeout" saying "Time to autolock: "


 


 


 


P.S. I'm writting down things that I create, so if something is wrong, we will be able to fix it as easily as possible.

Peli on December 18 2011 22:00 UTC Ok

If you intend to concatenate the string with the string from the time format, then it is preferable to use "Time to autolock: %s".


If you intend to have 2 separate TextViews, then of course it is fine the way you proposed.

Darriel on December 19 2011 07:54 UTC ..

I'm thinking about it, depends also on how the other part of the work goes...

Darriel on December 19 2011 08:35 UTC also

Also, is it normal to have many errors in the problems tab? About 100 of them appear here.. Like "AboutDialog cannot be resolved" (probably because I don't have OI About?) "service cannot be handled" (Intent Handler) and so on?

Peli on December 19 2011 09:33 UTC DistributionLibrary

Do you have DistributionLibrary properly included?


http://code.google.com/p/openintents/wiki/BuildingOIApps


http://code.google.com/p/openintents/wiki/Upgrade


I had some issues with aidl - some error message about ServiceDispatcher or so - and I had to manually call aidl from the command line. If you have those issues, let me know.

Darriel on December 19 2011 12:15 UTC s

Yes, SDK, Eclipse, Java all latest versions, DistributionLibrary
is included too.
All errors are the "minor" errors, as I call them - a light bulb with a red x. I had some "major" errors, but they were caused because JDK is 7, all resolved though. The remaining are "java errors" - no android errors. All from  project OI Safe, if I'm not mistaken. At least there are no problems in the DistributionLibrary.

Darriel on December 19 2011 14:12 UTC errors

All errors are from project "OI Safe" and many of them are from AskPassword.java, and most are "xxxx cannot be resolved"


 

Darriel on December 19 2011 17:37 UTC part solved

A big part of the errors disappeared when I did the following:


right click on OI Safe > Properties> Java Build Path > Projects tab and added OI distribution library there. Now I have about 20 errors remaining, and again, most of them are "xxx cannot be resolved to be XXX"

Darriel on December 19 2011 17:41 UTC ServiceDispatch

Sorry for so many posts in a row, but I found out something else. All errors now regard "Service Dispatch", except one 'oi_distribution_about cannot be resolved..." and one "Stub cannot be resolved to a type."


Any ideas how to solve this?

Darriel on December 19 2011 17:44 UTC r

I noticed that you said something about the aidl. I think that's where the problem is. How should I solve it?

Darriel on December 19 2011 20:38 UTC code

Here is the code I'm working with, but I can't test it, because of the errors. The code is in LogOffActivity.java


 


lock_timeout is the string "Time to autolock: %s" in strings.xml


"


TextView time = (TextView) findViewById(R.id.lock_timeout);


....


if (ServiceDispatchImpl.timeRemaining < 0) ServiceDispatchImpl.timeRemaining = 0;
            int minutes = (int)(ServiceDispatchImpl.timeRemaining/60000);
            int seconds = (int)((ServiceDispatchImpl.timeRemaining/60000)/1000);
            time.setText(getString(R.string.lock_timeout,
                    Integer.toString(minutes) + ":" + Integer.toString(seconds)));


"


 


I'm not sure it works, actually I'm almost sure it doesn't... I doubt that setText will work, but I wanted to try...


 

Peli on December 20 2011 00:35 UTC aidl

Do the following:


Go into trunk/safe/Safe/src/org/openintents/safe/service/


Do "aidl ServiceDispatch.aidl".


A new file ServiceDispatch.java is created, which should help you to compile your application without errors.


(Note that aidl should be called automatically, and the ServiceDispatch.java generated in gen/, but this apparently did not work).

Darriel on December 20 2011 09:51 UTC Done

The errors disappeared, thanks.


I have only one remaining "oi_distribution_about" cannot be resolved or is not a field".

Darriel on December 20 2011 09:53 UTC oi about

I don't have OI about, that's why this error occurs.

Darriel on December 20 2011 10:12 UTC ...

Made the following code a comment, it doens't do much, to stop the error.


//if (IntentUtils.isIntentAvailable(this, new Intent(AboutMiniIntents.ACTION_SHOW_ABOUT_DIALOG))) {
            // Only show "About" dialog, if OI About (or compatible) is installed.
        //    menu.add(0, ABOUT_INDEX, 0, R.string.oi_distribution_about).setIcon(
             //        android.R.drawable.ic_menu_info_details);
    //    }

Darriel on December 20 2011 11:41 UTC again..

All these errors are driving me crazy - now when I try to run OI Safe in the emulator, I get "Unfortunately OI Safe has stopped." And in Logcat there are several "red lines"... and in console - " [2011-12-20 13:29:40 - OI Distribution Library] Could not find OI Distribution Library.apk! " And where is that? In /bin there should be the .apk, as it is in OI Safe, but there is only a oi distribution library.jar, which I can't run.

Darriel on December 20 2011 18:38 UTC success, finally

Errors resolved, finally everything started working! :) Also, suprisingly, my test code works, though it shows 4:0 remaining when it should show something like 4:30 - I have to work the issue with the seconds and also must make it update in real time.

Darriel on December 20 2011 21:06 UTC seconds done

Now I only need to find a way to update the time shown without making big changes to the whole timer system. Any suggestions?

Peli on December 21 2011 00:27 UTC Timer

see here:


http://developer.android.com/resources/articles/timed-ui-updates.html

Darriel on December 21 2011 14:57 UTC done

I did the coding, now let's hope I will not mess up something with the patch!

Darriel on December 21 2011 15:10 UTC Patch

Hi,


I know the patch must contain only new and edited lines, but I'm not sure what to remove, what the yellow marked text means and what should I be careful not to do to prevent ruining the patch, so I submit it as TurtoiseSVN created it, sorry if that's not exactly what's needed.

Darriel on December 21 2011 15:11 UTC Ready for review

The work on this task is ready to be reviewed.

Randy McEoin on December 22 2011 01:44 UTC patch and formatting

Your patch shows you created it against revision 3891.   That's 3 days old and we're already up to 3911.   Moments before creating a patch file, you need to do an "svn update" to make sure you have the most recent version.


There is some re-formatting you need to do.   In the XML you'll see that most elements are formatted across several lines for readability.   You can seee that there is only one android: per line.


-<LinearLayout android:layout_below="@id/logoff_explanation"
-android:layout_width="fill_parent"
-android:layout_height="wrap_content"
-android:orientation="horizontal">


Your new line is one long line that is not as easy to read.



+<LinearLayout android:id="@+id/linearLayout1" android:layout_below="@id/logoff_explanation" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal">


Please reformat to match existing formats.   With layouts, you should avoid making changes with the GUI editor and stick to the text editor.  I only use the GUI side to see what it looks like after making manual changes to the text.  The GUI doesn't care about the look of the XML and slams things together.   That makes it difficult to read and difficult to know what changed.


I'm also seeing extraneous lines such as the following:


+
+
+
+
+}    
+    
+           
+                
+           
+            
+    
+    
+    
+    
+    
+
+


Please carefully examine the patch file you create for extraneous items.  Clean up your files, recreate the patch file and re-examine the patch file.   Do that until the patch file consists only what is needed.


You can look at the patch file in any text editor.  Lines that begin with minus '-' are to be removed from the originals.   Lines with plus '+' are to be added.


If you're struggling with some of it, you might consider copying your versions of the files to an alternate location.   Do a "svn revert" on each of the files to get them back to an original state.   Then very carefully re-edit the files.

Randy McEoin on December 22 2011 01:44 UTC Task Needs More Work

One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.

Darriel on December 22 2011 12:33 UTC Oops

Sorry, I uploaded the patch with the same name.. you can recognize it by the size, the second one is smaller. I hope it is as good as possible, I even counted whitespaces, until I found the option 'Ignore whitespace changes".

Darriel on December 22 2011 12:33 UTC Ready for review

The work on this task is ready to be reviewed.

Randy McEoin on December 24 2011 00:40 UTC Commit

I did tweak the log_off.xml to use "dp" instead of "px".   Avoid using "px" in layouts.   We still have "px" in there and haven't converted them yet, but anything new should be "dp".


Committed patch as revision 3921.


http://code.google.com/p/openintents/source/detail?r=3921

Randy McEoin on December 24 2011 00:40 UTC Task Closed

Congratulations, this task has been completed successfully.

Friedger Müffke on December 24 2011 01:09 UTC Rotating the phone let the time jump

If you rotate the phone the time jumps, i.e. in horizontal the time to autolock is longer or less than in vertical position, can be as much as 10 secs.


This can be a problem with the implementation in general, but should be worse checking.


Furthermore, the test cases should be made language agnostic, i.e. use getActivity().getString(R.string.continue_text) instead of "Continue". Otherwise, it does not pass on my (German) phone.


 

Randy McEoin on December 24 2011 04:40 UTC Can't duplicate

I can't get the time to jump.   Tried it in the emulator and on Galaxy Nexus.


On the "Continue" are you refering to the master password prompt with the "Continue" button?   Yea, I just noticed that it's not a string.  Discovered that with running Lint.  I might spend some time with what Lint is pointing out.   Things like not using strings or using "px".

Randy McEoin on December 24 2011 15:31 UTC Ahhh!

Ahh! Just saw your revision 3923.  You're right.   The various tests need to use the strings.