Example usage for android.widget TextView setFocusable

List of usage examples for android.widget TextView setFocusable

Introduction

In this page you can find the example usage for android.widget TextView setFocusable.

Prototype

public void setFocusable(boolean focusable) 

Source Link

Document

Set whether this view can receive the focus.

Usage

From source file:au.org.ala.fielddata.mobile.SurveyBuilder.java

public void buildSurveyName(Survey survey, ViewGroup parent) {

    ViewGroup row = (ViewGroup) viewContext.getLayoutInflater().inflate(R.layout.survey_layout, parent);
    TextView name = (TextView) row.findViewById(R.id.surveyName);
    name.setText(survey.name);/*  ww  w  .  ja  v  a 2 s. com*/
    name.setFocusableInTouchMode(true);
    name.setFocusable(true);
    TextView description = (TextView) row.findViewById(R.id.surveyDescription);
    description.setText(survey.description);

}

From source file:com.vuze.android.remote.activity.LoginActivity.java

@SuppressWarnings("deprecation")
@Override/*from ww  w .  j a  v a  2  s. c o  m*/
protected void onCreate(Bundle savedInstanceState) {
    // These are an attempt to make the gradient look better on some
    // android devices.  It doesn't on the ones I tested, but it can't hurt to
    // have it here, right?
    getWindow().setFormat(PixelFormat.RGBA_8888);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window w = getWindow(); // in Activity's onCreate() for instance
        w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            w.setNavigationBarColor(ContextCompat.getColor(this, R.color.login_grad_color_2));
        }
    }

    AndroidUtilsUI.onCreate(this);
    super.onCreate(savedInstanceState);

    if (AndroidUtils.DEBUG) {
        Log.d(TAG, "LoginActivity intent = " + getIntent() + "/" + getIntent().getDataString());
    }

    appPreferences = VuzeRemoteApp.getAppPreferences();

    setContentView(R.layout.activity_login);

    textAccessCode = (EditText) findViewById(R.id.editTextAccessCode);
    assert textAccessCode != null;

    RemoteProfile lastUsedRemote = appPreferences.getLastUsedRemote();
    if (lastUsedRemote != null && lastUsedRemote.getRemoteType() == RemoteProfile.TYPE_LOOKUP
            && lastUsedRemote.getAC() != null) {
        textAccessCode.setText(lastUsedRemote.getAC());
        textAccessCode.selectAll();
    }
    textAccessCode.setOnEditorActionListener(new OnEditorActionListener() {
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            loginButtonClicked(v);
            return true;
        }
    });

    TextView tvLoginCopyright = (TextView) findViewById(R.id.login_copyright);
    if (tvLoginCopyright != null) {
        AndroidUtilsUI.linkify(tvLoginCopyright);
    }

    TextView tvLoginGuide = (TextView) findViewById(R.id.login_guide);
    setupGuideText(tvLoginGuide);
    tvLoginGuide.setFocusable(false);
    TextView tvLoginGuide2 = (TextView) findViewById(R.id.login_guide2);
    setupGuideText(tvLoginGuide2);

    View coreArea = findViewById(R.id.login_core_area);
    if (coreArea != null) {
        coreArea.setVisibility(VuzeRemoteApp.isCoreAllowed() ? View.VISIBLE : View.GONE);
    }

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setIcon(R.drawable.ic_launcher);
    }
}

From source file:net.lp.actionbarpoirot.helpers.ActivityHelperHoneycomb.java

/** {@inheritDoc} */
@Override//  w  w  w .j a v a  2s  .  c om
public void enableActionBarTitleMarquee() {
    // Make title scrolling, a bit of a hack
    final TextView titleView = (TextView) mActivity.findViewById(actionBarTitleResId);
    if (titleView != null) {
        titleView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
        titleView.setMarqueeRepeatLimit(-1);
        titleView.setFocusable(true);
        titleView.setFocusableInTouchMode(true);
        titleView.requestFocus();// TODO: action bar title doesn't keep
        // scrolling after you've touched
        // something else. Should fix that.
    }

    // Also focus LeftNavBar, a bit of a hack too
    final View view = (mActivity.findViewById(leftNavActionBarResId));
    if (view != null) {
        view.setFocusable(true);
        view.setFocusableInTouchMode(true);
        view.requestFocus();
    }
}

From source file:ch.pantas.billsplitter.ui.FixedTabsView.java

private void addTab(final int position, String title) {
    TextView tab = new TextView(getContext());
    tab.setText(title);// w w  w .j  a  va 2  s.com
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, 1f));

    tab.setFocusable(true);
    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            viewPager.setCurrentItem(position);
        }
    });
    tabsContainer.addView(tab, position);
}

From source file:cn.wander.Utils.views.pageindicator.TabPageIndicator.java

private void addTab(int index, CharSequence text, int iconResId) {
    RelativeLayout tablayout = (RelativeLayout) View.inflate(getContext(), R.layout.tab_item_layout, null);

    final TextView tabView = (TextView) tablayout.findViewById(R.id.tab_item_title);
    tabView.setTag(index);/*  w w  w. j a va2 s.c  om*/
    tabView.setFocusable(true);
    tabView.setOnClickListener(mTabClickListener);
    tabView.setTextSize(TypedValue.COMPLEX_UNIT_PX, 19);
    tabView.setText(text);
    tabView.setTextColor(getResources().getColor(R.color.kw_common_cl_white));
    if (iconResId != 0) {
        //             tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);
        ImageView iconView = (ImageView) tablayout.findViewById(R.id.tab_item_icon);
        iconView.setImageResource(iconResId);
        iconView.setVisibility(View.VISIBLE);
    }

    mTabLayout.addView(tablayout, new LinearLayout.LayoutParams(0, MATCH_PARENT, 1));
}

From source file:de.fahrgemeinschaft.util.ReoccuringWeekDaysView.java

private TextView makeRecurringDayButton(Context ctx) {
    TextView day = new UnScrollingTextView(ctx);
    if (clickable)
        day.setOnClickListener(toggleSelectedState);
    LayoutParams lp = new LayoutParams(0, LayoutParams.MATCH_PARENT);
    lp.weight = 1;/*from  w w w .j a  v a  2s .  c om*/
    day.setLayoutParams(lp);
    day.setTextAppearance(getContext(), R.style.dark_Bold);
    day.setBackgroundResource(R.drawable.btn_night);
    day.setGravity(Gravity.CENTER);
    day.setFocusable(true);
    return day;
}

From source file:com.bringcommunications.etherpay.SendActivity.java

public void onResume() {
    super.onResume(); // Always call the superclass method first
    if (auto_pay.equals("true")) {
        Button pay_button = (Button) findViewById(R.id.pay_button);
        pay_button.setEnabled(false);//from w  w w .j av a 2 s .  c  o  m
        TextView size_view = (TextView) findViewById(R.id.size);
        size_view.setKeyListener(null);
        size_view.setCursorVisible(false);
        size_view.setFocusable(false);
        EditText data_view = (EditText) findViewById(R.id.data);
        data_view.setKeyListener(null);
        data_view.setCursorVisible(false);
        data_view.setFocusable(false);
        do_pay(null);
    }
}

From source file:com.kaszubski.kamil.emmhelper.MainActivity.java

private void longTextTitleMode(boolean enabled) {
    try {//from  www  .  ja  v  a2 s. c om
        Field titleField = Toolbar.class.getDeclaredField("mTitleTextView");
        titleField.setAccessible(enabled);
        TextView barTitleView = (TextView) titleField.get(toolbar);
        barTitleView.setEllipsize(enabled ? TextUtils.TruncateAt.START : TextUtils.TruncateAt.START);
        barTitleView.setFocusable(enabled);
        barTitleView.setFocusableInTouchMode(enabled);
        barTitleView.requestFocus();
        barTitleView.setSingleLine(enabled);
        barTitleView.setSelected(enabled);

    } catch (NoSuchFieldException e) {
        Log.e(TAG, "" + e);
    } catch (IllegalAccessException e) {
        Log.e(TAG, " " + e);
    }
}

From source file:com.example.samsungmdm.MainActivity.java

public void onServerResponse(String response) {
    TextView serverResponseTextView = new TextView(this);
    serverResponseTextView.setHorizontallyScrolling(true);
    serverResponseTextView.setSingleLine();
    serverResponseTextView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
    serverResponseTextView.setFocusableInTouchMode(true);
    serverResponseTextView.setMarqueeRepeatLimit(1);
    serverResponseTextView.setFocusable(true);
    String myTime = java.text.DateFormat.getTimeInstance().format(Calendar.getInstance().getTime());
    serverResponseTextView.setText(myTime + " - " + response);

    mServerResponseLinearLayout.addView(serverResponseTextView, 0);

    //Parsing server response
    try {//from  w w w  . j  ava 2  s.  co  m
        parseServerResponse(new JSONObject(response));
    } catch (JSONException e) {
        Log.e(TAG, "Invalid JSON response from the server");
        e.printStackTrace();
    }
}

From source file:com.example.testing.myapplication.module.pageSliding.PagerSlidingTabStrip.java

private void addTextTab(final int position, final String title) {
    TextView tab = new TextView(getContext());
    tab.setText(title);/*from   w w  w . ja va 2 s  .co  m*/
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();

    tab.setFocusable(true);
    //tab.setOnClickListener(new OnClickListener() {
    //    @Override public void onClick(View v) {
    //        pager.setCurrentItem(position);
    //        v.setSelected(true);
    //    }
    //});

    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
            v.setSelected(true);
        }
    });

    tab.setPadding(tabPadding, 0, tabPadding, 0);
    tab.setBackgroundResource(tabBackgroundResId);
    tab.setTextColor(mTabTextColor);
    tab.setTextSize(tabTextSize);
    //tab.setTypeface(tabTypeface, tabTypefaceStyle);

    tab.setSelected(position == 0);

    // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
    // pre-ICS-build
    if (textAllCaps) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            tab.setAllCaps(true);
        } else {
            tab.setText(tab.getText().toString().toUpperCase(locale));
        }
    }

    tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams);
}