missing files
authorBartek Przybylski <bart.p.pl@gmail.com>
Sun, 4 Sep 2011 11:47:06 +0000 (13:47 +0200)
committerBartek Przybylski <bart.p.pl@gmail.com>
Sun, 4 Sep 2011 11:47:06 +0000 (13:47 +0200)
res/drawable/breadcrumb.png [new file with mode: 0644]
res/drawable/main_header_bg.xml [new file with mode: 0644]
src/eu/alefzero/owncloud/PathLayout.java [new file with mode: 0644]

diff --git a/res/drawable/breadcrumb.png b/res/drawable/breadcrumb.png
new file mode 100644 (file)
index 0000000..b124f34
Binary files /dev/null and b/res/drawable/breadcrumb.png differ
diff --git a/res/drawable/main_header_bg.xml b/res/drawable/main_header_bg.xml
new file mode 100644 (file)
index 0000000..707e473
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <gradient 
+        android:startColor="#3A3C39" 
+        android:endColor="#181818"
+        android:angle="270"
+     />
+    <corners android:radius="0dp" />
+</shape>
\ 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 (file)
index 0000000..1927404
--- /dev/null
@@ -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<String> 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<String>();
+    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);
+  }
+
+}