List of usage examples for android.app Dialog Dialog
public Dialog(@NonNull Context context)
From source file:com.prad.yahooweather.YahooWeatherActivity.java
private void showFacebookshareDialog(String okButotnText) { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.dialog_layout); dialog.setTitle("Post to Facebook"); Button dialogButton = (Button) dialog.findViewById(R.id.cancel_dialog); // if button is clicked, close the custom dialog dialogButton.setOnClickListener(new OnClickListener() { @Override/*ww w. ja va 2s. c o m*/ public void onClick(View v) { dialog.dismiss(); } }); Button postButton = (Button) dialog.findViewById(R.id.post_to_facebook); postButton.setText(okButotnText); // if button is clicked, close the custom dialog postButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { onClickPostStatusUpdate(); dialog.dismiss(); } }); dialog.show(); }
From source file:com.equalsd.recon.UserActivity.java
private void alertDialogClick() { clickWrap = new Dialog(UserActivity.this); clickWrap.setContentView(R.layout.clickwrap_dialogue); clickWrap.setTitle(clickWrapTitle);/*from ww w . ja v a 2 s.c o m*/ clickWrapText = (TextView) clickWrap.findViewById(R.id.clickText); clickWrapText.setText(Html.fromHtml(textWrap)); refuse = (Button) clickWrap.findViewById(R.id.refuse); refuse.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { clickWrap.dismiss(); } }); accept = (Button) clickWrap.findViewById(R.id.accept); accept.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //upload(); //v.setEnabled(false); if (clickWrapTitle.matches("License Agreement")) { clickWrapTitle = "Private Policy"; new RequestTask().execute("http://ada-veracity.com/signup-wrapContent.php?content=private"); clickWrap.dismiss(); Toast.makeText(getApplicationContext(), "Working...", Toast.LENGTH_LONG).show(); } else { check = false; querySubmit(); } //Toast.makeText(getApplicationContext(), "UPLOAD", Toast.LENGTH_LONG).show(); } }); clickWrap.show(); }
From source file:com.inc.playground.playground.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED); // Create the adapter that will return a fragment for each of the three primary sections // of the app. mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager()); globalVariables = ((GlobalVariables) getApplication()); // Set up the action bar. final ActionBar actionBar = getActionBar(); setPlayGroundActionBar();/* w w w. j av a 2 s. com*/ //set actionBar color actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.primaryColor))); actionBar.setStackedBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.secondaryColor))); // Specify that the Home/Up button should not be enabled, since there is no hierarchical // parent. //actionBar.setHomeButtonEnabled(false); actionBar.setDisplayShowHomeEnabled(false); // Specify that we will be displaying tabs in the action bar. actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Set up the ViewPager, attaching the adapter and setting up a listener for when the // user swipes between sections. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mAppSectionsPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { // When swiping between different app sections, select the corresponding tab. // We can also use ActionBar.Tab#select() to do this if we have a reference to the // Tab. actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by the adapter. // Also specify this Activity object, which implements the TabListener interface, as the // listener for when this tab is selected. actionBar.addTab(actionBar.newTab().setTabListener(this)); } actionBar.getTabAt(0).setIcon(R.drawable.pg_list_view); actionBar.getTabAt(1).setIcon(R.drawable.pg_map_view); actionBar.getTabAt(2).setIcon(R.drawable.pg_calendar_view); //NavigationDrawer handling (e.g the list from leftside): mTitle = mDrawerTitle = getTitle(); mDrawerLayout = (DrawerLayout) findViewById(R.id.menu_layout); mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.pg_menu, /* nav drawer icon to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description */ R.string.drawer_close /* "close drawer" description */ ) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); getActionBar().setTitle(mTitle); } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); getActionBar().setTitle(mDrawerTitle); } }; // Set the drawer toggle as the DrawerListener mDrawerLayout.setDrawerListener(mDrawerToggle); mDrawerLayout.closeDrawers(); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); // all linear layout from slider menu /*Home button */ LinearLayout ll_Home = (LinearLayout) findViewById(R.id.ll_home); ll_Home.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // new changes Intent iv = new Intent(MainActivity.this, MainActivity.class); startActivity(iv); finish(); } }); /*Login button */ LinearLayout ll_Login = (LinearLayout) findViewById(R.id.ll_login); ll_Login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // new changes LinearLayout ll_Login = (LinearLayout) v; TextView loginTxt = (TextView) findViewById(R.id.login_txt); if (loginTxt.getText().equals("Login")) { Intent iv = new Intent(MainActivity.this, Login.class); startActivity(iv); finish(); } else if (loginTxt.getText().equals("Logout")) { final Dialog alertDialog = new Dialog(MainActivity.this); alertDialog.setContentView(R.layout.logout_dilaog); alertDialog.setTitle("Logout"); alertDialog.findViewById(R.id.ok_btn).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.clear(); editor.commit(); ImageView loginImg = (ImageView) findViewById(R.id.login_img); TextView loginTxt = (TextView) findViewById(R.id.login_txt); loginTxt.setText("Login"); loginImg.setImageResource(R.drawable.pg_action_lock_open); globalVariables = ((GlobalVariables) getApplication()); globalVariables.SetCurrentUser(null); globalVariables.SetUserPictureBitMap(null); globalVariables.SetUsersList(null); globalVariables.SetUsersImagesMap(null); Util.clearCookies(getApplicationContext()); Intent iv = new Intent(MainActivity.this, MainActivity.class); startActivity(iv); finish(); } }); alertDialog.findViewById(R.id.cancel_btn).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent iv = new Intent(MainActivity.this, MainActivity.class); startActivity(iv); finish(); } }); alertDialog.show(); //<-- See This! } } }); /*Setting button*/ LinearLayout ll_Setting = (LinearLayout) findViewById(R.id.ll_settings); ll_Setting.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // new changes Intent iv = new Intent(MainActivity.this, com.inc.playground.playground.upLeft3StripesButton.SettingsActivity.class); startActivity(iv); finish(); } }); /*My profile button*/ LinearLayout ll_my_profile = (LinearLayout) findViewById(R.id.ll_my_profile); ll_my_profile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // new changes globalVariables = ((GlobalVariables) getApplication()); User currentUser = globalVariables.GetCurrentUser(); if (currentUser == null) { Toast.makeText(MainActivity.this, "You are not logged in", Toast.LENGTH_LONG).show(); } else { Intent iv = new Intent(MainActivity.this, com.inc.playground.playground.upLeft3StripesButton.MyProfile.class); //for my profile iv.putExtra("name", currentUser.getName()); iv.putExtra("createdNumOfEvents", currentUser.getCreatedNumOfEvents()); //pass events iv.putExtra("events", currentUser.getEvents()); iv.putExtra("events_wait4approval", currentUser.getEvents_wait4approval()); iv.putExtra("events_decline", currentUser.getEvents_decline()); iv.putExtra("photoUrl", currentUser.getPhotoUrl()); startActivity(iv); // } } }); LinearLayout ll_aboutUs = (LinearLayout) findViewById(R.id.ll_about); ll_aboutUs.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // new changes Intent iv = new Intent(MainActivity.this, AboutUs.class); startActivity(iv); finish(); } }); }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { getActivity().finish();/*from w w w . j av a2 s.c o m*/ return true; } case R.id.AddLog: { try { addMessageDialog = new Dialog(getActivity()); addMessageDialog.setContentView(R.layout.add_message); addMessageDialog.setTitle("Add Message to Event Log"); ((Button) addMessageDialog.findViewById(R.id.SaveButton)) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AddLogMessage(((EditText) addMessageDialog.findViewById(R.id.LogMessage)).getText() .toString()); addMessageDialog.dismiss(); } }); addMessageDialog.show(); return true; } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "AddLog", e); return false; } } case R.id.escalate: { try { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); // Add data to the intent, the receiving app will decide what to do with it. intent.putExtra(Intent.EXTRA_SUBJECT, "Escalation of Zenoss Event on " + Title.getText()); String EventDetails = Summary.getText() + "\r\r\n" + LastTime.getText() + "\r\r\n" + "Count: " + EventCount.getText(); intent.putExtra(Intent.EXTRA_TEXT, EventDetails); startActivity(Intent.createChooser(intent, "How would you like to escalate this event?")); return true; } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "escalate", e); return false; } } default: { return false; } } }
From source file:com.trukr.shipper.fragment.RequestStatus.java
private void showImageAlert() { dialogCamera = new Dialog(mContext); dialogCamera.requestWindowFeature(Window.FEATURE_NO_TITLE); //before dialogCamera.setContentView(R.layout.dialog_more_icon); dialogCamera.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); dialogCamera.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); dialogCamera.show();//from w w w . ja v a2 s . co m TextView btnContact = (TextView) dialogCamera.findViewById(R.id.btnContact); TextView btnJobDetail = (TextView) dialogCamera.findViewById(R.id.btnJobDetail); TextView btnCancelOrder = (TextView) dialogCamera.findViewById(R.id.btnCancelOrder); TextView btnCancel = (TextView) dialogCamera.findViewById(R.id.btnCancel); /* Contact button click Method */ btnContact.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialogCamera.dismiss(); contactalertDialog(RequestStatus.this, IConstant.alert, getResources().getString(R.string.contactalert)); } }); /* JobDetail button click Method */ btnJobDetail.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialogCamera.dismiss(); Intent intent = new Intent(RequestStatus.this, CurrentJobTabLayout.class); intent.putExtra("OrderId", orderId); startActivity(intent); } }); /* CancelOrder button click Method */ btnCancelOrder.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialogCamera.dismiss(); cancelalertdialog(RequestStatus.this, IConstant.alert, getResources().getString(R.string.cancelorder), StatusCode); } }); /* Cancel button click Method */ btnCancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { dialogCamera.cancel(); } }); }
From source file:com.popdeem.sdk.uikit.fragment.PDUIRewardsFragment.java
private void performRewardClick(View view) { final int position = recyclerView.getChildAdapterPosition(view); if (position == RecyclerView.NO_POSITION) { return;/*from w ww .ja v a2 s . c o m*/ } final PDReward reward = mRewards.get(position); // if(BuildConfig.DEBUG){ // showDebugGratitude(reward.getId()); // return; // } if (reward.getAction().equalsIgnoreCase(PDReward.PD_REWARD_ACTION_NONE)) { final Dialog dialog = new Dialog(getActivity()); PDUIDialogUtils.setMargins(dialog, 25, 100, 25, 100); dialog.setContentView(R.layout.claim_alert_dialog); Button claim = (Button) dialog.findViewById(R.id.button_claim); Button cancel = (Button) dialog.findViewById(R.id.button_cancel); ImageView icon = (ImageView) dialog.findViewById(R.id.icon); String imageUrl = reward.getCoverImage(); if (imageUrl == null || imageUrl.isEmpty() || imageUrl.contains("default")) { Glide.with(getActivity()).load(R.drawable.pd_ui_star_icon).dontAnimate() .error(R.drawable.pd_ui_star_icon).dontAnimate().placeholder(R.drawable.pd_ui_star_icon) .into(icon); } else { Glide.with(getActivity()).load(imageUrl).dontAnimate().error(R.drawable.pd_ui_star_icon) .dontAnimate().placeholder(R.drawable.pd_ui_star_icon).into(icon); } claim.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); claimNoActionReward(position, reward); } }); cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); TextView tvTitle = dialog.findViewById(R.id.alertTitle); tvTitle.setText(reward.getDescription()); TextView message = dialog.findViewById(R.id.message); message.setText(reward.getRules()); dialog.show(); } else if (!reward.getAction().equalsIgnoreCase(PDReward.PD_REWARD_ACTION_SOCIAL_LOGIN)) { Intent intent = new Intent(getActivity(), PDUIClaimActivity.class); intent.putExtra("reward", new Gson().toJson(reward, PDReward.class)); startActivityForResult(intent, PD_CLAIM_REWARD_REQUEST_CODE); } }
From source file:com.starwood.anglerslong.MainActivity.java
/***************************************************************************************** * Dialog to show fishing regulations/*w w w . j a v a2 s . c om*/ *****************************************************************************************/ private void displayDialog() { final Dialog dialog = new Dialog(this); dialog.setContentView(R.layout.fishing_reg_dialog); dialog.setTitle("Select a State:"); dialog.findViewById(R.id.sc_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(scUrl)); startActivity(browserIntent); } }); dialog.findViewById(R.id.ga_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(gaUrl)); startActivity(browserIntent); } }); dialog.findViewById(R.id.fl_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(flUrl)); startActivity(browserIntent); } }); dialog.findViewById(R.id.al_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(alUrl)); startActivity(browserIntent); } }); dialog.findViewById(R.id.ms_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(msUrl)); startActivity(browserIntent); } }); dialog.setCanceledOnTouchOutside(true); dialog.show(); }
From source file:com.sentaroh.android.TaskAutomation.Config.ProfileMaintenanceTaskProfile.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { if (DEBUG_ENABLE) Log.v(APPLICATION_TAG, "onCreateDialog"); mDialog = new Dialog(getActivity()); mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); if (!mTerminateRequired) { initViewWidget();/*ww w. j av a 2 s . com*/ } return mDialog; }
From source file:com.near.chimerarevo.fragments.CommentsFragment.java
@SuppressLint("SetJavaScriptEnabled") private void loadDisqusOAuth() { if (getActivity().getSharedPreferences(Constants.PREFS_TAG, Context.MODE_PRIVATE) .getString(Constants.KEY_REFRESH_TOKEN, "").length() > 1) { RequestBody formBody = new FormEncodingBuilder().add("grant_type", "refresh_token") .add("client_id", Constants.DISQUS_API_KEY).add("client_secret", Constants.DISQUS_API_SECRET) .add("refresh_token", getActivity().getSharedPreferences(Constants.PREFS_TAG, Context.MODE_PRIVATE) .getString(Constants.KEY_REFRESH_TOKEN, "")) .build();// www. ja va2s . c om Request request = new Request.Builder().url(Constants.DISQUS_TOKEN_URL).post(formBody).tag(FRAGMENT_TAG) .build(); if (mDialog == null) mDialog = ProgressDialogUtils.getInstance(getActivity(), R.string.text_login); else mDialog = ProgressDialogUtils.modifyInstance(mDialog, R.string.text_login); mDialog.show(); OkHttpUtils.getInstance().newCall(request).enqueue(new PostAccessTokenCallback()); return; } final Dialog dialog = new Dialog(getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.webview_layout); dialog.setCancelable(true); dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { isDialogOpen = false; mFab.show(); } }); dialog.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss(DialogInterface arg0) { isDialogOpen = false; mFab.show(); } }); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) CookieManager.getInstance().removeAllCookies(null); else { CookieSyncManager.createInstance(getActivity()); CookieManager.getInstance().removeAllCookie(); } WebView wv = (WebView) dialog.findViewById(R.id.webview); wv.getSettings().setJavaScriptEnabled(true); wv.getSettings().setSaveFormData(false); wv.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); dialog.findViewById(R.id.progressContainer).setVisibility(View.GONE); dialog.findViewById(R.id.webViewContainer).setVisibility(View.VISIBLE); } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); dialog.findViewById(R.id.progressContainer).setVisibility(View.VISIBLE); dialog.findViewById(R.id.webViewContainer).setVisibility(View.GONE); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { boolean state = super.shouldOverrideUrlLoading(view, url); if (url.contains(Constants.SITE_URL)) { String code = url.split("code=")[1]; RequestBody formBody = new FormEncodingBuilder().add("grant_type", "authorization_code") .add("client_id", Constants.DISQUS_API_KEY) .add("client_secret", Constants.DISQUS_API_SECRET) .add("redirect_uri", Constants.SITE_URL).add("code", code).build(); Request request = new Request.Builder().url(Constants.DISQUS_TOKEN_URL).post(formBody) .tag(FRAGMENT_TAG).build(); if (mDialog == null) mDialog = ProgressDialogUtils.getInstance(getActivity(), R.string.text_login); else mDialog = ProgressDialogUtils.modifyInstance(mDialog, R.string.text_login); dialog.dismiss(); mDialog.show(); OkHttpUtils.getInstance().newCall(request).enqueue(new PostAccessTokenCallback()); } return state; } @Override public void onReceivedSslError(WebView view, @NonNull SslErrorHandler handler, SslError error) { handler.proceed(); } }); wv.loadUrl(URLUtils.getDisqusAuthUrl()); isDialogOpen = true; mFab.hide(); dialog.show(); }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search_results_resource); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); Bundle extra = getIntent().getExtras(); if (extra != null) { searchKeyword = extra.getString("keyWord").trim(); }/*w ww . j a va 2 s . c o m*/ prefsPrivate = getSharedPreferences(PREFS_PRIVATE, Context.MODE_PRIVATE); token = prefsPrivate.getString("token", ""); imageViewClose = (ImageView) findViewById(R.id.imageViewClose); imageViewSearch = (ImageView) findViewById(R.id.imageViewSearch); editTextSearchResults = (EditText) findViewById(R.id.textViewSearch); switchResColl = (Switch) findViewById(R.id.switchResColl); dialog1 = new Dialog(this); editTextSearchResults.setText(searchKeyword); imm = (InputMethodManager) this.getSystemService(Service.INPUT_METHOD_SERVICE); dialog = new ProgressDialog(this); dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); if (checkInternetConnection()) { new getResources().execute(); } else { showDialog("Please Check Internet connection"); new getResources().execute(); } // scroll views videoScroll = (HorizontalScrollView) findViewById(R.id.videoScroll); interactiveScroll = (HorizontalScrollView) findViewById(R.id.interactiveScroll); websiteScroll = (HorizontalScrollView) findViewById(R.id.websiteScroll); textbookScroll = (HorizontalScrollView) findViewById(R.id.textbookScroll); examScroll = (HorizontalScrollView) findViewById(R.id.examScroll); handoutScroll = (HorizontalScrollView) findViewById(R.id.handoutScroll); slideScroll = (HorizontalScrollView) findViewById(R.id.slideScroll); lessonScroll = (HorizontalScrollView) findViewById(R.id.lessonScroll); // category image load more resources videoRight = (ImageView) findViewById(R.id.videoRight); interactiveRight = (ImageView) findViewById(R.id.interactiveRight); websiteRight = (ImageView) findViewById(R.id.websiteRight); textbookRight = (ImageView) findViewById(R.id.textbookRight); examRight = (ImageView) findViewById(R.id.examRight); handoutRight = (ImageView) findViewById(R.id.handoutRight); slideRight = (ImageView) findViewById(R.id.slideRight); lessonRight = (ImageView) findViewById(R.id.lessonRight); videoRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { videoCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5Videos().execute(); } else { showDialog("Please Check Internet connection"); } } }); interactiveRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { interactiveCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5interactive().execute(); } else { showDialog("Please Check Internet connection"); } } }); imageViewSearch.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String searchKeyword = editTextSearchResults.getText().toString().trim(); if (searchKeyword.length() > 0) { Intent intentResResults = new Intent(getBaseContext(), SearchResults_resource.class); searchKeyword = editTextSearchResults.getText().toString().trim(); Log.i("Search :", searchKeyword); Bundle extras = new Bundle(); extras.putString("keyWord", searchKeyword); intentResResults.putExtras(extras); startActivity(intentResResults); finish(); } else { dialog1.setTitle("Please enter a Search keyword"); dialog1.show(); } } }); websiteRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { websiteCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5website().execute(); } else { showDialog("Please Check Internet connection"); } } }); textbookRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { textbookCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5textbook().execute(); } else { showDialog("Please Check Internet connection"); } } }); examRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { examCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5exam().execute(); } else { showDialog("Please Check Internet connection"); } } }); handoutRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { handoutCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5handout().execute(); } else { showDialog("Please Check Internet connection"); } } }); slideRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { slideCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5slide().execute(); } else { showDialog("Please Check Internet connection"); } } }); lessonRight.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (checkInternetConnection()) { lessonCount++; dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getNext5lesson().execute(); } else { showDialog("Please Check Internet connection"); } } }); editTextSearchResults.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: String searchKeyword = editTextSearchResults.getText().toString().trim(); if (searchKeyword.length() > 0) { Log.i("Resources", searchKeyword); Intent intentResResults = new Intent(getBaseContext(), SearchResults_resource.class); Bundle extras = new Bundle(); extras.putString("keyWord", searchKeyword); intentResResults.putExtras(extras); startActivity(intentResResults); finish(); } else { dialog1.setTitle("Please enter a Search keyword"); dialog1.show(); } return true; default: break; } } return false; } }); imageViewClose.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { finish(); } }); }