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:com.getchute.android.photopickerplus.ui.adapter.BaseCursorAdapter.java

@SuppressLint("NewApi")
public BaseCursorAdapter(Context context, Cursor c) {
    super(context, c, 0);
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    dataIndex = getDataIndex(c);/*from  w  w  w .  j  a v a 2 s .c  o m*/

}

From source file:com.example.android.DisplayHighscoreActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display_highscore);

    db = new DatabaseHelper(this);

    // Make sure we're running on Honeycomb or higher to use ActionBar APIs
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // getActionBar().setDisplayHomeAsUpEnabled(true);
    }/*from   w ww  .  j av  a  2 s.  co m*/

    listView = (ListView) findViewById(R.id.list_highscore);
    list = db.getAllUsers();

    // Create ArrayAdapter using the user list.
    HighScoreArrayAdapter adapter = new HighScoreArrayAdapter(this, R.layout.show_user_highscore, list);
    adapter.inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    listView.setAdapter(adapter);
}

From source file:com.fabernovel.alertevoirie.utils.JSONAdapter.java

public JSONAdapter(Context context, JSONArray data, int cellLayout, String[] from, int[] to,
        String jsonObjectName) {/*from   w  w w.j  a v a  2s  .  c  om*/
    this.data = data;
    this.cellLayout = cellLayout;
    this.from = from;
    this.to = to;
    this.jsonObjectName = jsonObjectName;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

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

/**
 * Builds parameter dialog with values pulled through from MainActivity.
 *
 * @param savedInstanceState/*from ww  w  .  ja  va  2s .co m*/
 * @return create parameter dialog box
 */
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

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

    Bundle blendParameters = getArguments();
    if (blendParameters != null) {
        mAltitude = blendParameters.getInt("altitude");
        mAzimuth = blendParameters.getInt("azimuth");
        mSlopeType = (SlopeType) blendParameters.getSerializable("slope_type");
        mColorRampType = (ColorRamp.PresetType) blendParameters.getSerializable("color_ramp_type");
    }

    final AlertDialog.Builder paramDialog = new AlertDialog.Builder(getContext());
    @SuppressLint("InflateParams")
    View dialogView = inflater.inflate(R.layout.dialog_box, null);
    paramDialog.setView(dialogView);
    paramDialog.setTitle(R.string.dialog_title);
    paramDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dismiss();
        }
    });
    paramDialog.setPositiveButton("Render", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            ParametersListener activity = (ParametersListener) getActivity();
            activity.returnParameters(mAltitude, mAzimuth, mSlopeType, mColorRampType);
        }
    });

    mCurrAltitudeTextView = (TextView) dialogView.findViewById(R.id.curr_altitude_text);
    SeekBar altitudeSeekBar = (SeekBar) dialogView.findViewById(R.id.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 = (TextView) dialogView.findViewById(R.id.curr_azimuth_text);
    SeekBar azimuthSeekBar = (SeekBar) dialogView.findViewById(R.id.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> slopeTypeSpinnerAdapter = new ArrayAdapter<>(getContext(), R.layout.spinner_text_view,
            slopeTypeArray);

    Spinner slopeTypeSpinner = (Spinner) dialogView.findViewById(R.id.slope_type_spinner);
    slopeTypeSpinner.setAdapter(slopeTypeSpinnerAdapter);
    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) {
        }
    });

    List<String> colorRampTypeArray = new ArrayList<>();
    colorRampTypeArray.add("None"); //ordinals:0
    colorRampTypeArray.add("Elevation"); //1
    colorRampTypeArray.add("DEM screen"); //2
    colorRampTypeArray.add("DEM light"); //3

    ArrayAdapter<String> colorRampSpinnerAdapter = new ArrayAdapter<>(getContext(), R.layout.spinner_text_view,
            colorRampTypeArray);

    Spinner colorRampSpinner = (Spinner) dialogView.findViewById(R.id.color_ramp_spinner);
    colorRampSpinner.setAdapter(colorRampSpinnerAdapter);
    colorRampSpinner.setSelection(mColorRampType.ordinal());
    colorRampSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            switch (position) {
            case 0:
                mColorRampType = ColorRamp.PresetType.NONE;
                break;
            case 1:
                mColorRampType = ColorRamp.PresetType.ELEVATION;
                break;
            case 2:
                mColorRampType = ColorRamp.PresetType.DEM_SCREEN;
                break;
            case 3:
                mColorRampType = ColorRamp.PresetType.DEM_LIGHT;
                break;
            }
        }

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

    return paramDialog.create();
}

From source file:com.jetheis.android.makeitrain.fragment.ReportDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Activity activity = getActivity();
    final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);

    AlertDialog.Builder reportBuilder;/*w  w  w .  j a  v  a 2 s.co m*/

    LayoutInflater reportInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View reportLayout = reportInflater.inflate(R.layout.report_dialog_fragment, null);

    int spent = preferences.getInt(activity.getString(R.string.pref_total_spent), 0);

    NumberFormat nf = NumberFormat.getCurrencyInstance();
    String spentDisplay = nf.format(spent);

    TextView reportText = (TextView) reportLayout.findViewById(R.id.report_dialog_fragment_text_view);
    reportText.setText(activity.getString(R.string.total_spent, spentDisplay));

    reportBuilder = new AlertDialog.Builder(activity);
    reportBuilder.setView(reportLayout);
    reportBuilder.setTitle(R.string.your_spending_report);
    reportBuilder.setPositiveButton(R.string.im_so_cool, null);
    reportBuilder.setNegativeButton(R.string.reset, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int item) {
            dialog.dismiss();
            Editor editor = preferences.edit();
            editor.putInt(activity.getString(R.string.pref_total_spent), 0);
            editor.commit();
        }

    });

    return reportBuilder.create();
}

From source file:com.QuarkLabs.BTCeClient.adapters.OrdersAdapter.java

public OrdersAdapter(Context context, ListType listType) {
    mContext = context;/*from   w  ww .  j a  v  a  2 s .  c  o m*/
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mListType = listType;
    mDateFormat.setTimeZone(TimeZone.getDefault());
}

From source file:at.alladin.rmbt.android.map.overlay.RMBTBalloonOverlayView.java

public View setupView(final Context context, final ViewGroup parent) {
    this.context = context;

    // inflate our custom layout into parent
    final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View v = inflater.inflate(R.layout.balloon_overlay, parent);
    // setup our fields
    //        title = (TextView) v.findViewById(R.id.balloon_item_title);

    resultListView = (LinearLayout) v.findViewById(R.id.resultList);
    resultListView.setVisibility(View.GONE);

    emptyView = (TextView) v.findViewById(R.id.infoText);
    emptyView.setVisibility(View.GONE);

    progessBar = (ProgressBar) v.findViewById(R.id.progressBar);

    return v;/*from ww w.  j a va2s. c o m*/

}

From source file:com.markupartist.android.widget.ActionBar.java

public ActionBar(Context context, AttributeSet attrs) {
    super(context, attrs);

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

    mBarView = (RelativeLayout) mInflater.inflate(R.layout.actionbar, null);
    addView(mBarView);/*from w  ww.j  a v  a2  s . c  om*/

    mLogoView = (ImageView) mBarView.findViewById(R.id.actionbar_home_logo);
    mHomeLayout = (RelativeLayout) mBarView.findViewById(R.id.actionbar_home_bg);
    mHomeBtn = (ImageButton) mBarView.findViewById(R.id.actionbar_home_btn);
    mBackIndicator = mBarView.findViewById(R.id.actionbar_home_is_back);

    mTitleView = (TextView) mBarView.findViewById(R.id.actionbar_title);
    mActionsView = (LinearLayout) mBarView.findViewById(R.id.actionbar_actions);

    mProgress = (ProgressBar) mBarView.findViewById(R.id.actionbar_progress);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionBar);
    CharSequence title = a.getString(R.styleable.ActionBar_title);
    if (title != null) {
        setTitle(title);
    }
    a.recycle();
}

From source file:edu.berkeley.boinc.adapter.NoticesListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    final Notice listItem = entries.get(position);

    LayoutInflater vi = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View v = vi.inflate(R.layout.notices_layout_listitem, null);

    ImageView ivIcon = (ImageView) v.findViewById(R.id.projectIcon);
    Bitmap icon = getIcon(position);// w  w  w . ja va 2 s. com
    // if available set icon, if not boinc logo
    if (icon == null) {
        ivIcon.setImageDrawable(getContext().getResources().getDrawable(R.drawable.boinc));
    } else {
        ivIcon.setImageBitmap(icon);
    }

    TextView tvProjectName = (TextView) v.findViewById(R.id.projectName);
    tvProjectName.setText(listItem.project_name);

    TextView tvNoticeTitle = (TextView) v.findViewById(R.id.noticeTitle);
    tvNoticeTitle.setText(listItem.title);

    TextView tvNoticeContent = (TextView) v.findViewById(R.id.noticeContent);
    tvNoticeContent.setText(Html.fromHtml(listItem.description));

    TextView tvNoticeTime = (TextView) v.findViewById(R.id.noticeTime);
    tvNoticeTime.setText(DateUtils.formatDate(new java.util.Date((long) listItem.create_time * 1000)));

    v.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (Logging.DEBUG)
                Log.d(Logging.TAG, "noticeClick: " + listItem.link);

            if (listItem.link != null && !listItem.link.isEmpty()) {
                Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(listItem.link));
                activity.startActivity(i);
            }

        }
    });

    return v;
}

From source file:com.jbirdvegas.mgerrit.cards.PatchSetCommentsCard.java

public PatchSetCommentsCard(Context context, RequestQueue requestQueue) {
    mRequestQuery = requestQueue;/*  ww  w  .j  a  v a2  s  .co m*/
    mContext = context;
    mActivity = (FragmentActivity) context;
    mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}