Example usage for android.view LayoutInflater from

List of usage examples for android.view LayoutInflater from

Introduction

In this page you can find the example usage for android.view LayoutInflater from.

Prototype

public static LayoutInflater from(Context context) 

Source Link

Document

Obtains the LayoutInflater from the given context.

Usage

From source file:arun.com.chromer.settings.browsingmode.BrowsingModeAdapter.java

@Override
public BrowsingModeViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    return new BrowsingModeViewHolder(
            LayoutInflater.from(context).inflate(R.layout.activity_browsing_mode_item_template, parent, false));
}

From source file:com.quinsoft.zeidon.android.ZeidonTableLayout.java

@Override
public void setFromOi() {
    // Remove any current items in the table.
    removeAllViews();/*  w ww. ja  v  a  2  s.co  m*/

    Context context = getContext();

    // Header layout supplied?
    if (hasHeaders) {
        int layoutId = context.getResources().getIdentifier(headerLayoutName, "layout",
                context.getPackageName());
        LayoutInflater inflater = LayoutInflater.from(context);
        View tableRow = inflater.inflate(layoutId, null);
        this.addView(tableRow,
                new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    }

    int layoutId = context.getResources().getIdentifier(rowLayoutName, "layout", context.getPackageName());
    LayoutInflater inflater = LayoutInflater.from(context);

    com.quinsoft.zeidon.View view = viewDelegate.findMappingView();
    for (@SuppressWarnings("unused")
    EntityInstance ei : view.cursor(getEntityName()).eachEntity()) {
        View tableRow = inflater.inflate(layoutId, null);
        this.addView(tableRow,
                new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
        viewDelegate.setChildrenFromOi((TableRow) tableRow);
    }
}

From source file:com.github.fi3te.iliasdownloader.model.adapter.SimpleFileRecyclerAdapter.java

public SimpleFileRecyclerAdapter(Context context, List<File> allFiles, View.OnClickListener onClickListener) {
    this.context = context;
    this.allFiles = allFiles;
    this.onClickListener = onClickListener;
    inflater = LayoutInflater.from(context);
}

From source file:com.orange.ocara.ui.activity.EditCommentActivity.java

@Override
void setUpToolbar() {
    super.setUpToolbar();

    final View responseButtonBar = LayoutInflater.from(this)
            .inflate(com.orange.ocara.R.layout.audit_object_toolbar, null);
    responseButtonBar.findViewById(com.orange.ocara.R.id.response_ok_button).setVisibility(View.GONE);

    responseButtonBar.findViewById(com.orange.ocara.R.id.response_nok_button).setVisibility(View.GONE);

    Toolbar.LayoutParams lp = new Toolbar.LayoutParams(Gravity.LEFT);
    responseButtonBar.setLayoutParams(lp);

    toolbar.addView(responseButtonBar);//  w w w  .j a v a2s  . co m
}

From source file:net.olejon.mdapp.PoisoningsCardsAdapter.java

@Override
public PoisoningsViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.activity_poisonings_card,
            viewGroup, false);//from  w w  w  .  j  av a 2s .  c  o m
    return new PoisoningsViewHolder(view);
}

From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.SignBrowserAdapter.java

@Override
public SignBrowserAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    return new ViewHolder(
            LayoutInflater.from(parent.getContext()).inflate(R.layout.browser_row_layout, parent, false));
}

From source file:com.vk.sdk.VKCaptchaDialog.java

/**
 * Prepare, create and show dialog for displaying captcha
 *//*ww w .  j  av  a2 s  . c  om*/
public void show() {
    Context context = VKUIHelper.getTopActivity();
    View innerView = LayoutInflater.from(context).inflate(R.layout.dialog_vkcaptcha, null);
    assert innerView != null;
    mCaptchaAnswer = (EditText) innerView.findViewById(R.id.captchaAnswer);
    mCaptchaImage = (ImageView) innerView.findViewById(R.id.imageView);
    mProgressBar = (ProgressBar) innerView.findViewById(R.id.progressBar);

    mDensity = context.getResources().getDisplayMetrics().density;
    final AlertDialog dialog = new AlertDialog.Builder(context).setView(innerView).create();
    mCaptchaAnswer.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
            }
        }
    });
    mCaptchaAnswer.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
            if (actionId == EditorInfo.IME_ACTION_SEND) {
                sendAnswer();
                return true;
            }
            return false;
        }
    });

    dialog.setButton(AlertDialog.BUTTON_NEGATIVE, context.getString(android.R.string.ok),
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    sendAnswer();
                }
            });
    dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialogInterface) {
            mCaptchaError.request.cancel();
        }
    });
    loadImage();
    dialog.show();
}

From source file:me.kartikarora.transfersh.adapters.FileGridAdapter.java

public FileGridAdapter(AppCompatActivity activity, Cursor cursor, Tracker tracker) {
    super(activity.getApplicationContext(), cursor, false);
    this.context = activity.getApplicationContext();
    this.inflater = LayoutInflater.from(context);
    this.activity = activity;
    this.tracker = tracker;
}

From source file:br.com.anteros.android.persistence.backup.DatabaseMaintenanceFragment.java

@Nullable
@Override/*from  w  ww.  j  av a2 s . c om*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.databasemaintenance, null);

    lvTables = (ListView) view.findViewById(R.id.listview_database);
    try {
        connection = (SQLiteConnection) getSQLSession().getConnection();
    } catch (Exception e) {
    }
    cursor = connection.getDatabase()
            .rawQuery("SELECT name as _id FROM sqlite_master WHERE type='table' ORDER BY name;", null);

    adapter = new CursorAdapter(getActivity(), cursor) {

        @Override
        public View newView(Context context, Cursor cursor, ViewGroup parent) {
            LayoutInflater inflater = LayoutInflater.from(context);
            View view = inflater.inflate(android.R.layout.simple_list_item_1, parent, false);
            bindView(view, context, cursor);
            return view;
        }

        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            TextView lbTabela = (TextView) view.findViewById(android.R.id.text1);
            try {
                lbTabela.setText(getObjectValue(cursor, 0) + "");
            } catch (SQLException e) {
                e.printStackTrace();
                lbTabela.setText("");
            }
        }

    };

    lvTables.setAdapter(adapter);
    lvTables.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

        public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long id) {
            String table = "";

            try {
                table = getObjectValue((Cursor) adapter.getItem(position), 0) + "";
            } catch (SQLException e) {
                e.printStackTrace();
            }

            RecordsOfTableActivity.setData(table, getSQLSession());

            startActivity(new Intent(getActivity(), RecordsOfTableActivity.class));

            return false;
        }
    });

    return view;
}

From source file:com.embeddedlapps.primeraversion.ListAdapterHolder.java

@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    final LayoutInflater mInflater = LayoutInflater.from(parent.getContext());
    final View sView = mInflater.inflate(R.layout.single_list_item, parent, false);
    return new ViewHolder(sView);
}