now browsing by category
So this is my setup that I am still working on.
So this is my setup that I am still working on. Thought of posting to give some other community members some ideas. Cheers.
]]>RSS listview with Tasker
1, Create a ‘RSS’ directory under Tasker user directory. And create a txt file there, ‘rsslist.txt’. Write URL of RSS to file, one URL per line.
2, Create a Tasker’s task using following code. And run this task. ‘myfeed.json’ which converted all RSSfeed data into JSON is output.
https://drive.google.com/file/d/0B0O6MUjTuxUNa3ZFZHhVdGpIVzQ/
3, Add customview using following LLscript. This script creates listview of RSSfeed using ‘myfeed.json’.
https://drive.google.com/file/d/0B0O6MUjTuxUNcFVtR2hQdFJfMVk/
4, You should update RSS customview. This customview’s script can be used to update. First, you add this script to the last action of Tasker’s task (As plugin action ‘Lightning Script’. Setting ‘Run in’ is ‘Background’). If you want automatic update with timer, include task in timer profile. If you want manual update, run Tasker’s task with Tasker intent script command of LL, from menu, shortcut, gesture etc.
LL.sendTaskerIntent(new TaskerIntent(“getrssdata”), true);
-If you want to change the textcolor, textsize, backgroundcolor, please edit script and re-create customview.
– The place of a directory and file is match with my device. If it is not all right, replace and rewrite code to your device.
]]>I’m trying to set a progressBar in a custom view.
I set all things necessary but I can’t find out a way to set the horrizontal style (cause here there is not a XML file xD), so it shows me an indeterminate indicator…
Someone could help me??
]]>“CustomAdapter” ListView Customview example
Little changes DroidScript page’s code(http://droidscript.blogspot.jp/2010/03/custom-listadapter-in-using-java-proxy.html)
It’s working. This example, ListView item contains layouted three TextView.
I’m using it as RSS widget replacement with Tasker.
(2015/06/29 edit this post)
LL.bindClass(“java.util.HashMap”);
LL.bindClass(“java.util.ArrayList”);
LL.bindClass(“android.view.View”);
LL.bindClass(“android.view.Gravity”);
LL.bindClass(“android.widget.ListAdapter”);
LL.bindClass(“android.widget.ListView”);
LL.bindClass(“android.widget.LinearLayout”);
LL.bindClass(“android.widget.TextView”);
LL.bindClass(“java.lang.reflect.Array”);
LL.bindClass(“java.lang.reflect.Proxy”);
LL.bindClass(“java.lang.Class”);
LL.bindClass(“java.lang.ClassLoader”);
LL.bindClass(“java.lang.String”);
LL.bindClass(“java.lang.Boolean”);
LL.bindClass(“java.lang.Integer”);
LL.bindClass(“java.lang.Long”);
LL.bindClass(“java.lang.Double”);
LL.bindClass(“java.lang.Number”);
retDataList = new ArrayList(LL.getContext());
for (n=0; n<20; n++) {
retDataList.add({
title:”Lightning Launcher”,
description:”ListView CustomAdapter test. ListView CustomAdapter test. ListView CustomAdapter test.”,
date:”24:00″,
});
}
item.setVerticalGrab(true);
var context = LL.getContext();
var listView = new ListView(context);
listView.setBackgroundColor(Color.parseColor(“#ff222222”));
listView.setDivider(new ColorDrawable(Color.parseColor(“#ffeeeeee”)));
listView.setDividerHeight(1);
listView.setPadding(16,8,16,8);
var adapter = createListViewArrayAdapter(
retDataList,
function(position, convertView)
{
var view1 = convertView;
var view2;
var text1;
var text2;
var text3;
var text1text = retDataList.get(position).title;
var text2text = retDataList.get(position).description;
var text3text = retDataList.get(position).date;
if (null == view1) {
view1 = new LinearLayout(context);
view1.setOrientation(LinearLayout.HORIZONTAL);
view1.setLayoutParams(LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT));
view1.setPadding(8,8,8,8);
view2 = new LinearLayout(context);
view2.setOrientation(LinearLayout.VERTICAL);
view2.setLayoutParams(LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT,1));
view2.setPadding(0,0,0,0);
view1.addView(view2);
text1 = new TextView(context);
text1.setId(01);
text1.setTextColor(Color.parseColor(“#ffeeeeee”));
text1.setTextSize(15);
text1.setTypeface(Typeface.SERIF,Typeface.BOLD);
text1.setLayoutParams(LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT,0));
text1.setText(text1text);
view2.addView(text1);
text2 = new TextView(context);
text2.setId(02);
text2.setTextColor(Color.parseColor(“#ffeeeeee”));
text2.setTextSize(13);
text2.setTypeface(Typeface.SANS_SERIF,Typeface.ITALIC);
text2.setLayoutParams(LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT,0));
text2.setText(text2text);
view2.addView(text2);
text3 = new TextView(context);
text3.setId(03);
text3.setTextColor(Color.parseColor(“#ffeeeeee”));
text3.setTextSize(11);
text3.setTypeface(Typeface.MONOSPACE,Typeface.NORMAL);
text3.setGravity(Gravity.RIGHT);
text3.setLayoutParams(LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.MATCH_PARENT,0));
text3.setText(text3text);
view1.addView(text3);
}
else if (null != view1) {
text1=TextView(convertView.findViewById(01));
text1.setText(text1text);
text2=TextView(convertView.findViewById(02));
text2.setText(text2text);
text3=TextView(convertView.findViewById(03));
text3.setText(text3text);
}
return view1;
});
listView.setAdapter(adapter);
return listView;
function javaArrayToJsArray(javaArray)
{
var jsArray = [];
for (i = 0; i < javaArray.length; ++i) {
jsArray[i] = javaArray[i];
}
return jsArray;
}
function createInstance(javaInterface, handler)
{
var interfaces = Array.newInstance(Class, 1);
interfaces[0] = javaInterface;
var obj = Proxy.newProxyInstance(
ClassLoader.getSystemClassLoader(),
interfaces,
function(proxy, method, args) {
return handler[method.getName()].apply(
null,
javaArrayToJsArray(args)
);
});
return obj;
}
function createListViewArrayAdapter(items, viewFun)
{
var observer;
var handler = {
areAllItemsEnabled : function() {
return true; },
isEnabled : function(position) {
return true; },
getCount : function() {
return new Integer(items.size()); },
getItem : function(position) {
return new String(items.get(position)); },
getItemId : function(position) {
return new Long(position); },
getItemViewType : function(position) {
return new Integer(0); },
getView : function(position, convertView, parent) {
return viewFun(position, convertView); },
getViewTypeCount : function(position) {
return new Integer(1); },
hasStableIds : function(position) {
return true; },
isEmpty : function(position) {
return 0 == items.size(); },
registerDataSetObserver : function(theObserver) {
observer = theObserver; },
unregisterDataSetObserver : function(theObserver) {
observer = null; },
};
return createInstance(ListAdapter, handler);
}
]]>