List of usage examples for android.view View.OnClickListener View.OnClickListener
View.OnClickListener
From source file:com.QuarkLabs.BTCeClient.fragments.HistoryFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mAdapter = new OrdersAdapter(getActivity(), mHistoryType); mListView = (ListView) getView().findViewById(R.id.HistoryContainer); final EditText startDate = (EditText) getView().findViewById(R.id.StartDateValue); final EditText endDate = (EditText) getView().findViewById(R.id.EndDateValue); startDate.setText(mDateFormat.format(mStartDateValue)); endDate.setText(mDateFormat.format(mEndDateValue)); Button makeQuery = (Button) getView().findViewById(R.id.MakeQueryButton); View.OnClickListener showDatePicker = new View.OnClickListener() { @Override/* w w w .ja va2 s .co m*/ public void onClick(View v) { final TextView dateValue = (TextView) v; Date date = null; try { date = mDateFormat.parse(dateValue.getText().toString()); } catch (ParseException e) { e.printStackTrace(); } int year = 1999; int month = 0; int day = 1; if (date != null) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); year = calendar.get(Calendar.YEAR); month = calendar.get(Calendar.MONTH); day = calendar.get(Calendar.DAY_OF_MONTH); } DatePickerDialog datePickerDialog = new android.app.DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { Calendar calendar = Calendar.getInstance(); if (dateValue.getId() == R.id.StartDateValue) { calendar.setTime(mStartDateValue); calendar.set(year, monthOfYear, dayOfMonth, 0, 0, 0); mStartDateValue = calendar.getTime(); } else { calendar.setTime(mEndDateValue); calendar.set(year, monthOfYear, dayOfMonth, 23, 59, 59); mEndDateValue = calendar.getTime(); } dateValue.setText(mDateFormat.format(calendar.getTime())); } }, year, month, day); datePickerDialog.getDatePicker().setCalendarViewShown(false); datePickerDialog.show(); } }; startDate.setOnClickListener(showDatePicker); endDate.setOnClickListener(showDatePicker); makeQuery.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Bundle bundle = new Bundle(); bundle.putString("startDate", String.valueOf(mStartDateValue.getTime() / 1000)); bundle.putString("endDate", String.valueOf(mEndDateValue.getTime() / 1000)); getLoaderManager().restartLoader(mLoaderId, bundle, HistoryFragment.this); mListView.setAdapter(null); mNoItems.setVisibility(View.GONE); mListView.setEmptyView(mLoadingView); } }); mLoadingView = (ProgressBar) getView().findViewById(R.id.Loading); mNoItems = (TextView) getView().findViewById(R.id.NoItems); mListView.setEmptyView(mLoadingView); }
From source file:com.dattasmoon.pebble.plugin.ConvertPreference.java
@Override protected void onBindDialogView(View view) { Button btnAdd = (Button) view.findViewById(R.id.btnAdd); etFrom = (EditText) view.findViewById(R.id.etFrom); etTo = (EditText) view.findViewById(R.id.etTo); lvConvert = (ListView) view.findViewById(R.id.lvConvert); lvConvert.setEmptyView(view.findViewById(android.R.id.empty)); lvConvert.setAdapter(arrayAdapter);/* ww w.jav a 2 s . c o m*/ lvConvert.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo contextInfo = (AdapterView.AdapterContextMenuInfo) menuInfo; int position = contextInfo.position; long id = contextInfo.id; // the child view who's info we're viewing (should be equal to v) View v = contextInfo.targetView; AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext()); final int arrayPosition = (Integer) v.getTag(); final String text = ((TextView) v.findViewById(R.id.tvItem)).getText().toString(); builder.setMessage( getContext().getResources().getString(R.string.confirm_delete) + " '" + text + "' ?") .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { JSONArray temp = new JSONArray(); for (int i = 0; i < arrayAdapter.getJSONArray().length(); i++) { if (i == arrayPosition) { continue; } try { temp.put(arrayAdapter.getJSONArray().getJSONObject(i)); } catch (JSONException e) { e.printStackTrace(); } } arrayAdapter.setJSONArray(temp); arrayAdapter.notifyDataSetChanged(); } }).setNegativeButton(R.string.decline, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); builder.create().show(); } }); btnAdd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { JSONObject item = new JSONObject(); try { item.put("from", etFrom.getText().toString()); item.put("to", etTo.getText().toString()); arrayAdapter.getJSONArray().put(item); etFrom.setText(""); etTo.setText(""); arrayAdapter.notifyDataSetChanged(); } catch (JSONException e) { e.printStackTrace(); } } }); super.onBindDialogView(view); }
From source file:mroza.forms.ChooseProgramActivity.java
private void handleButtonsBehaviour() { final Button buttonPrevious = (Button) findViewById(R.id.buttonChangePeriodHistorical); final Button buttonFuture = (Button) findViewById(R.id.buttonChangePeriodFuture); buttonPrevious.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (!buttonFuture.isEnabled()) { //Switch to actual displayTerm(Term.ACTUAL); } else { //Switch to previous displayTerm(Term.HISTORICAL); }/* www. j a v a2 s. co m*/ clearFilters(true); clearSearchField(); enableShowAllButton(false); } }); buttonFuture.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (!buttonPrevious.isEnabled()) { //Switch to actual period displayTerm(Term.ACTUAL); } else { //Switch to future period displayTerm(Term.FUTURE); } clearFilters(true); clearSearchField(); enableShowAllButton(false); } }); }
From source file:com.google.android.apps.iosched.ui.SessionFeedbackFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_session_feedback, null); mTitle = (TextView) rootView.findViewById(R.id.session_title); mSessionRatingFeedbackBar = RatingBarHelper.create(rootView.findViewById(R.id.session_rating_container)); mQ1FeedbackBar = RatingBarHelper.create(rootView.findViewById(R.id.session_feedback_q1_container)); mQ2FeedbackBar = RatingBarHelper.create(rootView.findViewById(R.id.session_feedback_q2_container)); mQ3FeedbackBar = RatingBarHelper.create(rootView.findViewById(R.id.session_feedback_q3_container)); mQ4RadioGroup = (RadioGroup) rootView.findViewById(R.id.session_feedback_q4); mComments = (EditText) rootView.findViewById(R.id.session_feedback_comments); if (mVariableHeightHeader) { View headerView = rootView.findViewById(R.id.header_session); ViewGroup.LayoutParams layoutParams = headerView.getLayoutParams(); layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT; headerView.setLayoutParams(layoutParams); }//from w ww .ja v a 2 s . c o m rootView.findViewById(R.id.submit_feedback_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { submitAllFeedback(); EasyTracker.getTracker().sendEvent("Session", "Feedback", mTitleString, 0L); LOGD("Tracker", "Feedback: " + mTitleString); getActivity().finish(); } }); return rootView; }
From source file:com.egoclean.testpregnancy.util.ActivityHelper.java
/** * Sets up the action bar with the given title and accent color. If title is null, then * the app logo will be shown instead of a title. Otherwise, a home button and title are * visible. If color is null, then the default colorstrip is visible. *///from w w w . java 2s. c o m public void setupActionBar(CharSequence title, int color) { final ViewGroup actionBarCompat = getActionBarCompat(); if (actionBarCompat == null) { return; } LinearLayout.LayoutParams springLayoutParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.FILL_PARENT); springLayoutParams.weight = 1; View.OnClickListener homeClickListener = new View.OnClickListener() { public void onClick(View view) { goHome(); } }; if (title != null) { // Add Home button addActionButtonCompat(R.drawable.ic_title_home, R.string.description_home, homeClickListener, true); } else { // Add logo ImageButton logo = new ImageButton(mActivity, null, R.attr.actionbarCompatLogoStyle); logo.setOnClickListener(homeClickListener); actionBarCompat.addView(logo); } // Add title text TextView titleText = new TextView(mActivity, null, R.attr.actionbarCompatTextStyle); titleText.setLayoutParams(springLayoutParams); titleText.setText(title); actionBarCompat.addView(titleText); setActionBarColor(color); }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.view_zenoss_event, container, false); Title = (TextView) rootView.findViewById(R.id.EventTitle); Component = (TextView) rootView.findViewById(R.id.Componant); EventClass = (TextView) rootView.findViewById(R.id.EventClass); Summary = (TextView) rootView.findViewById(R.id.Summary); FirstTime = (TextView) rootView.findViewById(R.id.FirstTime); LastTime = (TextView) rootView.findViewById(R.id.LastTime); ackIcon = (ImageView) rootView.findViewById(R.id.ackIcon); img = (ImageView) rootView.findViewById(R.id.summaryImage); EventCount = (TextView) rootView.findViewById(R.id.EventCount); agent = (TextView) rootView.findViewById(R.id.Agent); logList = (LinearLayout) rootView.findViewById(R.id.LogList); progressbar = (ProgressBar) rootView.findViewById(R.id.progressBar); Typeface Titles = Typeface.create("sans-serif-light", Typeface.NORMAL); Typeface Subtitles = Typeface.create("sans-serif", Typeface.BOLD); Title.setTypeface(Titles);/* w ww . jav a 2 s . co m*/ try { if (getActivity().getIntent().hasExtra("EventCount")) { EventCount.setText( "Count: " + Integer.toString(getActivity().getIntent().getIntExtra("EventCount", 0))); } else if (getArguments().getInt("EventCount", 0) != 0) { EventCount.setText("Count: " + Integer.toString(getArguments().getInt("EventCount", 0))); } else { EventCount.setText("Count: 0"); } } catch (Exception e) { e.printStackTrace(); } try { if (getActivity().getIntent().hasExtra("EventTitle")) { Title.setText(getActivity().getIntent().getStringExtra("EventTitle")); } else if (!getArguments().getString("EventTitle").equals("")) { Title.setText(getArguments().getString("EventTitle")); } else { Title.setText(getActivity().getString(R.string.eventDetailsTitlePlaceholder)); } } catch (Exception e) { e.printStackTrace(); } ackIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { progressbar.setVisibility(View.VISIBLE); ((Thread) new Thread() { public void run() { if (settings.getBoolean(ZenossAPI.PREFERENCE_IS_ZAAS, false)) { API = new ZenossAPIZaas(); } else { API = new ZenossAPICore(); } ZenossCredentials credentials = null; try { credentials = new ZenossCredentials(getActivity()); } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "credentials", e); credentials = null; } try { API.Login(credentials); JSONObject ackJSON = API.AcknowledgeEvent(getArguments().getString("EventID")); if (ackJSON.getJSONObject("result").getBoolean("success")) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { progressbar.setVisibility(View.INVISIBLE); ackIcon.setImageResource(R.drawable.ic_acknowledged); mCallbacks.onItemAcknowledged(getArguments().getInt("position")); } }); RhybuddDataSource datasource = null; try { datasource = new RhybuddDataSource(getActivity()); datasource.open(); datasource.ackEvent(getArguments().getString("EventID")); } catch (Exception e) { e.printStackTrace(); BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "DBUpdate", e); } finally { if (null != datasource) datasource.close(); } } else { Toast.makeText(getActivity(), "Unable to acknowledge alert", Toast.LENGTH_SHORT) .show(); } } catch (Exception e) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getActivity(), "Unable to acknowledge alert", Toast.LENGTH_SHORT) .show(); } }); BugSenseHandler.sendExceptionMessage("ViewZenossEventFragment", "outer try", e); } } }).start(); } }); return rootView; }
From source file:fm.krui.kruifm.StreamFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Instantiate class members prefManager = new PreferenceManager(getActivity()); favTrackManager = new FavoriteTrackManager(getActivity()); // FIXME: Move these to PreferenceManager after expanding its scope for cleaner code trackPrefs = getActivity().getSharedPreferences(StreamService.PREFS_NAME, 0); // Instantiate broadcast receiver broadcastReceiver = new BroadcastReceiver() { @Override/*from ww w . ja v a2 s.co m*/ public void onReceive(Context context, Intent intent) { processBroadcastCommand(intent); } }; // Determine the URL we need to use to stream based on the station tag and quality preferences streamUrl = getStreamUrl(stationTag); Log.v(TAG, "streamUrl is now set to: " + streamUrl); // Perform initial configuration of audio server changeUrl(stationTag); // Begin buffering the audio startAudio((ImageView) getActivity().findViewById(R.id.play_audio_imageview)); // Build play button listener final ImageView playButton = (ImageView) getActivity().findViewById(R.id.play_audio_imageview); playButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { handleAudio(playButton); } }); // Build volume seek bar listener // ** DISABLED FOR NOW -- This might be completely thrown out. ** /*final SeekBar volumeSeekBar = (SeekBar)getActivity().findViewById(R.id.volume_seekbar); volumeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { // When seek bar progress is changed, change the audio of the media player appropriately. @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // Send new volume via intent? Will this be slow? } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); */ // Build settings button listener and apply it to settings icon and submit button View.OnClickListener flipListener = new View.OnClickListener() { @Override public void onClick(View v) { // Card flip animation which toggles between stream controls and settings views flipCard(); } }; final ImageView settingsButton = (ImageView) getActivity().findViewById(R.id.stream_settings_imageview); final Button saveSettingsButton = (Button) getActivity().findViewById(R.id.set_stream_settings_button); settingsButton.setOnClickListener(flipListener); saveSettingsButton.setOnClickListener(flipListener); // Build favorite button listener final ImageView favoriteButton = (ImageView) getActivity().findViewById(R.id.stream_favorite_imageview); favoriteButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (trackIsFavorite) { favoriteButton.setImageResource(R.drawable.star_unfilled_white); trackIsFavorite = false; removeTrackFromFavorites(); } else { favoriteButton.setImageResource(R.drawable.star_filled_white); trackIsFavorite = true; addTrackToFavorites(); } } }); // Build settings switches final Switch streamQualitySwitch = (Switch) getActivity().findViewById(R.id.stream_quality_switch); final Switch albumArtSwitch = (Switch) getActivity().findViewById(R.id.stream_album_art_switch); // Set initial state of switches albumArtSwitch.setChecked(prefManager.getAlbumArtDownloadPreference()); if (prefManager.getStreamQuality() == prefManager.HIGH_QUALITY) { streamQualitySwitch.setChecked(true); } else { streamQualitySwitch.setChecked(false); } // Assign listeners to switches streamQualitySwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { prefManager.setStreamQuality(prefManager.HIGH_QUALITY); Log.v(TAG, "Stream quality setting is now: " + prefManager.getStreamQuality()); } else { prefManager.setStreamQuality(prefManager.LOW_QUALITY); Log.v(TAG, "Stream quality setting is now: " + prefManager.getStreamQuality()); } changeUrl(stationSpinnerPosition); } }); albumArtSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { prefManager.setAlbumArtDownloadPreference(true); Log.v(TAG, "Album Art Download setting is now " + prefManager.getAlbumArtDownloadPreference()); } else { prefManager.setAlbumArtDownloadPreference(false); Log.v(TAG, "Album Art Download setting is now " + prefManager.getAlbumArtDownloadPreference()); } } }); }
From source file:SwipeListViewTouchListener.java
/** * Sets current item's front view/* w ww. jav a 2 s . c o m*/ * * @param frontView Front view */ private void setFrontView(View frontView) { this.frontView = frontView; frontView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { swipeListView.onClickFrontView(downPosition); } }); if (swipeOpenOnLongPress) { frontView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openAnimate(downPosition); return false; } }); } }
From source file:mx.klozz.xperience.tweaker.fragments.CPUSettings.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup root, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.cpu_settings, root, false); mIsTegra3 = new File(TEGRA_MAX_FREQ_PATH).exists(); mIsDynFreq = new File(DYN_MAX_FREQ_PATH).exists() && new File(DYN_MIN_FREQ_PATH).exists(); lCurrentCPU = (LinearLayout) view.findViewById(R.id.lCurCPU); mCurFreq = (TextView) view.findViewById(R.id.current_speed); mCurFreq.setOnClickListener(new View.OnClickListener() { @Override/*from www.jav a 2s . c o m*/ public void onClick(View view) { if (nCpus == 1) return; if (++MainActivity.CurrentCPU > (nCpus - 1)) MainActivity.CurrentCPU = 0; setCPUval(MainActivity.CurrentCPU); } }); mCurFreq.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { if (new File(CPU_ON_PATH.replace("cpu0", "cpu" + MainActivity.CurrentCPU)).exists() && MainActivity.CurrentCPU > 0) { final StringBuilder sb = new StringBuilder(); if (MainActivity.mCPUOn.get(MainActivity.CurrentCPU).equals("1")) { sb.append("set_val \"").append(CPU_ON_PATH.replace("cpu0", "cpu" + MainActivity.CurrentCPU)) .append("\" \"0\";\n"); MainActivity.mCPUOn.set(MainActivity.CurrentCPU, "0"); } else { sb.append("set_val \"").append(CPU_ON_PATH.replace("cpu0", "cpu" + MainActivity.CurrentCPU)) .append("\" \"1\";\n"); MainActivity.mCPUOn.set(MainActivity.CurrentCPU, "1"); } Helpers.shExec(sb, context, true); setCPUval(MainActivity.CurrentCPU); } return true; } }); final int mFrequenciesNum = MainActivity.mAvailableFrequencies.length - 1; mMaxSlider = (SeekBar) view.findViewById(R.id.max_slider); mMaxSlider.setMax(mFrequenciesNum); mMaxSlider.setOnSeekBarChangeListener(this); mMaxSpeedText = (TextView) view.findViewById(R.id.max_speed_text); mMinSlider = (SeekBar) view.findViewById(R.id.min_slider); mMinSlider.setMax(mFrequenciesNum); mMinSlider.setOnSeekBarChangeListener(this); mMinSpeedText = (TextView) view.findViewById(R.id.min_speed_text); mGovernor = (Spinner) view.findViewById(R.id.pref_governor); String[] mAvailableGovernors = Helpers.LeerUnaLinea(GOVERNORS_LIST_PATH).split(" "); ArrayAdapter<CharSequence> governorAdapter = new ArrayAdapter<CharSequence>(context, android.R.layout.simple_spinner_item); governorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); for (String mAvailableGovernor : mAvailableGovernors) { governorAdapter.add(mAvailableGovernor.trim()); } mGovernor.setAdapter(governorAdapter); mGovernor.setSelection(Arrays.asList(mAvailableGovernors) .indexOf(MainActivity.mCurrentGovernor.get(MainActivity.CurrentCPU))); mGovernor.post(new Runnable() { public void run() { mGovernor.setOnItemSelectedListener(new GovListener()); } }); mIo = (Spinner) view.findViewById(R.id.pref_io); String[] mAvailableIo = Helpers.getAvailableIOSchedulers(IO_SCHEDULER_PATH); ArrayAdapter<CharSequence> ioAdapter = new ArrayAdapter<CharSequence>(context, android.R.layout.simple_spinner_item); ioAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); for (String aMAvailableIo : mAvailableIo) { ioAdapter.add(aMAvailableIo); } mIo.setAdapter(ioAdapter); mIo.setSelection( Arrays.asList(mAvailableIo).indexOf(MainActivity.mCurrentIOSched.get(MainActivity.CurrentCPU))); mIo.post(new Runnable() { public void run() { mIo.setOnItemSelectedListener(new IOListener()); } }); Switch mSetOnBoot = (Switch) view.findViewById(R.id.cpu_sob); mSetOnBoot.setChecked(mPreferences.getBoolean(CPU_SOB, false)); mSetOnBoot.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton v, boolean checked) { final SharedPreferences.Editor editor = mPreferences.edit(); editor.putBoolean(CPU_SOB, checked); if (checked) { for (int i = 0; i < nCpus; i++) { editor.putString(PREF_MIN_CPU + i, MainActivity.mMinimunFreqSetting.get(i)); editor.putString(PREF_MAX_CPU + i, MainActivity.mMaximunFreqSetting.get(i)); editor.putString(PREF_GOV, MainActivity.mCurrentGovernor.get(i)); editor.putString(PREF_IO, MainActivity.mCurrentIOSched.get(i)); editor.putString("cpuon" + i, MainActivity.mCPUOn.get(i)); } } editor.apply(); } }); //if(nCpus>1){ LinearLayout vcpus[] = new LinearLayout[nCpus]; for (int i = 0; i < nCpus; i++) { vcpus[i] = (LinearLayout) inflater.inflate(R.layout.cpu_view, root, false); vcpus[i].setId(i); TextView nc = (TextView) vcpus[i].findViewById(R.id.ncpu); nc.setText(Integer.toString(i + 1)); if (i != MainActivity.CurrentCPU) nc.setText(" "); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, (float) 0.1); lCurrentCPU.addView(vcpus[i], params); } //} setCPUval(MainActivity.CurrentCPU); return view; }
From source file:com.codegarden.nativenavigation.JuceActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); isScreenSaverEnabled = true;/*ww w. ja v a 2 s . c o m*/ viewHolder = new ViewHolder(this); setContentView(viewHolder); // -- Custom native UI setContentView(R.layout.main_activity); LinearLayout juceViewContainer = (LinearLayout) findViewById(R.id.juce_view_container); juceViewContainer.addView(viewHolder); final Toolbar toolbar = (Toolbar) findViewById(R.id.detail_toolbar); messageTitle = new StringBuilder(); messageTitle.append("JUCE meets Android"); toolbar.setTitle(messageTitle); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own detail action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); initialiseData(); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.left_drawer); LinearLayoutManager llm = new LinearLayoutManager(this); recyclerView.setLayoutManager(llm); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { public void onDrawerClosed(View view) { toolbar.setTitle(messageTitle); } public void onDrawerOpened(View drawerView) { toolbar.setTitle(drawerTitle); } }; drawerLayout.setDrawerListener(toggle); toggle.syncState(); MessageListAdapter adapter = new MessageListAdapter(messages, messageTitle, drawerLayout); recyclerView.setAdapter(adapter); //-------------------------------------- setVolumeControlStream(AudioManager.STREAM_MUSIC); }