Invoke GlobalActions dialog (Shutdown/Reboot...) on Android-x86

by Christian Erpelding » Fri, 23 Apr 2010 20:55:37 GMT


Sponsored Links
 Hello,

I'm trying to port Android to the OpenFrame/Joggler.
 http://www.openpeak.com/OpenFrame.php 

The problem is that this device is touch-only, i.e. it has no hardware 
buttons at all. Not even a power button.

I'd like to be able to shutdown Android in a safe way to avoid data 
loss. :-)

Android-x86.org offers a touch-only feature that can be 
started/stopped by tapping the right corner of the StatusBar.
It can simulate HOME/MENU/BACK, implemented in 
frameworks/base/services/java/com/android/server/status/TouchFeature.java

I'd like to implement a function to show the Power Off dialog that's 
normally invoked by pressing the Power button on the PC (or 
longpressing the ENDCALL key on the phone).

After reading 



Other Threads

1. Help: Issue with Android GridView, TouchListener and onTouch()

I am using the following code to do things with gridview(slightly
modified from 
http://developer.android.com/resources/tutorials/views/hello-gridview.html).
I want to replace the onClicklistener and the onClick() method with
their "touch" equivalents i.e. touchlistener and onTouch() so that
when i touch an element in the gridview the image of the element
changes and a double touch on the same element takes it back to the
orginal state.

How do I do this? I can't get my code to do this. The clicklistener
works to some extent but the touch isn't. Please help.

public class ImageAdapter extends BaseAdapter {
private Context mContext;

public ImageAdapter(Context c) {
    mContext = c;
}

public int getCount() {
    return mThumbIds.length;
}

public Object getItem(int position) {
    return null;
}

public long getItemId(int position) {
    return 0;
}

// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent)
{
    ImageView imageView;
    if (convertView == null) {  // if it's not recycled, initialize
some attributes
        imageView = new ImageView(mContext);
        imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setPadding(8, 8, 8, 8);

        imageView.setOnClickListener(new View.OnClickListener()
            {

              @Override
              public void onClick(View view)
{

                  if(position==0)
                  {
                                  //do this
                              }
                              else
                              {
                                //do this
                              }
                           }
                    });

    } else {
        imageView = (ImageView) convertView;
    }

    imageView.setImageResource(mThumbIds[position]);
    return imageView;
}

// references to our images
private Integer[] mThumbIds = {
        R.drawable.sample_2, R.drawable.sample_3,
        R.drawable.sample_4, R.drawable.sample_5,
        R.drawable.sample_6, R.drawable.sample_7,
        R.drawable.sample_0, R.drawable.sample_1,
        R.drawable.sample_2, R.drawable.sample_3,
        R.drawable.sample_4, R.drawable.sample_5,
        R.drawable.sample_6, R.drawable.sample_7,
        R.drawable.sample_0, R.drawable.sample_1,
        R.drawable.sample_2, R.drawable.sample_3,
        R.drawable.sample_4, R.drawable.sample_5,
        R.drawable.sample_6, R.drawable.sample_7
};
}

-- 

2. Search, Result and Detail workflow inside a tab

Well, here is a method that I can think of.

1. Create multiple View classes which prepare the layout and handle
all the actions on that view.
One for each, SearchView, ResultView and DetailView.

2. In the activity, get the first view and set it as content to the
activity.

3. When the user navigates, keep an ArrayList of Views so that you can
maintain the state of the previous screens.

4. Handle the Back button press, and change the Activity's content to
the required view.

Instead of setting the content, you can also use a simple ViewFlipper
to create animations while changing views.

Thanks and Regards,
Kumar Bibek




-- 

3. Got my free droid today from google

4. md5sum on the file

5. user agent of the device ..

6. Contacts from 1.5 and 1.6 ... filtering out trash

7. Progress dialog question/problem (API Demos example)