add (invisible) context triangle icon to feed rows

This commit is contained in:
Andrew Dolgov 2013-05-18 13:57:25 +04:00
parent 47a2f150ab
commit 8d85dc931f
7 changed files with 104 additions and 0 deletions

View File

@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="?feedsSelectedBackground"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="10dip"
@ -43,4 +44,15 @@
android:textSize="13sp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/feed_menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:paddingLeft="6dp"
android:paddingTop="6dp"
android:src="@drawable/ic_mailbox_collapsed_holo_light"
android:visibility="gone" />
</LinearLayout>

View File

@ -3,6 +3,7 @@
android:id="@+id/feeds_row"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="10dip"
@ -42,4 +43,15 @@
android:textSize="13sp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/feed_menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:paddingLeft="6dp"
android:paddingTop="6dp"
android:visibility="gone"
android:src="@drawable/ic_mailbox_collapsed_holo_light" />
</LinearLayout>

View File

@ -4,6 +4,7 @@
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="?feedsSelectedBackgroundSolid"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="10dip"
@ -43,4 +44,15 @@
android:textSize="13sp"
android:textStyle="bold" />
<ImageButton
android:id="@+id/feed_menu_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:paddingLeft="6dp"
android:paddingTop="6dp"
android:visibility="gone"
android:src="@drawable/ic_mailbox_collapsed_holo_light" />
</LinearLayout>

View File

@ -21,6 +21,7 @@ import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -29,6 +30,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -406,6 +408,21 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
icon.setImageResource(cat.unread > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
}
ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
if (ib != null) {
if (m_activity.isDarkTheme())
ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
}
return v;
}
}
@ -422,6 +439,8 @@ public class FeedCategoriesFragment extends Fragment implements OnItemClickListe
public void onItemClick(AdapterView<?> av, View view, int position, long id) {
ListView list = (ListView)av;
Log.d(TAG, "onItemClick=" + position);
if (list != null) {
FeedCategory cat = (FeedCategory)list.getItemAtPosition(position);

View File

@ -34,6 +34,7 @@ import android.util.Base64;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -42,6 +43,7 @@ import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -529,6 +531,20 @@ public class FeedsFragment extends Fragment implements OnItemClickListener, OnSh
}
}
ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
if (ib != null) {
if (m_activity.isDarkTheme())
ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
}
return v;
}

View File

@ -15,6 +15,7 @@ import android.support.v4.widget.SimpleCursorAdapter;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -22,6 +23,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -282,6 +284,21 @@ public class OfflineFeedCategoriesFragment extends Fragment implements OnItemCli
if (icon != null) {
icon.setImageResource(cursor.getInt(cursor.getColumnIndex("unread")) > 0 ? R.drawable.ic_rss : R.drawable.ic_rss_bw);
}
ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
if (ib != null) {
if (m_activity.isDarkTheme())
ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
}
return v;
}

View File

@ -20,6 +20,7 @@ import android.support.v4.widget.SimpleCursorAdapter;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -27,6 +28,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
@ -307,6 +309,20 @@ public class OfflineFeedsFragment extends Fragment implements OnItemClickListene
}
ImageButton ib = (ImageButton) v.findViewById(R.id.feed_menu_button);
if (ib != null) {
if (m_activity.isDarkTheme())
ib.setImageResource(R.drawable.ic_mailbox_collapsed_holo_dark);
ib.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
getActivity().openContextMenu(v);
}
});
}
return v;
}
}