Search in sources :

Example 16 with OnLongClickListener

use of android.view.View.OnLongClickListener in project android_frameworks_base by AOSPA.

the class LongpressTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    final Longpress a = getActivity();
    mSimpleView = a.findViewById(R.id.simple_view);
    mSimpleView.setOnLongClickListener(new OnLongClickListener() {

        public boolean onLongClick(View v) {
            mLongClicked = true;
            return true;
        }
    });
}
Also used : Longpress(android.view.Longpress) OnLongClickListener(android.view.View.OnLongClickListener) View(android.view.View)

Example 17 with OnLongClickListener

use of android.view.View.OnLongClickListener in project android_frameworks_base by AOSPA.

the class DisabledLongpressTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    final Longpress a = getActivity();
    mSimpleView = a.findViewById(R.id.simple_view);
    mSimpleView.setOnLongClickListener(new OnLongClickListener() {

        public boolean onLongClick(View v) {
            mLongClicked = true;
            return true;
        }
    });
    // The View#setOnLongClickListener will ensure the View is long
    // clickable, we reverse that here
    mSimpleView.setLongClickable(false);
}
Also used : Longpress(android.view.Longpress) OnLongClickListener(android.view.View.OnLongClickListener) View(android.view.View)

Example 18 with OnLongClickListener

use of android.view.View.OnLongClickListener in project android_frameworks_base by DirtyUnicorns.

the class LongpressTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    final Longpress a = getActivity();
    mSimpleView = a.findViewById(R.id.simple_view);
    mSimpleView.setOnLongClickListener(new OnLongClickListener() {

        public boolean onLongClick(View v) {
            mLongClicked = true;
            return true;
        }
    });
}
Also used : Longpress(android.view.Longpress) OnLongClickListener(android.view.View.OnLongClickListener) View(android.view.View)

Example 19 with OnLongClickListener

use of android.view.View.OnLongClickListener in project android_frameworks_base by DirtyUnicorns.

the class DisabledLongpressTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    final Longpress a = getActivity();
    mSimpleView = a.findViewById(R.id.simple_view);
    mSimpleView.setOnLongClickListener(new OnLongClickListener() {

        public boolean onLongClick(View v) {
            mLongClicked = true;
            return true;
        }
    });
    // The View#setOnLongClickListener will ensure the View is long
    // clickable, we reverse that here
    mSimpleView.setLongClickable(false);
}
Also used : Longpress(android.view.Longpress) OnLongClickListener(android.view.View.OnLongClickListener) View(android.view.View)

Example 20 with OnLongClickListener

use of android.view.View.OnLongClickListener in project Libraries-for-Android-Developers by eoecn.

the class ListBundleAdapter method getView.

@Override
public View getView(int position, View convertView, ViewGroup arg2) {
    final ListViewHolder viewHolder;
    final Bundle ab = list.get(position);
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.index_bundle_listview, null);
        viewHolder = new ListViewHolder();
        viewHolder.imageViewIcon = (ImageView) convertView.findViewById(R.id.image_item_1);
        viewHolder.appName = (TextView) convertView.findViewById(R.id.text_item_1);
        viewHolder.appinfo = (TextView) convertView.findViewById(R.id.text_item_2);
        viewHolder.download = (TextView) convertView.findViewById(R.id.text_item_4);
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ListViewHolder) convertView.getTag();
    }
    viewHolder.appName.setText(ab.getName());
    viewHolder.appinfo.setText(ab.getVersion());
    viewHolder.download.setText("运行");
    LinearLayout linearlayout_out_2 = (LinearLayout) convertView.findViewById(R.id.linearlayout_out_2);
    linearlayout_out_2.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            if (ab.getState() != ab.ACTIVE) {
                //判断插件是否已启动
                try {
                    ab.start();
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            if (ab.getBundleActivity() != null) {
                //插件设置了启动 Activity
                //在宿主应用中我们需要通过 activity启动服务来启动插件的activit
                Intent i = new Intent();
                i.setClassName(mContext, ab.getBundleActivity());
                i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                mContext.startActivity(i);
            } else {
                Toast.makeText(mContext, "该插件没有配置BundleActivity", Toast.LENGTH_SHORT).show();
            }
        }
    });
    convertView.setOnLongClickListener(new OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
            AlertDialog.Builder alertbBuilder = new AlertDialog.Builder(mContext);
            alertbBuilder.setMessage("").setNegativeButton("卸载", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    //直接使用 Bundle.uninstall()卸载
                    try {
                        ab.uninstall();
                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    dialog.cancel();
                }
            }).create();
            alertbBuilder.show();
            return false;
        }
    });
    convertView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            //这里调用PullToRefreshWebView2Activity从网络 查询插件demo说明
            mContext.startActivity(new Intent(mContext, DetailsActivity.class));
        }
    });
    return convertView;
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Bundle(org.osgi.framework.Bundle) Intent(android.content.Intent) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) OnLongClickListener(android.view.View.OnLongClickListener) OnClickListener(android.view.View.OnClickListener) LinearLayout(android.widget.LinearLayout)

Aggregations

OnLongClickListener (android.view.View.OnLongClickListener)34 View (android.view.View)33 TextView (android.widget.TextView)17 Longpress (android.view.Longpress)12 ImageView (android.widget.ImageView)12 OnClickListener (android.view.View.OnClickListener)10 Intent (android.content.Intent)9 ContextMenu (com.juns.wechat.chat.ContextMenu)4 RecyclerView (android.support.v7.widget.RecyclerView)3 LinearLayout (android.widget.LinearLayout)3 File (java.io.File)3 SuppressLint (android.annotation.SuppressLint)2 ViewGroup (android.view.ViewGroup)2 ListView (android.widget.ListView)2 RelativeLayout (android.widget.RelativeLayout)2 Timer (java.util.Timer)2 TimerTask (java.util.TimerTask)2 LayoutTransition (android.animation.LayoutTransition)1 AlertDialog (android.app.AlertDialog)1 ActivityNotFoundException (android.content.ActivityNotFoundException)1