Example usage for android.widget LinearLayout findViewById

List of usage examples for android.widget LinearLayout findViewById

Introduction

In this page you can find the example usage for android.widget LinearLayout findViewById.

Prototype

@Nullable
public final <T extends View> T findViewById(@IdRes int id) 

Source Link

Document

Finds the first descendant view with the given ID, the view itself if the ID matches #getId() , or null if the ID is invalid (< 0) or there is no matching view in the hierarchy.

Usage

From source file:au.com.wallaceit.reddinator.SubredditSelectActivity.java

private void showMultiEditDialog(final String multiPath) {
    JSONObject multiObj = global.getSubredditManager().getMultiData(multiPath);

    @SuppressLint("InflateParams")
    LinearLayout dialogView = (LinearLayout) getLayoutInflater().inflate(R.layout.dialog_multi_edit, null); // passing null okay for dialog
    final Button saveButton = (Button) dialogView.findViewById(R.id.multi_save_button);
    final Button renameButton = (Button) dialogView.findViewById(R.id.multi_rename_button);
    multiName = (TextView) dialogView.findViewById(R.id.multi_pname);
    final EditText displayName = (EditText) dialogView.findViewById(R.id.multi_name);
    final EditText description = (EditText) dialogView.findViewById(R.id.multi_description);
    final EditText color = (EditText) dialogView.findViewById(R.id.multi_color);
    final Spinner icon = (Spinner) dialogView.findViewById(R.id.multi_icon);
    final Spinner visibility = (Spinner) dialogView.findViewById(R.id.multi_visibility);
    final Spinner weighting = (Spinner) dialogView.findViewById(R.id.multi_weighting);

    ArrayAdapter<CharSequence> iconAdapter = ArrayAdapter.createFromResource(SubredditSelectActivity.this,
            R.array.multi_icons, android.R.layout.simple_spinner_item);
    iconAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    icon.setAdapter(iconAdapter);// www  .j  a  v a  2 s . com
    ArrayAdapter<CharSequence> visibilityAdapter = ArrayAdapter.createFromResource(SubredditSelectActivity.this,
            R.array.multi_visibility, android.R.layout.simple_spinner_item);
    visibilityAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    visibility.setAdapter(visibilityAdapter);
    ArrayAdapter<CharSequence> weightsAdapter = ArrayAdapter.createFromResource(SubredditSelectActivity.this,
            R.array.multi_weights, android.R.layout.simple_spinner_item);
    weightsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    weighting.setAdapter(weightsAdapter);

    try {
        multiName.setText(multiObj.getString("name"));
        displayName.setText(multiObj.getString("display_name"));
        description.setText(multiObj.getString("description_md"));
        color.setText(multiObj.getString("key_color"));
        String iconName = multiObj.getString("icon_name");
        icon.setSelection(iconAdapter.getPosition(iconName.equals("") ? "none" : iconName));
        visibility.setSelection(iconAdapter.getPosition(multiObj.getString("visibility")));
        weighting.setSelection(iconAdapter.getPosition(multiObj.getString("weighting_scheme")));
    } catch (JSONException e) {
        e.printStackTrace();
    }

    ViewPager pager = (ViewPager) dialogView.findViewById(R.id.multi_pager);
    LinearLayout tabsWidget = (LinearLayout) dialogView.findViewById(R.id.multi_tab_widget);
    pager.setAdapter(new SimpleTabsAdapter(new String[] { "Subreddits", "Settings" },
            new int[] { R.id.multi_subreddits, R.id.multi_settings }, SubredditSelectActivity.this,
            dialogView));
    SimpleTabsWidget simpleTabsWidget = new SimpleTabsWidget(SubredditSelectActivity.this, tabsWidget);
    simpleTabsWidget.setViewPager(pager);
    ThemeManager.Theme theme = global.mThemeManager.getActiveTheme("appthemepref");
    int headerColor = Color.parseColor(theme.getValue("header_color"));
    int headerText = Color.parseColor(theme.getValue("header_text"));
    simpleTabsWidget.setBackgroundColor(headerColor);
    simpleTabsWidget.setTextColor(headerText);
    simpleTabsWidget.setInidicatorColor(Color.parseColor(theme.getValue("tab_indicator")));

    ListView subList = (ListView) dialogView.findViewById(R.id.multi_subredditList);
    multiSubsAdapter = new SubsListAdapter(SubredditSelectActivity.this, multiPath);
    subList.setAdapter(multiSubsAdapter);
    renameButton.getBackground().setColorFilter(headerColor, PorterDuff.Mode.MULTIPLY);
    renameButton.setTextColor(headerText);
    renameButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            showMultiRenameDialog(multiPath);
        }
    });

    saveButton.getBackground().setColorFilter(headerColor, PorterDuff.Mode.MULTIPLY);
    saveButton.setTextColor(headerText);
    saveButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            System.out.println("Save multi");
            JSONObject multiObj = new JSONObject();
            try {
                multiObj.put("decription_md", description.getText().toString());
                multiObj.put("display_name", displayName.getText().toString());
                multiObj.put("icon_name", icon.getSelectedItem().toString().equals("none") ? ""
                        : icon.getSelectedItem().toString());
                multiObj.put("key_color", color.getText().toString());
                multiObj.put("subreddits",
                        global.getSubredditManager().getMultiData(multiPath).getJSONArray("subreddits"));
                multiObj.put("visibility", visibility.getSelectedItem().toString());
                multiObj.put("weighting_scheme", weighting.getSelectedItem().toString());

                new SubscriptionEditTask(SubscriptionEditTask.ACTION_MULTI_EDIT).execute(multiPath, multiObj);

            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    });

    AlertDialog.Builder builder = new AlertDialog.Builder(SubredditSelectActivity.this);

    multiDialog = builder.setView(dialogView).show();
}

From source file:com.mantz_it.rfanalyzer.ui.activity.MainActivity.java

/**
 * Will pop up a dialog to let the user input a new frequency.
 * Note: A frequency can be entered either in Hz or in MHz. If the input value
 * is a number smaller than the maximum frequency of the source in MHz, then it
 * is interpreted as a frequency in MHz. Otherwise it will be handled as frequency
 * in Hz./*from  ww w . j  a va 2  s  . co  m*/
 */
private void tuneToFrequency() {
    if (source == null)
        return;

    // calculate max frequency of the source in MHz:
    final double maxFreqMHz = rxFrequency.getMax() / 1000000f;

    final LinearLayout ll_view = (LinearLayout) this.getLayoutInflater().inflate(R.layout.tune_to_frequency,
            null);
    final EditText et_frequency = (EditText) ll_view.findViewById(R.id.et_tune_to_frequency);
    final Spinner sp_unit = (Spinner) ll_view.findViewById(R.id.sp_tune_to_frequency_unit);
    final CheckBox cb_bandwidth = (CheckBox) ll_view.findViewById(R.id.cb_tune_to_frequency_bandwidth);
    final EditText et_bandwidth = (EditText) ll_view.findViewById(R.id.et_tune_to_frequency_bandwidth);
    final Spinner sp_bandwidthUnit = (Spinner) ll_view.findViewById(R.id.sp_tune_to_frequency_bandwidth_unit);
    final TextView tv_warning = (TextView) ll_view.findViewById(R.id.tv_tune_to_frequency_warning);

    // Show warning if we are currently recording to file:
    if (recordingFile != null)
        tv_warning.setVisibility(View.VISIBLE);

    cb_bandwidth.setOnCheckedChangeListener((buttonView, isChecked) -> {
        et_bandwidth.setEnabled(isChecked);
        sp_bandwidthUnit.setEnabled(isChecked);
    });
    cb_bandwidth.toggle(); // to trigger the onCheckedChangeListener at least once to set inital state
    cb_bandwidth
            .setChecked(preferences.getBoolean(getString(R.string.pref_tune_to_frequency_setBandwidth), false));
    et_bandwidth.setText(preferences.getString(getString(R.string.pref_tune_to_frequency_bandwidth), "1"));
    sp_unit.setSelection(preferences.getInt(getString(R.string.pref_tune_to_frequency_unit), 0));
    sp_bandwidthUnit
            .setSelection(preferences.getInt(getString(R.string.pref_tune_to_frequency_bandwidthUnit), 0));

    new AlertDialog.Builder(this).setTitle("Tune to Frequency")
            .setMessage(
                    String.format("Frequency is %f MHz. Type a new Frequency: ", rxFrequency.get() / 1000000f))
            .setView(ll_view).setPositiveButton("Set", (dialog, whichButton) -> {
                try {
                    double newFreq = rxFrequency.get() / 1000000f;
                    if (et_frequency.getText().length() != 0)
                        newFreq = Double.valueOf(et_frequency.getText().toString());
                    switch (sp_unit.getSelectedItemPosition()) {
                    case 0: // MHz
                        newFreq *= 1000000;
                        break;
                    case 1: // KHz
                        newFreq *= 1000;
                        break;
                    default: // Hz
                    }

                    if (newFreq < maxFreqMHz)
                        newFreq = newFreq * 1000000;
                    if (newFreq <= rxFrequency.getMax() && newFreq >= rxFrequency.getMin()) {
                        rxFrequency.set((long) newFreq);
                        analyzerSurface.setVirtualFrequency((long) newFreq);
                        if (demodulationMode != Demodulator.DEMODULATION_OFF)
                            analyzerSurface.setDemodulationEnabled(true); // This will re-adjust the channel freq correctly

                        // Set bandwidth (virtual sample rate):
                        if (cb_bandwidth.isChecked() && et_bandwidth.getText().length() != 0) {
                            float bandwidth = Float.parseFloat(et_bandwidth.getText().toString());
                            if (sp_bandwidthUnit.getSelectedItemPosition() == 0) //MHz
                                bandwidth *= 1000000;
                            else if (sp_bandwidthUnit.getSelectedItemPosition() == 1) //KHz
                                bandwidth *= 1000;
                            if (bandwidth > rxSampleRate.getMax())
                                bandwidth = rxFrequency.getMax();
                            rxSampleRate.set(rxSampleRate.getNextHigherOptimalSampleRate((int) bandwidth));
                            analyzerSurface.setVirtualSampleRate((int) bandwidth);
                        }
                        // safe preferences:
                        SharedPreferences.Editor edit = preferences.edit();
                        edit.putInt(getString(R.string.pref_tune_to_frequency_unit),
                                sp_unit.getSelectedItemPosition());
                        edit.putBoolean(getString(R.string.pref_tune_to_frequency_setBandwidth),
                                cb_bandwidth.isChecked());
                        edit.putString(getString(R.string.pref_tune_to_frequency_bandwidth),
                                et_bandwidth.getText().toString());
                        edit.putInt(getString(R.string.pref_tune_to_frequency_bandwidthUnit),
                                sp_bandwidthUnit.getSelectedItemPosition());
                        edit.apply();

                    } else {
                        toaster.showLong("Frequency is out of the valid range: " + (long) newFreq + " Hz");
                    }
                } catch (NumberFormatException e) {
                    // todo: notify user
                    Log.e(LOGTAG, "tuneToFrequency: Error while setting frequency: " + e.getMessage());
                }
            }).setNegativeButton("Cancel", (dialog, whichButton) -> {
                // do nothing
            }).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  ww  w  . jav  a2 s  . c  om
    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:net.ddns.mlsoftlaberge.contactslist.ui.ContactAdminFragment.java

private void filltransactionlayout() {
    // Each LinearLayout has the same LayoutParams so this can
    // be created once and used for each cumulative layouts of data
    final LinearLayout.LayoutParams tlayoutParams = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    // Clears out the details layout first in case the details
    // layout has data from a previous data load still
    // added as children.
    mTransactionLayout.removeAllViews();
    int i;/*  w  w w.j  av  a 2  s. c  o m*/
    double tot = 0.0;
    for (i = 0; i < nbtransac; ++i) {
        // Builds the transaction layout
        // Inflates the transaction layout
        LinearLayout tlayout = (LinearLayout) LayoutInflater.from(getActivity())
                .inflate(R.layout.contact_transaction_item, null, false);

        // point to the 4 fields of the layout
        TextView t = (TextView) tlayout.findViewById(R.id.contact_transaction_description);
        TextView dt = (TextView) tlayout.findViewById(R.id.contact_transaction_date);
        TextView mnt = (TextView) tlayout.findViewById(R.id.contact_transaction_amount);
        ImageButton butt = (ImageButton) tlayout.findViewById(R.id.button_edit_transaction);

        // get the current transaction
        transac = transaclist.elementAt(i);

        // fill the fields with the table data
        t.setText(transac.descrip);
        dt.setText(transac.trdate);
        mnt.setText(transac.amount);

        // cumulate the total amount
        tot += transac.mnt;

        //save the position of the line in button id
        butt.setId(i);

        // Defines an onClickListener object for the address button
        butt.setOnClickListener(new View.OnClickListener() {
            // Defines what to do when users click the address button
            @Override
            public void onClick(View view) {
                // Displays a message that no activity can handle the view button.
                Toast.makeText(getActivity(), "Edit Transaction " + view.getId(), Toast.LENGTH_SHORT).show();
                edittransaction(view.getId());
            }
        });

        // Adds the new note layout to the notes layout
        mTransactionLayout.addView(tlayout, tlayoutParams);
    }
    // stamp the total amount in bottom view after the transaction layout
    String stot = String.format("%.2f", tot);
    mTransactionTotal.setText(stot);
}

From source file:com.sim2dial.dialer.InCallActivity.java

private void displayCall(Resources resources, LinphoneCall call, int index) {
    String sipUri = call.getRemoteAddress().asStringUriOnly();
    LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);

    // Control Row
    LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.active_call_control_row, container, false);
    setContactName(callView, lAddress, sipUri, resources);
    displayCallStatusIconAndReturnCallPaused(callView, call);
    //setRowBackground(callView, index);
    tim = (Chronometer) callView.findViewById(R.id.callTimer);
    registerCallDurationTimer(tim, call);
    // registerCallDurationTimer(callView, call);
    callsList.addView(callView);//w ww .  j  a va  2 s .  c o  m

    // Image Row
    //      LinearLayout imageView = (LinearLayout) inflater.inflate(R.layout.active_call_image_row, container, false);
    //      Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, imageView.getContext().getContentResolver());
    //      displayOrHideContactPicture(imageView, pictureUri, false);
    //      callsList.addView(imageView);
    //
    //      callView.setTag(imageView);
    //      callView.setOnClickListener(new OnClickListener()
    //      {
    //         @Override
    //         public void onClick(View v)
    //         {
    //            if (v.getTag() != null)
    //            {
    //               View imageView = (View) v.getTag();
    //               if (imageView.getVisibility() == View.VISIBLE) imageView.setVisibility(View.GONE);
    //               else imageView.setVisibility(View.VISIBLE);
    //               callsList.invalidate();
    //            }
    //         }
    //      });
}

From source file:au.com.wallaceit.reddinator.SubredditSelectActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.subredditselect);

    // load personal list from saved prefereces, if null use default and save
    mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(SubredditSelectActivity.this);
    global = ((GlobalObjects) SubredditSelectActivity.this.getApplicationContext());

    // get subreddit list and set adapter
    subredditList = global.getSubredditManager().getSubredditNames();
    subsAdapter = new MySubredditsAdapter(this, subredditList);
    ListView subListView = (ListView) findViewById(R.id.sublist);
    subListView.setAdapter(subsAdapter);
    subListView.setTextFilterEnabled(true);
    subListView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String subreddit = ((TextView) view.findViewById(R.id.subreddit_name)).getText().toString();
            global.getSubredditManager().setFeedSubreddit(mAppWidgetId, subreddit);
            updateFeedAndFinish();//  w w w  . ja v  a 2 s.  co  m
            //System.out.println(sreddit+" selected");
        }
    });
    subsAdapter.sort(new Comparator<String>() {
        @Override
        public int compare(String s, String t1) {
            return s.compareToIgnoreCase(t1);
        }
    });
    // get multi list and set adapter
    mMultiAdapter = new MyMultisAdapter(this);
    ListView multiListView = (ListView) findViewById(R.id.multilist);
    multiListView.setAdapter(mMultiAdapter);
    multiListView.setTextFilterEnabled(true);
    multiListView.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position == mMultiAdapter.getCount() - 1) {
                LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.dialog_multi_add,
                        parent, false);
                final EditText name = (EditText) layout.findViewById(R.id.new_multi_name);
                AlertDialog.Builder builder = new AlertDialog.Builder(SubredditSelectActivity.this);
                builder.setTitle("Create A Multi").setView(layout)
                        .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                dialogInterface.dismiss();
                            }
                        }).setPositiveButton("OK", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                if (name.getText().toString().equals("")) {
                                    Toast.makeText(SubredditSelectActivity.this,
                                            "Please enter a name for the multi", Toast.LENGTH_LONG).show();
                                    return;
                                }
                                new SubscriptionEditTask(SubscriptionEditTask.ACTION_MULTI_CREATE)
                                        .execute(name.getText().toString());
                                dialogInterface.dismiss();
                            }
                        }).show();
            } else {
                JSONObject multiObj = mMultiAdapter.getItem(position);
                try {
                    String name = multiObj.getString("display_name");
                    String path = multiObj.getString("path");
                    global.getSubredditManager().setFeed(mAppWidgetId, name, path, true);
                    updateFeedAndFinish();
                } catch (JSONException e) {
                    e.printStackTrace();
                    Toast.makeText(SubredditSelectActivity.this, "Error setting multi.", Toast.LENGTH_LONG)
                            .show();
                }
            }
        }
    });

    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    if (extras != null) {
        mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID,
                AppWidgetManager.INVALID_APPWIDGET_ID);
        if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
            mAppWidgetId = 0; // Id of 4 zeros indicates its the app view, not a widget, that is being updated
        } else {
            String action = getIntent().getAction();
            widgetFirstTimeSetup = action != null
                    && action.equals("android.appwidget.action.APPWIDGET_CONFIGURE");
        }
    } else {
        mAppWidgetId = 0;
    }

    final ViewPager pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new SimpleTabsAdapter(new String[] { "My Subreddits", "My Multis" },
            new int[] { R.id.sublist, R.id.multilist }, SubredditSelectActivity.this, null));

    LinearLayout tabsLayout = (LinearLayout) findViewById(R.id.tab_widget);
    tabs = new SimpleTabsWidget(SubredditSelectActivity.this, tabsLayout);
    tabs.setViewPager(pager);

    addButton = (Button) findViewById(R.id.addsrbutton);
    addButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            Intent intent = new Intent(SubredditSelectActivity.this, ViewAllSubredditsActivity.class);
            startActivityForResult(intent, 1);
        }
    });
    refreshButton = (Button) findViewById(R.id.refreshloginbutton);
    refreshButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            if (global.mRedditData.isLoggedIn()) {
                if (pager.getCurrentItem() == 1) {
                    refreshMultireddits();
                } else {
                    refreshSubreddits();
                }
            } else {
                global.mRedditData.initiateLogin(SubredditSelectActivity.this);
            }
        }
    });
    // sort button
    sortBtn = (Button) findViewById(R.id.sortselect);
    String sortTxt = "Sort:  "
            + mSharedPreferences.getString("sort-" + (mAppWidgetId == 0 ? "app" : mAppWidgetId), "hot");
    sortBtn.setText(sortTxt);
    sortBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            showSortDialog();
        }
    });

    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    // set theme colors
    setThemeColors();

    GlobalObjects.doShowWelcomeDialog(SubredditSelectActivity.this);
}

From source file:net.ddns.mlsoftlaberge.trycorder.contacts.ContactAdminFragment.java

private void filltransactionlayout() {
    // Each LinearLayout has the same LayoutParams so this can
    // be created once and used for each cumulative layouts of data
    final LinearLayout.LayoutParams tlayoutParams = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    // Clears out the details layout first in case the details
    // layout has data from a previous data load still
    // added as children.
    mTransactionLayout.removeAllViews();
    int i;/*from   www  . j  a  v  a2 s. c om*/
    double tot = 0.0;
    for (i = 0; i < nbtransac; ++i) {
        // Builds the transaction layout
        // Inflates the transaction layout
        LinearLayout tlayout = (LinearLayout) LayoutInflater.from(getActivity())
                .inflate(R.layout.contact_transaction_item, null, false);

        // point to the 4 fields of the layout
        TextView t = (TextView) tlayout.findViewById(R.id.contact_transaction_description);
        TextView dt = (TextView) tlayout.findViewById(R.id.contact_transaction_date);
        TextView mnt = (TextView) tlayout.findViewById(R.id.contact_transaction_amount);
        ImageButton butt = (ImageButton) tlayout.findViewById(R.id.button_edit_transaction);

        // get the current transaction
        transac = transaclist.elementAt(i);

        // fill the fields with the table data
        t.setText(transac.descrip);
        dt.setText(transac.trdate);
        mnt.setText(transac.amount);

        // cumulate the total amount
        tot += transac.mnt;

        //save the position of the line in button id
        butt.setId(i);

        // Defines an onClickListener object for the address button
        butt.setOnClickListener(new View.OnClickListener() {
            // Defines what to do when users click the address button
            @Override
            public void onClick(View view) {
                buttonsound();
                // Displays a message that no activity can handle the view button.
                Toast.makeText(getActivity(), "Edit Transaction " + view.getId(), Toast.LENGTH_SHORT).show();
                edittransaction(view.getId());
            }
        });

        // Adds the new note layout to the notes layout
        mTransactionLayout.addView(tlayout, tlayoutParams);
    }
    // stamp the total amount in bottom view after the transaction layout
    String stot = String.format("%.2f", tot);
    mTransactionTotal.setText(stot);
}

From source file:net.ddns.mlsoftlaberge.contactslist.ui.ContactAdminFragment.java

/**
 * Builds a notes LinearLayout based on note information from the Contacts Provider.
 * Each note for the contact gets its own LinearLayout object; for example, if the contact
 * has three notes, then 3 LinearLayouts are generated.
 *
 * @param type  From//  w w  w . j a  va  2  s.c o  m
 *              {@link android.provider.ContactsContract.CommonDataKinds.Phone#TYPE}
 * @param label From
 *              {@link android.provider.ContactsContract.CommonDataKinds.Phone#LABEL}
 * @param phone From
 *              {@link android.provider.ContactsContract.CommonDataKinds.Phone#NUMBER}
 * @return A LinearLayout to add to the contact notes layout,
 * populated with the provided notes.
 */
private LinearLayout buildPhoneLayout(final int type, final String label, final String phone) {

    // Inflates the address layout
    final LinearLayout phoneLayout = (LinearLayout) LayoutInflater.from(getActivity())
            .inflate(R.layout.contact_phone_item, mPhoneLayout, false);

    // Gets handles to the view objects in the layout
    final TextView pheaderTextView = (TextView) phoneLayout.findViewById(R.id.contact_phone_header);
    final TextView phoneTextView = (TextView) phoneLayout.findViewById(R.id.contact_phone_item);
    final ImageButton editPhoneButton = (ImageButton) phoneLayout.findViewById(R.id.button_edit_phone);

    // If there's no addresses for the contact, shows the empty view and message, and hides the
    // header and button.
    if (phone == null) {
        pheaderTextView.setVisibility(View.GONE);
        editPhoneButton.setVisibility(View.GONE);
        phoneTextView.setText("");
    } else {
        // Gets postal address label type
        CharSequence plabel = android.provider.ContactsContract.CommonDataKinds.Phone
                .getTypeLabel(getResources(), type, label);

        // Sets TextView objects in the layout
        pheaderTextView.setText(plabel + " Phone");
        phoneTextView.setText(phone);
        editPhoneButton.setContentDescription(phone);

        // Defines an onClickListener object for the address button
        editPhoneButton.setOnClickListener(new View.OnClickListener() {
            // Defines what to do when users click the address button
            @Override
            public void onClick(View view) {
                // Displays a message that no activity can handle the view button.
                Toast.makeText(getActivity(), "Call Phone", Toast.LENGTH_SHORT).show();
                phonecontact(view.getContentDescription().toString());
            }
        });

    }
    return phoneLayout;
}

From source file:net.ddns.mlsoftlaberge.contactslist.ui.ContactAdminFragment.java

/**
 * Builds a notes LinearLayout based on note information from the Contacts Provider.
 * Each note for the contact gets its own LinearLayout object; for example, if the contact
 * has three notes, then 3 LinearLayouts are generated.
 *
 * @param type  From/*from   w w  w.ja v a 2  s  .c  om*/
 *              {@link android.provider.ContactsContract.CommonDataKinds.Email#TYPE}
 * @param label From
 *              {@link android.provider.ContactsContract.CommonDataKinds.Email#LABEL}
 * @param email From
 *              {@link android.provider.ContactsContract.CommonDataKinds.Email#ADDRESS}
 * @return A LinearLayout to add to the contact notes layout,
 * populated with the provided notes.
 */
private LinearLayout buildEmailLayout(final int type, final String label, final String email) {

    // Inflates the address layout
    final LinearLayout emailLayout = (LinearLayout) LayoutInflater.from(getActivity())
            .inflate(R.layout.contact_email_item, mEmailLayout, false);

    // Gets handles to the view objects in the layout
    final TextView eheaderTextView = (TextView) emailLayout.findViewById(R.id.contact_email_header);
    final TextView emailTextView = (TextView) emailLayout.findViewById(R.id.contact_email_item);
    final ImageButton editEmailButton = (ImageButton) emailLayout.findViewById(R.id.button_edit_email);

    // If there's no addresses for the contact, shows the empty view and message, and hides the
    // header and button.
    if (email == null) {
        eheaderTextView.setVisibility(View.GONE);
        editEmailButton.setVisibility(View.GONE);
        emailTextView.setText("");
    } else {
        // Gets postal address label type
        CharSequence elabel = android.provider.ContactsContract.CommonDataKinds.Email
                .getTypeLabel(getResources(), type, label);

        // Sets TextView objects in the layout
        eheaderTextView.setText(elabel + " Email");
        emailTextView.setText(email);
        editEmailButton.setContentDescription(email);

        // Defines an onClickListener object for the address button
        editEmailButton.setOnClickListener(new View.OnClickListener() {
            // Defines what to do when users click the address button
            @Override
            public void onClick(View view) {
                // Displays a message that no activity can handle the view button.
                Toast.makeText(getActivity(), "Send Email", Toast.LENGTH_SHORT).show();
                emailcontact(view.getContentDescription().toString());
            }
        });

    }
    return emailLayout;
}

From source file:net.ddns.mlsoftlaberge.trycorder.contacts.ContactAdminFragment.java

/**
 * Builds a notes LinearLayout based on note information from the Contacts Provider.
 * Each note for the contact gets its own LinearLayout object; for example, if the contact
 * has three notes, then 3 LinearLayouts are generated.
 *
 * @param type  From/* www  . j  a v a2s  .co  m*/
 *              {@link android.provider.ContactsContract.CommonDataKinds.Phone#TYPE}
 * @param label From
 *              {@link android.provider.ContactsContract.CommonDataKinds.Phone#LABEL}
 * @param phone From
 *              {@link android.provider.ContactsContract.CommonDataKinds.Phone#NUMBER}
 * @return A LinearLayout to add to the contact notes layout,
 * populated with the provided notes.
 */
private LinearLayout buildPhoneLayout(final int type, final String label, final String phone) {

    // Inflates the address layout
    final LinearLayout phoneLayout = (LinearLayout) LayoutInflater.from(getActivity())
            .inflate(R.layout.contact_phone_item, mPhoneLayout, false);

    // Gets handles to the view objects in the layout
    final TextView pheaderTextView = (TextView) phoneLayout.findViewById(R.id.contact_phone_header);
    final TextView phoneTextView = (TextView) phoneLayout.findViewById(R.id.contact_phone_item);
    final ImageButton editPhoneButton = (ImageButton) phoneLayout.findViewById(R.id.button_edit_phone);

    // If there's no addresses for the contact, shows the empty view and message, and hides the
    // header and button.
    if (phone == null) {
        pheaderTextView.setVisibility(View.GONE);
        editPhoneButton.setVisibility(View.GONE);
        phoneTextView.setText("");
    } else {
        // Gets postal address label type
        CharSequence plabel = android.provider.ContactsContract.CommonDataKinds.Phone
                .getTypeLabel(getResources(), type, label);

        // Sets TextView objects in the layout
        pheaderTextView.setText(plabel + " Phone");
        phoneTextView.setText(phone);
        editPhoneButton.setContentDescription(phone);

        // Defines an onClickListener object for the address button
        editPhoneButton.setOnClickListener(new View.OnClickListener() {
            // Defines what to do when users click the address button
            @Override
            public void onClick(View view) {
                buttonsound();
                // Displays a message that no activity can handle the view button.
                Toast.makeText(getActivity(), "Call Phone", Toast.LENGTH_SHORT).show();
                phonecontact(view.getContentDescription().toString());
            }
        });

    }
    return phoneLayout;
}