| 1 | /* |
| 2 | * Tomdroid |
| 3 | * Tomboy on Android |
| 4 | * http://www.launchpad.net/tomdroid |
| 5 | * |
| 6 | * Copyright 2011 Stefan Hammer <j.4@gmx.at> |
| 7 | * Copyright 2010, Rodja Trappe <mail@rodja.net> |
| 8 | * |
| 9 | * This file is part of Tomdroid. |
| 10 | * |
| 11 | * Tomdroid is free software: you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation, either version 3 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * Tomdroid is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with Tomdroid. If not, see <http://www.gnu.org/licenses/>. |
| 23 | */ |
| 24 | package org.tomdroid.ui; |
| 25 | |
| 26 | import org.tomdroid.R; |
| 27 | import org.tomdroid.sync.SyncManager; |
| 28 | |
| 29 | import android.content.Context; |
| 30 | import android.util.AttributeSet; |
| 31 | import android.view.View; |
| 32 | import android.widget.ImageView; |
| 33 | import android.widget.RelativeLayout; |
| 34 | |
| 35 | public class Actionbar extends RelativeLayout { |
| 36 | |
| 37 | public static final int DEFAULT_ICON_ALPHA = 200; |
| 38 | |
| 39 | public Actionbar(Context context, AttributeSet attrs) { |
| 40 | super(context, attrs); |
| 41 | } |
| 42 | |
| 43 | public Actionbar(Context context, AttributeSet attrs, int defStyle) { |
| 44 | super(context, attrs, defStyle); |
| 45 | } |
| 46 | |
| 47 | public Actionbar(Context context) { |
| 48 | super(context); |
| 49 | } |
| 50 | |
| 51 | @Override |
| 52 | public void onFinishInflate(){ |
| 53 | super.onFinishInflate(); |
| 54 | setupButtons(); |
| 55 | } |
| 56 | |
| 57 | private void setupButtons(){ |
| 58 | |
| 59 | final ImageView syncButton = (ImageView) findViewById(R.id.sync); |
| 60 | final ImageView syncIcon = (ImageView) findViewById(R.id.syncIcon); |
| 61 | syncIcon.getDrawable().setAlpha(Actionbar.DEFAULT_ICON_ALPHA); |
| 62 | syncButton.setOnClickListener(new View.OnClickListener() { |
| 63 | |
| 64 | public void onClick(View v) { |
| 65 | SyncManager.getInstance().startSynchronization(); |
| 66 | } |
| 67 | }); |
| 68 | |
| 69 | final ImageView TomdroidIcon = (ImageView) findViewById(R.id.action_icon); |
| 70 | TomdroidIcon.setOnClickListener(new View.OnClickListener() { |
| 71 | |
| 72 | public void onClick(View v) { |
| 73 | Tomdroid.ViewList(getContext()); |
| 74 | } |
| 75 | }); |
| 76 | } |
| 77 | |
| 78 | } |