List of usage examples for android.view View isActivated
@ViewDebug.ExportedProperty public boolean isActivated()
From source file:nuclei.ui.view.media.PlayerControlsView.java
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { setClickable(true);/*from ww w . j a v a 2s.c o m*/ final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PlayerControlsView, defStyleAttr, defStyleRes); mAutoHide = a.getBoolean(R.styleable.PlayerControlsView_auto_hide, false); boolean bottom = a.getBoolean(R.styleable.PlayerControlsView_bottom, false); int layout = a.getResourceId(R.styleable.PlayerControlsView_control_layout, bottom ? R.layout.cyto_view_player_controls_bottom : R.layout.cyto_view_player_controls); boolean hasPrevious = a.getBoolean(R.styleable.PlayerControlsView_has_previous, true); boolean hasNext = a.getBoolean(R.styleable.PlayerControlsView_has_next, true); boolean hasRewind = a.getBoolean(R.styleable.PlayerControlsView_has_rewind, false); boolean hasFastforward = a.getBoolean(R.styleable.PlayerControlsView_has_fastforward, false); a.recycle(); View view = LayoutInflater.from(context).inflate(layout, this, false); addView(view); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { if (mMediaInterface != null) { if (v.getId() == R.id.btn_play) { if (mMediaInterface.getPlayerController() != null) { v.setActivated(!v.isActivated()); if (v.isActivated()) mMediaInterface.getPlayerController().start(); else mMediaInterface.getPlayerController().pause(); } } else if (v.getId() == R.id.btn_speed) { onSpeedSelected(v); } else if (v.getId() == R.id.btn_timer) { onTimerSelected(v); } else if (mMediaInterface.getMediaController() != null) { if (mMediaInterface.getPlayerController() != null) { if (v.getId() == R.id.btn_previous) mMediaInterface.getPlayerController().skipToPrevious(); else if (v.getId() == R.id.btn_next) mMediaInterface.getPlayerController().skipToNext(); else if (v.getId() == R.id.btn_rewind) mMediaInterface.getPlayerController().rewind(); else if (v.getId() == R.id.btn_fastforward) mMediaInterface.getPlayerController().fastForward(); } } } } }; view.findViewById(R.id.btn_play).setOnClickListener(listener); ImageView previous = (ImageView) view.findViewById(R.id.btn_previous); ImageView next = (ImageView) view.findViewById(R.id.btn_next); ImageView rewind = (ImageView) view.findViewById(R.id.btn_rewind); ImageView fastforward = (ImageView) view.findViewById(R.id.btn_fastforward); if (previous != null) { previous.setOnClickListener(listener); previous.setVisibility(hasPrevious ? VISIBLE : GONE); } if (next != null) { next.setOnClickListener(listener); next.setVisibility(hasNext ? VISIBLE : GONE); } if (rewind != null) { rewind.setOnClickListener(listener); rewind.setVisibility(hasRewind ? VISIBLE : GONE); } if (fastforward != null) { fastforward.setOnClickListener(listener); fastforward.setVisibility(hasFastforward ? VISIBLE : GONE); } DefaultCallback.onHandleState(this, fastforward, rewind, next, previous, null); TextView speed = ((TextView) view.findViewById(R.id.btn_speed)); if (speed != null) { speed.setText(ResourceProvider.getInstance().getSelectedSpeed()); speed.setOnClickListener(listener); speed.setVisibility(View.VISIBLE); } TextView timer = (TextView) view.findViewById(R.id.btn_timer); if (timer != null) { timer.setText(ResourceProvider.getInstance().getString(ResourceProvider.TIMER)); timer.setOnClickListener(listener); } }
From source file:de.vanita5.twittnuker.activity.support.ComposeActivity.java
@Override public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) { if (isSingleAccount()) return;/*w w w.j a v a 2s. co m*/ final boolean selected = !view.isActivated(); final Account account = mAccountSelectorAdapter.getItem(position); mAccountSelectorAdapter.setAccountSelected(account.account_id, selected); mSendAccountIds = mAccountSelectorAdapter.getSelectedAccountIds(); updateAccountSelection(); }
From source file:net.e_fas.oss.tabijiman.MapsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { e_print("onCreate"); // ActionBar? if (savedInstanceState == null) { // customActionBar?? View customActionBarView = this.getActionBarView(); // ActionBar?? ActionBar actionBar = this.getSupportActionBar(); // ?????('<' <- ???) if (actionBar != null) { // ??????? actionBar.setDisplayShowTitleEnabled(false); // icon??????? actionBar.setDisplayShowHomeEnabled(false); // ActionBar?customView? actionBar.setCustomView(customActionBarView); // CutomView?? actionBar.setDisplayShowCustomEnabled(true); }//w w w .j av a2 s.c o m } // ????? Locale locale = Locale.getDefault(); if (locale.equals(Locale.JAPAN) || locale.equals(Locale.JAPANESE)) { locale = Locale.JAPAN; } else { locale = Locale.ENGLISH; } // ?? Locale.setDefault(locale); Configuration config = new Configuration(); // Resources?? config.locale = locale; Resources resources = getBaseContext().getResources(); // Resources?????? resources.updateConfiguration(config, null); super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); try { new CreateInitData(this).exec(locale); new SPARQL().query(AppSetting.query_place, "place"); new SPARQL().query(AppSetting.query_frame, "frame"); } catch (IOException | JSONException e) { e.printStackTrace(); } makeTempDir(); // ??? ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo == null) { Toast.makeText(getApplicationContext(), "???????????", Toast.LENGTH_LONG).show(); } buttons = new ArrayList<>(); View.OnClickListener change_button = new View.OnClickListener() { @Override public void onClick(View v) { CameraPosition cameraPos; if (v == TrainButton) { zoomLevel = 9.0f; cameraPos = new CameraPosition.Builder() .target(new LatLng(nowLocation.latitude, nowLocation.longitude)).zoom(zoomLevel) .bearing(0).build(); } else if (v == CarButton) { zoomLevel = 11.0f; cameraPos = new CameraPosition.Builder() .target(new LatLng(nowLocation.latitude, nowLocation.longitude)).zoom(zoomLevel) .bearing(0).build(); } else { zoomLevel = 14.0f; cameraPos = new CameraPosition.Builder() .target(new LatLng(nowLocation.latitude, nowLocation.longitude)).zoom(zoomLevel) .bearing(0).build(); } if (!v.isActivated()) { v.setActivated(true); for (int i = 0; i < buttons.size(); i++) { if (buttons.get(i) != v) { buttons.get(i).setActivated(false); } } } mMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPos)); } }; View.OnClickListener marker_change_button = new View.OnClickListener() { @Override public void onClick(View v) { if (!v.isActivated()) { v.setActivated(true); if (v == FrameSwitch) { setMarker("frame"); FrameMarkerOptions.clear(); } else { setMarker("place"); PlaceMarkerOptions.clear(); } } else { v.setActivated(false); if (v == FrameSwitch) { for (Marker m : FrameMarker) { m.remove(); } FrameMarker.clear(); } else { for (Marker m : PlaceMarker) { m.remove(); } PlaceMarker.clear(); } } } }; // LocationManager? mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); TakePicture = (ImageButton) findViewById(R.id.takePicture); TakePicture.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent TakePictureView = new Intent(getApplicationContext(), TakePicture.class); startActivity(TakePictureView); } }); TrainButton = (ImageButton) findViewById(R.id.Train); TrainButton.setActivated(false); TrainButton.setOnClickListener(change_button); CarButton = (ImageButton) findViewById(R.id.Car); CarButton.setActivated(true); CarButton.setOnClickListener(change_button); WalkButton = (ImageButton) findViewById(R.id.Walk); WalkButton.setActivated(false); WalkButton.setOnClickListener(change_button); buttons = Arrays.asList(TrainButton, CarButton, WalkButton); FrameSwitch = (ImageButton) findViewById(R.id.showFrame); FrameSwitch.setActivated(true); FrameSwitch.setOnClickListener(marker_change_button); PlaceSwitch = (ImageButton) findViewById(R.id.showPlace); PlaceSwitch.setActivated(true); PlaceSwitch.setOnClickListener(marker_change_button); GoFukuiButton = (ImageButton) findViewById(R.id.GoFukuiButton); // new AppSetting(this); // AppSetting.context = getApplicationContext(); AppSetting.Inc_CountRun(); e_print("Run_Count >> " + AppSetting.CountRun()); if (AppSetting.CountRun() % 20 == 0) { GoFukuiButton.setVisibility(View.VISIBLE); } FrameCollectionButton = (ImageButton) findViewById(R.id.frameCollection); FrameCollectionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent collection = new Intent(getApplicationContext(), FrameCollection.class); startActivity(collection); } }); mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); mapFragment.getMapAsync(this); // mapFragment.getMap(); helper = new SQLiteHelper(this); db = helper.getWritableDatabase(); }