package org.ligi.androidhelper.helpers;


import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

public class ViewHelper {

    private final View view;

    public ViewHelper(View view) {
        this.view = view;
    }

    public <T extends View> T findById(int id) {
        return (T) view.findViewById(id);
    }

    public void hideKeyBoard() {
        InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm != null) {
            imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
        } else {
            Log.w("AndroidHelper", "could not hide Keyboard as INPUT_METHOD_SERVICE is not available");
        }
    }

    public void startIntentOnClick(final Intent intent) {
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                v.getContext().startActivity(intent);
            }
        });
    }


}

@@ -802,32 +802,390 @@
        %7D%0A    %7D%0A%0A
+    public void showKeyboard() %7B%0A        InputMethodManager imm = (InputMethodManager) view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);%0A        if (imm != null) %7B%0A            imm.showSoftInput(view, 0);%0A        %7D else %7B%0A            Log.w(%22AndroidHelper%22, %22could not show Keyboard as INPUT_METHOD_SERVICE is not available%22);%0A        %7D%0A    %7D%0A%0A
     public void 

add method to show the keyboard