Skip to content
Browse files

Working on the privacy slider and the search fields. They don't work,…

… yet, though.
  • Loading branch information...
1 parent c494db4 commit 9c086e017e08a1215edc3af9bf4d555fc4954133 @Pimm committed Mar 25, 2011
Showing with 172 additions and 12 deletions.
  1. +2 −0 AndroidManifest.xml
  2. BIN bin/GNU Free Call.apk
  3. BIN bin/classes.dex
  4. BIN bin/org/gnu/freecall/R$id.class
  5. BIN bin/org/gnu/freecall/R$layout.class
  6. BIN bin/org/gnu/freecall/R$string.class
  7. BIN bin/org/gnu/freecall/data/Cloud.class
  8. BIN bin/org/gnu/freecall/data/CloudArrayAdapter$1.class
  9. BIN bin/org/gnu/freecall/data/CloudArrayAdapter$CloudArrayFilter.class
  10. BIN bin/org/gnu/freecall/data/CloudArrayAdapter.class
  11. BIN bin/org/gnu/freecall/discoverherd/DiscoverHerdActivity.class
  12. BIN bin/org/gnu/freecall/fellowgnus/FellowGNUsActivity.class
  13. BIN bin/org/gnu/freecall/main/MainActivity$1.class
  14. BIN bin/org/gnu/freecall/main/MainActivity$2.class
  15. BIN bin/org/gnu/freecall/main/MainActivity$3.class
  16. BIN bin/org/gnu/freecall/main/MainActivity.class
  17. BIN bin/org/gnu/freecall/view/PrivacySlider.class
  18. BIN bin/org/gnu/freecall/view/SearchFieldWatcher.class
  19. BIN bin/org/gnu/freecall/you/YouActivity.class
  20. BIN bin/resources.ap_
  21. +6 −5 gen/org/gnu/freecall/R.java
  22. +2 −1 res/layout/list.xml
  23. +6 −3 res/layout/list_item.xml
  24. +3 −2 src/org/gnu/freecall/data/Cloud.java
  25. +0 −1 src/org/gnu/freecall/data/CloudArrayAdapter.java
  26. +35 −0 src/org/gnu/freecall/discoverherd/DiscoverHerdActivity.java
  27. +33 −0 src/org/gnu/freecall/fellowgnus/FellowGNUsActivity.java
  28. +14 −0 src/org/gnu/freecall/main/MainActivity.java
  29. +30 −0 src/org/gnu/freecall/view/PrivacySlider.java
  30. +36 −0 src/org/gnu/freecall/view/SearchFieldWatcher.java
  31. +5 −0 src/org/gnu/freecall/you/YouActivity.java
View
2 AndroidManifest.xml
@@ -9,5 +9,7 @@
</intent-filter>
</activity>
<activity android:name=".you.YouActivity" android:label="@string/you_label" />
+ <activity android:name=".fellowgnus.FellowGNUsActivity" android:label="@string/fellow_gnus_label" />
+ <activity android:name=".discoverherd.DiscoverHerdActivity" android:label="@string/discover_herd_label" />
</application>
</manifest>
View
BIN bin/GNU Free Call.apk
Binary file not shown.
View
BIN bin/classes.dex
Binary file not shown.
View
BIN bin/org/gnu/freecall/R$id.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/R$layout.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/R$string.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/data/Cloud.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/data/CloudArrayAdapter$1.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/data/CloudArrayAdapter$CloudArrayFilter.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/data/CloudArrayAdapter.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/discoverherd/DiscoverHerdActivity.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/fellowgnus/FellowGNUsActivity.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/main/MainActivity$1.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/main/MainActivity$2.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/main/MainActivity$3.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/main/MainActivity.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/view/PrivacySlider.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/view/SearchFieldWatcher.class
Binary file not shown.
View
BIN bin/org/gnu/freecall/you/YouActivity.class
Binary file not shown.
View
BIN bin/resources.ap_
Binary file not shown.
View
11 gen/org/gnu/freecall/R.java
@@ -18,11 +18,12 @@
public static final int you_icon=0x7f020004;
}
public static final class id {
- public static final int discover_herd=0x7f050004;
- public static final int fellow_gnus=0x7f050003;
- public static final int list_view=0x7f050000;
- public static final int text=0x7f050001;
- public static final int you=0x7f050002;
+ public static final int discover_herd=0x7f050005;
+ public static final int fellow_gnus=0x7f050004;
+ public static final int list_view=0x7f050001;
+ public static final int search_field=0x7f050000;
+ public static final int text=0x7f050002;
+ public static final int you=0x7f050003;
}
public static final class layout {
public static final int list=0x7f030000;
View
3 res/layout/list.xml
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content">
- <ListView android:id="@+id/list_view" android:layout_width="fill_parent" android:layout_height="fill_parent" />
+ <EditText android:id="@+id/search_field" android:text="Search" android:layout_width="fill_parent" android:layout_height="wrap_content" />
+ <ListView android:id="@+id/list_view" android:layout_width="fill_parent" android:layout_height="wrap_content" />
</LinearLayout>
View
9 res/layout/list_item.xml
@@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
- <TextView android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:paddingLeft="12dip" android:minHeight="?android:attr/listPreferredItemHeight" />
-</LinearLayout>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
+ <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
+ <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_vertical" android:paddingLeft="12dip" android:minHeight="?android:attr/listPreferredItemHeight" />
+ <!--org.gnu.freecall.view.PrivacySlider android:id="@+id/privacy_slider" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:paddingRight="12dip" /-->
+ </LinearLayout>
+</LinearLayout>
View
5 src/org/gnu/freecall/data/Cloud.java
@@ -12,9 +12,10 @@
public final String label;
/**
* The values of this cloud. This is an array, as Pimm thinks this way the filter operation is faster. This should be
- * measured, though (TODO). Can be null if there are no values yet.
+ * measured, though (TODO). Can be null if there are no values yet. This is not a private property with a getter, for
+ * speed reasons.
*/
- private String[] values;
+ public String[] values;
public Cloud(String label) {
this.label = label;
}
View
1 src/org/gnu/freecall/data/CloudArrayAdapter.java
@@ -9,7 +9,6 @@
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Filter;
-import android.widget.TextView;
/**
* A concrete BaseAdapter that is backed by an array of clouds.
View
35 src/org/gnu/freecall/discoverherd/DiscoverHerdActivity.java
@@ -0,0 +1,35 @@
+package org.gnu.freecall.discoverherd;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gnu.freecall.R;
+import org.gnu.freecall.data.Cloud;
+import org.gnu.freecall.data.CloudArrayAdapter;
+import org.gnu.freecall.view.SearchFieldWatcher;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.EditText;
+import android.widget.ListView;
+
+/**
+ * The "discover herd" activity.
+ */
+public class DiscoverHerdActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ // Set the content view.
+ setContentView(R.layout.list);
+ final List<Cloud> clouds = new ArrayList<Cloud>();
+ clouds.add(new Cloud("David Sugar"));
+ clouds.add(new Cloud("Andrew Bovsunovskiy"));
+ clouds.add(new Cloud("Pimm Hogeling"));
+ clouds.add(new Cloud("Guitarist"));
+ clouds.add(new Cloud("Hospital"));
+ final CloudArrayAdapter dataAdapter = new CloudArrayAdapter(this, R.layout.list_item, R.id.text, clouds);
+ ((ListView) findViewById(R.id.list_view)).setAdapter(dataAdapter);
+ new SearchFieldWatcher(((EditText) findViewById(R.id.search_field)));
+ }
+}
View
33 src/org/gnu/freecall/fellowgnus/FellowGNUsActivity.java
@@ -0,0 +1,33 @@
+package org.gnu.freecall.fellowgnus;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gnu.freecall.R;
+import org.gnu.freecall.data.Cloud;
+import org.gnu.freecall.data.CloudArrayAdapter;
+import org.gnu.freecall.view.SearchFieldWatcher;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.EditText;
+import android.widget.ListView;
+
+/**
+ * The "fellow GNUs" activity, which is like a list of contacts.
+ */
+public class FellowGNUsActivity extends Activity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ // Set the content view.
+ setContentView(R.layout.list);
+ final List<Cloud> clouds = new ArrayList<Cloud>();
+ clouds.add(new Cloud("David Sugar"));
+ clouds.add(new Cloud("Pimm Hogeling"));
+ clouds.add(new Cloud("Hospital"));
+ final CloudArrayAdapter dataAdapter = new CloudArrayAdapter(this, R.layout.list_item, R.id.text, clouds);
+ ((ListView) findViewById(R.id.list_view)).setAdapter(dataAdapter);
+ new SearchFieldWatcher(((EditText) findViewById(R.id.search_field)));
+ }
+}
View
14 src/org/gnu/freecall/main/MainActivity.java
@@ -1,6 +1,8 @@
package org.gnu.freecall.main;
import org.gnu.freecall.R;
+import org.gnu.freecall.discoverherd.DiscoverHerdActivity;
+import org.gnu.freecall.fellowgnus.FellowGNUsActivity;
import org.gnu.freecall.you.YouActivity;
import android.app.Activity;
@@ -25,5 +27,17 @@ public void onClick(View button) {
startActivity(new Intent(MainActivity.this, YouActivity.class));
}
});
+ ((Button) findViewById(R.id.fellow_gnus)).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View button) {
+ startActivity(new Intent(MainActivity.this, FellowGNUsActivity.class));
+ }
+ });
+ ((Button) findViewById(R.id.discover_herd)).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View button) {
+ startActivity(new Intent(MainActivity.this, DiscoverHerdActivity.class));
+ }
+ });
}
}
View
30 src/org/gnu/freecall/view/PrivacySlider.java
@@ -0,0 +1,30 @@
+package org.gnu.freecall.view;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.util.AttributeSet;
+import android.view.View;
+
+public class PrivacySlider extends View {
+ private static final int HEIGHT = 48;
+ private final Paint orangePaint;
+ private final Paint whiteStrokePaint;
+ private int width;
+ public PrivacySlider(Context context, AttributeSet attributes) {
+ super(context, attributes);
+ orangePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ orangePaint.setColor(0xFFFBB829);
+ whiteStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ whiteStrokePaint.setStyle(Paint.Style.STROKE);
+ whiteStrokePaint.setColor(0xFFFFFFFF);
+ }
+ @Override
+ protected void onDraw(Canvas canvas) {
+ }
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ width = MeasureSpec.getSize(widthMeasureSpec) - getPaddingRight();
+ setMeasuredDimension(width, HEIGHT);
+ }
+}
View
36 src/org/gnu/freecall/view/SearchFieldWatcher.java
@@ -0,0 +1,36 @@
+package org.gnu.freecall.view;
+
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.widget.EditText;
+
+/**
+ *
+ */
+public class SearchFieldWatcher implements TextWatcher {
+ private final EditText editText;
+ /**
+ * Whether the initial "search" text is still set.
+ */
+ private boolean initialTextSet;
+ public SearchFieldWatcher(EditText editText) {
+ this.editText = editText;
+ initialTextSet = true;
+ editText.addTextChangedListener(this);
+ editText.setTextColor(0xFF5F5F5F);
+ }
+ @Override
+ public void afterTextChanged(Editable value) {
+ }
+ @Override
+ public void beforeTextChanged(CharSequence value, int changeStartIndex, int replacedTextLength, int replacingTextLength) {
+ }
+ @Override
+ public void onTextChanged(CharSequence value, int changeStartIndex, int replacingTextLength, int replacedTextLength) {
+ if (initialTextSet) {
+ initialTextSet = false;
+ editText.setTextColor(0xFF000000);
+ editText.setText("");
+ }
+ }
+}
View
5 src/org/gnu/freecall/you/YouActivity.java
@@ -6,9 +6,11 @@
import org.gnu.freecall.R;
import org.gnu.freecall.data.Cloud;
import org.gnu.freecall.data.CloudArrayAdapter;
+import org.gnu.freecall.view.SearchFieldWatcher;
import android.app.Activity;
import android.os.Bundle;
+import android.widget.EditText;
import android.widget.ListView;
/**
@@ -24,12 +26,15 @@ protected void onCreate(Bundle savedInstanceState) {
final Cloud nameCloud = new Cloud("Names");
nameCloud.addValue("Haakon Meland Eriksen");
clouds.add(nameCloud);
+ clouds.add(new Cloud("Address"));
final Cloud interestCloud = new Cloud("Interests");
interestCloud.addValue("Rock music");
interestCloud.addValue("Free software");
interestCloud.addValue("The darkside");
clouds.add(interestCloud);
+ clouds.add(new Cloud("Pictures"));
final CloudArrayAdapter dataAdapter = new CloudArrayAdapter(this, R.layout.list_item, R.id.text, clouds);
((ListView) findViewById(R.id.list_view)).setAdapter(dataAdapter);
+ new SearchFieldWatcher(((EditText) findViewById(R.id.search_field)));
}
}

0 comments on commit 9c086e0

Please sign in to comment.
Something went wrong with that request. Please try again.