Example usage for android.widget TextView setVisibility

List of usage examples for android.widget TextView setVisibility

Introduction

In this page you can find the example usage for android.widget TextView setVisibility.

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.arctech.stikyhive.ChattingActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    recipientStkid = getIntent().getExtras().getString("recipientStkid");
    chatRecipient = getIntent().getExtras().getString("chatRecipient");
    chatRecipientUrl = getIntent().getExtras().getString("chatRecipientUrl");
    senderToken = getIntent().getExtras().getString("senderToken");
    recipientToken = getIntent().getExtras().getString("recipientToken");
    noti = getIntent().getExtras().getBoolean("noti");
    message = getIntent().getExtras().getString("message");
    rows = getIntent().getExtras().getInt("rows");

    pref = PreferenceManager.getDefaultSharedPreferences(this);
    ws = new JsonWebService();
    dbHelper = new DBHelper(this);
    dialog = new ProgressDialog(this);
    listChatContact = new ArrayList<>();
    listChatContact = dbHelper.getChatContact();
    Log.i(" Chat Contact ", " " + listChatContact.size());
    //to change font
    faceSemi_bold = Typeface.createFromAsset(getAssets(), fontOSSemi_bold);
    Typeface faceLight = Typeface.createFromAsset(getAssets(), fontOSLight);
    faceRegular = Typeface.createFromAsset(getAssets(), fontOSRegular);

    imageLoader = ImageLoader.getInstance();
    if (!imageLoader.isInited()) {
        imageLoader.init(ImageLoaderConfiguration.createDefault(this));
    }/*from   w ww .  j  a va2 s.  c  o  m*/

    start = new Date();
    SimpleDateFormat oFormat = new SimpleDateFormat("dd MMM HH:mm");
    timeSend = oFormat.format(start);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.chat);

    txtUserName = (TextView) findViewById(R.id.txtChatName);
    edTxtMsg = (EditText) findViewById(R.id.edTxtMsg);
    imgViewProfile = (ImageView) findViewById(R.id.imgViewChat);
    imgViewAddCon = (ImageView) findViewById(R.id.imgAddContact);
    lv = (ListView) findViewById(R.id.listView1);
    layoutLabel = (LinearLayout) findViewById(R.id.layoutLabel);
    txtLabel1 = (TextView) findViewById(R.id.txtLabel1);
    txtLabel2 = (TextView) findViewById(R.id.txtLabel2);
    txtLabel3 = (TextView) findViewById(R.id.txtLabel3);
    txtLabel2.setText(" " + chatRecipient + " ");
    txtLabel1.setTypeface(faceLight);
    txtLabel2.setTypeface(faceRegular);
    txtLabel3.setTypeface(faceLight);
    // lv.smoothScrollToPosition(adapter.getCount() - 1);

    for (ChatContact contact : listChatContact) {
        if (contact.getContactId().equals(recipientStkid)) {
            imgViewAddCon.setVisibility(View.INVISIBLE);
            layoutLabel.setVisibility(View.GONE);
            break;
        }
    }
    Log.i(TAG, " come back again");
    adapter = new ChatArrayAdapter(getApplicationContext(), R.layout.messaging_listview, faceSemi_bold,
            faceRegular);
    lv.setAdapter(adapter);
    // adapter.add(new StikyChat(chatRecipientUrl, "Hello", false, "12.10.2015", "12.1.2014"));

    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout);
    // BEGIN_INCLUDE (change_colors)
    // Set the color scheme of the SwipeRefreshLayout by providing 4 color resource ids
    swipeRefreshLayout.setColorScheme(R.color.swipe_color_1, R.color.swipe_color_2, R.color.swipe_color_3,
            R.color.swipe_color_4);
    limitMsg = 7;
    // END_INCLUDE (change_colors)
    swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            Log.i(" Refresh Layout ", "onRefresh called from SwipeRefreshLayout");
            if (limitMsg < rows) {
                Log.i("Limit Message ", " " + limitMsg);
                limitMsg *= 2;
                fetchRecords();
            } else if (limitMsg > rows && (limitMsg - rows < 7)) {
                fetchRecords();
            } else {
                Log.i("No data ", "to refresh");
                swipeRefreshLayout.setRefreshing(false);
                Toast.makeText(getApplicationContext(), "No data to refresh!", Toast.LENGTH_SHORT).show();
            }

            // initiateRefresh();
        }
    });

    LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout headerLayout = (LinearLayout) findViewById(R.id.header);
    View header = inflator.inflate(R.layout.header, null);

    TextView textView = (TextView) header.findViewById(R.id.textView1);
    textView.setText("StikyChat");
    textView.setTypeface(faceSemi_bold);
    textView.setVisibility(View.VISIBLE);
    headerLayout.addView(header);
    LinearLayout layoutRight = (LinearLayout) header.findViewById(R.id.layoutRight);
    layoutRight.setVisibility(View.GONE);

    txtUserName.setText(chatRecipient);
    Log.i(TAG, "Activity Name " + txtUserName.getText().toString());
    txtUserName.setTypeface(faceSemi_bold);

    String url = "";
    if (chatRecipientUrl.contains("http")) {
        url = chatRecipientUrl;
    } else {
        url = this.getResources().getString(R.string.url) + "/" + chatRecipientUrl;
    }
    addAndroidUniversalImageLoader(imgViewProfile, url);
    //        if (noti && (!message.equals(""))) {
    //            adapter.add(new StikyChat(chatRecipientUrl, message, true, timeSend, ""));
    //            lv.smoothScrollToPosition(adapter.getCount() - 1);
    //        }

    //to show history chats between two users(sender & recipient)
    dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    dateFormat2 = new SimpleDateFormat("dd MMM HH:mm");
    listHistory = dbHelper.getStikyChat();
    if (listHistory.size() > 0) {
        Collections.reverse(listHistory);
        for (StikyChatTb chatTb : listHistory) {
            String getDate = chatTb.getSendDate();
            String fromStikyBee = chatTb.getSender();
            try {
                String createDate = dateFormat2.format(dateFormat.parse(getDate));
                if (fromStikyBee.equals(pref.getString("stkid", ""))) {
                    adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), false, createDate, ""));
                } else {
                    adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), true, createDate, ""));
                }
                lv.smoothScrollToPosition(adapter.getCount() - 1);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
    }

    mRegistrationBroadcastReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
            messageGCM = sharedPreferences.getString("message", "");
            recipientProfileGCM = sharedPreferences.getString("chatRecipientUrl", "");
            recipientNameGCM = sharedPreferences.getString("chatRecipientName", "");
            recipientStkidGCM = sharedPreferences.getString("recipientStkid", "");
            recipientTokenGCM = sharedPreferences.getString("recipientToken", "");
            senderTokenGCM = sharedPreferences.getString("senderToken", "");

            Log.i(TAG, "..." + recipientStkidGCM.trim() + " STKID " + recipientStkid.trim() + ":");
            if (firstConnect) {
                if (recipientStkidGCM.trim() == recipientStkid.trim()
                        || recipientStkidGCM.equals(recipientStkid)) {
                    MyGcmListenerService.flagSendNoti = false;
                    Log.i(TAG, " " + message);
                    // (1) get today's date
                    start = new Date();
                    SimpleDateFormat oFormat = new SimpleDateFormat("dd MMM HH:mm");
                    timeSend = oFormat.format(start);

                    Log.i(TAG, "First connect " + firstConnect);
                    StikyChat stikyChat = new StikyChat(recipientProfileGCM, messageGCM, true, timeSend, "");
                    Log.i(TAG, " First " + message + " " + recipientProfileGCM + " " + timeSend);
                    Log.i(TAG, "User " + txtUserName.getText().toString());
                    //txtUserName.setText(message);
                    Log.i(TAG, "User 2 " + txtUserName.getText().toString());
                    adapter.add(stikyChat);
                    adapter.notifyDataSetChanged();
                    //new regTask2().execute("Obj ");
                    lv.smoothScrollToPosition(adapter.getCount() - 1);
                } else {
                    Log.i(TAG, "..." + recipientStkidGCM.trim());
                    Log.i(TAG, "&&&" + recipientStkid.trim());
                    Log.i(TAG, "else casee");
                    //notificaton send
                    flagNotifi = true;
                    new regTask2().execute("Notification");
                }
                firstConnect = false;
            }
        }
    };
}

From source file:com.cssweb.android.base.DialogActivity.java

protected void initStockBar() {
    hiddenOrDisplayStockBar(View.VISIBLE);

    TextView stkBar1 = (TextView) findViewById(R.id.njzq_userstockbtn1);
    TextView stkBar2 = (TextView) findViewById(R.id.njzq_userstockbtn2);
    TextView stkBar3 = (TextView) findViewById(R.id.njzq_userstockbtn3);
    TextView stkBar4 = (TextView) findViewById(R.id.njzq_userstockbtn4);
    TextView stkBar5 = (TextView) findViewById(R.id.njzq_userstockbtn5);
    TextView stkBar6 = (TextView) findViewById(R.id.njzq_userstockbtn6);

    stkBar1.setTextColor(getResources().getColor(R.color.zr_white));
    stkBar1.setOnClickListener(toolbarClick);
    stkBar1.setVisibility(View.VISIBLE);
    stkBar1.setTag(11);// w  w w  . j av a 2s . c  o m

    stkBar2.setTextColor(getResources().getColor(R.color.zr_white));
    stkBar2.setOnClickListener(toolbarClick);
    stkBar2.setVisibility(View.VISIBLE);
    stkBar2.setTag(12);

    stkBar3.setTextColor(getResources().getColor(R.color.zr_white));
    stkBar3.setOnClickListener(toolbarClick);
    stkBar3.setVisibility(View.VISIBLE);
    stkBar3.setTag(13);

    stkBar4.setTextColor(getResources().getColor(R.color.zr_white));
    stkBar4.setOnClickListener(toolbarClick);
    stkBar4.setVisibility(View.VISIBLE);
    stkBar4.setTag(14);

    stkBar5.setTextColor(getResources().getColor(R.color.zr_white));
    stkBar5.setOnClickListener(toolbarClick);
    stkBar5.setVisibility(View.VISIBLE);
    stkBar5.setTag(15);

    stkBar6.setTextColor(getResources().getColor(R.color.zr_white));
    stkBar6.setOnClickListener(toolbarClick);
    stkBar6.setVisibility(View.VISIBLE);
    stkBar6.setTag(16);
}

From source file:ch.scythe.hsr.DayFragment.java

private void createAndFormatTableRows(List<UiLesson> lessons, TableLayout timeTable,
        LayoutInflater layoutInflater) {

    String lastLessonTimeslot = "";
    boolean firstRow = true;

    for (UiLesson lesson : lessons) {

        View row = layoutInflater.inflate(R.layout.timetable_row, null);
        timeTable.addView(row);/*  www  .  jav a 2  s. c om*/

        View horizontalLine = row.findViewById(R.id.horizontalLine);
        if (firstRow) {
            horizontalLine.setVisibility(View.GONE);
            firstRow = false;
        }

        TextView timeUnitField = (TextView) row.findViewById(R.id.rowTimeunit);
        TextView lessonField = (TextView) row.findViewById(R.id.rowLesson);
        TextView lecturerFieldShort = (TextView) row.findViewById(R.id.rowLecturerShort);
        TextView lecturerFieldLong = (TextView) row.findViewById(R.id.rowLecturerLong);
        TextView roomField = (TextView) row.findViewById(R.id.rowRoom);
        TextView descriptionField = (TextView) row.findViewById(R.id.rowDescription);
        TextView typeField = (TextView) row.findViewById(R.id.rowType);

        // fill values into row

        String newTimeslot = lesson.getTimeSlot();
        if (!lastLessonTimeslot.equals(newTimeslot)) {
            timeUnitField.setText(newTimeslot);
        } else {
            timeUnitField.setText("");
            horizontalLine.setVisibility(View.GONE);
        }
        lastLessonTimeslot = newTimeslot;

        lessonField.setText(lesson.getName());
        roomField.setText(lesson.getRoom());

        if (lecturerFieldShort != null)
            lecturerFieldShort.setText(lesson.getLecturerShort());
        if (lecturerFieldLong != null)
            lecturerFieldLong.setText(lesson.getLecturerLong());

        typeField.setText(lesson.getType());

        if (lesson.hasDescription()) {
            descriptionField.setText(lesson.getDescription());
        } else {
            descriptionField.setVisibility(View.GONE);
        }
    }

}

From source file:es.upv.riromu.arbre.main.MainActivity.java

private void setVisibility() {

    TextView imc = (TextView) findViewById(R.id.textView);
    imc.setVisibility(View.GONE);
    ImageButton sendButton = (ImageButton) findViewById(R.id.button_send);
    sendButton.setVisibility(View.GONE);
    ImageButton histButton = (ImageButton) findViewById(R.id.button_histogram);
    histButton.setVisibility(View.GONE);
    ImageButton revertButton = (ImageButton) findViewById(R.id.button_revert);
    revertButton.setVisibility(View.GONE);
    ImageView imagePalette = (ImageView) findViewById(R.id.palette);
    imagePalette.setVisibility(View.GONE);
}

From source file:com.cw.litenote.note.NoteUi.java

void hide_picViewUI(String pictureStr) {
    String tagStr = "current" + pager.getCurrentItem() + "pictureView";
    ViewGroup pictureGroup = (ViewGroup) pager.findViewWithTag(tagStr);

    System.out.println("NoteUi / _hide_picViewUI / tagStr = " + tagStr);

    if ((pictureGroup != null)) {
        // image view
        TextView picView_title = (TextView) (pictureGroup.findViewById(R.id.image_title));
        TextView picView_footer = (TextView) (pictureGroup.findViewById(R.id.image_footer));

        Button picView_back_button = (Button) (pictureGroup.findViewById(R.id.image_view_back));
        Button picView_viewMode_button = (Button) (pictureGroup.findViewById(R.id.image_view_mode));
        Button picView_previous_button = (Button) (pictureGroup.findViewById(R.id.image_view_previous));
        Button picView_next_button = (Button) (pictureGroup.findViewById(R.id.image_view_next));

        picView_title.setVisibility(View.GONE);
        picView_footer.setVisibility(View.GONE);

        picView_back_button.setVisibility(View.GONE);

        // view mode button visibility affects pop up menu ON/OFF
        picView_viewMode_button.setVisibility(View.GONE);

        if (Note.isPictureMode() && UtilImage.hasImageExtension(pictureStr, act)) {
            if (picView_previous_button != null) {
                picView_previous_button.setVisibility(View.GONE);
                picView_next_button.setVisibility(View.GONE);
            }//ww w  .j a v  a  2  s . c  om
        }

        // video view
        Button videoPlayButton = (Button) (pictureGroup.findViewById(R.id.video_view_play_video));

        TextView videoView_currPosition = (TextView) (pictureGroup.findViewById(R.id.video_current_pos));
        SeekBar videoView_seekBar = (SeekBar) (pictureGroup.findViewById(R.id.video_seek_bar));
        TextView videoView_fileLength = (TextView) (pictureGroup.findViewById(R.id.video_file_length));

        // since the play button is designed at the picture center, should be gone when playing
        if (UtilVideo.getVideoState() == UtilVideo.VIDEO_AT_PLAY) {
            videoPlayButton.setVisibility(View.GONE);
        }

        if ((!UtilVideo.hasMediaControlWidget) && UtilVideo.hasVideoExtension(pictureStr, act)) {
            picView_previous_button.setVisibility(View.GONE);
            picView_next_button.setVisibility(View.GONE);
        }

        videoView_currPosition.setVisibility(View.GONE);
        videoView_seekBar.setVisibility(View.GONE);
        videoView_fileLength.setVisibility(View.GONE);
    }

    cancel_UI_callbacks();
}

From source file:es.upv.riromu.arbre.main.MainActivity.java

private void resetVisibility(int code)

{

    RangeSeekBar<Integer> seekBar = (RangeSeekBar<Integer>) findViewById(R.id.rangeseekbar);
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    String rangepreference = (String) sharedPref.getString("rangepreference", "H");
    if (rangepreference.equals("H"))
        seekBar = new RangeSeekBar<Integer>(Integer.valueOf(sharedPref.getString("minH_preference", "60")),
                Integer.valueOf(sharedPref.getString("maxH_preference", "130")), this);
    if (rangepreference.equals("S"))
        seekBar = new RangeSeekBar<Integer>(Integer.valueOf(sharedPref.getString("minS_preference", "0")),
                Integer.valueOf(sharedPref.getString("maxS_preference", "255")), this);
    if (rangepreference.equals("V"))
        seekBar = new RangeSeekBar<Integer>(Integer.valueOf(sharedPref.getString("minV_preference", "0")),
                Integer.valueOf(sharedPref.getString("maxV_preference", "255")), this);

    seekBar.setSelectedMinValue(MIN_TH);
    seekBar.setSelectedMaxValue(MAX_TH);

    TextView imc = (TextView) findViewById(R.id.textView);
    imc.setVisibility(View.GONE);
    if ((code == CAPTURE_IMAGE) || (code == PICK_IMAGE)) {
        ImageButton cropButton = (ImageButton) findViewById(R.id.button_crop);
        cropButton.setVisibility(View.VISIBLE);
    }//from w w w. java  2 s.c  om
    ImageButton sendButton = (ImageButton) findViewById(R.id.button_send);
    sendButton.setVisibility(View.GONE);
    ImageButton histButton = (ImageButton) findViewById(R.id.button_histogram);
    histButton.setVisibility(View.GONE);
    ImageButton revertButton = (ImageButton) findViewById(R.id.button_revert);
    revertButton.setVisibility(View.GONE);
    ImageView imagePalette = (ImageView) findViewById(R.id.palette);
    imagePalette.setVisibility(View.GONE);
}

From source file:com.owncloud.android.ui.fragment.FileDetailFragment.java

/**
 * Updates the time that the file was created in view
 * @param milliseconds Unix time to set/*from www .jav  a 2s.  c o m*/
 */
private void setTimeCreated(long milliseconds) {
    TextView tv = (TextView) getView().findViewById(R.id.fdCreated);
    TextView tvLabel = (TextView) getView().findViewById(R.id.fdCreatedLabel);
    if (tv != null) {
        tv.setText(DisplayUtils.unixTimeToHumanReadable(milliseconds));
        tv.setVisibility(View.VISIBLE);
        tvLabel.setVisibility(View.VISIBLE);
    }
}

From source file:gr.scify.newsum.ui.ViewActivity.java

private void initRatingBar() {
    final TextView tx = (TextView) findViewById(R.id.textView1);

    final RatingBar rb = (RatingBar) findViewById(R.id.ratingBar);
    rb.setVisibility(View.VISIBLE);
    final TextView rateLbl = (TextView) findViewById(R.id.rateLbl);
    rateLbl.setVisibility(View.VISIBLE);
    final Button btnSubmit = (Button) findViewById(R.id.submitRatingBtn);
    // Set rating bar reaction
    btnSubmit.setOnClickListener(new OnClickListener() {

        @Override/* ww  w  . j a  va 2  s  .c  o  m*/
        public void onClick(View v) {
            HttpParams params = new BasicHttpParams(); // Basic params
            HttpClient client = new DefaultHttpClient(params);
            String sURL = getApplicationContext().getResources().getString(R.string.urlRating);

            HttpPost post = new HttpPost(sURL);
            ArrayList<NameValuePair> alParams = new ArrayList<NameValuePair>();

            NameValuePair nvSummary = new NameValuePair() {

                @Override
                public String getValue() {
                    return tx.getText().toString();
                }

                @Override
                public String getName() {
                    return "summary";
                }
            };

            NameValuePair nvRating = new NameValuePair() {

                @Override
                public String getValue() {
                    return String.valueOf(rb.getRating());
                }

                @Override
                public String getName() {
                    return "rating";
                }
            };
            // added User ID
            NameValuePair nvUserID = new NameValuePair() {

                @Override
                public String getValue() {
                    SharedPreferences idSettings = getSharedPreferences(UID_PREFS_NAME, Context.MODE_PRIVATE);
                    String sUID = idSettings.getString("UID", "");
                    return sUID;
                }

                @Override
                public String getName() {
                    return "userID";
                }
            };

            alParams.add(nvSummary);
            alParams.add(nvRating);
            alParams.add(nvUserID);

            boolean bSuccess = false;
            try {
                post.setEntity(new UrlEncodedFormEntity(alParams, HTTP.UTF_8)); // with list of key-value pairs
                client.execute(post);
                bSuccess = true;
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            } catch (ClientProtocolException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }

            if (bSuccess) {
                Toast.makeText(ViewActivity.this, R.string.thankyou_rate, Toast.LENGTH_SHORT).show();
                rb.setVisibility(View.GONE);
                rateLbl.setVisibility(View.GONE);
                btnSubmit.setVisibility(View.GONE);
            } else
                Toast.makeText(ViewActivity.this, R.string.fail_rate, Toast.LENGTH_SHORT).show();

        }
    });

    rb.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {

        @Override
        public void onRatingChanged(final RatingBar ratingBar, float rating, boolean fromUser) {
            // Ignore auto setting
            if (!fromUser)
                return;
            // Allow submit
            btnSubmit.setVisibility(View.VISIBLE);

        }
    });
    rb.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // Allow submit
            btnSubmit.setVisibility(View.VISIBLE);
        }
    });
    rb.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // Allow submit
            btnSubmit.setVisibility(View.VISIBLE);
            return false;
        }
    });

}

From source file:net.exclaimindustries.geohashdroid.wiki.WikiPictureEditor.java

private void resetSubmitButton() {
    // Resets the submit button to whatever state and visibility it ought to
    // be.//  w w w  .j a  v  a 2 s.c o m

    // First, check for username/password here.  That way, when we get back
    // from the settings screen, it'll update the message accordingly.
    Button submitButton = (Button) findViewById(R.id.wikieditbutton);
    TextView warning = (TextView) findViewById(R.id.warningmessage);

    SharedPreferences prefs = getSharedPreferences(GHDConstants.PREFS_BASE, 0);
    String wpName = prefs.getString(GHDConstants.PREF_WIKI_USER, "");

    if ((wpName == null) || (wpName.trim().length() == 0)) {
        // If there's no username or password, the button is gone and the
        // warning goes up.
        submitButton.setEnabled(false);
        submitButton.setVisibility(View.GONE);
        warning.setVisibility(View.VISIBLE);
    } else if (mCurrentFile == null || mCurrentFile.trim().length() == 0) {
        // If there IS a username or password, but there's no currently
        // selected image, the button is visible but disabled.
        submitButton.setEnabled(false);
        submitButton.setVisibility(View.VISIBLE);
        warning.setVisibility(View.GONE);
    } else {
        // Otherwise, the button is visible and enabled.
        submitButton.setEnabled(true);
        submitButton.setVisibility(View.VISIBLE);
        warning.setVisibility(View.GONE);
    }
}

From source file:es.upv.riromu.arbre.main.MainActivity.java

private void rangeSeekBarChanged(int minValue, int maxValue) {
    {/*  w  w  w.  j  av a  2 s.  c om*/

        TextView imc = (TextView) findViewById(R.id.textView);
        imc.setVisibility(View.VISIBLE);
        ImageButton cropButton = (ImageButton) findViewById(R.id.button_crop);
        cropButton.setVisibility(View.GONE);
        ImageButton sendButton = (ImageButton) findViewById(R.id.button_send);
        sendButton.setVisibility(View.VISIBLE);
        ImageButton histButton = (ImageButton) findViewById(R.id.button_histogram);
        histButton.setVisibility(View.VISIBLE);
        ImageButton revertButton = (ImageButton) findViewById(R.id.button_revert);
        revertButton.setVisibility(View.VISIBLE);
        ImageView imagePalette = (ImageView) findViewById(R.id.palette);
        imagePalette.setVisibility(View.GONE);
        ImageWrapper imw = new ImageWrapper();
        if (image_uri == null)
            image = Util.decodeSampledBitmapFromResource(getResources(), R.drawable.platanus_hispanica,
                    MAX_SIZE, MAX_SIZE);
        if (image_uri != null)
            image = Util.decodeSampledBitmapFromUri(image_uri, MAX_SIZE, MAX_SIZE, this);
        // handle changed range values
        try {
            Log.i(TAG, "User selected new range values: MIN=" + minValue + ", MAX=" + maxValue);
            ImageView imv = (ImageView) findViewById(R.id.image_intro);
            if (state[CROP_IMAGE])
                imw.setBitmap(croppedimage);
            else
                imw.setBitmap(image);
            imw.setMinV(minValue);
            imw.setMaxV(maxValue);

            ProcessImageTask pit = new ProcessImageTask();
            imw = (ImageWrapper) pit.execute(imw).get();
            treatedimage = imw.getBitmap();
            imv.setImageBitmap(treatedimage);
            histogram = imw.getHistogram();
            histograma = imw.getHist();
            mascara = imw.getMask();
            imc.setBackgroundColor(
                    Color.rgb(imw.getR().intValue(), imw.getG().intValue(), imw.getB().intValue()));
            state[TREAT_IMAGE] = true;

        } catch (Exception e) {
            Log.e(TAG, "Error " + e.getMessage());

        }
    }
}