From 7e20e39f259981e923fff4f3470c39757b70d48d Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Sun, 4 Sep 2011 13:47:06 +0200 Subject: [PATCH] missing files --- res/drawable/breadcrumb.png | Bin 0 -> 452 bytes res/drawable/main_header_bg.xml | 9 ++++ src/eu/alefzero/owncloud/PathLayout.java | 82 +++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 res/drawable/breadcrumb.png create mode 100644 res/drawable/main_header_bg.xml create mode 100644 src/eu/alefzero/owncloud/PathLayout.java diff --git a/res/drawable/breadcrumb.png b/res/drawable/breadcrumb.png new file mode 100644 index 0000000000000000000000000000000000000000..b124f349f56e7da0e9975c0e888cf8e39295783f GIT binary patch literal 452 zcmV;#0XzPQP)c(K7a&GXptz08w#Y5 zM1l*@lOC=>i)pAm1xKJpTADF(mi=))$&$7D{C4E0p>5ljwrwZQIdabkxC2(IT9U~~ zL>iz0X1Q|VoI_Rjfj3|*BHvLmfQWnn8=y{((R*J4Q@bTyw(HlxVh9=F38+-H%9cgs z2bcp7L&%88D^RHFBwMyz6A%?Fo2U;wQH66Zhz^O0jS&jbK9JF**3)4#%!hZiY2fD&O+Du + + + + \ No newline at end of file diff --git a/src/eu/alefzero/owncloud/PathLayout.java b/src/eu/alefzero/owncloud/PathLayout.java new file mode 100644 index 00000000..1927404a --- /dev/null +++ b/src/eu/alefzero/owncloud/PathLayout.java @@ -0,0 +1,82 @@ +package eu.alefzero.owncloud; + +import java.net.Inet4Address; +import java.util.Stack; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.HorizontalScrollView; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ScrollView; +import android.widget.TextView; + +public class PathLayout extends LinearLayout { + + private Stack paths; + ScrollView internalScroll; + LinearLayout view; + + public PathLayout(Context context) { + super(context); + initialize(); + } + + public PathLayout(Context context, AttributeSet attrs) { + super(context, attrs); + initialize(); + } + + public String pop() { + if (paths.empty()) { + return null; + } + int start = paths.size()*2-2; + int count = 2; + if (paths.size() == 1) { + start++; + count--; + } + view.removeViews(start, count); + return paths.pop(); + } + + public void push(String path) { + // its weird that we cannot declare static imgView as path separator + if (!paths.empty()) { + ImageView iv = new ImageView(getContext()); + iv.setImageDrawable(getResources().getDrawable(R.drawable.breadcrumb)); + iv.setPadding(2, 0, 2, 0); + view.addView(iv); + } + TextView tv = new TextView(getContext()); + tv.setLayoutParams(getLayoutParams()); + tv.setText(path); + view.addView(tv); + HorizontalScrollView hsv = (HorizontalScrollView) internalScroll.getChildAt(0); + hsv.smoothScrollTo(hsv.getMaxScrollAmount()*2, 0); + paths.push(path); + } + + public String peek() { + return paths.peek(); + } + + private void initialize() { + paths = new Stack(); + internalScroll = new ScrollView(getContext()); + internalScroll.setFillViewport(true); + HorizontalScrollView hsv = new HorizontalScrollView(getContext()); + hsv.setSmoothScrollingEnabled(true); + internalScroll.addView(hsv); + view = new LinearLayout(getContext()); + addView(internalScroll); + hsv.addView(view); + ImageView iv = new ImageView(getContext()); + iv.setImageDrawable(getResources().getDrawable(R.drawable.breadcrumb)); + view.addView(iv); + } + +} -- 2.11.0