Example usage for android.content Context LAYOUT_INFLATER_SERVICE

List of usage examples for android.content Context LAYOUT_INFLATER_SERVICE

Introduction

In this page you can find the example usage for android.content Context LAYOUT_INFLATER_SERVICE.

Prototype

String LAYOUT_INFLATER_SERVICE

To view the source code for android.content Context LAYOUT_INFLATER_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.view.LayoutInflater for inflating layout resources in this context.

Usage

From source file:io.coldstart.android.TrapDetailListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    Trap trap = listOfTraps.get(position);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    convertView = inflater.inflate(R.layout.trap_detail_list_item, null);

    String TrapDetails = "";

    /*try/*ww w. jav a 2 s  . co  m*/
    {
    JSONArray TrapJSON = new JSONArray(trap.trap);
            
    int trapsCount = TrapJSON.length();
            
    for(int i = 0; i < trapsCount; i++)
    {
        String tmpPayload = TrapJSON.getString(i);
            
        if(!tmpPayload.equals(""))
        {
            TrapDetails += tmpPayload + "\n\n";
        }
    }
    }
    catch (JSONException e)
    {
    TrapDetails = "Trap details failed to parse";
    }
            
            
    ((TextView) convertView.findViewById(R.id.TrapDetail)).setText(TrapDetails);*/
    String trapDescription = "";
    try {
        trapDescription = trap.getPayloadAsString();
    } catch (Exception e) {
        trapDescription = "Unable to decode trap";
    }

    ((TextView) convertView.findViewById(R.id.TrapDetail)).setText(trapDescription);

    ((TextView) convertView.findViewById(R.id.TrapDate))
            .setTypeface(Typeface.createFromAsset((context).getAssets(), "fonts/MavenPro-Regular.ttf"));
    ((TextView) convertView.findViewById(R.id.TrapDate)).setText(trap.date);

    if (trapOnClick != null) {
        convertView.setTag(position);
        convertView.setOnClickListener((OnClickListener) trapOnClick);
    }

    return convertView;
}

From source file:it.redturtle.mobile.apparpav.MeteogramAdapter.java

public MeteogramAdapter(Context context, LinkedList<Slot> listOfSlot) {
    this.listOfSlot = listOfSlot;
    this.context = context;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

From source file:com.flowzr.activity.AbstractEditorActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Setup ActionBar      
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    //@see: http://stackoverflow.com/questions/16539251/get-rid-of-blue-line, 
    //only way found to remove on various devices 2.3x, 3.0, ...
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#000000")));

    LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    NodeInflater nodeInflater = new NodeInflater(layoutInflater);

    x = new ActivityLayout(nodeInflater, this);
    db = new DatabaseAdapter(this);
    db.open();// w w w  .j a v  a  2  s  . com
    em = db.em();
}

From source file:com.battlelancer.seriesguide.adapters.EpisodesAdapter.java

public EpisodesAdapter(Context context, Cursor c, int flags, PopupMenuClickListener listener,
        OnFlagEpisodeListener flagListener) {
    super(context, c, flags);
    mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mPopupMenuClickListener = listener;// w w  w.ja v a2s . c om
    mOnFlagListener = flagListener;
}

From source file:com.irccloud.android.fragment.WhoisFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Context ctx = getActivity();// w ww . jav  a  2  s  .com

    if (ctx == null)
        return null;

    LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = inflater.inflate(R.layout.dialog_whois, null);
    extra = v.findViewById(R.id.extra);
    name = v.findViewById(R.id.name);
    mask = v.findViewById(R.id.mask);
    server = v.findViewById(R.id.server);
    timeTitle = v.findViewById(R.id.timeTitle);
    time = v.findViewById(R.id.time);
    awayTitle = v.findViewById(R.id.awayTitle);
    away = v.findViewById(R.id.away);
    operTitle = v.findViewById(R.id.operTitle);
    operChannels = v.findViewById(R.id.operChannels);
    operChannels.setMovementMethod(IRCCloudLinkMovementMethod.getInstance());
    operChannels.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getDialog().dismiss();
        }
    });
    ownerTitle = v.findViewById(R.id.ownerTitle);
    ownerChannels = v.findViewById(R.id.ownerChannels);
    ownerChannels.setMovementMethod(IRCCloudLinkMovementMethod.getInstance());
    ownerChannels.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getDialog().dismiss();
        }
    });
    adminTitle = v.findViewById(R.id.adminTitle);
    adminChannels = v.findViewById(R.id.adminChannels);
    adminChannels.setMovementMethod(IRCCloudLinkMovementMethod.getInstance());
    adminChannels.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getDialog().dismiss();
        }
    });
    opTitle = v.findViewById(R.id.opTitle);
    opChannels = v.findViewById(R.id.opChannels);
    opChannels.setMovementMethod(IRCCloudLinkMovementMethod.getInstance());
    opChannels.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getDialog().dismiss();
        }
    });
    halfopTitle = v.findViewById(R.id.halfopTitle);
    halfopChannels = v.findViewById(R.id.halfopChannels);
    halfopChannels.setMovementMethod(IRCCloudLinkMovementMethod.getInstance());
    halfopChannels.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getDialog().dismiss();
        }
    });
    voicedTitle = v.findViewById(R.id.voicedTitle);
    voicedChannels = v.findViewById(R.id.voicedChannels);
    voicedChannels.setMovementMethod(IRCCloudLinkMovementMethod.getInstance());
    voicedChannels.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getDialog().dismiss();
        }
    });
    channelsTitle = v.findViewById(R.id.channelsTitle);
    channels = v.findViewById(R.id.channels);
    channels.setMovementMethod(IRCCloudLinkMovementMethod.getInstance());
    channels.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getDialog().dismiss();
        }
    });
    if (savedInstanceState != null && savedInstanceState.containsKey("event")) {
        event = new IRCCloudJSONObject(savedInstanceState.getString("event"));
    }
    Dialog d = new AlertDialog.Builder(ctx).setTitle("WHOIS response for " + event.getString("user_nick"))
            .setView(v).setNegativeButton("Close", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
    return d;
}

From source file:com.chalmers.feedlr.adapter.UserAdapter.java

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    super.newView(context, cursor, parent);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View tempView = inflater.inflate(R.layout.user_list_item, null);

    // Find views
    ViewHolder viewHolder = new ViewHolder();
    viewHolder.source = (ImageView) tempView.findViewById(R.id.user_item_source_image);

    tempView.setTag(viewHolder);/*from  w  ww  .  j  a  va2s  .c o  m*/
    return tempView;
}

From source file:de.devmil.common.ui.color.HistorySelectorView.java

private void makeColorList() {
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout colorlist = (LinearLayout) findViewById(R.id.colorlist);

    if (colors == null || colors.length() <= 0) {
        View nocolors = findViewById(R.id.nocolors);
        nocolors.setVisibility(View.VISIBLE);
        colorlist.setVisibility(View.GONE);
        findViewById(R.id.colorlistscroll).setVisibility(View.GONE); //have to remove it's parent container too
        return;/*from  w  w w.j a  v a2s . c o  m*/
    }
    try {
        for (int i = colors.length() - 1; i >= 0; i--) {
            final int color = colors.getInt(i);
            ViewGroup boxgroup = (ViewGroup) inflater.inflate(R.layout.color_historyview_item, colorlist,
                    false);
            TextView box = (TextView) boxgroup.findViewById(R.id.colorbox);
            box.setBackgroundColor(color);
            //box.setText("#"+Integer.toHexString(color));
            colorlist.addView(boxgroup);
            box.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    setColor(color);
                    onColorChanged();
                }
            });
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.esri.arcgisruntime.sample.hillshaderenderer.ParametersDialogFragment.java

/**
 * Builds a parameter dialog box with values pulled through from MainActivity.
 * @param savedInstanceState bundle holding previous activity's saved state
 * @return create parameter dialog box//from  w ww.  j  a va 2 s . c  o  m
 */
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    Bundle hillshadeParameters = getArguments();
    if (hillshadeParameters != null) {
        mAltitude = hillshadeParameters.getInt("altitude");
        mAzimuth = hillshadeParameters.getInt("azimuth");
        mSlopeType = (SlopeType) hillshadeParameters.getSerializable("slope_type");
    }

    AlertDialog.Builder paramDialog = new AlertDialog.Builder(getContext());
    @SuppressLint("InflateParams")
    View dialogView = inflater.inflate(R.layout.hillshade_dialog_box, null);
    paramDialog.setView(dialogView);
    paramDialog.setTitle(R.string.dialog_title);
    paramDialog.setNegativeButton("Cancel", (dialog, which) -> dismiss());
    paramDialog.setPositiveButton("Render", (dialog, which) -> {
        ParametersListener activity = (ParametersListener) getActivity();
        activity.returnParameters(mAltitude, mAzimuth, mSlopeType);
    });

    mCurrAltitudeTextView = dialogView.findViewById(R.id.hillshade_curr_altitude_text);
    SeekBar altitudeSeekBar = dialogView.findViewById(R.id.hillshade_altitude_seek_bar);
    altitudeSeekBar.setMax(90); //altitude is restricted to 0 - 90
    //set initial altitude value
    updateAltitudeSeekBar(altitudeSeekBar);
    altitudeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mAltitude = progress;
            updateAltitudeSeekBar(seekBar);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });

    mCurrAzimuthTextView = dialogView.findViewById(R.id.hillshade_curr_azimuth_text);
    SeekBar azimuthSeekBar = dialogView.findViewById(R.id.hillshade_azimuth_seek_bar);
    azimuthSeekBar.setMax(360); //azimuth measured in degrees 0 - 360
    //set initial azimuth value
    updateAzimuthSeekBar(azimuthSeekBar);
    azimuthSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mAzimuth = progress;
            updateAzimuthSeekBar(seekBar);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });

    List<String> slopeTypeArray = new ArrayList<>();
    slopeTypeArray.add("None"); //ordinals:0
    slopeTypeArray.add("Degree"); //1
    slopeTypeArray.add("Percent rise"); //2
    slopeTypeArray.add("Scaled"); //3

    ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(getContext(), R.layout.hillshade_spinner_text_view,
            slopeTypeArray);

    Spinner slopeTypeSpinner = dialogView.findViewById(R.id.hillshade_slope_type_spinner);
    slopeTypeSpinner.setAdapter(spinnerAdapter);
    slopeTypeSpinner.setSelection(mSlopeType.ordinal());
    slopeTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            switch (position) {
            case 0:
                mSlopeType = SlopeType.NONE;
                break;
            case 1:
                mSlopeType = SlopeType.DEGREE;
                break;
            case 2:
                mSlopeType = SlopeType.PERCENT_RISE;
                break;
            case 3:
                mSlopeType = SlopeType.SCALED;
                break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });

    return paramDialog.create();
}

From source file:com.jana.android.ui.impl.viewmodel.ImagePagerAdapter.java

public ImagePagerAdapter(Context context, final ImageLoader imageLoader, List<T> imagesList) {

    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    mImageList = imagesList;//from   w  w  w . j a v a2s .co  m

    mImageLoader = imageLoader;

    mOptions = new DisplayImageOptions.Builder().showImageForEmptyUri(R.mipmap.ic_launcher)
            .showImageOnFail(R.mipmap.ic_launcher).resetViewBeforeLoading(true).cacheOnDisc(true)
            .cacheInMemory(true).imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565)
            .considerExifParams(true).displayer(new FadeInBitmapDisplayer(300)).build();

    if (mIndicatorIconId > 0) {

        mIcons = new int[mImageList.size()];

        for (int i = 0; i < mIcons.length; i++) {

            mIcons[i] = mIndicatorIconId;
        }
    }

}

From source file:com.flowzr.activity.AbstractTotalsDetailsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    LayoutInflater layoutInflater = (LayoutInflater) getActivity()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    NodeInflater nodeInflater = new NodeInflater(layoutInflater);

    x = new ActivityLayout(nodeInflater, this);
    db = new DatabaseAdapter(this.getActivity());
    db.open();/*from   www .j a v a  2 s  . c  om*/
    em = db.em();

    u = new Utils(this.getActivity());
    layout = (LinearLayout) getView().findViewById(R.id.list);
    calculatingNode = x.addTitleNodeNoDivider(layout, R.string.calculating);

    internalOnCreate();
    calculateTotals();
}