List of usage examples for android.widget ImageView setEnabled
@RemotableViewMethod public void setEnabled(boolean enabled)
From source file:org.openobservatory.ooniprobe.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); checkResources();/*from w w w . ja v a 2 s . co m*/ TestData.getInstance(this, this).addObserver(this); mTitle = mDrawerTitle = getTitle(); mMenuItemsTitles = new String[] { getString(R.string.run_tests), getString(R.string.past_tests), getString(R.string.settings), getString(R.string.about) }; mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); //mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.menu_item, mMenuItemsTitles)); ArrayList<String> stringList = new ArrayList<String>(Arrays.asList(mMenuItemsTitles)); mleftMenuListAdapter = new LeftMenuListAdapter(this, R.layout.row_left_menu, stringList); mDrawerList.setAdapter(mleftMenuListAdapter); mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); ImageView _imgView = new ImageView(this); _imgView.setEnabled(false); _imgView.setImageResource(R.drawable.ooni_logo); mDrawerList.addFooterView(_imgView); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); updateActionBar(); // Only used with v4.app.ActionBarDrawerToggle //getSupportActionBar().setHomeAsUpIndicator(R.drawable.menu_white); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, //R.drawable.menu_white, /* Only used with v4.app.ActionBarDrawerToggle */ R.string.drawer_open, R.string.drawer_close) { public void onDrawerClosed(View view) { //getSupportActionBar().setHomeAsUpIndicator(R.drawable.menu_white); mleftMenuListAdapter.notifyDataSetChanged(); //getSupportActionBar().setTitle(mTitle); invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { //getSupportActionBar().setHomeAsUpIndicator(R.drawable.notification_icon); mleftMenuListAdapter.notifyDataSetChanged(); //getSupportActionBar().setTitle(mDrawerTitle); invalidateOptionsMenu(); } public void onDrawerStateChanged(int newState) { } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(0); } checkInformedConsent(); }
From source file:me.henrytao.mdcore.core.MdLayoutInflaterFactory.java
protected void supportImageView(Context context, ImageView imageView, AttributeSet attrs) { if (imageView == null) { return;/*from w w w . j a va 2s . c o m*/ } boolean isEnabled = true; TypedArray a = context.getTheme().obtainStyledAttributes(attrs, new int[] { R.attr.enabled }, 0, 0); try { isEnabled = a.getBoolean(0, true); } catch (Exception ignore) { } a.recycle(); imageView.setEnabled(isEnabled); }
From source file:com.pdftron.pdf.controls.AddPageDialogFragment.java
private void changeDotPosition(int position) { if ((int) Math.ceil(PageType.values().length / 3.0) < 2) return;// ww w . j a v a2s. c om for (int i = 0; i < (int) Math.ceil(PageType.values().length / 3.0); i++) { ImageView dot = (ImageView) mViewPagerDotLayout.getChildAt(i); dot.setEnabled(i == position ? true : false); } }
From source file:com.tecnojin.timekiller.menuviews.GamePageAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { GameDescriptor descriptor = GameManager.instance(context).getGameFromIndex(context, position); View layout = inflater.inflate(R.layout.game_page, null); TextView t = (TextView) layout.findViewById(R.id.game_name); ImageView icon = (ImageView) layout.findViewById(R.id.gameIcon); ImageView sett = (ImageView) layout.findViewById(R.id.settings); ImageView tutorial = (ImageView) layout.findViewById(R.id.tutorial); ImageView stat = (ImageView) layout.findViewById(R.id.stat); if (descriptor.getName() != 0) { t.setText(descriptor.getName()); ActivityUtil.setFont(t, ActivityUtil.FONTS_BATES_SHOWER); if (descriptor.isReady()) icon.setImageResource(descriptor.getIcon()); else/* w w w .j ava 2 s . c om*/ icon.setImageResource(R.drawable.work); if (!descriptor.isReady()) { tutorial.setEnabled(false); icon.setEnabled(false); } if (!descriptor.isReady() || descriptor.getOptions() == null) sett.setEnabled(false); if (descriptor.getStatistics() == null) stat.setVisibility(View.INVISIBLE); } icon.setOnClickListener(new myOnclickListener(myOnclickListener.PLAY, GameManager.instance(context).getIndexFor(descriptor), context)); sett.setOnClickListener(new myOnclickListener(myOnclickListener.SETTINGS, GameManager.instance(context).getIndexFor(descriptor), context)); tutorial.setOnClickListener(new myOnclickListener(myOnclickListener.TUTORIAL, GameManager.instance(context).getIndexFor(descriptor), context)); stat.setOnClickListener(new myOnclickListener(myOnclickListener.STATISTICS, GameManager.instance(context).getIndexFor(descriptor), context)); container.addView(layout); return layout; }
From source file:com.fatelon.partyphotobooth.setup.fragments.ShareServicesSetupFragment.java
/** * Updates the link status ui.// w ww. ja v a 2 s.c om * * @param event the {@link com.groundupworks.wings.WingsEndpoint.LinkEvent}. * @param statusView the status {@link android.widget.TextView}. * @param iconView the icon {@link android.widget.ImageView}. */ private void updateLinkStatus(WingsEndpoint.LinkEvent event, TextView statusView, ImageView iconView) { String status = getString(R.string.share_services_setup__disabled); int color = getResources().getColor(R.color.text_light); boolean iconEnabled = false; if (event.isLinked()) { WingsEndpoint.LinkInfo linkInfo = Wings.getEndpoint(event.getEndpoint()).getLinkInfo(); if (linkInfo != null) { status = linkInfo.mDestinationDescription; color = getResources().getColor(R.color.text_dark); iconEnabled = true; } } statusView.setText(status); statusView.setTextColor(color); iconView.setEnabled(iconEnabled); updateNoticeEnabled(); }
From source file:com.bluros.updater.UpdatesSettings.java
private void startDownload() { UpdateInfo ui = mDownloadingPreference.getUpdateInfo(); if (ui == null) { return;// ww w . j av a 2 s .co m } mDownloadingPreference.setStyle(UpdatePreference.STYLE_DOWNLOADING); // Set progress bar to indeterminate while incremental check runs ProgressBar progressBar = mDownloadingPreference.getProgressBar(); progressBar.setIndeterminate(true); // Disable cancel button while incremental check runs ImageView updatesButton = mDownloadingPreference.getUpdatesButton(); updatesButton.setEnabled(false); mDownloadFileName = ui.getFileName(); mDownloading = true; // Start the download Intent intent = new Intent(this, DownloadReceiver.class); intent.setAction(DownloadReceiver.ACTION_START_DOWNLOAD); intent.putExtra(DownloadReceiver.EXTRA_UPDATE_INFO, (Parcelable) ui); sendBroadcast(intent); mUpdateHandler.post(mUpdateProgress); }
From source file:com.pdftron.pdf.controls.AddPageDialogFragment.java
private void initViewPagerDotLayout() { if ((int) Math.ceil(PageType.values().length / 3.0) < 2) return;/*from ww w . j a v a 2 s.com*/ for (int i = 0; i < (int) Math.ceil(PageType.values().length / 3.0); i++) { ImageView dot = new ImageView(getContext()); LinearLayout.LayoutParams dotParams = new LinearLayout.LayoutParams((int) (8 * mDeviceScale + 0.5f), (int) (8 * mDeviceScale + 0.5f)); int margin = (int) (5 * mDeviceScale + 0.5f); dotParams.setMargins(margin, margin, margin, margin); dot.setLayoutParams(dotParams); dot.setImageDrawable(getResources().getDrawable(R.drawable.viewpager_point)); dot.setEnabled(i == 0 ? true : false); mViewPagerDotLayout.addView(dot); } }
From source file:hu.fnf.devel.atlas.Atlas.java
public void addCat(View view) { Spinner spinner = (Spinner) findViewById(R.id.taskSpinner); // In case of null add! if (spinner.getSelectedItem() == null) { Log.d("Atlas", "null selection"); return;/*from w ww .ja va 2 s .co m*/ } String selected = (String) spinner.getSelectedItem(); /* * add to list */ Category sel = categories.get(selected); Log.d("Atlas", "selected: " + selected); Log.d("Atlas", "id: " + sel.getId()); ListView cats = (ListView) findViewById(R.id.taskCats); CatAddAdapter catAddAdapter = (CatAddAdapter) cats.getAdapter(); if (catAddAdapter.getSum() >= (int) (catAddAdapter.getAmount()) + Integer.valueOf(sel.getAmount())) { AlertDialog.Builder myAlertDialog = new AlertDialog.Builder(this); myAlertDialog.setTitle("--- Task ---"); myAlertDialog.setMessage("Nothing left to categorize"); myAlertDialog.setPositiveButton(getResources().getString(R.string.ok), AtlasData.ackClick); myAlertDialog.show(); return; } catAddAdapter.add(new Category(sel.getId(), sel.getName(), sel.getAmount(), sel.getDepth(), sel.getColorr(), sel.getColorg(), sel.getColorb())); cats.setAdapter(catAddAdapter); //remove from spinner ArrayList<String> array_spinner = new ArrayList<String>(); int spin_count = spinner.getAdapter().getCount(); Log.d("Atlas", "spinner count: " + spin_count); if (spin_count == 1) { // no more category in spinner (ASANA: mi legyen ha elfogy a spinner) Log.d("Atlas", "no more category in spinner"); ImageView add = (ImageView) findViewById(R.id.taskAdd); add.setVisibility(View.INVISIBLE); add.setEnabled(false); spinner.setVisibility(View.INVISIBLE); spinner.setEnabled(false); } for (int i = 0; i < spin_count; i++) { String s = (String) spinner.getAdapter().getItem(i); if (!s.equalsIgnoreCase(selected)) { array_spinner.add(s); } } ArrayAdapter<String> arrayadapter = new ArrayAdapter<String>(getApplicationContext(), R.layout.custom_simple_spinner, array_spinner); spinner.setAdapter(arrayadapter); }
From source file:net.abcdroid.devfest12.ui.SessionDetailFragment.java
private void onSpeakersQueryComplete(Cursor cursor) { mSpeakersCursor = true;/*from ww w . ja va2s . c o m*/ // TODO: remove existing speakers from layout, since this cursor might be from a data change final ViewGroup speakersGroup = (ViewGroup) mRootView.findViewById(R.id.session_speakers_block); final LayoutInflater inflater = getActivity().getLayoutInflater(); boolean hasSpeakers = false; while (cursor.moveToNext()) { final String speakerName = cursor.getString(SpeakersQuery.SPEAKER_NAME); if (TextUtils.isEmpty(speakerName)) { continue; } final String speakerImageUrl = cursor.getString(SpeakersQuery.SPEAKER_IMAGE_URL); final String speakerCompany = cursor.getString(SpeakersQuery.SPEAKER_COMPANY); final String speakerUrl = cursor.getString(SpeakersQuery.SPEAKER_URL); final String speakerAbstract = cursor.getString(SpeakersQuery.SPEAKER_ABSTRACT); String speakerHeader = speakerName; if (!TextUtils.isEmpty(speakerCompany)) { speakerHeader += ", " + speakerCompany; } final View speakerView = inflater.inflate(R.layout.speaker_detail, speakersGroup, false); final TextView speakerHeaderView = (TextView) speakerView.findViewById(R.id.speaker_header); final ImageView speakerImageView = (ImageView) speakerView.findViewById(R.id.speaker_image); final TextView speakerAbstractView = (TextView) speakerView.findViewById(R.id.speaker_abstract); if (!TextUtils.isEmpty(speakerImageUrl)) { mImageFetcher.loadThumbnailImage(speakerImageUrl, speakerImageView, R.drawable.person_image_empty); } speakerHeaderView.setText(speakerHeader); speakerImageView.setContentDescription(getString(R.string.speaker_googleplus_profile, speakerHeader)); UIUtils.setTextMaybeHtml(speakerAbstractView, speakerAbstract); if (!TextUtils.isEmpty(speakerUrl)) { speakerImageView.setEnabled(true); speakerImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Intent speakerProfileIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(speakerUrl)); speakerProfileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); UIUtils.preferPackageForIntent(getActivity(), speakerProfileIntent, UIUtils.GOOGLE_PLUS_PACKAGE_NAME); UIUtils.safeOpenLink(getActivity(), speakerProfileIntent); } }); } else { speakerImageView.setEnabled(false); speakerImageView.setOnClickListener(null); } speakersGroup.addView(speakerView); hasSpeakers = true; mHasSummaryContent = true; } speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE); // Show empty message when all data is loaded, and nothing to show if (mSessionCursor && !mHasSummaryContent) { mRootView.findViewById(android.R.id.empty).setVisibility(View.VISIBLE); } }
From source file:com.conferenceengineer.android.iosched.ui.SessionDetailFragment.java
private void onSpeakersQueryComplete(Cursor cursor) { mSpeakersCursor = true;//from w ww . j a v a 2 s.c om final ViewGroup speakersGroup = (ViewGroup) mRootView.findViewById(R.id.session_speakers_block); // Remove all existing speakers (everything but first child, which is the header) for (int i = speakersGroup.getChildCount() - 1; i >= 1; i--) { speakersGroup.removeViewAt(i); } final LayoutInflater inflater = getActivity().getLayoutInflater(); boolean hasSpeakers = false; while (cursor.moveToNext()) { final String speakerName = cursor.getString(SpeakersQuery.SPEAKER_NAME); if (TextUtils.isEmpty(speakerName)) { continue; } final String speakerImageUrl = cursor.getString(SpeakersQuery.SPEAKER_IMAGE_URL); final String speakerCompany = cursor.getString(SpeakersQuery.SPEAKER_COMPANY); final String speakerUrl = cursor.getString(SpeakersQuery.SPEAKER_URL); final String speakerAbstract = cursor.getString(SpeakersQuery.SPEAKER_ABSTRACT); String speakerHeader = speakerName; if (!TextUtils.isEmpty(speakerCompany)) { speakerHeader += ", " + speakerCompany; } final View speakerView = inflater.inflate(R.layout.speaker_detail, speakersGroup, false); final TextView speakerHeaderView = (TextView) speakerView.findViewById(R.id.speaker_header); final ImageView speakerImageView = (ImageView) speakerView.findViewById(R.id.speaker_image); final TextView speakerAbstractView = (TextView) speakerView.findViewById(R.id.speaker_abstract); if (!TextUtils.isEmpty(speakerImageUrl) && mImageLoader != null) { mImageLoader.get(UIUtils.getConferenceImageUrl(speakerImageUrl), speakerImageView); } speakerHeaderView.setText(speakerHeader); speakerImageView.setContentDescription(getString(R.string.speaker_googleplus_profile, speakerHeader)); UIUtils.setTextMaybeHtml(speakerAbstractView, speakerAbstract); if (!TextUtils.isEmpty(speakerUrl)) { speakerImageView.setEnabled(true); speakerImageView.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Intent speakerProfileIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(speakerUrl)); speakerProfileIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(speakerProfileIntent); } }); } else { speakerImageView.setEnabled(false); speakerImageView.setOnClickListener(null); } speakersGroup.addView(speakerView); hasSpeakers = true; mHasSummaryContent = true; } speakersGroup.setVisibility(hasSpeakers ? View.VISIBLE : View.GONE); // Show empty message when all data is loaded, and nothing to show if (mSessionCursor && !mHasSummaryContent) { mRootView.findViewById(android.R.id.empty).setVisibility(View.VISIBLE); } }