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.cloudkick.NodeViewActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    NodeViewState previousState = (NodeViewState) getLastNonConfigurationInstance();
    if (previousState != null) {
        node = previousState.node;//from  ww w . j  a va  2 s.  co m
        checks = previousState.checks;
    } else {
        Bundle data = this.getIntent().getExtras();
        checks = new ArrayList<CKListItem>();
        checks.add(new CKListLoadingSpinner());
        node = (Node) data.getSerializable("node");
    }

    String inflater = Context.LAYOUT_INFLATER_SERVICE;
    LayoutInflater li = (LayoutInflater) getSystemService(inflater);

    nodeView = new RelativeLayout(this);
    li.inflate(R.layout.node_view, nodeView, true);
    setContentView(nodeView);
    adapter = new CheckAdapter(this, checks);
    ((ListView) findViewById(R.id.node_detail_list)).setAdapter(adapter);
    ((ListView) findViewById(R.id.node_detail_list)).setOnItemClickListener(checkClickListener);
    redrawHeader();

    // If the name of the node changes we can't exactly refresh it anyway
    setTitle("Node: " + node.name);
    ((ImageView) findViewById(R.id.node_detail_separator)).bringToFront();
    reloadAPI();
}

From source file:com.getchute.android.photopickerplus.ui.adapter.AssetAccountAdapter.java

public AssetAccountAdapter(FragmentActivity context, AccountBaseModel baseModel,
        AdapterItemClickListener adapterItemClicklistener, DisplayType displayType,
        ListenerItemCount itemCountListener) {
    this.context = context;
    this.adapterItemClickListener = adapterItemClicklistener;
    this.itemCountListener = itemCountListener;
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    tick = new HashMap<Integer, AccountMediaModel>();
    rows = new ArrayList<AccountMedia>();

    if (baseModel.getFiles() != null) {
        for (AccountMediaModel file : baseModel.getFiles()) {
            rows.add(file);/* ww w  .ja v  a2 s. c  om*/
        }
    }
    if (baseModel.getFolders() != null) {
        for (AccountAlbumModel folder : baseModel.getFolders()) {
            rows.add(folder);
        }
    }
    if (context.getResources().getBoolean(R.bool.has_two_panes)) {
        ((ServicesActivity) context).setAssetsSelectListener(this);
    } else {
        ((AssetActivity) context).setAssetsSelectListener(this);
    }
    this.displayType = displayType;
}

From source file:com.battlelancer.seriesguide.ui.dialogs.TraktRateDialogFragment.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder;/*  w  ww  . j  a  va2s .  c o m*/

    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View layout = inflater.inflate(R.layout.dialog_trakt_rate, null);

    layout.findViewById(R.id.totallyninja).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            onRate(Rating.TotallyNinja);
        }
    });
    layout.findViewById(R.id.weaksauce).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            onRate(Rating.WeakSauce);
        }
    });

    // advanced rating steps
    layout.findViewById(R.id.rating2).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            onRate(Rating.Terrible);
        }
    });
    layout.findViewById(R.id.rating3).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            onRate(Rating.Bad);
        }
    });
    layout.findViewById(R.id.rating4).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            onRate(Rating.Poor);
        }
    });
    layout.findViewById(R.id.rating5).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            onRate(Rating.Meh);
        }
    });
    layout.findViewById(R.id.rating6).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            onRate(Rating.Fair);
        }
    });
    layout.findViewById(R.id.rating7).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            onRate(Rating.Good);
        }
    });
    layout.findViewById(R.id.rating8).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            onRate(Rating.Great);
        }
    });
    layout.findViewById(R.id.rating9).setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            onRate(Rating.Superb);
        }
    });

    builder = new AlertDialog.Builder(getActivity());
    builder.setView(layout);

    return builder.create();
}

From source file:com.mifos.mifosxdroid.fragments.GroupFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {

    if (item.getItemId() == R.id.action_sync) {
        LayoutInflater inflater = (LayoutInflater) getActivity()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View syncProgress = inflater.inflate(R.layout.sync_progress, null);
        MenuItemCompat.setActionView(item, syncProgress);
        if (centerId != -1) {
            RepaymentTransactionSyncService syncService = new RepaymentTransactionSyncService(this, centerId);
            syncService.syncRepayments(getActivity());
        }//from  w w  w. ja v a 2s .c  o m
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.HumanDecisionSupportSystemsLaboratory.DD_P2P.JustificationsAll.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.justification_against, container, false);

    // Create Expandable List and set it's properties
    ExpandableListView expandableList = (ExpandableListView) v
            .findViewById(R.id.justification_against_expandablelist);
    expandableList.setDividerHeight(2);//from  ww  w .  j a  v  a  2  s . co  m
    expandableList.setGroupIndicator(null);
    expandableList.setClickable(true);

    // Set the Items of Parent
    setGroupParents();
    // Set The Child Data
    setChildData();

    // Create the Adapter
    MyExpandableAdapter adapter = new MyExpandableAdapter(parentItems, childItems);

    adapter.setInflater((LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE),
            getActivity());

    // Set the Adapter to expandableList
    expandableList.setAdapter(adapter);
    /*      expandableList.setOnChildClickListener(new OnChildClickListener() {
                     
             @Override
             public boolean onChildClick(ExpandableListView parent, View v,
       int groupPosition, int childPosition, long id) {
    return false;
             }
          });*/
    return v;
}

From source file:com.breadwallet.tools.adapter.TransactionListAdapter.java

public TransactionListAdapter(Activity a, TransactionListItem[] d) {
    activity = a;/*w  ww.  jav  a  2 s  .com*/
    data = new ArrayList<>();
    if (d != null)
        Collections.addAll(data, d);
    inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    unconfirmedColor = ContextCompat.getColor(a, R.color.white);
    sentColor = Color.parseColor("#FF5454");
    receivedColor = Color.parseColor("#00BF00");
    buyBitcoinEnabled = APIClient.getInstance(a)
            .isFeatureEnabled(APIClient.FeatureFlags.BUY_BITCOIN.toString());
    buyBitcoinEnabled = BRConstants.PLATFORM_ON; //todo delete
}

From source file:com.android.messaging.ui.contact.ContactRecipientAdapter.java

public ContactRecipientAdapter(final Context context, final int preferredMaxResultCount, final int queryMode,
        final ContactListItemView.HostInterface clivHost) {
    super(context, preferredMaxResultCount, queryMode);
    setPhotoManager(new ContactRecipientPhotoManager(context, clivHost));
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

From source file:com.messagesight.mqtthelper.PayloadAdapter.java

@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView,
        ViewGroup parent) {/*from   w ww.  java2 s  . c o m*/
    final String childText = (String) getChild(groupPosition, childPosition);
    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.list_item, null);
    }
    TextView txtListChild = (TextView) convertView.findViewById(R.id.lblListItem);

    txtListChild.setText(childText);
    return convertView;
}

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

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Context ctx = getActivity();//from   ww w.j a  v  a  2  s  . co  m
    if (ctx == null)
        return null;
    LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View v = inflater.inflate(R.layout.dialog_add_channel, null);
    spinner = v.findViewById(R.id.networkSpinner);
    channels = v.findViewById(R.id.channels);
    channels.setText("");
    channels.append("#");
    Button b = v.findViewById(R.id.addBtn);
    b.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!getActivity().getResources().getBoolean(R.bool.isTablet)) {
                Intent i = new Intent(getActivity(), EditConnectionActivity.class);
                startActivity(i);
            } else {
                EditConnectionFragment newFragment = new EditConnectionFragment();
                newFragment.show(getActivity().getSupportFragmentManager(), "editconnection");
            }
        }
    });

    return new AlertDialog.Builder(ctx).setTitle("Join A Channel").setView(v)
            .setPositiveButton("Join", new DoneClickListener())
            .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            }).create();
}

From source file:com.mobeta.dslv.ResourceDragSortCursorAdapter.java

/**
 * Constructor with default behavior as per
 * {@link CursorAdapter#CursorAdapter(Context, Cursor, boolean)}; it is recommended
 * you not use this, but instead {@link #ResourceCursorAdapter(Context, int, Cursor, int)}.
 * When using this constructor, {@link #FLAG_REGISTER_CONTENT_OBSERVER}
 * will always be set.//from ww  w . j av  a2  s .co  m
 *
 * @param context The context where the ListView associated with this adapter is running
 * @param layout resource identifier of a layout file that defines the views
 *            for this list item.  Unless you override them later, this will
 *            define both the item views and the drop down views.
 * @param c The cursor from which to get the data.
 * @param autoRequery If true the adapter will call requery() on the
 *                    cursor whenever it changes so the most recent
 *                    data is always displayed.  Using true here is discouraged.
 */
public ResourceDragSortCursorAdapter(Context context, int layout, Cursor c, boolean autoRequery) {

    super(context, c, autoRequery);
    mLayout = mDropDownLayout = layout;
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}