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.tachyondev.android.glass.looking.MainActivity.java

private void displayAuth(int state) {
    TextView titleView = (TextView) findViewById(R.id.tv_title);
    TextView urlView = (TextView) findViewById(R.id.tv_first);
    TextView codeView = (TextView) findViewById(R.id.tv_second);
    TextView instructionsView = (TextView) findViewById(R.id.tv_third);

    switch (state) {
    case 0:/*  w  ww . ja  v  a2 s  .  com*/
        urlView.setText("Go to: " + verification_url);
        codeView.setText("and enter: " + user_code);
        break;
    case 1:
        instructionsView.setText("using your Glass account within " + expires_in + " seconds.");
        break;
    case 2:
        urlView.setVisibility(View.GONE);
        codeView.setText("DONE!");
        instructionsView.setVisibility(View.GONE);
        break;
    }
}

From source file:azad.hallaji.farzad.com.masirezendegi.PageVirayesh.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_page_virayesh);

    Fabric.with(this, new Crashlytics());

    TextView virayeshTextinToolbar = (TextView) findViewById(R.id.virayeshTextinToolbar);
    final TextView zaxireTextinToolbar = (TextView) findViewById(R.id.zaxireTextinToolbar);
    init();//from www .j  a  v  a2s.  co m
    ableall(false);

    drawer = (DrawerLayout) findViewById(R.id.drawer_layout);

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    ImageView imageView = (ImageView) findViewById(R.id.menuButton);
    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            drawer.openDrawer(Gravity.END);

        }
    });

    if (GlobalVar.getUserType().equals("adviser") || GlobalVar.getUserType().equals("user")) {

        Menu nav_Menu = navigationView.getMenu();
        nav_Menu.findItem(R.id.nav_marakez).setVisible(true);
        nav_Menu.findItem(R.id.nav_profile).setVisible(true);
        nav_Menu.findItem(R.id.nav_login).setVisible(false);
        nav_Menu.findItem(R.id.nav_moshaverin).setVisible(true);
        nav_Menu.findItem(R.id.nav_porseshha).setVisible(true);
        nav_Menu.findItem(R.id.nav_logout).setVisible(true);

    } else {

        Menu nav_Menu = navigationView.getMenu();
        nav_Menu.findItem(R.id.nav_marakez).setVisible(true);
        nav_Menu.findItem(R.id.nav_profile).setVisible(false);
        nav_Menu.findItem(R.id.nav_login).setVisible(true);
        nav_Menu.findItem(R.id.nav_moshaverin).setVisible(true);
        nav_Menu.findItem(R.id.nav_porseshha).setVisible(true);
        nav_Menu.findItem(R.id.nav_logout).setVisible(false);
    }

    final ImageView imageView1 = (ImageView) findViewById(R.id.onclickeasadinchimastanxanim);
    imageView1.setVisibility(View.GONE);

    if (isOnline()) {
        setAlage();

        if (GlobalVar.getUserType().equals("adviser")) {

            virayeshTextinToolbar.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    ableall(true);
                    sihhhhh1.setVisibility(View.VISIBLE);
                    sihhhhh2.setVisibility(View.VISIBLE);
                    imageView1.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            Intent pickPhoto = new Intent(Intent.ACTION_PICK,
                                    android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                            startActivityForResult(pickPhoto, 1);//one can be replaced with any action code
                        }
                    });
                    zaxireTextinToolbar.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            postgetData();
                        }
                    });
                }
            });

            imageView1.setVisibility(View.VISIBLE);
            barchasbEdit.setVisibility(View.VISIBLE);
            costperminEdit.setVisibility(View.VISIBLE);
            maxtimeEdit.setVisibility(View.VISIBLE);
            sexEdit.setVisibility(View.VISIBLE);
            dialtecEdit.setVisibility(View.VISIBLE);
            aboutmeEdit.setVisibility(View.VISIBLE);

        } else if (GlobalVar.getUserType().equals("user")) {

            virayeshTextinToolbar.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    TextView textView = (TextView) findViewById(R.id.sihhhhh1);
                    TextView textView2 = (TextView) findViewById(R.id.sihhhhh2);
                    textView.setVisibility(View.GONE);
                    textView2.setVisibility(View.GONE);
                    imageView1.setVisibility(View.VISIBLE);
                    boolean b = false;
                    sihhhhh1.setVisibility(View.GONE);
                    sihhhhh2.setVisibility(View.GONE);
                    namexanivadeEdit.setEnabled(!b);
                    shomareteleEdit.setEnabled(!b);
                    emailEdit.setEnabled(!b);
                    barchasbEdit.setVisibility(View.GONE);
                    costperminEdit.setVisibility(View.GONE);
                    maxtimeEdit.setVisibility(View.GONE);
                    sexEdit.setVisibility(View.GONE);
                    dialtecEdit.setVisibility(View.GONE);
                    aboutmeEdit.setVisibility(View.GONE);

                    imageView1.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            Intent pickPhoto = new Intent(Intent.ACTION_PICK,
                                    android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                            startActivityForResult(pickPhoto, 1);//one can be replaced with any action code
                        }
                    });
                    zaxireTextinToolbar.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            postgetData();
                        }
                    });
                }
            });
        }
    } else {
        Toast.makeText(getApplicationContext(), "Network isn't available", Toast.LENGTH_LONG).show();
    }
}

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

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

    // Set rating bar visibility
    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//from  www.  j  av  a 2  s  .c  o m
        public void onClick(View v) {
            HttpParams params = new BasicHttpParams(); // Basic params
            HttpClient client = new DefaultHttpClient(params);
            HttpPost post = new HttpPost("http://scify.iit.demokritos.gr/NewSumWeb/rate.php");
            ArrayList<NameValuePair> alParams = new ArrayList<NameValuePair>();

            NameValuePair nvSummary = new NameValuePair() {

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

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

            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(SearchViewActivity.this, R.string.thankyou_rate, Toast.LENGTH_SHORT).show();
                rb.setVisibility(View.GONE);
                rateLbl.setVisibility(View.GONE);
                btnSubmit.setVisibility(View.GONE);
            } else
                Toast.makeText(SearchViewActivity.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:com.bringcommunications.etherpay.SendActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overlay_frame_layout = new FrameLayout(getApplicationContext());
    setContentView(overlay_frame_layout);
    ///*from ww  w  . ja va 2s.co  m*/
    context = this;
    hex = new Hex();
    preferences = getSharedPreferences("etherpay.bringcommunications.com", MODE_PRIVATE);
    private_key = preferences.getString("key", private_key);
    acct_addr = preferences.getString("acct_addr", acct_addr);
    long wei_balance = preferences.getLong("balance", 0);
    eth_balance = (float) wei_balance / Util.WEI_PER_ETH;
    price = preferences.getFloat("price", price);
    show_gas = preferences.getBoolean("show_gas", show_gas);
    show_data = preferences.getBoolean("show_data", show_data);
    boolean denomination_eth = preferences.getBoolean("denomination_eth", true);
    System.out.println("denomination_eth is " + denomination_eth);
    denomination = denomination_eth ? Denomination.ETH : Denomination.FINNEY;
    auto_pay = getIntent().getStringExtra("AUTO_PAY");
    to_addr = getIntent().getStringExtra("TO_ADDR");
    String size_str = getIntent().getStringExtra("SIZE");
    eth_size = Float.valueOf(size_str);
    data = getIntent().getStringExtra("DATA");
    send_is_done = false;
    //
    View activity_send_view = getLayoutInflater().inflate(R.layout.activity_send, overlay_frame_layout, false);
    setContentView(activity_send_view);
    //
    Spinner dropdown = (Spinner) findViewById(R.id.denomination);
    String[] items = new String[] { "ETH", "Finney" };
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item,
            items);
    dropdown.setSelection((denomination == Denomination.ETH) ? 0 : 1);
    dropdown.setOnItemSelectedListener(this);
    dropdown.setAdapter(adapter);
    //
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    String app_name = getResources().getString(R.string.app_name);
    toolbar.setTitle(app_name);
    toolbar.setSubtitle("Send Payment");
    toolbar.setBackgroundResource(R.color.color_toolbar);
    setSupportActionBar(toolbar);
    //
    TextView to_addr_view = (TextView) findViewById(R.id.to_addr);
    to_addr_view.setText(to_addr);
    //
    TextView size_view = (TextView) findViewById(R.id.size);
    size_str = (denomination == Denomination.ETH) ? String.format("%1.03f", eth_size)
            : String.format("%03d", (int) (eth_size * 1000 + 0.5));
    size_view.setText(size_str);
    //
    LinearLayout gas_layout = (LinearLayout) findViewById(R.id.gas_layout);
    TextView gas_prompt_view = (TextView) findViewById(R.id.gas_prompt);
    TextView gas_view = (TextView) findViewById(R.id.gas);
    ImageButton gas_help_view = (ImageButton) findViewById(R.id.gas_help);
    if (show_gas) {
        String gas_str = String.format("%7d", gas_limit);
        gas_view.setText(gas_str);
        gas_layout.setVisibility(View.VISIBLE);
        gas_prompt_view.setVisibility(View.VISIBLE);
        gas_help_view.setVisibility(View.VISIBLE);
        gas_view.setVisibility(View.VISIBLE);
    } else {
        gas_layout.setVisibility(View.GONE);
        gas_prompt_view.setVisibility(View.GONE);
        gas_help_view.setVisibility(View.GONE);
        gas_view.setVisibility(View.GONE);
    }

    LinearLayout data_layout = (LinearLayout) findViewById(R.id.data_layout);
    TextView data_prompt_view = (TextView) findViewById(R.id.data_prompt);
    TextView data_view = (TextView) findViewById(R.id.data);
    ImageButton data_help_view = (ImageButton) findViewById(R.id.data_help);
    if (show_data) {
        data_view.setText(data);
        data_layout.setVisibility(View.VISIBLE);
        data_prompt_view.setVisibility(View.VISIBLE);
        data_help_view.setVisibility(View.VISIBLE);
        data_view.setVisibility(View.VISIBLE);
    } else {
        data = "";
        data_layout.setVisibility(View.GONE);
        data_prompt_view.setVisibility(View.GONE);
        data_help_view.setVisibility(View.GONE);
        data_view.setVisibility(View.GONE);
    }

    //
    //sanity check
    if (to_addr.length() != 42) {
        this.finish();
    }
}

From source file:com.github.pockethub.android.ui.MainActivity.java

private void setUpHeaderView() {
    ImageView userImage;//from  www .j  av a2  s .c  o m
    TextView userRealName;
    TextView userName;
    View headerView = navigationView.getHeaderView(0);
    userImage = (ImageView) headerView.findViewById(R.id.user_picture);
    userRealName = (TextView) headerView.findViewById(R.id.user_real_name);
    userName = (TextView) headerView.findViewById(R.id.user_name);

    avatars.bind(userImage, org);
    userName.setText(org.login());

    String name = org.name();
    if (name != null) {
        userRealName.setText(org.name());
    } else {
        userRealName.setVisibility(View.GONE);
    }
}

From source file:be.matteotaroli.pomodoro.IntroFragment.java

@Nullable
@Override//from ww  w  .j av  a  2 s .  c o m
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = getActivity().getLayoutInflater().inflate(R.layout.fragment_intro_page, container, false);

    mPager = ((IntroActivity) getActivity()).getPager();
    TextView titleTv = (TextView) view.findViewById(R.id.intro_title_textView);
    TextView textTv = (TextView) view.findViewById(R.id.intro_text_textView);
    ImageView pictureIV = (ImageView) view.findViewById(R.id.intro_picture_imageView);
    TextView skipTv = (TextView) view.findViewById(R.id.intro_skip);
    TextView nextTv = (TextView) view.findViewById(R.id.intro_next);

    View.OnClickListener skipIntro = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(getActivity(), TimerActivity.class);
            startActivity(intent);
            getActivity().finish();
        }
    };
    View.OnClickListener next = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mPager.setCurrentItem(mPage + 1);
        }
    };

    if (mPage == IntroAdapter.PAGE_COUNT - 1) {
        /* Last page */
        skipTv.setVisibility(View.INVISIBLE);
        nextTv.setText(R.string.lets_start);
        nextTv.setOnClickListener(skipIntro);

        titleTv.setText(R.string.intro_end_title);
        textTv.setText(R.string.intro_end_text);
        pictureIV.setImageResource(R.drawable.pomodoro);
        pictureIV.setContentDescription(getResources().getString(R.string.logo_description));
    } else {
        /* Any other page */
        skipTv.setOnClickListener(skipIntro);
        nextTv.setText(R.string.intro_next);
        nextTv.setOnClickListener(next);

        titleTv.setText(pages[mPage][0]);
        textTv.setText(pages[mPage][1]);

        /*  TODO  - v 0.1.0 - add pictures and uncomment those lines
            pictureIV.setImageResource(pages[mPage][2]);
            pictureIV.setContentDescription(getResources().getString(pages[mPage][3]));
        */
    }

    view.setTag(mPage);
    return view;
}

From source file:com.android.browser.GearsBaseDialog.java

/**
 * Utility method that get the dialogMessage
 * and icon and ask the setupDialog(message,icon)
 * method to set the values.//from   ww  w  .  j a  v a  2 s.c om
 */
public void setupDialog() {
    TextView dialogMessage = null;
    ImageView icon = null;

    View view = findViewById(R.id.dialog_message);
    if (view != null) {
        dialogMessage = (TextView) view;
    }

    View iconView = findViewById(R.id.icon);
    if (iconView != null) {
        icon = (ImageView) iconView;
    }

    if ((dialogMessage != null) && (icon != null)) {
        setupDialog(dialogMessage, icon);
        dialogMessage.setVisibility(View.VISIBLE);
    }
}

From source file:com.example.wmgps.MainActivity.java

/** Called when the user clicks the Send button */
public void sendMessage(View view) {
    /*Intent intent = new Intent(this, DisplayMessageActivity.class);
    EditText editText = (EditText) findViewById(R.id.edit_message);
    String message = editText.getText().toString();
    intent.putExtra(EXTRA_MESSAGE, message);
    startActivity(intent);*///from   w w w.j  a  va  2 s  . com

    /*EditText editText = (EditText) findViewById(R.id.edit_message);
    String message = editText.getText().toString();
            
    TextView output = (TextView) findViewById(R.id.welcome);
    output.setText(message);*/

    /*Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(URL));
    startActivity(browserIntent);
            
    */
    TextView hiddenText = (TextView) findViewById(R.id.Hidden11);
    if (Misc.isNullTrimmedString(hiddenText.getText().toString())) {
        TextView output = (TextView) findViewById(R.id.welcome1);
        boolean without_connection = true;
        Map<String, ArrayList<String>> typeAndValueOfTag = new LinkedHashMap<String, ArrayList<String>>(); // Insertion order must be followed

        String response = Misc.EMPTY_STRING;
        String welcome1String = "*******************Connected*************************";
        try {

            response = new RetrieveFeedTask().execute(new String[] {}).get();

        } catch (Exception e) {
            response = Misc.EMPTY_STRING;
            Log.e("Exception ", e.getMessage());

            Log.e("Exception ", e.getLocalizedMessage());

            Log.e("Exception ", e.getStackTrace().toString());

        }

        if (Misc.isNullTrimmedString(response)) {
            // welcome1String = "***Loading Static, couldn't connect***";

            response = "{\"window\":{\"elements\":[{\"type\":\"hidden\",\"name\":\"sourceAction\"},{\"type\":\"label\",\"value\":\"Warehouse Management\"},"
                    + "{\"type\":\"break\"},{\"type\":\"label\",\"value\":\"--------- ----------\"},{\"type\":\"break\"}, {\"type\":\"label\",\"value\":\" User ID: \"},"
                    + "{\"type\":\"entry\",\"name\":\"j_username\",\"value\":\"\",\"maxLength\":15,\"dispLength\":10,"
                    + "\"setHidden\":[{\"hiddenName\":\"sourceAction\",\"hiddenValue\":\"username\"}],\"focus\":true},"
                    + "{\"type\":\"break\"},{\"type\":\"label\",\"value\":\"Password: \"},"
                    + "{\"type\":\"entry\",\"name\":\"j_password\",\"value\":\"\",\"hideInput\":true,\"maxLength\":14,\"dispLength\":10,\"focus\":false},"
                    + "{\"type\":\"keybinding\",\"value\":\"CTRL-X\",\"URL\":\"\",\"keyDescription\":\"CTRL-X Exit\"},"
                    + "{\"type\":\"keybinding\",\"value\":\"CTRL-L\",\"URL\":\"/scopeRF/RFLogin/RFLegal.jsp\",\"keyDescription\":\"CTRL-L License Agreement\"}]"
                    + ",\"submit\":\"/scopeRF/RFLogin/ProcessLogin.jsp\"}}";
        }

        StringBuffer finalEncodedString = new StringBuffer(Misc.EMPTY_STRING);

        int currentOutputTag = R.id.Hidden1;
        int currentInputTag = R.id.edit_message;

        // Renderer::decodeConfig()
        if (!Misc.isNullTrimmedString(response)) {
            try {
                JSONObject jsonObj = new JSONObject(response);

                for (Iterator iterator = jsonObj.keys(); iterator.hasNext();) {
                    String name = (String) iterator.next();

                    JSONObject jsonObj1 = jsonObj.getJSONObject(name);

                    for (Iterator iterator1 = jsonObj1.keys(); iterator1.hasNext();) {
                        String name1 = (String) iterator1.next();

                        if ("elements".equals(name1)) {
                            JSONArray jsonArr = jsonObj1.getJSONArray(name1);
                            boolean userName = false;
                            boolean password = false;
                            for (int i = 0; i < jsonArr.length(); i++) {
                                JSONObject temp = jsonArr.getJSONObject(i);
                                String initialValue = null;
                                String initialName = null;
                                String initialLabel = null;

                                if (!temp.isNull("name") && temp.getString("name").equals("j_password")) {
                                    initialName = "j_password";
                                } else if (!temp.isNull("name")
                                        && temp.getString("name").equals("j_username")) {
                                    initialName = "j_username";
                                }

                                for (Iterator iterator2 = temp.keys(); iterator2.hasNext();) {
                                    String tempName = (String) iterator2.next();
                                    String tempValue = (String) temp.getString(tempName);

                                    if (tempName.equals("type")) {
                                        if (tempValue.equals("label") || tempValue.equals("entry")) {
                                            initialLabel = tempValue;
                                        }
                                    } else if (tempName.equals("value")) {
                                        initialValue = tempValue;
                                    }

                                    /* if(tempName.equals("label"))
                                     {
                                        if(Misc.isNullTrimmedString(initialValue))
                                     initialLabel = tempName;
                                        else
                                        {
                                     typeAndValueOfTag.put("output",initialValue);
                                     initialValue = Misc.EMPTY_STRING;
                                     continue;
                                        }
                                     }
                                     else if(tempName.equals("value"))
                                     {
                                        if(Misc.isNullTrimmedString(initialName) && Misc.isNullTrimmedString(initialLabel))
                                        {
                                     initialValue = tempValue;
                                        }
                                        else if(!Misc.isNullTrimmedString(initialLabel) && initialLabel.equals("label"))
                                        {
                                     typeAndValueOfTag.put("output",tempValue);
                                     initialValue = Misc.EMPTY_STRING;
                                     continue;
                                        }
                                        else if(!Misc.isNullTrimmedString(initialLabel) && initialLabel.equals("entry"))
                                        {
                                     if(!Misc.isNullTrimmedString(initialName) && initialName.equals("name"))
                                        typeAndValueOfTag.put("input",tempValue);
                                     else
                                        initialValue = tempValue;
                                        }
                                     }
                                     else if(tempName.equals("entry"))
                                     {
                                        if(Misc.isNullTrimmedString(initialValue) || Misc.isNullTrimmedString(initialLabel))
                                        {
                                     initialName = tempName;
                                        }
                                        else
                                     typeAndValueOfTag.put("input",initialValue);
                                                
                                        finalEncodedString.append("  " + tempName + "  " + tempValue + " ----- ");
                                     }*/
                                }

                                if (initialLabel != null) {
                                    if (initialLabel.equals("label")) {
                                        if (initialValue.equals(" User ID: ")) {
                                            TextView output1 = (TextView) findViewById(R.id.userNameText);
                                            output1.setText(initialValue);
                                            output1.setVisibility(View.VISIBLE);
                                            userName = true;
                                            password = false;
                                        } else if (initialValue.equals("Password: ")) {
                                            TextView output1 = (TextView) findViewById(R.id.passwordText);
                                            output1.setText(initialValue);
                                            output1.setVisibility(View.VISIBLE);
                                            password = true;
                                            userName = false;
                                        } else {
                                            TextView output1 = (TextView) findViewById(currentOutputTag++);
                                            output1.setText(initialValue);
                                            output1.setVisibility(View.VISIBLE);
                                            userName = false;
                                            password = false;
                                        }
                                    } else if (initialLabel.equals("entry")) {
                                        if ("j_password".equals(initialName)) {
                                            EditText input = ((EditText) findViewById(R.id.passwordEdit));
                                            input.setVisibility(View.VISIBLE);
                                            if (Misc.isNullTrimmedString(initialValue)) {
                                                input.setText("");
                                                input.setHint("Please enter password");
                                            }
                                        } else if ("j_username".equals(initialName)) {
                                            EditText input = ((EditText) findViewById(R.id.userNameEdit));
                                            input.setVisibility(View.VISIBLE);
                                            if (Misc.isNullTrimmedString(initialValue)) {
                                                input.setText("");
                                                input.setHint("Please enter username");
                                            }
                                        } else {
                                            EditText input = ((EditText) findViewById(currentInputTag++));
                                            input.setVisibility(View.VISIBLE);
                                            if (Misc.isNullTrimmedString(initialValue)) {
                                                input.setText("");
                                                input.setHint("Please enter value");
                                            } else
                                                input.setText(initialValue);
                                        }
                                    }
                                }
                                /*if(initialLabel != null)
                                {
                                   List<String> listOfValues;
                                   if(typeAndValueOfTag.containsKey(initialLabel))
                                   {
                                  listOfValues = typeAndValueOfTag.get(initialLabel);
                                  listOfValues.add(initialValue);
                                   }
                                   typeAndValueOfTag.put(initialLabel,initialValue);
                                }*/
                            }
                        } else {
                            // Here, just the URL would get processed. So don't use.
                            // output.setText("  " + name + "  " + jsonObj1.getString(name1));
                        }
                    }
                }

                TextView welcome1 = (TextView) findViewById(R.id.welcome1);
                welcome1.setText(welcome1String);

                // processUIDisplay(typeAndValueOfTag);

                /*if(finalEncodedString.length() == 0)
                   finalEncodedString.append("Could not process");
                        
                output.setText(finalEncodedString.toString());
                        
                TextView output2 = (TextView) findViewById(R.id.Hidden1);
                output2.setText("Hidden one is enabled");
                output2.setVisibility(View.VISIBLE);*/

            } catch (JSONException e) {
                Log.e("Exception ", e.getMessage());

                Log.e("Exception ", e.getLocalizedMessage());

                Log.e("Exception ", e.getStackTrace().toString());
            }
        }

        hiddenText.setText("validated user");

        /* {"window":{"elements":[{"type":"hidden","name":"sourceAction"},{"type":"label","value":"Warehouse Management"},
                  {"type":"break"},{"type":"label","value":"--------- ----------"},{"type":"break"}, {"type":"label","value":" User ID: "},
                  {"type":"entry","name":"j_username","value":"","maxLength":15,"dispLength":10,
                  "setHidden":[{"hiddenName":"sourceAction","hiddenValue":"username"}],"focus":true},
                  {"type":"break"},{"type":"label","value":"Password: "},
                  {"type":"entry","name":"j_password","value":"","hideInput":true,"maxLength":14,"dispLength":10,"focus":false},
                  {"type":"keybinding","value":"CTRL-X","URL":"","keyDescription":"CTRL-X Exit"},
                  {"type":"keybinding","value":"CTRL-L","URL":"/scopeRF/RFLogin/RFLegal.jsp","keyDescription":"CTRL-L License Agreement"}]
           ,"submit":"/scopeRF/RFLogin/ProcessLogin.jsp"}}*/
    } else {
        List outputList = verifyUser();

        if (!Misc.isNullList(outputList)) {
            String sessionId = (String) outputList.get(0);
            String userType = (String) outputList.get(1);

            Intent intent = new Intent(this, MenuActivity.class);
            if (!Misc.isNullTrimmedString(sessionId) && !Misc.isNullTrimmedString(userType)
                    && Integer.parseInt(sessionId) > 0) {
                if (userType.equals(Constants.WORKER)) {
                    MenuActivity.sessionId = Misc.EMPTY_STRING;
                    TextView error = (TextView) findViewById(R.id.ErrorText);
                    error.setText(Misc.EMPTY_STRING);
                    error.setVisibility(View.GONE);
                    intent.putExtra(Constants.USER_TYPE, Constants.WORKER);
                    intent.putExtra(Constants.SESSION_ID, sessionId);
                } else {
                    TextView error = (TextView) findViewById(R.id.ErrorText);
                    error.setText(Misc.EMPTY_STRING);
                    error.setVisibility(View.GONE);
                    intent.putExtra(Constants.USER_TYPE, Constants.SUPERVISOR);
                    intent.putExtra(Constants.SESSION_ID, sessionId);
                }
            }
            // goto Maps screen
            // Get the message from the intent
            startActivity(intent);
        } else {

            TextView error = (TextView) findViewById(R.id.ErrorText);
            error.setText("Invalid Username/Password");
            error.setVisibility(View.VISIBLE);
        }
    }
    return;

}

From source file:fr.gotorennes.AbstractMapActivity.java

protected void populateItineraireDetails(Itineraire itineraire) {
    LinearLayout details = (LinearLayout) findViewById(R.id.details);
    for (final Etape etape : itineraire.etapes) {
        addEtapeOverlay(etape);//  w w  w. j a v  a2  s .c o m

        RelativeLayout view = (RelativeLayout) getLayoutInflater().inflate(R.layout.itineraire_listitem, null);

        ImageView lineIcon = (ImageView) view.findViewById(R.id.icon);
        if (etape.bitmapIcon != null) {
            lineIcon.setImageBitmap(etape.bitmapIcon);
        } else {
            lineIcon.setImageResource(etape.type.icon);
        }

        TextView name = (TextView) view.findViewById(R.id.name);
        name.setText(Html.fromHtml(Arret.getTime(etape.depart) + " : " + etape.adresseDepart + "<br />"
                + Arret.getTime(etape.arrivee) + " : " + etape.adresseArrivee));

        TextView duree = (TextView) view.findViewById(R.id.duree);
        duree.setText(etape.getDuree() + "min");

        TextView distance = (TextView) view.findViewById(R.id.distance);
        distance.setText(getFormattedDistance(etape.locationDepart, etape.locationArrivee));
        distance.setVisibility(
                etape.type == TypeEtape.PIETON || etape.type == TypeEtape.VELO ? View.VISIBLE : View.GONE);

        view.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Location depart = etape.locationDepart;
                centerMap(depart.latitude, depart.longitude);
            }
        });
        details.addView(view);
    }
    Location first = itineraire.etapes.get(0).locationDepart;
    centerMap(first.latitude, first.longitude);
}

From source file:com.arantius.tivocommander.Person.java

private void requestFinished() {
    if (--mOutstandingRequests > 0) {
        return;//from w  w w .  j  av a 2s  . c o m
    }
    setProgressBarIndeterminateVisibility(false);

    if (mPerson == null || mCredits == null) {
        setContentView(R.layout.no_results);
        return;
    }

    setContentView(R.layout.list_person);

    // Credits.
    JsonNode[] credits = new JsonNode[mCredits.size()];
    int i = 0;
    for (JsonNode credit : mCredits) {
        credits[i++] = credit;
    }

    ListView lv = getListView();
    CreditsAdapter adapter = new CreditsAdapter(Person.this, R.layout.item_person_credits, credits);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(mOnItemClickListener);

    // Name.
    ((TextView) findViewById(R.id.person_name)).setText(mName);

    // Role.
    JsonNode rolesNode = mPerson.path("roleForPersonId");
    String[] roles = new String[rolesNode.size()];
    for (i = 0; i < rolesNode.size(); i++) {
        roles[i] = rolesNode.path(i).asText();
        roles[i] = Utils.ucFirst(roles[i]);
    }
    ((TextView) findViewById(R.id.person_role)).setText(Utils.join(", ", roles));

    // Birth date.
    TextView birthdateView = ((TextView) findViewById(R.id.person_birthdate));
    if (mPerson.has("birthDate")) {
        Date birthdate = Utils.parseDateStr(mPerson.path("birthDate").asText());
        SimpleDateFormat dateFormatter = new SimpleDateFormat("MMMMM d, yyyy", Locale.US);
        dateFormatter.setTimeZone(TimeZone.getDefault());
        Spannable birthdateStr = new SpannableString("Birthdate: " + dateFormatter.format(birthdate));
        birthdateStr.setSpan(new ForegroundColorSpan(Color.WHITE), 11, birthdateStr.length(), 0);
        birthdateView.setText(birthdateStr);
    } else {
        birthdateView.setVisibility(View.GONE);
    }

    // Birth place.
    TextView birthplaceView = ((TextView) findViewById(R.id.person_birthplace));
    if (mPerson.has("birthPlace")) {
        Spannable birthplaceStr = new SpannableString("Birthplace: " + mPerson.path("birthPlace").asText());
        birthplaceStr.setSpan(new ForegroundColorSpan(Color.WHITE), 12, birthplaceStr.length(), 0);
        birthplaceView.setText(birthplaceStr);
    } else {
        birthplaceView.setVisibility(View.GONE);
    }

    ImageView iv = (ImageView) findViewById(R.id.person_image);
    View pv = findViewById(R.id.person_image_progress);
    String imgUrl = Utils.findImageUrl(mPerson);
    new DownloadImageTask(this, iv, pv).execute(imgUrl);
}