Affichage des articles dont le libellé est Clock. Afficher tous les articles
Affichage des articles dont le libellé est Clock. Afficher tous les articles

dimanche 1 mars 2015

[Q] How to change clock color (statusbar only) ? topic






I want to change color of clock in statusbar, not the one in notification drawer just the one in statusbar (please see attached pictures) to white. I have decompiled SystemUI but have no idea where to change this. Can someone help me out?








Attached Thumbnails


Click image for larger version<br/><br/>Name:	Screenshot_2015-03-01-13-59-33.jpg<br/>Views:	N/A<br/>Size:	99.2 KB<br/>ID:	3188720
 

Click image for larger version<br/><br/>Name:	Screenshot_2015-03-01-13-59-46.png<br/>Views:	N/A<br/>Size:	136.8 KB<br/>ID:	3188721
 

















jeudi 26 février 2015

[GUIDE] Customize Lollipop's official Clock application topic








I am a person who needs many many multiple alarms to wake up early in the morning.
Every clock/alarm applications I tried has no feature that turning on or off all alarms at once.
So I decided to customize google's official android clock app.

Let's get it started.

### Needed #####
  1. google's clock app source (I use Lollipop's source for my device)

  2. buttons icon image


### Steps #####

1) download source from googlesource.com repository
android system clock application's package name is "DeskClock".
You can clone the source like below

Code:


git clone -b lollipop-release https://android.googlesource.com/platform/packages/apps/DeskClock

2. import it & remove errors
When you import the project to your IDE, you will get thousand of import errors.
Check below
  • SDK Version
    - Make sure that you have lollipop sdk and check "Build Target" in "Project Properties"

  • AndroidManifest
    - Specify min/targetSdkVersion, if it is not in AndroidManifest.xml
    - There is "DEVICE_POWER" permission because it is android system app but we can't build system application so just remove it. (In my usage, it seems to be no problem)

  • Library
    - Put android support-library jar file and add it to project build path.


3. Add button icons
- add ic_all_on.png, ic_all_off.png as drawable


4. Edit the sources
There is "DeskClockFragmet" class which is parent of alam/timer/stopwatch/clock's Fragment class.
It uses common layout "desk_clock.xml". It has three buttons (Fab, sub buttons) in the bottom of the screen and Alarm Fragment does not use and just hide sub buttons.
Which means we can easily add buttons to that place.

setLeftRightButtonAppearance() in AlarmClockFragment.java

Code:


    @Override
    public void setLeftRightButtonAppearance() {
        final DeskClock activity = (DeskClock) getActivity();
        if (mLeftButton == null || mRightButton == null ||
                activity.getSelectedTab() != DeskClock.ALARM_TAB_INDEX) {
            return;
        }
      // mLeftButton.setVisibility(View.INVISIBLE);
        //mRightButton.setVisibility(View.INVISIBLE);
        mLeftButton.setEnabled(true);
        mRightButton.setEnabled(true);
        mLeftButton.setVisibility(View.VISIBLE);
        mRightButton.setVisibility(View.VISIBLE);
        mLeftButton.setImageResource(R.drawable.ic_all_off);
        mRightButton.setImageResource(R.drawable.ic_all_on);

    }


set mLeft/RightButton enabled and change visibilty to VISIBLE, set button image as drawable we added.

and I just hide menu button in bottom-right just in alarm tab because right and menu button are overlayed.

onCreateView() in AlarmClockFragment.java

Code:


        if (menuButton != null) {
//            if (isLandscape) {
//                menuButton.setVisibility(View.GONE);
//            } else {
//                menuButton.setVisibility(View.VISIBLE);
//                setupFakeOverflowMenuButton(menuButton);
//            }
                //remove menu button
                menuButton.setVisibility(View.GONE);
        }


There is AlarmItemAdapter sub class in AlarmClockFragment.java which extends CursorAdapter.
We have to implement something that change actual alarm data in inner database and change views depend on each alarm's on/off value.
I just added a method "swichAlarms" into this sub class to do that.

boolean enabled value is passed as parameter (on : true / off : false)
Get every alarm's view and change the view when the alarm on/off status has to be changed

Also there's a way to get alarms llist in Alarm.java that is getAlarms() method.
I use it to get alarms list a alarm's enabled value is different.
And change alarms enabled value with asyncUpdateAlarm() method in AlarmClockFragment.java

That's all!
easy? :D


Code:


// added by donghe
/**
 * A convenience method to enable or disable every alarm.
 * Get child view (visible view) in alarm list and changing ItemAlpha whether if its enabled value is different
 * Get alarm(s) linked list from Alarms Class only if the alarm has to be updated.
 * Do asynchronous updating.
 * @param enabled        true for turning on, false for turning off
 */
private void switchAlarms(boolean enabled) {
        int totalLength = mList.getCount();
       
        for (int i = 0; i < totalLength; i++) {
                View v = mList.getChildAt(i);
                if (v != null) {
                        ItemHolder h = (ItemHolder)(v.getTag());
                        if (h != null && h.alarm.enabled != enabled) {
                                setDigitalTimeAlpha(h, enabled);
                        }
                }
        }
       
        String selection = null;
        if(enabled){
                selection = "ENABLED = 0";
        }
        else{
                selection = "ENABLED = 1";
        }
        ContentResolver cr = getActivity().getApplicationContext().getContentResolver();
        List<Alarm> alarmList = Alarm.getAlarms(cr, selection, null);

        for(Alarm alarm: alarmList){
                alarm.enabled = enabled;
                asyncUpdateAlarm(alarm, false);
        }
}




Now I feel comfortable to sleep lately in the evening and wake up early in the morning :)
Hope this thread is helpful to someone like me.
I attached project archive and apk.
Enjoy it!








Attached Thumbnails


Click image for larger version<br/><br/>Name:	there-are-two-kinds-of-people-alarm.jpg<br/>Views:	N/A<br/>Size:	22.2 KB<br/>ID:	3184397
 

Click image for larger version<br/><br/>Name:	button_icon.png<br/>Views:	N/A<br/>Size:	6.2 KB<br/>ID:	3184398
 

Click image for larger version<br/><br/>Name:	screeenshot.png<br/>Views:	N/A<br/>Size:	42.4 KB<br/>ID:	3184404
 











Attached Files





File Type: zip DeskClock_Lollipop_apk_and_project.zip -
[Click for QR Code]
(10.93 MB)










mardi 24 février 2015

[Q] Hide Clock on Lockscreen (lollipop)? topic






Hello.
Anyone know if it's possible, remove or hide clock on lockscreen on lollipop???
I've one live wallpaper with clock and I don't need de clock on lockscreen.

I've stock rom with root.

Thank you.






dimanche 22 février 2015

[Q] clock randomizer? topic






I dread knowing what the real clock time is when I'm pulling a late night. Is there an app that can randomize the clock time?






mercredi 11 février 2015

[Q] alarm clock topic






anyone have the note 3 (Verizon) alarm clock apk available?
the note 4 doesn't have the location based alarm and the days of the week park is to me just less useful. Id love to put the old alarm from note 3 onto note 4.
Thx in advance






[Q] Digital Clock Widget... topic






Is it possible to change the colour of the fonts of the Digital Clock Widget on the homepage?..
I am currently using a JB 4.1.2 rom and I have it practically set up to my liking,except
for the white fonts of the clock...Tia






lundi 9 février 2015

HTC Clock topic






After the last update (8.10.14219.341) my HTC clock works again :good: