Example usage for android.widget ImageView setOnClickListener

List of usage examples for android.widget ImageView setOnClickListener

Introduction

In this page you can find the example usage for android.widget ImageView setOnClickListener.

Prototype

public void setOnClickListener(@Nullable OnClickListener l) 

Source Link

Document

Register a callback to be invoked when this view is clicked.

Usage

From source file:com.freeme.filemanager.view.FileViewFragment.java

private View createStorageVolumeItem(final String volumPath, String volumDescription) {

    View listItem = LayoutInflater.from(mActivity).inflate(R.layout.dropdown_item, null);
    View listContent = listItem.findViewById(R.id.list_item);
    ImageView img = (ImageView) listItem.findViewById(R.id.item_icon);
    TextView text = (TextView) listItem.findViewById(R.id.path_name);
    text.setText(volumDescription);//  w w w .jav  a  2 s.  co m

    //*/ freeme.liuhaoran , 20160728 , volumeItem image
    /*/
    img.setImageResource(getStorageVolumeIconByDescription(volumDescription));
    //*/
    Log.i("liuhaoran3", "storageVolume.getPath() = " + storageVolume.getPath());
    Log.i("liuhaoran3", "internalPath = " + internalPath);
    if (storageVolume.getPath().equals(internalPath)) {
        img.setImageDrawable((getResources().getDrawable(R.drawable.storage_internal_n)));
    } else if ((storageVolume.getDescription(mActivity).toString()).contains("SD")) {
        img.setImageDrawable((getResources().getDrawable(R.drawable.storage_sd_card_n)));
    } else if (storageVolume.getDescription(mActivity).toString().contains("usbotg")) {
        img.setImageDrawable((getResources().getDrawable(R.drawable.storage_usb_n)));
    }
    //*/

    //modigy by droi heqianqian if the stroage device is not phone memeory, then set the storage could be unmoumt
    ImageView unmount_btn = (ImageView) listItem.findViewById(R.id.unmount_btn);
    if (volumPath.equals(Util.SD_DIR)) {
        //*/ freeme.liuhaoran , 20160802 , judge whether there is a SD card operation permissions
        if (ContextCompat.checkSelfPermission(mActivity,
                "android.permission.MOUNT_UNMOUNT_FILESYSTEMS") == PackageManager.PERMISSION_GRANTED) {
            unmount_btn.setVisibility(View.VISIBLE);
            unmount_btn.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View arg0) {
                    MountHelper.getInstance(mActivity).unMount(volumPath);
                    showVolumesList(false);
                    mVolumeSwitch.setVisibility(View.GONE);
                    int mounedCount = StorageHelper.getInstance(mActivity).getMountedVolumeCount();
                }
            });
        } else {
            unmount_btn.setVisibility(View.INVISIBLE);
        }
        //*/
    }
    listItem.setOnClickListener(mStorageVolumeClick);
    listItem.setTag(new Pair(volumPath, volumDescription));
    return listItem;
}

From source file:com.irccloud.android.activity.UploadsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (ColorFormatter.file_uri_template != null)
        template = UriTemplate.fromTemplate(ColorFormatter.file_uri_template);
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= 21) {
        Bitmap cloud = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
        setTaskDescription(new ActivityManager.TaskDescription(getResources().getString(R.string.app_name),
                cloud, 0xFFF2F7FC));/*from ww  w .  j  a v a2 s. co  m*/
        cloud.recycle();
    }

    if (Build.VERSION.SDK_INT >= 14) {
        try {
            java.io.File httpCacheDir = new java.io.File(getCacheDir(), "http");
            long httpCacheSize = 10 * 1024 * 1024; // 10 MiB
            HttpResponseCache.install(httpCacheDir, httpCacheSize);
        } catch (IOException e) {
            Log.i("IRCCloud", "HTTP response cache installation failed:" + e);
        }
    }
    setContentView(R.layout.ignorelist);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
        getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar));
        getSupportActionBar().setElevation(0);
    }

    if (savedInstanceState != null && savedInstanceState.containsKey("cid")) {
        cid = savedInstanceState.getInt("cid");
        to = savedInstanceState.getString("to");
        msg = savedInstanceState.getString("msg");
        page = savedInstanceState.getInt("page");
        File[] files = (File[]) savedInstanceState.getSerializable("adapter");
        for (File f : files) {
            adapter.addFile(f);
        }
        adapter.notifyDataSetChanged();
    }

    footer = getLayoutInflater().inflate(R.layout.messageview_header, null);
    ListView listView = (ListView) findViewById(android.R.id.list);
    listView.setAdapter(adapter);
    listView.addFooterView(footer);
    listView.setOnScrollListener(new AbsListView.OnScrollListener() {
        @Override
        public void onScrollStateChanged(AbsListView absListView, int i) {

        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            if (canLoadMore && firstVisibleItem + visibleItemCount > totalItemCount - 4) {
                canLoadMore = false;
                new FetchFilesTask().execute((Void) null);
            }
        }
    });
    listView.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {

        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            final File f = (File) adapter.getItem(i);

            AlertDialog.Builder builder = new AlertDialog.Builder(UploadsActivity.this);
            builder.setInverseBackgroundForced(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB);
            final View v = getLayoutInflater().inflate(R.layout.dialog_upload, null);
            final EditText messageinput = (EditText) v.findViewById(R.id.message);
            messageinput.setText(msg);
            final ImageView thumbnail = (ImageView) v.findViewById(R.id.thumbnail);

            v.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                @Override
                public void onGlobalLayout() {
                    if (messageinput.hasFocus()) {
                        v.post(new Runnable() {
                            @Override
                            public void run() {
                                v.scrollTo(0, v.getBottom());
                            }
                        });
                    }
                }
            });

            if (f.mime_type.startsWith("image/")) {
                try {
                    thumbnail.setImageBitmap(f.image);
                    thumbnail.setVisibility(View.VISIBLE);
                    thumbnail.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            Intent i = new Intent(UploadsActivity.this, ImageViewerActivity.class);
                            i.setData(Uri.parse(f.url));
                            startActivity(i);
                        }
                    });
                    thumbnail.setClickable(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            } else {
                thumbnail.setVisibility(View.GONE);
            }

            ((TextView) v.findViewById(R.id.filesize)).setText(f.metadata);
            v.findViewById(R.id.filename).setVisibility(View.GONE);
            v.findViewById(R.id.filename_heading).setVisibility(View.GONE);

            builder.setTitle("Send A File To " + to);
            builder.setView(v);
            builder.setPositiveButton("Send", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    String message = messageinput.getText().toString();
                    if (message.length() > 0)
                        message += " ";
                    message += f.url;

                    dialog.dismiss();
                    if (getParent() == null) {
                        setResult(Activity.RESULT_OK);
                    } else {
                        getParent().setResult(Activity.RESULT_OK);
                    }
                    finish();

                    NetworkConnection.getInstance().say(cid, to, message);
                }
            });
            builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                }
            });
            AlertDialog d = builder.create();
            d.setOwnerActivity(UploadsActivity.this);
            d.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
            d.show();
        }
    });
}

From source file:co.taqat.call.CallActivity.java

private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, LinphoneCall call) {
    boolean isCallPaused, isInConference;
    ImageView callState = (ImageView) callView.findViewById(R.id.call_pause);
    callState.setTag(call);//from  w ww  .jav a 2s.c o m
    callState.setOnClickListener(this);

    if (call.getState() == State.Paused || call.getState() == State.PausedByRemote
            || call.getState() == State.Pausing) {
        callState.setImageResource(R.drawable.pause);
        isCallPaused = true;
        isInConference = false;
    } else if (call.getState() == State.OutgoingInit || call.getState() == State.OutgoingProgress
            || call.getState() == State.OutgoingRinging) {
        isCallPaused = false;
        isInConference = false;
    } else {
        isInConference = isConferenceRunning && call.isInConference();
        isCallPaused = false;
    }

    return isCallPaused || isInConference;
}

From source file:com.hughes.android.dictionary.DictionaryActivity.java

void onSearchTextChange(final String text) {
    if ("thadolina".equals(text)) {
        final Dialog dialog = new Dialog(getListView().getContext());
        dialog.setContentView(R.layout.thadolina_dialog);
        dialog.setTitle("Ti amo, amore mio!");
        final ImageView imageView = (ImageView) dialog.findViewById(R.id.thadolina_image);
        imageView.setOnClickListener(new OnClickListener() {
            @Override/*w ww  . jav a 2 s.co m*/
            public void onClick(View v) {
                final Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("https://sites.google.com/site/cfoxroxvday/vday2012"));
                startActivity(intent);
            }
        });
        dialog.show();
    }
    if (dictRaf == null) {
        Log.d(LOG, "searchText changed during shutdown, doing nothing.");
        return;
    }

    // if (!searchView.hasFocus()) {
    // Log.d(LOG, "searchText changed without focus, doing nothing.");
    // return;
    // }
    Log.d(LOG, "onSearchTextChange: " + text);
    if (currentSearchOperation != null) {
        Log.d(LOG, "Interrupting currentSearchOperation.");
        currentSearchOperation.interrupted.set(true);
    }
    currentSearchOperation = new SearchOperation(text, index);
    searchExecutor.execute(currentSearchOperation);
}

From source file:com.farmerbb.taskbar.service.TaskbarService.java

@SuppressLint("RtlHardcoded")
private void drawTaskbar() {
    IconCache.getInstance(this).clearCache();

    // Initialize layout params
    windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
    U.setCachedRotation(windowManager.getDefaultDisplay().getRotation());

    final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
            WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT,
            WindowManager.LayoutParams.TYPE_PHONE,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
            PixelFormat.TRANSLUCENT);// w  ww .  j av  a2s  . c  om

    // Determine where to show the taskbar on screen
    switch (U.getTaskbarPosition(this)) {
    case "bottom_left":
        layoutId = R.layout.taskbar_left;
        params.gravity = Gravity.BOTTOM | Gravity.LEFT;
        positionIsVertical = false;
        break;
    case "bottom_vertical_left":
        layoutId = R.layout.taskbar_vertical;
        params.gravity = Gravity.BOTTOM | Gravity.LEFT;
        positionIsVertical = true;
        break;
    case "bottom_right":
        layoutId = R.layout.taskbar_right;
        params.gravity = Gravity.BOTTOM | Gravity.RIGHT;
        positionIsVertical = false;
        break;
    case "bottom_vertical_right":
        layoutId = R.layout.taskbar_vertical;
        params.gravity = Gravity.BOTTOM | Gravity.RIGHT;
        positionIsVertical = true;
        break;
    case "top_left":
        layoutId = R.layout.taskbar_left;
        params.gravity = Gravity.TOP | Gravity.LEFT;
        positionIsVertical = false;
        break;
    case "top_vertical_left":
        layoutId = R.layout.taskbar_top_vertical;
        params.gravity = Gravity.TOP | Gravity.LEFT;
        positionIsVertical = true;
        break;
    case "top_right":
        layoutId = R.layout.taskbar_right;
        params.gravity = Gravity.TOP | Gravity.RIGHT;
        positionIsVertical = false;
        break;
    case "top_vertical_right":
        layoutId = R.layout.taskbar_top_vertical;
        params.gravity = Gravity.TOP | Gravity.RIGHT;
        positionIsVertical = true;
        break;
    }

    // Initialize views
    int theme = 0;

    SharedPreferences pref = U.getSharedPreferences(this);
    switch (pref.getString("theme", "light")) {
    case "light":
        theme = R.style.AppTheme;
        break;
    case "dark":
        theme = R.style.AppTheme_Dark;
        break;
    }

    boolean altButtonConfig = pref.getBoolean("alt_button_config", false);

    ContextThemeWrapper wrapper = new ContextThemeWrapper(this, theme);
    layout = (LinearLayout) LayoutInflater.from(wrapper).inflate(layoutId, null);
    taskbar = (LinearLayout) layout.findViewById(R.id.taskbar);
    scrollView = (FrameLayout) layout.findViewById(R.id.taskbar_scrollview);

    if (altButtonConfig) {
        space = (Space) layout.findViewById(R.id.space_alt);
        layout.findViewById(R.id.space).setVisibility(View.GONE);
    } else {
        space = (Space) layout.findViewById(R.id.space);
        layout.findViewById(R.id.space_alt).setVisibility(View.GONE);
    }

    space.setOnClickListener(v -> toggleTaskbar());

    startButton = (ImageView) layout.findViewById(R.id.start_button);
    int padding;

    if (pref.getBoolean("app_drawer_icon", false)) {
        startButton.setImageDrawable(ContextCompat.getDrawable(this, R.mipmap.ic_launcher));
        padding = getResources().getDimensionPixelSize(R.dimen.app_drawer_icon_padding_alt);
    } else {
        startButton.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.all_apps_button_icon));
        padding = getResources().getDimensionPixelSize(R.dimen.app_drawer_icon_padding);
    }

    startButton.setPadding(padding, padding, padding, padding);
    startButton.setOnClickListener(ocl);
    startButton.setOnLongClickListener(view -> {
        openContextMenu();
        return true;
    });

    startButton.setOnGenericMotionListener((view, motionEvent) -> {
        if (motionEvent.getAction() == MotionEvent.ACTION_BUTTON_PRESS
                && motionEvent.getButtonState() == MotionEvent.BUTTON_SECONDARY)
            openContextMenu();

        return false;
    });

    refreshInterval = (int) (Float.parseFloat(pref.getString("refresh_frequency", "2")) * 1000);
    if (refreshInterval == 0)
        refreshInterval = 100;

    sortOrder = pref.getString("sort_order", "false");
    runningAppsOnly = pref.getString("recents_amount", "past_day").equals("running_apps_only");

    switch (pref.getString("recents_amount", "past_day")) {
    case "past_day":
        searchInterval = System.currentTimeMillis() - AlarmManager.INTERVAL_DAY;
        break;
    case "app_start":
        long oneDayAgo = System.currentTimeMillis() - AlarmManager.INTERVAL_DAY;
        long appStartTime = pref.getLong("time_of_service_start", System.currentTimeMillis());
        long deviceStartTime = System.currentTimeMillis() - SystemClock.elapsedRealtime();
        long startTime = deviceStartTime > appStartTime ? deviceStartTime : appStartTime;

        searchInterval = startTime > oneDayAgo ? startTime : oneDayAgo;
        break;
    }

    Intent intent = new Intent("com.farmerbb.taskbar.HIDE_START_MENU");
    LocalBroadcastManager.getInstance(TaskbarService.this).sendBroadcast(intent);

    if (altButtonConfig) {
        button = (Button) layout.findViewById(R.id.hide_taskbar_button_alt);
        layout.findViewById(R.id.hide_taskbar_button).setVisibility(View.GONE);
    } else {
        button = (Button) layout.findViewById(R.id.hide_taskbar_button);
        layout.findViewById(R.id.hide_taskbar_button_alt).setVisibility(View.GONE);
    }

    try {
        button.setTypeface(Typeface.createFromFile("/system/fonts/Roboto-Regular.ttf"));
    } catch (RuntimeException e) {
        /* Gracefully fail */ }

    updateButton(false);
    button.setOnClickListener(v -> toggleTaskbar());

    LinearLayout buttonLayout = (LinearLayout) layout.findViewById(
            altButtonConfig ? R.id.hide_taskbar_button_layout_alt : R.id.hide_taskbar_button_layout);
    if (buttonLayout != null)
        buttonLayout.setOnClickListener(v -> toggleTaskbar());

    LinearLayout buttonLayoutToHide = (LinearLayout) layout.findViewById(
            altButtonConfig ? R.id.hide_taskbar_button_layout : R.id.hide_taskbar_button_layout_alt);
    if (buttonLayoutToHide != null)
        buttonLayoutToHide.setVisibility(View.GONE);

    int backgroundTint = U.getBackgroundTint(this);
    int accentColor = U.getAccentColor(this);

    dashboardButton = (FrameLayout) layout.findViewById(R.id.dashboard_button);
    navbarButtons = (LinearLayout) layout.findViewById(R.id.navbar_buttons);

    dashboardEnabled = pref.getBoolean("dashboard", false);
    if (dashboardEnabled) {
        layout.findViewById(R.id.square1).setBackgroundColor(accentColor);
        layout.findViewById(R.id.square2).setBackgroundColor(accentColor);
        layout.findViewById(R.id.square3).setBackgroundColor(accentColor);
        layout.findViewById(R.id.square4).setBackgroundColor(accentColor);
        layout.findViewById(R.id.square5).setBackgroundColor(accentColor);
        layout.findViewById(R.id.square6).setBackgroundColor(accentColor);

        dashboardButton.setOnClickListener(v -> LocalBroadcastManager.getInstance(TaskbarService.this)
                .sendBroadcast(new Intent("com.farmerbb.taskbar.TOGGLE_DASHBOARD")));
    } else
        dashboardButton.setVisibility(View.GONE);

    if (pref.getBoolean("button_back", false)) {
        navbarButtonsEnabled = true;

        ImageView backButton = (ImageView) layout.findViewById(R.id.button_back);
        backButton.setVisibility(View.VISIBLE);
        backButton.setOnClickListener(v -> {
            U.sendAccessibilityAction(this, AccessibilityService.GLOBAL_ACTION_BACK);
            if (pref.getBoolean("hide_taskbar", true)
                    && !FreeformHackHelper.getInstance().isInFreeformWorkspace())
                hideTaskbar(true);
        });
    }

    if (pref.getBoolean("button_home", false)) {
        navbarButtonsEnabled = true;

        ImageView homeButton = (ImageView) layout.findViewById(R.id.button_home);
        homeButton.setVisibility(View.VISIBLE);
        homeButton.setOnClickListener(v -> {
            U.sendAccessibilityAction(this, AccessibilityService.GLOBAL_ACTION_HOME);
            if (pref.getBoolean("hide_taskbar", true)
                    && !FreeformHackHelper.getInstance().isInFreeformWorkspace())
                hideTaskbar(true);
        });

        homeButton.setOnLongClickListener(v -> {
            Intent voiceSearchIntent = new Intent(RecognizerIntent.ACTION_VOICE_SEARCH_HANDS_FREE);
            voiceSearchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

            try {
                startActivity(voiceSearchIntent);
            } catch (ActivityNotFoundException e) {
                /* Gracefully fail */ }

            if (pref.getBoolean("hide_taskbar", true)
                    && !FreeformHackHelper.getInstance().isInFreeformWorkspace())
                hideTaskbar(true);

            return true;
        });

        homeButton.setOnGenericMotionListener((view13, motionEvent) -> {
            if (motionEvent.getAction() == MotionEvent.ACTION_BUTTON_PRESS
                    && motionEvent.getButtonState() == MotionEvent.BUTTON_SECONDARY) {
                Intent voiceSearchIntent = new Intent(RecognizerIntent.ACTION_VOICE_SEARCH_HANDS_FREE);
                voiceSearchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

                try {
                    startActivity(voiceSearchIntent);
                } catch (ActivityNotFoundException e) {
                    /* Gracefully fail */ }

                if (pref.getBoolean("hide_taskbar", true)
                        && !FreeformHackHelper.getInstance().isInFreeformWorkspace())
                    hideTaskbar(true);
            }
            return true;
        });
    }

    if (pref.getBoolean("button_recents", false)) {
        navbarButtonsEnabled = true;

        ImageView recentsButton = (ImageView) layout.findViewById(R.id.button_recents);
        recentsButton.setVisibility(View.VISIBLE);
        recentsButton.setOnClickListener(v -> {
            U.sendAccessibilityAction(this, AccessibilityService.GLOBAL_ACTION_RECENTS);
            if (pref.getBoolean("hide_taskbar", true)
                    && !FreeformHackHelper.getInstance().isInFreeformWorkspace())
                hideTaskbar(true);
        });

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            recentsButton.setOnLongClickListener(v -> {
                U.sendAccessibilityAction(this, AccessibilityService.GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN);
                if (pref.getBoolean("hide_taskbar", true)
                        && !FreeformHackHelper.getInstance().isInFreeformWorkspace())
                    hideTaskbar(true);

                return true;
            });

            recentsButton.setOnGenericMotionListener((view13, motionEvent) -> {
                if (motionEvent.getAction() == MotionEvent.ACTION_BUTTON_PRESS
                        && motionEvent.getButtonState() == MotionEvent.BUTTON_SECONDARY) {
                    U.sendAccessibilityAction(this, AccessibilityService.GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN);
                    if (pref.getBoolean("hide_taskbar", true)
                            && !FreeformHackHelper.getInstance().isInFreeformWorkspace())
                        hideTaskbar(true);
                }
                return true;
            });
        }
    }

    if (!navbarButtonsEnabled)
        navbarButtons.setVisibility(View.GONE);

    layout.setBackgroundColor(backgroundTint);
    layout.findViewById(R.id.divider).setBackgroundColor(accentColor);
    button.setTextColor(accentColor);

    if (isFirstStart && FreeformHackHelper.getInstance().isInFreeformWorkspace())
        showTaskbar(false);
    else if (!pref.getBoolean("collapsed", false) && pref.getBoolean("taskbar_active", false))
        toggleTaskbar();

    LocalBroadcastManager.getInstance(this).unregisterReceiver(showReceiver);
    LocalBroadcastManager.getInstance(this).unregisterReceiver(hideReceiver);
    LocalBroadcastManager.getInstance(this).unregisterReceiver(tempShowReceiver);
    LocalBroadcastManager.getInstance(this).unregisterReceiver(tempHideReceiver);

    LocalBroadcastManager.getInstance(this).registerReceiver(showReceiver,
            new IntentFilter("com.farmerbb.taskbar.SHOW_TASKBAR"));
    LocalBroadcastManager.getInstance(this).registerReceiver(hideReceiver,
            new IntentFilter("com.farmerbb.taskbar.HIDE_TASKBAR"));
    LocalBroadcastManager.getInstance(this).registerReceiver(tempShowReceiver,
            new IntentFilter("com.farmerbb.taskbar.TEMP_SHOW_TASKBAR"));
    LocalBroadcastManager.getInstance(this).registerReceiver(tempHideReceiver,
            new IntentFilter("com.farmerbb.taskbar.TEMP_HIDE_TASKBAR"));

    startRefreshingRecents();

    windowManager.addView(layout, params);

    isFirstStart = false;
}

From source file:org.alfresco.mobile.android.application.fragments.properties.DetailsFragment.java

private void display(Node refreshedNode, LayoutInflater inflater) {
    node = refreshedNode;/*w w w  . j  a v a  2  s .  co m*/

    // Detect if restrictable
    isRestrictable = node.hasAspect(ContentModel.ASPECT_RESTRICTABLE);

    renditionManager = ApplicationManager.getInstance(getActivity()).getRenditionManager(getActivity());

    // Header
    TextView tv = (TextView) vRoot.findViewById(R.id.title);
    tv.setText(node.getName());
    tv = (TextView) vRoot.findViewById(R.id.details);
    tv.setText(Formatter.createContentBottomText(getActivity(), node, true));

    if (isRestrictable) {
        tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_encrypt, 0);
    }

    // Preview + Thumbnail
    displayIcon(node, R.drawable.mime_folder, (ImageView) vRoot.findViewById(R.id.icon), false);
    displayIcon(node, R.drawable.mime_256_folder, (ImageView) vRoot.findViewById(R.id.preview), true);

    // Description
    Integer generalPropertyTitle = null;
    tv = (TextView) vRoot.findViewById(R.id.description);
    List<String> filter = new ArrayList<String>();
    if (node.getDescription() != null && node.getDescription().length() > 0
            && vRoot.findViewById(R.id.description_group) != null) {
        vRoot.findViewById(R.id.description_group).setVisibility(View.VISIBLE);
        tv.setText(node.getDescription());
        generalPropertyTitle = -1;
        ((TextView) vRoot.findViewById(R.id.prop_name_value)).setText(node.getName());
        filter.add(ContentModel.PROP_NAME);
    } else if (vRoot.findViewById(R.id.description_group) != null) {
        vRoot.findViewById(R.id.description_group).setVisibility(View.GONE);
        generalPropertyTitle = R.string.metadata;
    }

    mTabHost = (TabHost) vRoot.findViewById(android.R.id.tabhost);
    setupTabs();

    if (mTabHost == null) {
        grouprootview = (ViewGroup) vRoot.findViewById(R.id.metadata);
        createPropertiesPanel(inflater, generalPropertyTitle, filter);
    }

    // BUTTONS
    ImageView b = (ImageView) vRoot.findViewById(R.id.action_openin);
    if (node.isDocument() && ((DocumentImpl) node).hasAllowableAction(Action.CAN_GET_CONTENT_STREAM.value())
            && ((Document) node).getContentStreamLength() > 0 && !isRestrictable) {
        b.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                openin();
            }
        });
    } else {
        b.setVisibility(View.GONE);
    }

    b = (ImageView) vRoot.findViewById(R.id.action_geolocation);
    if (node.isDocument() && node.hasAspect(ContentModel.ASPECT_GEOGRAPHIC)) {
        b.setVisibility(View.VISIBLE);
        b.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if (node == null) {
                    return;
                }
                String latitude = (node.getProperty(ContentModel.PROP_LATITUDE).getValue() != null)
                        ? node.getProperty(ContentModel.PROP_LATITUDE).getValue().toString()
                        : "";
                String longitude = (node.getProperty(ContentModel.PROP_LONGITUDE).getValue() != null)
                        ? node.getProperty(ContentModel.PROP_LONGITUDE).getValue().toString()
                        : "";
                ActionManager.actionShowMap(DetailsFragment.this, node.getName(), latitude, longitude);
            }
        });
    } else {
        b.setVisibility(View.GONE);
    }

    b = (ImageView) vRoot.findViewById(R.id.like);
    if (alfSession != null && alfSession.getRepositoryInfo() != null
            && alfSession.getRepositoryInfo().getCapabilities() != null
            && alfSession.getRepositoryInfo().getCapabilities().doesSupportLikingNodes()) {
        IsLikedLoaderCallBack lcb = new IsLikedLoaderCallBack(alfSession, getActivity(), node);
        lcb.setImageButton(b);
        lcb.setProgressView(vRoot.findViewById(R.id.like_progress));
        lcb.execute(false);

        b.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                like(v);
            }
        });
    } else {
        b.setVisibility(View.GONE);
        if (vRoot.findViewById(R.id.like_progress) != null) {
            vRoot.findViewById(R.id.like_progress).setVisibility(View.GONE);
        }
    }

    // BUTTONS
    b = (ImageView) vRoot.findViewById(R.id.action_favorite);
    if (!isRestrictable) {
        IsFavoriteLoaderCallBack lcb = new IsFavoriteLoaderCallBack(alfSession, this, node);
        lcb.setImageButton(b);
        lcb.setProgressView(vRoot.findViewById(R.id.favorite_progress));
        lcb.execute(false);
        b.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                favorite(v);
            }
        });
    } else {
        b.setVisibility(View.GONE);
        vRoot.findViewById(R.id.favorite_progress).setVisibility(View.GONE);
    }

    b = (ImageView) vRoot.findViewById(R.id.action_share);
    if (node.isDocument() && !isRestrictable) {
        b.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                share();
            }
        });
    } else {
        b.setVisibility(View.GONE);
    }
}

From source file:com.swiftkaydevelopment.fullsailcommunicate.activities.HomeActivity.java

private View setUpHeader(View header) {
    TextView tvName = (TextView) header.findViewById(R.id.tvDrawerHeaderName);
    ImageView ivusersphoto = (ImageView) header.findViewById(R.id.ivDrawerHeaderProfilePicture);

    tvName.setText(prefs.getString(AppConstants.PREFERENCE_NAMES.PREF_FIRSTNAME, MockData.FIRSTNAME) + " "
            + prefs.getString(AppConstants.PREFERENCE_NAMES.PREF_LASTNAME, MockData.LASTNAME));
    String imgLoc = prefs.getString(AppConstants.PREFERENCE_NAMES.PREF_PRO_PIC_LOC,
            MockData.PROFILE_PICTURE_LOCATION);
    if (!TextUtils.isEmpty(imgLoc)) {
        Picasso.with(this).load(imgLoc).transform(new CircleTransform()).into(ivusersphoto);
    } else {//from   w w w  .ja  v  a 2  s  .c  o  m
        Picasso.with(this).load(R.drawable.profile_pic_blank_150).transform(new CircleTransform())
                .into(ivusersphoto);
    }

    tvName.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mDrawerLayout != null) {
                mDrawerLayout.closeDrawers();
            }

            ProfileFragment fragment = (ProfileFragment) getSupportFragmentManager()
                    .findFragmentByTag(ProfileFragment.TAG);
            if (fragment == null) {
                fragment = ProfileFragment.newInstance(uid);
            }
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.frame_container, fragment, ProfileFragment.TAG).addToBackStack(null).commit();
        }
    });

    ivusersphoto.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (mDrawerLayout != null) {
                mDrawerLayout.closeDrawers();
            }

            ProfileFragment fragment = (ProfileFragment) getSupportFragmentManager()
                    .findFragmentByTag(ProfileFragment.TAG);
            if (fragment == null) {
                fragment = ProfileFragment.newInstance(uid);
            }
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.frame_container, fragment, ProfileFragment.TAG).addToBackStack(null).commit();
        }
    });
    return header;
}

From source file:dev.ukanth.ufirewall.MainActivity.java

private void hideColumns(int id) {
    ImageView view = (ImageView) this.findViewById(id);
    view.setVisibility(View.GONE);
    view.setOnClickListener(this);
}

From source file:dev.ukanth.ufirewall.MainActivity.java

private void addColumns(int id) {
    ImageView view = (ImageView) this.findViewById(id);
    view.setVisibility(View.VISIBLE);
    view.setOnClickListener(this);
}

From source file:com.esri.android.mapsapp.MapFragment.java

/**
 * Shows the search result in the layout after successful geocoding and
 * reverse geocoding//from w  ww  .  j a v  a2 s. com
 * 
 */

private void showSearchResultLayout(String address) {
    // Remove the layouts
    mMapContainer.removeView(mSearchBox);
    mMapContainer.removeView(mSearchResult);

    // Inflate the new layout from the xml file
    mSearchResult = mInflater.inflate(R.layout.search_result, null);

    // Set layout parameters
    mSearchResult.setLayoutParams(mlayoutParams);

    // Initialize the textview and set its text
    TextView tv = (TextView) mSearchResult.findViewById(R.id.textView1);
    tv.setTypeface(null, Typeface.BOLD);
    tv.setText(address);

    // Adding the search result layout to the map container
    mMapContainer.addView(mSearchResult);

    // Setup the listener for the "cancel" icon
    ImageView iv_cancel = (ImageView) mSearchResult.findViewById(R.id.imageView3);
    iv_cancel.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // Remove the search result view
            mMapContainer.removeView(mSearchResult);

            suggestionClickFlag = false;
            // Add the search box view
            showSearchBoxLayout();

            // Remove all graphics from the map
            resetGraphicsLayers();

        }
    });

    // Set up the listener for the "Get Directions" icon
    ImageView iv_route = (ImageView) mSearchResult.findViewById(R.id.imageView2);
    iv_route.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            onGetRoute(getString(R.string.my_location), mLocationLayerPointString);
        }
    });

    // Add the compass after getting the height of the layout
    mSearchResult.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            addCompass(mSearchResult.getHeight());
            mSearchResult.getViewTreeObserver().removeGlobalOnLayoutListener(this);
        }

    });

}