List of usage examples for android.view Window FEATURE_NO_TITLE
int FEATURE_NO_TITLE
To view the source code for android.view Window FEATURE_NO_TITLE.
Click Source Link
From source file:com.lifehackinnovations.siteaudit.FloorPlanActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try {// ww w . ja v a 2s . c o m Tabs1.db.showfulldblog(Tabs1.db.TABLE_MCR_METERINGLIST); } catch (Throwable e) { } ctx = this; try { if (Tabs1.foldername.contains("_")) { tempfoldername = Tabs1.foldername.substring(0, Tabs1.foldername.indexOf("_")); } else { tempfoldername = Tabs1.foldername; } Log.d("foldername", tempfoldername); dbtablename = "floorplan"; if (Tabs1.db.checktableindb(dbtablename)) { // } else { try { Tabs1.db.createfloorplandb(dbtablename); } catch (Throwable e) { e.printStackTrace(); } } try { MULTILEVEL = ReadBoolean(this, "multilevel", false); } catch (Throwable e) { System.out.println("couldn't read multilevel value from preferences on start"); MULTILEVEL = false; } try { NGBICONS = ReadBoolean(this, "ngbicons", false); } catch (Throwable e) { System.out.println("couldn't read autorenumber temp sensors value from preferences on start"); NGBICONS = true; } try { DRAWSAMREFERENCE = ReadBoolean(this, "drawsamreferencetable", true); } catch (Throwable e) { } try { RAPIDPLACEMENT = ReadBoolean(this, "rapidplacement", false); } catch (Throwable e) { } // Remove title bar this.requestWindowFeature(Window.FEATURE_NO_TITLE); // Remove notification bar this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); Intent intent = getIntent(); FloorPlanActivity.floorplannumber = intent.getExtras().getInt("floorplannumber"); try { FloorPlanActivity.floorplancount = Tabs1.FloorPlanCount; } catch (Throwable e) { FloorPlanActivity.floorplancount = new File(Tabs1.inputfloorplandirectory).list().length; } MODE = MODE_DONOTHING; progressDialog = new ProgressDialog(this); progressDialog.setIndeterminate(true); if (tempfoldername.equals("Paul")) { progressDialog.setIndeterminateDrawable(getResources().getDrawable(R.anim.paul_animation)); } else if (tempfoldername.equals("Will")) { progressDialog.setIndeterminateDrawable(getResources().getDrawable(R.anim.will_animation)); } else if (tempfoldername.equals("Bill")) { progressDialog.setIndeterminateDrawable(getResources().getDrawable(R.anim.bill_animation)); } else { progressDialog.setIndeterminateDrawable( getResources().getDrawable(R.anim.progress_dialog_icon_drawable_animation)); } progressDialog.setIcon(R.drawable.ic_launcher); progressDialog.setTitle("Loading"); progressDialog.setMessage("Please Wait"); progressDialog.setCancelable(false); rl = new RelativeLayout(this); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); rl.setLayoutParams(rllp); toolbar = new View(this); LayoutInflater inflater = (LayoutInflater) getBaseContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); toolbar = inflater.inflate(R.layout.toolbar, null); toptoolbar = (View) toolbar.findViewById(R.id.toptoolbar); righttoolbar = (View) toolbar.findViewById(R.id.righttoolbar); righttoolbarbuttonparent = (View) toolbar.findViewById(R.id.righttoolbarbuttonparent); righttoolbarscrollview = (ScrollView) toolbar.findViewById(R.id.righttoolbarscrollview); floorplanprevious = (ImageView) toolbar.findViewById(R.id.floorplanprevious); floorplannext = (ImageView) toolbar.findViewById(R.id.floorplannext); fullscreen = (ImageView) toolbar.findViewById(R.id.fullscreen); unfullscreen = (ImageView) toolbar.findViewById(R.id.unfullscreen); showlayers = (ImageView) toolbar.findViewById(R.id.layers); resizeicons = (ImageView) toolbar.findViewById(R.id.resizeicons); metersperpixelbutton = (ImageView) toolbar.findViewById(R.id.metersperpixelbutton); resizeiconsseekbar = (SeekBar) toolbar.findViewById(R.id.resizeiconsseekbar); resizeiconsseekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub view.invalidate(); } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } }); resizeiconscancel = (Button) toolbar.findViewById(R.id.resizeiconscancel); resizeiconsfinished = (Button) toolbar.findViewById(R.id.resizeiconsfinished); preferences = (ImageView) toolbar.findViewById(R.id.preferences); floorplantitle = (TextView) toolbar.findViewById(R.id.floorplantitle); BMS = (ImageView) toolbar.findViewById(R.id.bms); ELC = (ImageView) toolbar.findViewById(R.id.elc); Gateway = (ImageView) toolbar.findViewById(R.id.gateway); SAM = (ImageView) toolbar.findViewById(R.id.sam); tempsensor = (ImageView) toolbar.findViewById(R.id.tempsensor); ethernetport = (ImageView) toolbar.findViewById(R.id.ethernetport); distributionboard = (ImageView) toolbar.findViewById(R.id.distributionboard); samarray = (ImageView) toolbar.findViewById(R.id.samarray); datahub = (ImageView) toolbar.findViewById(R.id.datahub); AddText = (ImageView) toolbar.findViewById(R.id.addtexttofloorplan); legend = (ImageView) toolbar.findViewById(R.id.legend); hiddenaddpicturebutton = new Button(this); hiddenaddpicturebutton.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { int tabforpicture = view.gettabofitemselected(view.itemselectednumber); String foldername = view.getGenericDisplayText(view.itemselectednumber); // System.out.println("this is the name of the new file to be saved."+imageF.getAbsolutePath()); //takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, // Uri.fromFile(imageF)); Intent takePictureIntent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA); u.log("starting activity camera"); PICTURESTARTTIME = System.currentTimeMillis(); TABFORGETPICTURE = tabforpicture; FOLDERNAMEFORGETPICTURE = foldername; startActivityForResult(takePictureIntent, FLOORPLANGETPICFROMCAMERA); } }); hiddeneditpicturebutton = new Button(this); hiddeneditpicturebutton.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { Intent intent = u.openpicture(editpicturelocation); System.out.println("this is the name of the file to be edited." + editpicturelocation); startActivityForResult(intent, EDITPICTUREACTIVITY); } }); floorplantitle.setTextColor(view.presentableblue); floorplantitle.setText(Tabs1.floorplanname); floorplanprevious.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { ACTION = ACTION_FLOORPLANPREVIOUS; view.invalidate(); } }); floorplannext.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { ACTION = ACTION_FLOORPLANNEXT; view.invalidate(); } }); fullscreen.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { ACTION = ACTION_FULLSCREEN; toptoolbar.setVisibility(View.INVISIBLE); righttoolbar.setVisibility(View.INVISIBLE); unfullscreen.setVisibility(View.VISIBLE); } }); unfullscreen.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { ACTION = ACTION_UNFULLSCREEN; toptoolbar.setVisibility(View.VISIBLE); righttoolbar.setVisibility(View.VISIBLE); unfullscreen.setVisibility(View.INVISIBLE); } }); showlayers.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { Log.d("show layers selected", "true"); if (!(ACTION == ACTION_SHOWLAYERS)) { ACTION = ACTION_SHOWLAYERS; } else { ACTION = ACTION_DONOTHING; } view.invalidate(); } }); metersperpixelbutton.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { //show dialog asking if you want scale from google maps, or from 2 points on map getscaledialog(); //startActivity(u.intent("Getscalefromgooglemaps")); } }); resizeicons.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { view.resizeboolean = true; ACTION = ACTION_RESIZEICONS; toptoolbar.setVisibility(View.INVISIBLE); righttoolbar.setVisibility(View.INVISIBLE); resizeiconsseekbar.setVisibility(View.VISIBLE); resizeiconscancel.setVisibility(View.VISIBLE); resizeiconsfinished.setVisibility(View.VISIBLE); } }); resizeiconscancel.setOnClickListener(new Button.OnClickListener() { public void onClick(View arg0) { //restore size //resizeiconsseekbar.setProgress((int)((float)resizeiconsseekbar.getMax()/(float)4)); view.invalidate(); ACTION = ACTION_DONOTHING; toptoolbar.setVisibility(View.VISIBLE); righttoolbar.setVisibility(View.VISIBLE); resizeiconsseekbar.setVisibility(View.INVISIBLE); resizeiconscancel.setVisibility(View.INVISIBLE); resizeiconsfinished.setVisibility(View.INVISIBLE); } }); resizeiconsfinished.setOnClickListener(new Button.OnClickListener() { public void onClick(View arg0) { if (ACTION == ACTION_RESIZEICON) { writeonedbitem(view.itemselectednumber); } else { rewritewholedb(); } ACTION = ACTION_DONOTHING; toptoolbar.setVisibility(View.VISIBLE); righttoolbar.setVisibility(View.VISIBLE); resizeiconsseekbar.setVisibility(View.INVISIBLE); resizeiconscancel.setVisibility(View.INVISIBLE); resizeiconsfinished.setVisibility(View.INVISIBLE); } }); preferences.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { ACTION = ACTION_PREFERENCES; //preferences(); startActivityForResult(u.intent("FloorPlanPrefs"), PREFS); } }); BMS.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_BMS; Log.d("mode", u.s(MODE)); } }); ELC.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_ELC; Log.d("mode", u.s(MODE)); } }); Gateway.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_GATEWAY; Log.d("mode", u.s(MODE)); } }); SAM.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); //MODE = MODE_SAM; //Log.d("mode", u.s(MODE)); int itemnum = -1; for (int k = 0; k < view.i; k++) { if (view.ITEMtype[k] == view.TYPE_ELC) { itemnum = k; } } if (!(itemnum == -1)) { view.addsamsdialog("ELC# " + u.s(view.ELCdisplaynumber[itemnum]) + ": SAMs Menu", itemnum); } } }); tempsensor.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_TEMPSENSOR; Log.d("mode", u.s(MODE)); } }); ethernetport.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_ETHERNETPORT; Log.d("mode", u.s(MODE)); } }); distributionboard.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_DISTRIBUTIONBOARD; Log.d("mode", u.s(MODE)); } }); samarray.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_SAMARRAY; Log.d("mode", u.s(MODE)); } }); datahub.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_DATAHUB; Log.d("mode", u.s(MODE)); } }); AddText.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_ADDTEXT; getaddtextdialog("ADD TEXT", view.i, FloorPlanActivity.this).show(); Log.d("mode", u.s(MODE)); } }); legend.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_LEGEND; Log.d("mode", u.s(MODE)); } }); view = new FloorPlanView(this); view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); rl.addView(view); rl.addView(toolbar); setContentView(rl); //readexcel(); AUTORENUMBERTEMPS = !Tabs1.db.tableexists(dbtablename); WriteBoolean(this, "autorenumbertemps", AUTORENUMBERTEMPS); System.out.println("auto number=" + AUTORENUMBERTEMPS); readdb(); grabsamcounts(); grabelccount(); System.out.println("item" + " " + "type" + " " + "tempcount"); for (int h = 0; h < view.i; h++) { System.out.println(h + " " + view.ITEMtype[h] + " " + view.ITEMtempsensorcount[h]); } } catch (Throwable e) { e.printStackTrace(); finish(); } }
From source file:com.polyvi.xface.extension.inappbrowser.XInAppBrowser.java
/** * ?//w w w. j ava 2s . c o m */ public XInAppBrowser buildBrowser() { mDialog = createDialog(android.R.style.Theme_NoTitleBar, android.R.style.Animation_Dialog, Window.FEATURE_NO_TITLE); LinearLayout mainLayout = buildMainContainerLayout(); if (mIsShowToolBar) { buildToolbar(mainLayout); } createWebView(mUrl, mainLayout); WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); layoutParams.copyFrom(mDialog.getWindow().getAttributes()); layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT; mDialog.getWindow().setAttributes(layoutParams); mDialog.setContentView(mainLayout); return this; }
From source file:com.codetroopers.betterpickers.radialtimepicker.RadialTimePickerDialogFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (getShowsDialog()) { getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); }/* ww w . ja va 2 s . co m*/ View view = inflater.inflate(R.layout.radial_time_picker_dialog, container, false); KeyboardListener keyboardListener = new KeyboardListener(); view.findViewById(R.id.time_picker_dialog).setOnKeyListener(keyboardListener); Resources res = getResources(); TypedArray themeColors = getActivity().obtainStyledAttributes(mStyleResId, R.styleable.BetterPickersDialogs); // Prepare some colors to use. int headerBgColor = themeColors.getColor(R.styleable.BetterPickersDialogs_bpHeaderBackgroundColor, ContextCompat.getColor(getActivity(), R.color.bpBlue)); int bodyBgColor = themeColors.getColor(R.styleable.BetterPickersDialogs_bpBodyBackgroundColor, ContextCompat.getColor(getActivity(), R.color.bpWhite)); int buttonBgColor = themeColors.getColor(R.styleable.BetterPickersDialogs_bpButtonsBackgroundColor, ContextCompat.getColor(getActivity(), R.color.bpWhite)); int buttonTextColor = themeColors.getColor(R.styleable.BetterPickersDialogs_bpButtonsTextColor, ContextCompat.getColor(getActivity(), R.color.bpBlue)); mSelectedColor = themeColors.getColor(R.styleable.BetterPickersDialogs_bpHeaderSelectedTextColor, ContextCompat.getColor(getActivity(), R.color.bpWhite)); mUnselectedColor = themeColors.getColor(R.styleable.BetterPickersDialogs_bpHeaderUnselectedTextColor, ContextCompat.getColor(getActivity(), R.color.radial_gray_light)); mHourPickerDescription = res.getString(R.string.hour_picker_description); mSelectHours = res.getString(R.string.select_hours); mMinutePickerDescription = res.getString(R.string.minute_picker_description); mSelectMinutes = res.getString(R.string.select_minutes); mHourView = (TextView) view.findViewById(R.id.hours); mHourView.setOnKeyListener(keyboardListener); mHourSpaceView = (TextView) view.findViewById(R.id.hour_space); mMinuteSpaceView = (TextView) view.findViewById(R.id.minutes_space); mMinuteView = (TextView) view.findViewById(R.id.minutes); mMinuteView.setOnKeyListener(keyboardListener); mAmPmTextView = (TextView) view.findViewById(R.id.ampm_label); mAmPmTextView.setOnKeyListener(keyboardListener); String[] amPmTexts = new DateFormatSymbols().getAmPmStrings(); mAmText = amPmTexts[0]; mPmText = amPmTexts[1]; mHapticFeedbackController = new HapticFeedbackController(getActivity()); mTimePicker = (RadialPickerLayout) view.findViewById(R.id.time_picker); mTimePicker.setOnValueSelectedListener(this); mTimePicker.setOnKeyListener(keyboardListener); mTimePicker.initialize(getActivity(), mHapticFeedbackController, mInitialHourOfDay, mInitialMinute, mIs24HourMode); int currentItemShowing = HOUR_INDEX; if (savedInstanceState != null && savedInstanceState.containsKey(KEY_CURRENT_ITEM_SHOWING)) { currentItemShowing = savedInstanceState.getInt(KEY_CURRENT_ITEM_SHOWING); } setCurrentItemShowing(currentItemShowing, false, true, true); mTimePicker.invalidate(); mHourView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setCurrentItemShowing(HOUR_INDEX, true, false, true); tryVibrate(); } }); mMinuteView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setCurrentItemShowing(MINUTE_INDEX, true, false, true); tryVibrate(); } }); mTitleTextView = (TextView) view.findViewById(R.id.time_picker_header); if (mTitleText != null) { mTitleTextView.setVisibility(View.VISIBLE); mTitleTextView.setText(mTitleText); } else { mTitleTextView.setVisibility(View.GONE); } mError = (NumberPickerErrorTextView) view.findViewById(R.id.error); if (hasTimeLimits()) { mError.setVisibility(View.INVISIBLE); } else { mError.setVisibility(View.GONE); } mDoneButton = (Button) view.findViewById(R.id.done_button); if (mDoneText != null) { mDoneButton.setText(mDoneText); } mDoneButton.setTextColor(buttonTextColor); mDoneButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mInKbMode && isTypedTimeFullyLegal()) { finishKbMode(false); } else { tryVibrate(); } doneClickValidateAndCallback(); } }); mDoneButton.setOnKeyListener(keyboardListener); Button cancelButton = (Button) view.findViewById(R.id.cancel_button); if (mCancelText != null) { cancelButton.setText(mCancelText); } cancelButton.setTextColor(buttonTextColor); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { tryVibrate(); dismiss(); } }); // Enable or disable the AM/PM view. mAmPmHitspace = view.findViewById(R.id.ampm_hitspace); if (mIs24HourMode) { mAmPmTextView.setVisibility(View.GONE); RelativeLayout.LayoutParams paramsSeparator = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); paramsSeparator.addRule(RelativeLayout.CENTER_IN_PARENT); TextView separatorView = (TextView) view.findViewById(R.id.separator); separatorView.setLayoutParams(paramsSeparator); } else { mAmPmTextView.setVisibility(View.VISIBLE); updateAmPmDisplay(mInitialHourOfDay < 12 ? AM : PM); mAmPmHitspace.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tryVibrate(); int amOrPm = mTimePicker.getIsCurrentlyAmOrPm(); if (amOrPm == AM) { amOrPm = PM; } else if (amOrPm == PM) { amOrPm = AM; } updateAmPmDisplay(amOrPm); mTimePicker.setAmOrPm(amOrPm); } }); } mAllowAutoAdvance = true; setHour(mInitialHourOfDay, true); setMinute(mInitialMinute); // Set up for keyboard mode. mDoublePlaceholderText = res.getString(R.string.time_placeholder); mDeletedKeyFormat = res.getString(R.string.deleted_key); mPlaceholderText = mDoublePlaceholderText.charAt(0); mAmKeyCode = mPmKeyCode = -1; generateLegalTimesTree(); if (mInKbMode) { mTypedTimes = savedInstanceState.getIntegerArrayList(KEY_TYPED_TIMES); tryStartingKbMode(-1); mHourView.invalidate(); } else if (mTypedTimes == null) { mTypedTimes = new ArrayList<Integer>(); } // Set the theme at the end so that the initialize()s above don't counteract the theme. mTimePicker.setTheme(themeColors); // Set the colors for each view based on the theme. view.findViewById(R.id.time_display_background).setBackgroundColor(headerBgColor); view.findViewById(R.id.ok_cancel_buttons_layout).setBackgroundColor(buttonBgColor); view.findViewById(R.id.time_display).setBackgroundColor(headerBgColor); view.findViewById(R.id.time_picker_error_holder).setBackgroundColor(headerBgColor); ((TextView) view.findViewById(R.id.separator)).setTextColor(mUnselectedColor); ((TextView) view.findViewById(R.id.ampm_label)).setTextColor(mUnselectedColor); mTimePicker.setBackgroundColor(bodyBgColor); return view; }
From source file:com.eeshana.icstories.activities.UploadVideoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // this will copy the license file and the demo video file. // to the videokit work folder location. // without the license file the library will not work. //copyLicenseAndDemoFilesFromAssetsToSDIfNeeded(); setContentView(R.layout.upload_video_activity); height = SignInActivity.getScreenHeight(UploadVideoActivity.this); width = SignInActivity.getScreenWidth(UploadVideoActivity.this); mProgressDialog = new ProgressDialog(UploadVideoActivity.this); pDialog = new ProgressDialog(UploadVideoActivity.this); showCustomToast = new ShowCustomToast(); connectionDetector = new ConnectionDetector(UploadVideoActivity.this); // mProgressDialog=new ProgressDialog(UploadVideoActivity.this,AlertDialog.THEME_HOLO_LIGHT); // mProgressDialog.setFeatureDrawableResource(height,R.drawable.rounded_toast); prefs = getSharedPreferences("PREF", MODE_PRIVATE); regId = prefs.getString("regid", "NA"); SharedPreferences pref = getSharedPreferences("DB", 0); userid = pref.getString("userid", "1"); SharedPreferences assign_prefs = getSharedPreferences("ASSIGN", 0); assignment_id = assign_prefs.getString("ASSIGN_ID", ""); videoPath = getIntent().getStringExtra("VIDEOPATH"); // iCTextView=(TextView) findViewById(R.id.tvIC); // iCTextView.setTypeface(CaptureVideoActivity.ic_typeface,Typeface.BOLD); // storiesTextView=(TextView) findViewById(R.id.tvStories); // storiesTextView.setTypeface(CaptureVideoActivity.stories_typeface,Typeface.BOLD); // watsStoryTextView=(TextView) findViewById(R.id.tvWhatsStory); // watsStoryTextView.setTypeface(CaptureVideoActivity.stories_typeface,Typeface.ITALIC); // logoImageView=(ImageView) findViewById(R.id.ivLogo); // RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams((int) (width/1.9), (int) (height/9.5)); // lp.addRule(RelativeLayout.CENTER_HORIZONTAL); // lp.setMargins(0, 0, 0, 0); // logoImageView.setLayoutParams(lp); uploadtTextView = (TextView) findViewById(R.id.tvUpload); uploadtTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); // extension=getIntent().getStringExtra("EXTENSION"); // folderPath = Environment.getExternalStorageDirectory().getPath()+"/ICStoriesFolder"; // if (!FileUtils.checkIfFolderExists(folderPath)) { // boolean isFolderCreated = FileUtils.createFolder(folderPath); // Log.i(Prefs.TAG, folderPath + " created? " + isFolderCreated); // if (isFolderCreated) { ///* ww w. j a v a 2s . c om*/ // } // } //command for rotating video 90 degree //String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -vf transpose=1 -s 160x120 -r 30 -aspect 4:3 -ab 48000 -ac 2 -ar 22050 -b 2097k "+folderPath+"/out."+extension; //Change Video Resolution: //String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -vf transpose=3 -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 "+folderPath+"/res."+extension; //command for compressing video // String commandStr="ffmpeg -y -i "+videoPath+" -strict experimental -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 "+folderPath+"/test."+extension; // setCommand(commandStr); // runTranscoing(); thumb = ThumbnailUtils.createVideoThumbnail(videoPath, MediaStore.Images.Thumbnails.MINI_KIND); System.out.println("THUMB IMG in uplaod== " + thumb); titleEditText = (EditText) findViewById(R.id.etTitle); titleEditText.setTypeface(CaptureVideoActivity.stories_typeface); descriptionEditText = (EditText) findViewById(R.id.etDescripton); descriptionEditText.setTypeface(CaptureVideoActivity.stories_typeface); locationEditText = (EditText) findViewById(R.id.etLocation); locationEditText.setTypeface(CaptureVideoActivity.stories_typeface); isAssignmentButton = (Button) findViewById(R.id.buttonCheck); isAssignmentButton.setTypeface(CaptureVideoActivity.stories_typeface); isAssignmentButton.setOnClickListener(this); dailyAssignTextView = (TextView) findViewById(R.id.tvDailyAssignment); dailyAssignTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); uploadButton = (Button) findViewById(R.id.buttonUpload); uploadButton.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); RelativeLayout uploadRelativeLayout = (RelativeLayout) findViewById(R.id.rlUpload); RelativeLayout.LayoutParams lp9 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, height / 17); lp9.addRule(RelativeLayout.BELOW, R.id.rlDailyAssignment); lp9.setMargins(width / 7, 30, width / 7, 0); uploadRelativeLayout.setLayoutParams(lp9); uploadButton.setOnClickListener(this); //bottom bar homeRelativeLayout = (RelativeLayout) findViewById(R.id.rlHome); homeRelativeLayout.setBackgroundResource(R.drawable.press_border); homeRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); homeTextView = (TextView) homeRelativeLayout.findViewById(R.id.tvHome); homeTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); homeTextView.setTextColor(Color.parseColor("#fffffe")); RelativeLayout.LayoutParams lp4 = new RelativeLayout.LayoutParams(width / 3, width / 5); lp4.addRule(RelativeLayout.ALIGN_LEFT); homeRelativeLayout.setLayoutParams(lp4); homeRelativeLayout.setOnClickListener(this); wallRelativeLayout = (RelativeLayout) findViewById(R.id.rlWall); wallRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); wallTextView = (TextView) wallRelativeLayout.findViewById(R.id.tvWall); wallTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); RelativeLayout.LayoutParams lp5 = new RelativeLayout.LayoutParams(width / 3, width / 5); lp5.addRule(RelativeLayout.RIGHT_OF, R.id.rlHome); wallRelativeLayout.setLayoutParams(lp5); wallRelativeLayout.setOnClickListener(this); settingsRelativeLayout = (RelativeLayout) findViewById(R.id.rlSettings); settingsRelativeLayout.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL); settingsTextView = (TextView) settingsRelativeLayout.findViewById(R.id.tvSettings); settingsTextView.setTypeface(CaptureVideoActivity.stories_typeface, Typeface.BOLD); RelativeLayout.LayoutParams lp6 = new RelativeLayout.LayoutParams(width / 3, width / 5); lp6.addRule(RelativeLayout.RIGHT_OF, R.id.rlWall); settingsRelativeLayout.setLayoutParams(lp6); settingsRelativeLayout.setOnClickListener(this); // current location locationDialog = new Dialog(UploadVideoActivity.this); locationDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); locationDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); locationDialog.setContentView(R.layout.location_dialog); locationDialog.setCancelable(true); LinearLayout dialogLayout = (LinearLayout) locationDialog.findViewById(R.id.ll1); okButton = (Button) dialogLayout.findViewById(R.id.OkBtn); okButton.setOnClickListener(this); cancelButton = (Button) dialogLayout.findViewById(R.id.cancelBtn); cancelButton.setOnClickListener(this); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); boolean network_enabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (network_enabled) { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this); } else { showCustomToast.showToast(UploadVideoActivity.this, "Could not find current location. Please enable location services of your device."); } // else if(gps_enabled == false){ // locationDialog.show(); // } }
From source file:com.t2.compassionMeditation.Graphs1Activity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, this.getClass().getSimpleName() + ".onCreate()"); // We don't want the screen to timeout in this activity getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); this.requestWindowFeature(Window.FEATURE_NO_TITLE); // This needs to happen BEFORE setContentView setContentView(R.layout.graphs_activity_layout); mInstance = this; sharedPref = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); mLoggingEnabled = SharedPref.getBoolean(this, "enable_logging", true); mDatabaseEnabled = SharedPref.getBoolean(this, "database_enabled", false); mAntHrmEnabled = SharedPref.getBoolean(this, "enable_ant_hrm", false); mInternalSensorMonitoring = SharedPref.getBoolean(this, "inernal_sensor_monitoring_enabled", false); if (mAntHrmEnabled) { mHeartRateSource = HEARTRATE_ANT; } else {//from w w w. ja v a2s.co m mHeartRateSource = HEARTRATE_ZEPHYR; } // The session start time will be used as session id // Note this also sets session start time // **** This session ID will be prepended to all JSON data stored // in the external database until it's changed (by the start // of a new session. Calendar cal = Calendar.getInstance(); SharedPref.setBioSessionId(sharedPref, cal.getTimeInMillis()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.US); String sessionDate = sdf.format(new Date()); String userId = SharedPref.getString(this, "SelectedUser", ""); long sessionId = SharedPref.getLong(this, "bio_session_start_time", 0); mDataOutHandler = new DataOutHandler(this, userId, sessionDate, mAppId, DataOutHandler.DATA_TYPE_EXTERNAL_SENSOR, sessionId); if (mDatabaseEnabled) { TelephonyManager telephonyManager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); String myNumber = telephonyManager.getLine1Number(); String remoteDatabaseUri = SharedPref.getString(this, "database_sync_name", getString(R.string.database_uri)); // remoteDatabaseUri += myNumber; Log.d(TAG, "Initializing database at " + remoteDatabaseUri); // TODO: remove try { mDataOutHandler.initializeDatabase(dDatabaseName, dDesignDocName, dDesignDocId, byDateViewName, remoteDatabaseUri); } catch (DataOutHandlerException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } mDataOutHandler.setRequiresAuthentication(false); } mBioDataProcessor.initialize(mDataOutHandler); if (mLoggingEnabled) { mDataOutHandler.enableLogging(this); } if (mLogCatEnabled) { mDataOutHandler.enableLogCat(); } // Log the version try { PackageManager packageManager = getPackageManager(); PackageInfo info = packageManager.getPackageInfo(getPackageName(), 0); mApplicationVersion = info.versionName; String versionString = mAppId + " application version: " + mApplicationVersion; DataOutPacket packet = new DataOutPacket(); packet.add(DataOutHandlerTags.version, versionString); try { mDataOutHandler.handleDataOut(packet); } catch (DataOutHandlerException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } } catch (NameNotFoundException e) { Log.e(TAG, e.toString()); } // Set up UI elements Resources resources = this.getResources(); AssetManager assetManager = resources.getAssets(); mPauseButton = (Button) findViewById(R.id.buttonPause); mAddMeasureButton = (Button) findViewById(R.id.buttonAddMeasure); mTextInfoView = (TextView) findViewById(R.id.textViewInfo); mMeasuresDisplayText = (TextView) findViewById(R.id.measuresDisplayText); // Don't actually show skin conductance meter unless we get samples ImageView image = (ImageView) findViewById(R.id.imageView1); image.setImageResource(R.drawable.signal_bars0); // Check to see of there a device configured for EEG, if so then show the skin conductance meter String tmp = SharedPref.getString(this, "EEG", null); if (tmp != null) { image.setVisibility(View.VISIBLE); } else { image.setVisibility(View.INVISIBLE); } // Initialize SPINE by passing the fileName with the configuration properties try { mManager = SPINEFactory.createSPINEManager("SPINETestApp.properties", resources); } catch (InstantiationException e) { Log.e(TAG, "Exception creating SPINE manager: " + e.toString()); e.printStackTrace(); } try { currentMindsetData = new MindsetData(this); } catch (Exception e1) { Log.e(TAG, "Exception creating MindsetData: " + e1.toString()); e1.printStackTrace(); } // Establish nodes for BSPAN // Create a broadcast receiver. Note that this is used ONLY for command messages from the service // All data from the service goes through the mail SPINE mechanism (received(Data data)). // See public void received(Data data) this.mCommandReceiver = new SpineReceiver(this); int itemId = 0; eegPos = itemId; // eeg always comes first mBioParameters.clear(); // First create GraphBioParameters for each of the EEG static params (ie mindset) for (itemId = 0; itemId < MindsetData.NUM_BANDS + 2; itemId++) { // 2 extra, for attention and meditation GraphBioParameter param = new GraphBioParameter(itemId, MindsetData.spectralNames[itemId], "", true); param.isShimmer = false; mBioParameters.add(param); } // Now create all of the potential dynamic GBraphBioParameters (GSR, EMG, ECG, EEG, HR, Skin Temp, Resp Rate // String[] paramNamesStringArray = getResources().getStringArray(R.array.parameter_names); String[] paramNamesStringArray = getResources().getStringArray(R.array.parameter_names_less_eeg); for (String paramName : paramNamesStringArray) { if (paramName.equalsIgnoreCase("not assigned")) continue; GraphBioParameter param = new GraphBioParameter(itemId, paramName, "", true); if (paramName.equalsIgnoreCase("gsr")) { gsrPos = itemId; param.isShimmer = true; param.shimmerSensorConstant = SPINESensorConstants.SHIMMER_GSR_SENSOR; param.shimmerNode = getShimmerNode(); } if (paramName.equalsIgnoreCase("emg")) { emgPos = itemId; param.isShimmer = true; param.shimmerSensorConstant = SPINESensorConstants.SHIMMER_EMG_SENSOR; param.shimmerNode = getShimmerNode(); } if (paramName.equalsIgnoreCase("ecg")) { ecgPos = itemId; param.isShimmer = true; param.shimmerSensorConstant = SPINESensorConstants.SHIMMER_ECG_SENSOR; param.shimmerNode = getShimmerNode(); } if (paramName.equalsIgnoreCase("heart rate")) { heartRatePos = itemId; param.isShimmer = false; } if (paramName.equalsIgnoreCase("resp rate")) { respRatePos = itemId; param.isShimmer = false; } if (paramName.equalsIgnoreCase("skin temp")) { skinTempPos = itemId; param.isShimmer = false; } if (paramName.equalsIgnoreCase("EHealth Airflow")) { eHealthAirFlowPos = itemId; param.isShimmer = false; } if (paramName.equalsIgnoreCase("EHealth Temp")) { eHealthTempPos = itemId; param.isShimmer = false; } if (paramName.equalsIgnoreCase("EHealth SpO2")) { eHealthSpO2Pos = itemId; param.isShimmer = false; } if (paramName.equalsIgnoreCase("EHealth Heartrate")) { eHealthHeartRatePos = itemId; param.isShimmer = false; } if (paramName.equalsIgnoreCase("EHealth GSR")) { eHealthGSRPos = itemId; param.isShimmer = false; } itemId++; mBioParameters.add(param); } // Since These are static nodes (Non-spine) we have to manually put them in the active node list Node mindsetNode = null; mindsetNode = new Node(new Address("" + Constants.RESERVED_ADDRESS_MINDSET)); // Note that the sensor id 0xfff1 (-15) is a reserved id for this particular sensor mManager.getActiveNodes().add(mindsetNode); Node zepherNode = null; zepherNode = new Node(new Address("" + Constants.RESERVED_ADDRESS_ZEPHYR)); mManager.getActiveNodes().add(zepherNode); // The arduino node is programmed to look like a static Spine node // Note that currently we don't have to turn it on or off - it's always streaming // Since Spine (in this case) is a static node we have to manually put it in the active node list // Since the final int RESERVED_ADDRESS_ARDUINO_SPINE = 1; // 0x0001 mSpineNode = new Node(new Address("" + RESERVED_ADDRESS_ARDUINO_SPINE)); mManager.getActiveNodes().add(mSpineNode); final String sessionName; // Check to see if we were requested to play back a previous session try { Bundle bundle = getIntent().getExtras(); if (bundle != null) { sessionName = bundle.getString(BioZenConstants.EXTRA_SESSION_NAME); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle("Replay Session " + sessionName + "?"); alert.setMessage("Make sure to turn off all Bluetooth Sensors!"); alert.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { try { mDataOutHandler.logNote("Replaying data from session " + sessionName); } catch (DataOutHandlerException e) { Log.e(TAG, e.toString()); e.printStackTrace(); } replaySessionData(sessionName); AlertDialog.Builder alert1 = new AlertDialog.Builder(mInstance); alert1.setTitle("INFO"); alert1.setMessage("Replay of session complete!"); alert1.show(); } }); alert.show(); } } catch (Exception e) { Log.e(TAG, e.toString()); e.printStackTrace(); } if (mInternalSensorMonitoring) { // IntentSender Launches our service scheduled with with the alarm manager mBigBrotherService = PendingIntent.getService(Graphs1Activity.this, 0, new Intent(Graphs1Activity.this, BigBrotherService.class), 0); long firstTime = SystemClock.elapsedRealtime(); // Schedule the alarm! AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE); am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime, mPollingPeriod * 1000, mBigBrotherService); // Tell the user about what we did. Toast.makeText(Graphs1Activity.this, R.string.service_scheduled, Toast.LENGTH_LONG).show(); } //testFIRFilter(); // testHR(); }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
/** * Called when the activity is first created. *///from ww w . ja v a 2s . c om @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); OShandler = this.handler; if (LimboSettingsManager.getOrientationReverse(this)) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); if (Const.enable_fullscreen || android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) { requestWindowFeature(Window.FEATURE_NO_TITLE); } getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Declare an instance variable for your MoPubView. activity = this; // DB init favDB = new FavOpenHelper(activity); machineDB = new MachineOpenHelper(activity); this.setContentView(R.layout.main); this.setupWidgets(); this.enableOptions(false); resetUserPressed(); populateAttributes(); if (Const.enableAds) { LimboAds.setupAds(); } execTimeListener(); if (this.isFirstLaunch()) { onFirstLaunch(); } // acquireLocks(); }
From source file:com.android.contacts.activities.PeopleActivity.java
private void createViewsAndFragments(Bundle savedState) { // Disable the ActionBar so that we can use a Toolbar. This needs to be called before // setContentView(). getWindow().requestFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.people_activity); final FragmentManager fragmentManager = getFragmentManager(); // Hide all tabs (the current tab will later be reshown once a tab is selected) final FragmentTransaction transaction = fragmentManager.beginTransaction(); mTabTitles = new String[TabState.COUNT]; mTabTitles[TabState.FAVORITES] = getString(R.string.favorites_tab_label); mTabTitles[TabState.ALL] = getString(R.string.all_contacts_tab_label); mTabPager = getView(R.id.tab_pager); mTabPagerAdapter = new TabPagerAdapter(); mTabPager.setAdapter(mTabPagerAdapter); mTabPager.setOnPageChangeListener(mTabPagerListener); // Configure toolbar and toolbar tabs. If in landscape mode, we configure tabs differntly. final Toolbar toolbar = getView(R.id.toolbar); setActionBar(toolbar);// w w w . j av a2 s. com final ViewPagerTabs portraitViewPagerTabs = (ViewPagerTabs) findViewById(R.id.lists_pager_header); ViewPagerTabs landscapeViewPagerTabs = null; if (portraitViewPagerTabs == null) { landscapeViewPagerTabs = (ViewPagerTabs) getLayoutInflater() .inflate(R.layout.people_activity_tabs_lands, toolbar, /* attachToRoot = */ false); mViewPagerTabs = landscapeViewPagerTabs; } else { mViewPagerTabs = portraitViewPagerTabs; } mViewPagerTabs.setViewPager(mTabPager); final String FAVORITE_TAG = "tab-pager-favorite"; final String ALL_TAG = "tab-pager-all"; // Create the fragments and add as children of the view pager. // The pager adapter will only change the visibility; it'll never create/destroy // fragments. // However, if it's after screen rotation, the fragments have been re-created by // the fragment manager, so first see if there're already the target fragments // existing. mFavoritesFragment = (ContactTileListFragment) fragmentManager.findFragmentByTag(FAVORITE_TAG); mAllFragment = (MultiSelectContactsListFragment) fragmentManager.findFragmentByTag(ALL_TAG); if (mFavoritesFragment == null) { mFavoritesFragment = new ContactTileListFragment(); mAllFragment = new MultiSelectContactsListFragment(); transaction.add(R.id.tab_pager, mFavoritesFragment, FAVORITE_TAG); transaction.add(R.id.tab_pager, mAllFragment, ALL_TAG); } mFavoritesFragment.setListener(mFavoritesFragmentListener); mAllFragment.setOnContactListActionListener(new ContactBrowserActionListener()); mAllFragment.setCheckBoxListListener(new CheckBoxListListener()); // Hide all fragments for now. We adjust visibility when we get onSelectedTabChanged() // from ActionBarAdapter. transaction.hide(mFavoritesFragment); transaction.hide(mAllFragment); transaction.commitAllowingStateLoss(); fragmentManager.executePendingTransactions(); // Setting Properties after fragment is created mFavoritesFragment.setDisplayType(DisplayType.STREQUENT); mActionBarAdapter = new ActionBarAdapter(this, this, getActionBar(), portraitViewPagerTabs, landscapeViewPagerTabs, toolbar); mActionBarAdapter.initialize(savedState, mRequest); // Add shadow under toolbar ViewUtil.addRectangularOutlineProvider(findViewById(R.id.toolbar_parent), getResources()); // Configure floating action button mFloatingActionButtonContainer = findViewById(R.id.floating_action_button_container); final ImageButton floatingActionButton = (ImageButton) findViewById(R.id.floating_action_button); floatingActionButton.setOnClickListener(this); mFloatingActionButtonController = new FloatingActionButtonController(this, mFloatingActionButtonContainer, floatingActionButton); initializeFabVisibility(); invalidateOptionsMenuIfNeeded(); }
From source file:com.example.google.playservices.placepicker.PlacePickerFragment.java
@Override public void onCardClick(int cardActionId, String cardTag) { if (cardActionId == ACTION_PICK_PLACE) { // BEGIN_INCLUDE(intent) /* Use the PlacePicker Builder to construct an Intent. Note: This sample demonstrates a basic use case. The PlacePicker Builder supports additional properties such as search bounds. *///from ww w. j a v a 2 s . co m try { PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder(); Intent intent = intentBuilder.build(getActivity()); // Start the Intent by requesting a result, identified by a request code. startActivityForResult(intent, REQUEST_PLACE_PICKER); // Hide the pick option in the UI to prevent users from starting the picker // multiple times. showPickAction(false); } catch (GooglePlayServicesRepairableException e) { GooglePlayServicesUtil.getErrorDialog(e.getConnectionStatusCode(), getActivity(), 0); } catch (GooglePlayServicesNotAvailableException e) { Toast.makeText(getActivity(), "Google Play Services is not available.", Toast.LENGTH_LONG).show(); } // END_INCLUDE(intent) } else if (cardActionId == ACTION_REPORT_WAIT) { final Dialog dialog = new Dialog(this.getActivity()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.report); final NumberPicker np = (NumberPicker) dialog.findViewById(R.id.numpicker); np.setMaxValue(120); np.setMinValue(0); // Report Button dialogButtonReport = (Button) dialog.findViewById(R.id.dialogButtonReport); dialogButtonReport.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { HttpPost httppost = new HttpPost("http://powergrid.xyz/quickq/restaurantpost.php"); httppost.setHeader("Content-type", "application/x-www-form-urlencoded"); List<NameValuePair> nameValuePairs = new ArrayList<>(2); // TODO nameValuePairs.add(new BasicNameValuePair("placeid", globalplace.getId())); nameValuePairs.add(new BasicNameValuePair("waittime", String.valueOf(np.getValue()))); try { httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); } catch (UnsupportedEncodingException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } powergridServerReportTime task = new powergridServerReportTime(); task.execute(httppost); dialog.dismiss(); } }); // Cancel Button dialogButtonCancel = (Button) dialog.findViewById(R.id.dialogButtonCancel); // If button is clicked, close the custom dialog dialogButtonCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }
From source file:com.emergencyskills.doe.aed.UI.activity.TabsActivity.java
public void showconfirmationdialog(final int fragnumber) { final Dialog dialog = new Dialog(TabsActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_leaving_confirmation); dialog.getWindow()//from w ww.j a va 2 s . co m .setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent))); Button yes = (Button) dialog.findViewById(R.id.yesbtn); yes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { switch (fragnumber) { case 1: showpickupschool(); break; case 2: showdrill(); break; case 3: showservice(); break; case 4: showinstall(); break; case 5: showpending(); break; } dialog.dismiss(); } }); Button no = (Button) dialog.findViewById(R.id.nobtn); no.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); ImageView close = (ImageView) dialog.findViewById(R.id.ivClose); close.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); }
From source file:com.birdeye.MainActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!Prefs.usernames.isSet()) { Prefs.usernames.set(Twitter.getSessionManager().getActiveSession().getUserName()); }/* w w w. j ava 2s. c om*/ setContentView(R.layout.main); ButterKnife.bind(this); // hideSystemUI(this); Chartboost.startWithAppId(MainActivity.this, "57552756f6cd4526e365b9d1", "239b2e3aa657ccdcdf0b9674c8750f077b5e0aed"); Chartboost.setLoggingLevel(CBLogging.Level.ALL); Chartboost.setDelegate(delegate); Chartboost.onCreate(this); tv_cancel = (TextView) findViewById(R.id.tv_cancel); tvSetTimer = (Button) findViewById(R.id.tvSetTimer); if (!BillingProcessor.isIabServiceAvailable(MainActivity.this)) { // showToast("In-app billing service is unavailable, please upgrade Android Market/Play to version >= 3.9.16"); onBackPressed(); } bp = new BillingProcessor(this, LICENSE_KEY, MERCHANT_ID, new BillingProcessor.IBillingHandler() { @Override public void onProductPurchased(String productId, TransactionDetails details) { showToast("onProductPurchased: " + productId); // updateTextViews(); } @Override public void onBillingError(int errorCode, Throwable error) { showToast("onBillingError: " + Integer.toString(errorCode)); } @Override public void onBillingInitialized() { showToast("onBillingInitialized"); readyToPurchase = true; //updateTextViews(); } @Override public void onPurchaseHistoryRestored() { showToast("onPurchaseHistoryRestored"); for (String sku : bp.listOwnedProducts()) Log.d(LOG_TAG, "Owned Managed Product: " + sku); for (String sku : bp.listOwnedSubscriptions()) Log.d(LOG_TAG, "Owned Subscription: " + sku); //updateTextViews(); Log.i(LOG_TAG, String.format("%s is%s subscribed", SUBSCRIPTION_ID, bp.isSubscribed(SUBSCRIPTION_ID) ? "" : " not")); } }); subs = bp.getSubscriptionListingDetails(SUBSCRIPTION_ID); // showToast(subs != null ? subs.toString() : "Failed to load subscription details"); if (subs == null) { // showToast(subs != null ? subs.toString() : "Failed to load subscription details"); Globals.hasPaid = false; } else { Globals.hasPaid = true; } if (Globals.hasPaid) { tvSetTimer.setVisibility(View.VISIBLE); message4.setVisibility(View.VISIBLE); message5.setVisibility(View.VISIBLE); message6.setVisibility(View.VISIBLE); message7.setVisibility(View.VISIBLE); message8.setVisibility(View.VISIBLE); message9.setVisibility(View.VISIBLE); message10.setVisibility(View.VISIBLE); message11.setVisibility(View.VISIBLE); message12.setVisibility(View.VISIBLE); message13.setVisibility(View.VISIBLE); message14.setVisibility(View.VISIBLE); message15.setVisibility(View.VISIBLE); message16.setVisibility(View.VISIBLE); message17.setVisibility(View.VISIBLE); message18.setVisibility(View.VISIBLE); message19.setVisibility(View.VISIBLE); message20.setVisibility(View.VISIBLE); message21.setVisibility(View.VISIBLE); message22.setVisibility(View.VISIBLE); message23.setVisibility(View.VISIBLE); message24.setVisibility(View.VISIBLE); message25.setVisibility(View.VISIBLE); ets = Arrays.asList(usernames, hashtags, message1, message2, message3, message4, message5, message6, message7, message8, message9, message10, message11, message12, message13, message14, message15, message16, message17, message18, message19, message20, message21, message22, message23, message24, message25); } else { tvSetTimer.setVisibility(View.GONE); message4.setVisibility(View.GONE); message5.setVisibility(View.GONE); message6.setVisibility(View.GONE); message7.setVisibility(View.GONE); message8.setVisibility(View.GONE); message9.setVisibility(View.GONE); message10.setVisibility(View.GONE); message11.setVisibility(View.GONE); message12.setVisibility(View.GONE); message13.setVisibility(View.GONE); message14.setVisibility(View.GONE); message15.setVisibility(View.GONE); message16.setVisibility(View.GONE); message17.setVisibility(View.GONE); message18.setVisibility(View.GONE); message19.setVisibility(View.GONE); message20.setVisibility(View.GONE); message21.setVisibility(View.GONE); message22.setVisibility(View.GONE); message23.setVisibility(View.GONE); message24.setVisibility(View.GONE); message25.setVisibility(View.GONE); ets = Arrays.asList(usernames, hashtags, message1, message2, message3); } tvSetTimer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(MainActivity.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); dialog.setContentView(R.layout.input_time); dialog.setCancelable(true); Button bt_set = (Button) dialog.findViewById(R.id.bt_set); final EditText et_time = (EditText) dialog.findViewById(R.id.et_time); bt_set.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (et_time.getText().toString().equalsIgnoreCase("")) { Toast.makeText(MainActivity.this, "Please enter time to auto shut down", Toast.LENGTH_SHORT).show(); } else { int valueTimer = Integer.parseInt(et_time.getText().toString()) * 1000; initateCounter(valueTimer); tv_cancel.setText("Auto ShutDown started"); tvSetTimer.setVisibility(View.GONE); tv_cancel.setVisibility(View.VISIBLE); dialog.dismiss(); } } }); dialog.show(); } }); cameras.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, Facing.values())); //noinspection ConstantConditions cameras.setSelection(Prefs.facing.get().ordinal()); cameras.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { Prefs.facing.set(Facing.values()[position]); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); for (TextInputEditText et : ets) { DrawableCompat.setTint(et.getBackground(), ContextCompat.getColor(this, R.color.colorAccent)); final TextInputLayout til = textLayout(et); til.setError(null); til.setErrorEnabled(false); } TextViews.setText(usernames, Prefs.usernames.get()); TextViews.setText(hashtags, Prefs.hashtags.get()); TextViews.setText(message1, Prefs.message1.get()); TextViews.setText(message2, Prefs.message2.get()); TextViews.setText(message3, Prefs.message3.get()); TextViews.setText(message4, Prefs.message4.get()); TextViews.setText(message5, Prefs.message5.get()); TextViews.setText(message6, Prefs.message6.get()); TextViews.setText(message7, Prefs.message7.get()); TextViews.setText(message8, Prefs.message8.get()); TextViews.setText(message9, Prefs.message9.get()); TextViews.setText(message10, Prefs.message10.get()); TextViews.setText(message11, Prefs.message11.get()); TextViews.setText(message12, Prefs.message12.get()); TextViews.setText(message13, Prefs.message13.get()); TextViews.setText(message14, Prefs.message14.get()); TextViews.setText(message15, Prefs.message15.get()); TextViews.setText(message16, Prefs.message16.get()); TextViews.setText(message17, Prefs.message17.get()); TextViews.setText(message18, Prefs.message18.get()); TextViews.setText(message19, Prefs.message19.get()); TextViews.setText(message20, Prefs.message20.get()); TextViews.setText(message21, Prefs.message21.get()); TextViews.setText(message22, Prefs.message22.get()); TextViews.setText(message23, Prefs.message23.get()); TextViews.setText(message24, Prefs.message24.get()); TextViews.setText(message25, Prefs.message25.get()); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); getWindow().setBackgroundDrawableResource(R.color.bg); mAdView = (AdView) findViewById(R.id.adView); mInterstitialAd = new InterstitialAd(this); // set the ad unit ID mInterstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen)); adRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR) // Check the LogCat to get your test device ID .addTestDevice("EB02375D2DA62FFA0F6F145AD2302B3D").build(); // adRequest = new AdRequest.Builder().build(); mAdView.setAdListener(new AdListener() { @Override public void onAdLoaded() { } @Override public void onAdClosed() { // Toast.makeText(getApplicationContext(), "Ad is closed!", Toast.LENGTH_SHORT).show(); } @Override public void onAdFailedToLoad(int errorCode) { // Toast.makeText(getApplicationContext(), "Ad failed to load! error code: " + errorCode, Toast.LENGTH_SHORT).show(); } @Override public void onAdLeftApplication() { // Toast.makeText(getApplicationContext(), "Ad left application!", Toast.LENGTH_SHORT).show(); } @Override public void onAdOpened() { super.onAdOpened(); } }); mAdView.loadAd(adRequest); mInterstitialAd.loadAd(adRequest); mInterstitialAd.setAdListener(new AdListener() { public void onAdLoaded() { showInterstitial(); } @Override public void onAdClosed() { Toast.makeText(getApplicationContext(), "Ad is closed!", Toast.LENGTH_SHORT).show(); } @Override public void onAdFailedToLoad(int errorCode) { Toast.makeText(getApplicationContext(), "Ad failed to load! error code: " + errorCode, Toast.LENGTH_SHORT).show(); } @Override public void onAdLeftApplication() { Toast.makeText(getApplicationContext(), "Ad left application!", Toast.LENGTH_SHORT).show(); } @Override public void onAdOpened() { Toast.makeText(getApplicationContext(), "Ad is opened!", Toast.LENGTH_SHORT).show(); } }); if (Globals.hasPaid) { tv_cancel.setVisibility(View.GONE); mAdView.setVisibility(View.GONE); } else { // initateCounter(120000); startRepeatingTask(); mAdView.setVisibility(View.VISIBLE); } }