List of usage examples for android.widget LinearLayout findViewById
@Nullable public final <T extends View> T findViewById(@IdRes int id)
From source file:com.ridhofkr.hanacaraka.LetterCardActivity.java
private void removeSoundListener(LinearLayout front) { Button sound = (Button) front.findViewById(R.id.soundaksara); sound.setOnClickListener(null); }
From source file:com.barcamppenang2014.tabfragment.HomeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (scrollView != null) { ViewGroup parent = (ViewGroup) scrollView.getParent(); if (parent != null) parent.removeView(scrollView); }// w w w .j a v a 2s .c o m scrollView = (ScrollView) inflater.inflate(R.layout.home_layout, container, false); LinearLayout linearLayout = (LinearLayout) scrollView.findViewById(R.id.home_linear_layout); // linearLayout.setBackgroundColor(Color.WHITE); mTextViewDay = (TextView) linearLayout.findViewById(R.id.count_down_day); mTextViewHour = (TextView) linearLayout.findViewById(R.id.count_down_hour); mImageViewClickMe = (Button) linearLayout.findViewById(R.id.map_fullscreen_button); mImageViewClickMe.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getActivity() == null) return; MainActivity fca = (MainActivity) getActivity(); fca.getSupportActionBar().setDisplayHomeAsUpEnabled(true); fca.switchContent(new MapFragment()); } }); // mTextView.setBackgroundResource(R.drawable.info_countdown); @SuppressWarnings("deprecation") Date date = new Date(114, 4, 17, 9, 0, 0); // 2014/May/17 9am // year the year, 0 is 1900. // month the month, 0 - 11. // day the day of the month, 1 - 31. long dtMili = System.currentTimeMillis(); Date dateNow = new Date(dtMili); long remain = date.getTime() - dateNow.getTime(); new CountDownTimer(remain, 1000) { public void onTick(long millisUntilFinished) { //mTextView.setText("seconds remaining: " + millisUntilFinished/ 1000); String day = timeDay(millisUntilFinished / 1000); String hour = timeHour(millisUntilFinished / 1000); mTextViewDay.setText(day); mTextViewHour.setText(hour); /*if(Integer.parseInt(day)>9 && Integer.parseInt(hour)<=9){ LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mTextViewDay.getLayoutParams(); params.rightMargin = 85; mTextViewDay.setLayoutParams(params); } if(Integer.parseInt(day)<=9 && Integer.parseInt(hour)<=9 ){ LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mTextViewDay.getLayoutParams(); params.rightMargin = 145; mTextViewDay.setLayoutParams(params); } if(Integer.parseInt(day)<=9 && Integer.parseInt(hour)>9 ){ LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mTextViewDay.getLayoutParams(); params.rightMargin = 125; mTextViewDay.setLayoutParams(params); }*/ } public void onFinish() { // mTextView.setText("done!"); } }.start(); return scrollView; }
From source file:com.saulcintero.moveon.fragments.Summary2_hiit.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LinearLayout fragmentView = (LinearLayout) inflater.inflate(R.layout.summary2_hiit, container, false); summary2ListView = (ListView) fragmentView.findViewById(R.id.summary2_list_splitlaps); summary2ListView.setSelector(android.R.color.transparent); summary2Label1 = (TextView) fragmentView.findViewById(R.id.summary2_item_one); mContext = getActivity().getApplicationContext(); prefs = PreferenceManager.getDefaultSharedPreferences(mContext); id = prefs.getInt("selected_practice", 0); isMetric = FunctionUtils.checkIfUnitsAreMetric(mContext); summary2Label1.setText((isMetric ? getString(R.string.long_unit1_detail_1).toUpperCase(Locale.getDefault()) : getString(R.string.long_unit2_detail_1).toUpperCase(Locale.getDefault())) + "."); return fragmentView; }
From source file:com.androguide.honamicontrol.fragments.CardsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LinearLayout ll = (LinearLayout) inflater.inflate(R.layout.cardsui, container, false); ActionBarActivity fa = (ActionBarActivity) super.getActivity(); fa.getSupportActionBar().setDisplayHomeAsUpEnabled(true); fa.getSupportActionBar().setHomeButtonEnabled(true); assert ll != null; mCardUI = (CardUI) (ll.findViewById(R.id.cardsui)); mCardUI.addStack(new CardStack(""), true); mCardUI.addStack(new CardStack(""), true); mCardUI.addCard(new CardImageLocal(fa.getString(R.string.kernel_cpu_control), fa.getString(R.string.kernel_cpu_control_desc), fa.getString(R.string.kernel_color), R.drawable.ic_tools_cpu_control, fa)); mCardUI.refresh();/*from w w w . j ava 2s . c om*/ return ll; }
From source file:com.google.android.gcm.demo.ui.GroupsFragment.java
@Override public void refresh() { float density = getActivity().getResources().getDisplayMetrics().density; SimpleArrayMap<String, Sender> senders = mSenders.getSenders(); LinearLayout sendersList = new LinearLayout(getActivity()); sendersList.setOrientation(LinearLayout.VERTICAL); for (int i = 0; i < senders.size(); i++) { Sender sender = senders.valueAt(i); if (sender.groups.size() > 0) { LinearLayout senderRow = (LinearLayout) getActivity().getLayoutInflater() .inflate(R.layout.widget_icon_text_button_row, sendersList, false); ImageView senderIcon = (ImageView) senderRow.findViewById(R.id.widget_itbr_icon); TextView senderText = (TextView) senderRow.findViewById(R.id.widget_itbr_text); senderRow.findViewById(R.id.widget_itbr_button).setVisibility(View.GONE); senderIcon.setImageResource(R.drawable.cloud_googblue); senderIcon.setPadding(0, 0, (int) (8 * density), 0); senderText.setText(getString(R.string.groups_sender_id, sender.senderId)); sendersList.addView(senderRow); for (DeviceGroup deviceGroup : sender.groups.values()) { LinearLayout row = (LinearLayout) getActivity().getLayoutInflater() .inflate(R.layout.widget_icon_text_button_row, sendersList, false); ImageView icon = (ImageView) row.findViewById(R.id.widget_itbr_icon); TextView label = (TextView) row.findViewById(R.id.widget_itbr_text); Button button = (Button) row.findViewById(R.id.widget_itbr_button); icon.setImageResource(R.drawable.group_grey600); label.setText(deviceGroup.notificationKeyName); label.setBackgroundResource(selectableBackgroundResource); label.setTag(R.id.tag_action, ACTION_OPEN_GROUP); label.setTag(R.id.tag_senderid, sender.senderId); label.setTag(R.id.tag_group, deviceGroup.notificationKeyName); label.setOnClickListener(this); button.setText(R.string.groups_delete); button.setTag(R.id.tag_action, ACTION_DELETE_GROUP); button.setTag(R.id.tag_senderid, sender.senderId); button.setTag(R.id.tag_group, deviceGroup.notificationKeyName); button.setOnClickListener(this); row.setPadding((int) (16 * density), 0, 0, 0); sendersList.addView(row); }//w w w . j a v a2 s .c o m } } if (sendersList.getChildCount() == 0) { TextView noTokens = new TextView(getActivity()); noTokens.setText(getString(R.string.groups_no_groups_available)); noTokens.setTypeface(null, Typeface.ITALIC); sendersList.addView(noTokens); } FrameLayout topicsView = (FrameLayout) getActivity().findViewById(R.id.groups_list_wrapper); topicsView.removeAllViews(); topicsView.addView(sendersList); }
From source file:com.melvin.android.base.common.ui.TabPageIndicator.java
private void addTab(String text, int index) { // Workaround for not being able to pass a defStyle on pre-3.0 RFileUtil fileUtil = RFileUtil.getInstance(this.mContext); int layoutid = fileUtil.getLayoutValue("tab_item_layout"); LinearLayout linear = (LinearLayout) mInflater.inflate(layoutid, null); linear.setFocusable(true);// w w w . j av a 2 s . c om linear.setOnClickListener(mTabClickListener); TextView vv = (TextView) linear.findViewById(android.R.id.text1); vv.setText(text); linear.setTag(index); mTabLayout.addView(linear, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1)); }
From source file:org.tomahawk.tomahawk_android.dialogs.ResolverConfigDialog.java
/** * Called when this {@link android.support.v4.app.DialogFragment} is being created *//*from w w w .j a v a 2s. c om*/ @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (getArguments() != null && getArguments().containsKey(TomahawkFragment.PREFERENCEID)) { String resolverId = getArguments().getString(TomahawkFragment.PREFERENCEID); mScriptResolver = (ScriptResolver) PipeLine.get().getResolver(resolverId); } EditText showKeyboardEditText = null; EditText lastEditText = null; if (mScriptResolver.getConfigUi() != null && mScriptResolver.getConfigUi().fields != null) { TextView headerTextView = (TextView) addScrollingViewToFrame(R.layout.config_textview); headerTextView.setText(mScriptResolver.getDescription()); for (ScriptResolverConfigUiField field : mScriptResolver.getConfigUi().fields) { Map<String, Object> config = mScriptResolver.getConfig(); if (PROPERTY_CHECKED.equals(field.property)) { LinearLayout checkboxLayout = (LinearLayout) addScrollingViewToFrame(R.layout.config_checkbox); TextView textView = (TextView) checkboxLayout.findViewById(R.id.config_textview); textView.setText(field.name); ConfigCheckbox checkBox = (ConfigCheckbox) checkboxLayout.findViewById(R.id.config_checkbox); checkBox.mFieldName = field.name; mStringViews.add(checkBox); if (config.get(field.name) != null) { checkBox.setChecked((Boolean) config.get(field.name)); } } else if (PROPERTY_TEXT.equals(field.property)) { ConfigEdittext editText = (ConfigEdittext) addScrollingViewToFrame(R.layout.config_edittext); editText.mFieldName = field.name; editText.setHint(field.name); mStringViews.add(editText); if (config.get(field.name) != null) { editText.setText((String) config.get(field.name)); } if (VariousUtils.containsIgnoreCase(field.name, "password")) { editText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); editText.setTransformationMethod(new PasswordTransformationMethod()); } if (showKeyboardEditText == null) { showKeyboardEditText = editText; } lastEditText = editText; } else if (PROPERTY_VALUE.equals(field.property)) { LinearLayout numberpickerLayout = (LinearLayout) addScrollingViewToFrame( R.layout.config_numberpicker); TextView textView = (TextView) numberpickerLayout.findViewById(R.id.config_textview); textView.setText(field.name); ConfigNumberEdittext editText = (ConfigNumberEdittext) numberpickerLayout .findViewById(R.id.config_edittext); editText.mFieldName = field.name; editText.setHint(field.name); mStringViews.add(editText); if (config.get(field.name) != null) { editText.setText(String.valueOf(config.get(field.name))); } if (showKeyboardEditText == null) { showKeyboardEditText = editText; } lastEditText = editText; } } } else { hideNegativeButton(); } if (mScriptResolver.getScriptAccount().isManuallyInstalled()) { showRemoveButton(); } if (lastEditText != null) { lastEditText.setOnEditorActionListener(mOnKeyboardEnterListener); } if (showKeyboardEditText != null) { ViewUtils.showSoftKeyboard(showKeyboardEditText); } setDialogTitle(mScriptResolver.getName()); if (!mScriptResolver.isConfigTestable()) { setConnectImageViewClickable(); } setStatus(mScriptResolver); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(getDialogView()); return builder.create(); }
From source file:com.yelinaung.karrency.app.ui.ExchangeRateFragment.java
@Override public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mContext = getActivity().getApplicationContext(); rootView = inflater.inflate(R.layout.fragment_exchange_rate, container, false); assert rootView != null; ButterKnife.inject(this, rootView); exchangeSRL.setColorSchemeColors(R.color.theme_primary); exchangeSRL.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override/*from w ww.ja va 2 s . c o m*/ public void onRefresh() { RestAdapter restAdapter = new RestAdapter.Builder().setClient(new OkClient(okHttpClient)) .setEndpoint(BASE_URL).setLogLevel(RestAdapter.LogLevel.BASIC).build(); CurrencyService currencyService = restAdapter.create(CurrencyService.class); currencyService.getLatestCurrencies(new Callback<Currency>() { @Override public void success(Currency currency, Response response) { Date time = new Date((long) (Integer.valueOf(currency.getTimestamp()) * 1000)); for (int i = 0; i < currency.getRates().getTotal(); i++) { final LinearLayout baseLayout = (LinearLayout) inflater.inflate(R.layout.currency_row, null, false); TextView currencyName = (TextView) baseLayout.findViewById(R.id.currency_name); TextView currencyValue = (TextView) baseLayout.findViewById(R.id.currency_value); currencyName.setText(currency.getRates().getAllCurrenciesNames().get(i)); currencyValue.setText(currency.getRates().getAll().get(i)); currenciesWrapper.addView(baseLayout); } exchangeSRL.setRefreshing(false); } @Override public void failure(RetrofitError error) { } }); } }); return rootView; }
From source file:com.gigathinking.simpleapplock.NavigationDrawerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.fragment_navigation_drawer, container, false);/* w w w .jav a2 s. c om*/ ListView lv = (ListView) layout.findViewById(R.id.id_lv_nav_settings); lv.setAdapter(new ArrayAdapter<String>(getActionBar().getThemedContext(), R.layout.layout_drawer_list_item, R.id.tv_drawer_list, new String[] { "Preferences" })); lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { startActivity(new Intent(getActionBar().getThemedContext(), PrefActivity.class)); mDrawerLayout.closeDrawer(mFragmentContainerView); } }); mDrawerListView = (ListView) layout.findViewById(R.id.id_lv_nav_drawer); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } }); mDrawerListView.setAdapter(new ArrayAdapter<String>(getActionBar().getThemedContext(), R.layout.layout_drawer_list_item, R.id.tv_drawer_list, new String[] { "App List" })); mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); return layout; }
From source file:github.daneren2005.dsub.view.CacheLocationPreference.java
@Override protected void onBindDialogView(View view) { super.onBindDialogView(view); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { view.setLayoutParams(new ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT)); final EditText editText = (EditText) view.findViewById(android.R.id.edit); ViewGroup vg = (ViewGroup) editText.getParent(); LinearLayout cacheButtonsWrapper = (LinearLayout) LayoutInflater.from(context) .inflate(R.layout.cache_location_buttons, vg, true); Button internalLocation = (Button) cacheButtonsWrapper.findViewById(R.id.location_internal); Button externalLocation = (Button) cacheButtonsWrapper.findViewById(R.id.location_external); File[] dirs;/* w w w .j a v a 2s. c o m*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { dirs = context.getExternalMediaDirs(); } else { dirs = ContextCompat.getExternalFilesDirs(context, null); } // Past 5.0 we can query directly for SD Card File internalDir = null, externalDir = null; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { for (int i = 0; i < dirs.length; i++) { try { if (dirs[i] != null) { if (Environment.isExternalStorageRemovable(dirs[i])) { if (externalDir != null) { externalDir = dirs[i]; } } else { internalDir = dirs[i]; } if (internalDir != null && externalDir != null) { break; } } } catch (Exception e) { Log.e(TAG, "Failed to check if is external", e); } } } // Before 5.0, we have to guess. Most of the time the SD card is last if (externalDir == null) { for (int i = dirs.length - 1; i >= 0; i--) { if (dirs[i] != null) { externalDir = dirs[i]; break; } } } if (internalDir == null) { for (int i = 0; i < dirs.length; i++) { if (dirs[i] != null) { internalDir = dirs[i]; break; } } } final File finalInternalDir = new File(internalDir, "music"); final File finalExternalDir = new File(externalDir, "music"); final EditText editTextBox = (EditText) view.findViewById(android.R.id.edit); if (finalInternalDir != null && (finalInternalDir.exists() || finalInternalDir.mkdirs())) { internalLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String path = finalInternalDir.getPath(); editTextBox.setText(path); } }); } else { internalLocation.setEnabled(false); } if (finalExternalDir != null && !finalInternalDir.equals(finalExternalDir) && (finalExternalDir.exists() || finalExternalDir.mkdirs())) { externalLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String path = finalExternalDir.getPath(); editTextBox.setText(path); } }); } else { externalLocation.setEnabled(false); } } }