My android app does not respond to ir remote ok button -
please forgive me if have not made post clear enough.
i have gridview imageview , textview beingness filled custom adapter.
when highlight item in gridview , press ir remote (ok) button returns stat pressed animation.
now have tried keycode listener returns keycode numbers , found out keycodes except ok button did not homecoming anything.
now have tried keycode event such enter, dpad_center, action_down , ontouchlisteners nil worked.
i have added tag stat pressed in gridview xml false.
there no way debug app in debugger because smart tv
channellistadapter.java
package com.showhd.adapter; import java.util.list; import android.annotation.suppresslint; import android.app.activity; import android.content.context; import android.content.intent; import android.graphics.bitmap; import android.view.display; import android.view.layoutinflater; import android.view.motionevent; import android.view.view; import android.view.view.onclicklistener; import android.view.view.ontouchlistener; import android.view.viewgroup; import android.widget.arrayadapter; import android.widget.imageview; import android.widget.textview; import com.nostra13.universalimageloader.core.imageloaderconfiguration; import com.nostra13.universalimageloader.core.assist.failreason; import com.nostra13.universalimageloader.core.assist.imageloadinglistener; import com.showhd.r; import com.showhd.common.shared; import com.showhd.data.tvchannel; import com.showhd.stb.stbtv; import com.showhd.stb.vstreaming; @suppresslint("clickableviewaccessibility") public class channellistadapter extends arrayadapter<tvchannel> { private context context; private int layoutid; private list<tvchannel> info = null; public channellistadapter(context context, int layoutid, list<tvchannel> data) { super(context, layoutid, data); this.context = context; this.layoutid = layoutid; this.data = data; shared.imageloader.init(imageloaderconfiguration .createdefault(context)); } @suppresswarnings("deprecation") public view getview(final int position, view convertview, viewgroup parent) { final viewholder holder; if (convertview == null) { layoutinflater inflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); convertview = inflater.inflate(layoutid, parent, false); holder = new viewholder(); holder.imageviewicon = (imageview) convertview .findviewbyid(r.id.iv_channel_icon); holder.textviewchannelcaption = (textview) convertview.findviewbyid(r.id.tv_channel_caption); convertview.settag(holder); } else { holder = (viewholder) convertview.gettag(); } final imageview imageview = holder.imageviewicon; shared.imageloader.displayimage(data.get(position).geticonurl(), holder.imageviewicon, shared.options, new imageloadinglistener() { public void onloadingstarted() { } public void onloadingfailed(failreason failreason) { } public void onloadingcomplete(bitmap loadedimage) { int realwidth = loadedimage.getwidth(); int realheight = loadedimage.getheight(); // resize image display display = ((activity)context).getwindowmanager().getdefaultdisplay(); int screenwidth = display.getwidth(); int imagewidth = screenwidth / 10; imageview.getlayoutparams().width = imagewidth; imageview.getlayoutparams().height = (int)(((float)imagewidth / (float)realwidth) * realheight); } public void onloadingcancelled() { } }); holder.textviewchannelcaption.settext(data.get(position).getcaption()); convertview.setonclicklistener(new onclicklistener() { public void onclick(view v) { stbtv.channelid = data.get(position).getid(); // vstreaming.streamvideo1(data.get(position).getstreamingurl()); string g = data.get(position).getstreamingurl(); intent intent = new intent(context,vstreaming.class); intent.putextra("vpath", g); context.startactivity(intent); } }); homecoming convertview; } static class viewholder { textview textviewchannelcaption; imageview imageviewicon; } }
stb_channel_item.xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/list_item_selector" android:gravity="center_vertical" android:orientation="horizontal" > <imageview android:id="@+id/iv_channel_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dp" android:state_pressed="false" android:focusable="false" android:contentdescription="@string/app_name" android:padding="1.5dp" android:scaletype="fitxy"/> <textview android:id="@+id/tv_channel_caption" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_margin="5dp" android:layout_weight="1" android:textcolor="@color/white" android:textsize="25sp" android:textisselectable="false" android:textstyle="bold" android:singleline="false" android:ellipsize="end" /> </linearlayout>
stb_tv.xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bg_main" android:orientation="vertical" > <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" > <linearlayout android:id="@+id/ll_packages" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_marginright="2dp" android:layout_weight="1" android:orientation="vertical" android:visibility="gone" > <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/bg_title" android:gravity="center" android:paddingbottom="5dp" android:paddingtop="5dp" android:text="@string/packages" android:textcolor="@color/red" android:textstyle="bold" /> <listview android:id="@+id/lv_packages" android:layout_width="fill_parent" android:layout_height="wrap_content" > </listview> </linearlayout> <linearlayout android:id="@+id/ll_categories" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_marginright="2dp" android:layout_weight="1" android:orientation="vertical" > <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/lawn_green" android:gravity="center" android:paddingbottom="5dp" android:paddingtop="5dp" android:alpha=".80" android:text="@string/categories" android:textcolor="@color/white" android:textstyle="bold" /> <listview android:id="@+id/lv_categories" android:layout_width="fill_parent" android:layout_height="fill_parent" android:height="?android:attr/listpreferreditemheight" android:textalignment="textstart" > </listview> </linearlayout> <linearlayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="0" android:orientation="vertical" > <listview android:id="@+id/lv_epgs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:visibility="gone" > </listview> </linearlayout> <linearlayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="3" android:orientation="vertical" > <gridview android:id="@+id/gridview1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:numcolumns="3" android:verticalspacing="25dp" > </gridview> </linearlayout> </linearlayout> </linearlayout>
android
No comments:
Post a Comment