List of usage examples for android.graphics.drawable ColorDrawable ColorDrawable
public ColorDrawable(@ColorInt int color)
From source file:com.haomee.chat.activity.ChatActivity.java
public View init_grid_viewpager_data(List<String> images_path_list, List<String> iamges_name_list, final int current_page, final int type_size, final String package_id, final int type) { View view = LayoutInflater.from(this).inflate(R.layout.express_grid, null); GridView grid = (GridView) view.findViewById(R.id.gridView1); grid.setSelector(new ColorDrawable(Color.TRANSPARENT)); final NewExpressAdapter2 grid_adapter = new NewExpressAdapter2(ChatActivity.this); grid.setAdapter(grid_adapter);//from www .j a v a 2s. co m final List<String> current_page_path; final List<String> current_page_name; int total_page = 0; if (type_size == 1) {// total_page = (images_path_list.size() - 1) / 10 + 1; page_size = 10; } else if (type_size == 2) {// ? total_page = (images_path_list.size() - 1) / 20 + 1; page_size = 20; } if (current_page < total_page - 1) { current_page_path = images_path_list.subList(current_page * page_size, (current_page + 1) * page_size); current_page_name = iamges_name_list.subList(current_page * page_size, (current_page + 1) * page_size); } else { current_page_path = images_path_list.subList(current_page * page_size, images_path_list.size()); current_page_name = iamges_name_list.subList(current_page * page_size, images_path_list.size()); } grid_adapter.setData(current_page_path, current_page_name, type_size); grid.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String[] path_list = current_page_path.get(position).split("/"); String[] file_name = path_list[path_list.length - 1].split("#"); String[] current_id = file_name[0].split("\\."); String temp_type = ""; if (type == TYPE_GIF) { temp_type = ".gif"; } else { temp_type = ".png"; } sendTextByExpression(type, package_id, current_id[0], current_page_name.get(position), PathConst.URL_EXPRESS_PREFIX + package_id + "/" + current_id[0] + temp_type, type_size); } }); return view; }
From source file:com.xplink.android.carchecklist.CarCheckListActivity.java
private void SlideDocumentLayout() { final SharedPreferences settings = getSharedPreferences("mysettings", 0); final SharedPreferences.Editor editor = settings.edit(); final Dialog documentdialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog); documentdialog.requestWindowFeature(Window.FEATURE_NO_TITLE); documentdialog.setContentView(R.layout.documentdialoglayout); documentdialog.getWindow().getAttributes().windowAnimations = R.style.DocumentDialogAnimation; documentdialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); // make everything around Dialog brightness than default WindowManager.LayoutParams lp = documentdialog.getWindow().getAttributes(); lp.dimAmount = 0f;//from www. ja v a 2s. co m final CheckBox chkinsurance = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_insurance); final CheckBox chkactTaxLabel = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_actTaxLabel); final CheckBox chkbill = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_bill); final CheckBox chklicensePlate = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_licensePlate); final CheckBox chklicenseManual = (CheckBox) documentdialog.getWindow() .findViewById(R.id.doc_licenseManual); final CheckBox chkcarPartPaper = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_carPartPaper); final CheckBox chkcarManual = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_carManual); final CheckBox chklicenseRegister = (CheckBox) documentdialog.getWindow() .findViewById(R.id.doc_licenseRegister); final CheckBox chkgift = (CheckBox) documentdialog.getWindow().findViewById(R.id.doc_gift); // Change font chkinsurance.setTypeface(type); chkactTaxLabel.setTypeface(type); chkbill.setTypeface(type); chklicensePlate.setTypeface(type); chklicenseManual.setTypeface(type); chkcarPartPaper.setTypeface(type); chkcarManual.setTypeface(type); chklicenseRegister.setTypeface(type); chkgift.setTypeface(type); documentdialog.setCanceledOnTouchOutside(true); documentdialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { headdocument.setVisibility(ImageView.VISIBLE); TranslateAnimation slideoutheaddocument = new TranslateAnimation(0, 0, 350, 800); slideoutheaddocument.setDuration(500); slideoutheaddocument.setFillAfter(true); headdocument.startAnimation(slideoutheaddocument); Map<String, Boolean> mp = new HashMap<String, Boolean>(); mp.put("doc_insurance", chkinsurance.isChecked()); mp.put("doc_actTaxLabel", chkactTaxLabel.isChecked()); mp.put("doc_bill", chkbill.isChecked()); mp.put("doc_licensePlate", chklicensePlate.isChecked()); mp.put("doc_licenseManual", chklicenseManual.isChecked()); mp.put("doc_carPartPaper", chkcarPartPaper.isChecked()); mp.put("doc_carManual", chkcarManual.isChecked()); mp.put("doc_licenseRegister", chklicenseRegister.isChecked()); mp.put("doc_gift", chkgift.isChecked()); filterStore("document", mp); save(mp); } }); TextView document = (TextView) documentdialog.getWindow().findViewById(R.id.Document); document.setTypeface(type); Button documentback = (Button) documentdialog.getWindow().findViewById(R.id.Documentback); documentback.setTypeface(type); documentback.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { documentdialog.dismiss(); headdocument.setVisibility(ImageView.VISIBLE); TranslateAnimation slideoutheaddocument = new TranslateAnimation(0, 0, 350, 800); slideoutheaddocument.setDuration(500); slideoutheaddocument.setFillAfter(true); headdocument.startAnimation(slideoutheaddocument); Map<String, Boolean> mp = new HashMap<String, Boolean>(); mp.put("doc_insurance", chkinsurance.isChecked()); mp.put("doc_actTaxLabel", chkactTaxLabel.isChecked()); mp.put("doc_bill", chkbill.isChecked()); mp.put("doc_licensePlate", chklicensePlate.isChecked()); mp.put("doc_licenseManual", chklicenseManual.isChecked()); mp.put("doc_carPartPaper", chkcarPartPaper.isChecked()); mp.put("doc_carManual", chkcarManual.isChecked()); mp.put("doc_licenseRegister", chklicenseRegister.isChecked()); mp.put("doc_gift", chkgift.isChecked()); filterStore("document", mp); save(mp); } }); chkinsurance.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkactTaxLabel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkbill.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chklicensePlate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chklicenseManual.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkcarPartPaper.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkcarManual.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chklicenseRegister.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); chkgift.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { boolean increment = true; if (((CheckBox) v).isChecked()) { getTotalDocument(increment); } else { increment = false; getTotalDocument(increment); } DocumentProgress.setProgress(PercenDocument); percendocument.setText("" + PercenDocument + "%"); RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); headdocument.setVisibility(ImageView.VISIBLE); TranslateAnimation slideheaddocument = new TranslateAnimation(0, 0, 800, 350); slideheaddocument.setDuration(500); slideheaddocument.setFillAfter(true); headdocument.startAnimation(slideheaddocument); documentdialog.show(); WindowManager.LayoutParams params = documentdialog.getWindow().getAttributes(); params.y = 350; params.x = 60; params.gravity = Gravity.TOP | Gravity.LEFT; documentdialog.getWindow().setAttributes(params); chkinsurance.setChecked(load("doc_insurance")); chkactTaxLabel.setChecked(load("doc_actTaxLabel")); chkbill.setChecked(load("doc_bill")); chklicensePlate.setChecked(load("doc_licensePlate")); chklicenseManual.setChecked(load("doc_licenseManual")); chkcarPartPaper.setChecked(load("doc_carPartPaper")); chkcarManual.setChecked(load("doc_carManual")); chklicenseRegister.setChecked(load("doc_licenseRegister")); chkgift.setChecked(load("doc_gift")); }
From source file:com.bernard.beaconportal.activities.activity.MessageList.java
/** * Hide menu items not appropriate for the current context. * //w w w. j a v a 2 s. c om * <p> * <strong>Note:</strong> Please adjust the comments in * {@code res/menu/message_list_option.xml} if you change the visibility of * a menu item in this method. * </p> * * @param mMenu2 * The {@link Menu} instance that should be modified. May be * {@code null}; in that case the method does nothing and * immediately returns. */ private void configureMenu(android.view.Menu mMenu2) { if (mMenu2 == null) { return; } // Set visibility of account/folder settings menu items if (mMessageListFragment == null) { mMenu2.findItem(R.id.account_settings).setVisible(false); mMenu2.findItem(R.id.folder_settings).setVisible(false); } else { mMenu2.findItem(R.id.account_settings).setVisible(mMessageListFragment.isSingleAccountMode()); mMenu2.findItem(R.id.folder_settings).setVisible(mMessageListFragment.isSingleFolderMode()); } /* * Set visibility of menu items related to the message view */ if (mDisplayMode == DisplayMode.MESSAGE_LIST || mMessageViewFragment == null || !mMessageViewFragment.isInitialized()) { mMenu2.findItem(R.id.next_message).setVisible(false); mMenu2.findItem(R.id.previous_message).setVisible(false); mMenu2.findItem(R.id.single_message_options).setVisible(false); mMenu2.findItem(R.id.delete).setVisible(false); mMenu2.findItem(R.id.composeList).setVisible(false); mMenu2.findItem(R.id.composeView).setVisible(false); mMenu2.findItem(R.id.archive).setVisible(false); mMenu2.findItem(R.id.move).setVisible(false); mMenu2.findItem(R.id.copy).setVisible(false); mMenu2.findItem(R.id.spam).setVisible(false); mMenu2.findItem(R.id.refile).setVisible(false); mMenu2.findItem(R.id.toggle_unread).setVisible(false); mMenu2.findItem(R.id.select_text).setVisible(false); mMenu2.findItem(R.id.toggle_message_view_theme).setVisible(false); mMenu2.findItem(R.id.show_headers).setVisible(false); mMenu2.findItem(R.id.hide_headers).setVisible(false); final int splitBarId = getResources().getIdentifier("split_action_bar", "id", "android"); final View splitActionBar = findViewById(splitBarId); SharedPreferences sharedpref = getSharedPreferences("actionbar_color", Context.MODE_PRIVATE); if (!sharedpref.contains("actionbar_color")) { if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4285f4"))); } } else { actionbar_colors = sharedpref.getString("actionbar_color", null); if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(actionbar_colors))); } } } else { // hide prev/next buttons in split mode if (mDisplayMode != DisplayMode.MESSAGE_VIEW) { mMenu2.findItem(R.id.next_message).setVisible(false); mMenu2.findItem(R.id.previous_message).setVisible(false); } else { MessageReference ref = mMessageViewFragment.getMessageReference(); boolean initialized = (mMessageListFragment != null && mMessageListFragment.isLoadFinished()); boolean canDoPrev = (initialized && !mMessageListFragment.isFirst(ref)); boolean canDoNext = (initialized && !mMessageListFragment.isLast(ref)); MenuItem prev = mMenu2.findItem(R.id.previous_message); prev.setEnabled(canDoPrev); // prev.getIcon().setAlpha(canDoPrev ? 255 : 127); // MenuItem next = menu.findItem(R.id.next_message); // next.setEnabled(canDoNext); // next.getIcon().setAlpha(canDoNext ? 255 : 127); final int splitBarId = getResources().getIdentifier("split_action_bar", "id", "android"); final View splitActionBar = findViewById(splitBarId); if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#ffffff"))); } } MenuItem toggleTheme = mMenu2.findItem(R.id.toggle_message_view_theme); if (K9.useFixedMessageViewTheme()) { toggleTheme.setVisible(false); } else { // Set title of menu item to switch to dark/light theme if (K9.getK9MessageViewTheme() == K9.Theme.DARK) { toggleTheme.setTitle(R.string.message_view_theme_action_light); } else { toggleTheme.setTitle(R.string.message_view_theme_action_dark); } toggleTheme.setVisible(true); } // Set title of menu item to toggle the read state of the currently // displayed message if (mMessageViewFragment.isMessageRead()) { mMenu2.findItem(R.id.toggle_unread).setTitle(R.string.mark_as_unread_action); } else { mMenu2.findItem(R.id.toggle_unread).setTitle(R.string.mark_as_read_action); } // Jellybean has built-in long press selection support mMenu2.findItem(R.id.select_text).setVisible(Build.VERSION.SDK_INT < 16); mMenu2.findItem(R.id.delete).setVisible(K9.isMessageViewDeleteActionVisible()); /* * Set visibility of copy, move, archive, spam in action bar and * refile submenu */ if (mMessageViewFragment.isCopyCapable()) { mMenu2.findItem(R.id.copy).setVisible(K9.isMessageViewCopyActionVisible()); mMenu2.findItem(R.id.refile_copy).setVisible(true); } else { mMenu2.findItem(R.id.copy).setVisible(false); mMenu2.findItem(R.id.refile_copy).setVisible(false); } if (mMessageViewFragment.isMoveCapable()) { boolean canMessageBeArchived = mMessageViewFragment.canMessageBeArchived(); boolean canMessageBeMovedToSpam = mMessageViewFragment.canMessageBeMovedToSpam(); mMenu2.findItem(R.id.move).setVisible(K9.isMessageViewMoveActionVisible()); mMenu2.findItem(R.id.archive) .setVisible(canMessageBeArchived && K9.isMessageViewArchiveActionVisible()); mMenu2.findItem(R.id.spam) .setVisible(canMessageBeMovedToSpam && K9.isMessageViewSpamActionVisible()); mMenu2.findItem(R.id.refile_move).setVisible(true); mMenu2.findItem(R.id.refile_archive).setVisible(canMessageBeArchived); mMenu2.findItem(R.id.refile_spam).setVisible(canMessageBeMovedToSpam); } else { mMenu2.findItem(R.id.move).setVisible(false); mMenu2.findItem(R.id.archive).setVisible(false); mMenu2.findItem(R.id.spam).setVisible(false); mMenu2.findItem(R.id.refile).setVisible(false); } if (mMessageViewFragment.allHeadersVisible()) { mMenu2.findItem(R.id.show_headers).setVisible(false); } else { mMenu2.findItem(R.id.hide_headers).setVisible(false); } } /* * Set visibility of menu items related to the message list */ // Hide both search menu items by default and enable one when // appropriate mMenu2.findItem(R.id.search).setVisible(false); mMenu2.findItem(R.id.search_remote).setVisible(false); if (mDisplayMode == DisplayMode.MESSAGE_VIEW || mMessageListFragment == null || !mMessageListFragment.isInitialized()) { mMenu2.findItem(R.id.check_mail).setVisible(false); mMenu2.findItem(R.id.set_sort).setVisible(false); mMenu2.findItem(R.id.select_all).setVisible(false); mMenu2.findItem(R.id.send_messages).setVisible(false); mMenu2.findItem(R.id.expunge).setVisible(false); mMenu2.findItem(R.id.mark_all_as_read).setVisible(false); mMenu2.findItem(R.id.show_folder_list).setVisible(false); } else { mMenu2.findItem(R.id.set_sort).setVisible(true); mMenu2.findItem(R.id.select_all).setVisible(true); mMenu2.findItem(R.id.composeList).setVisible(true); mMenu2.findItem(R.id.mark_all_as_read).setVisible(mMessageListFragment.isMarkAllAsReadSupported()); if (!mMessageListFragment.isSingleAccountMode()) { mMenu2.findItem(R.id.expunge).setVisible(false); mMenu2.findItem(R.id.send_messages).setVisible(false); mMenu2.findItem(R.id.show_folder_list).setVisible(false); } else { mMenu2.findItem(R.id.send_messages).setVisible(mMessageListFragment.isOutbox()); mMenu2.findItem(R.id.expunge).setVisible( mMessageListFragment.isRemoteFolder() && mMessageListFragment.isAccountExpungeCapable()); mMenu2.findItem(R.id.show_folder_list).setVisible(true); } mMenu2.findItem(R.id.check_mail).setVisible(mMessageListFragment.isCheckMailSupported()); // If this is an explicit local search, show the option to search on // the server if (!mMessageListFragment.isRemoteSearch() && mMessageListFragment.isRemoteSearchAllowed()) { mMenu2.findItem(R.id.search_remote).setVisible(true); } else if (!mMessageListFragment.isManualSearch()) { mMenu2.findItem(R.id.search).setVisible(true); } } }
From source file:com.rfo.basic.Run.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.v(LOGTAG, "onCreate " + this.toString()); if (Basic.lines == null) { Log.e(LOGTAG, "onCreate: Lost context. Bail out."); finish();//from w w w . j av a 2 s .c o m return; } // Log.v(LOGTAG, "isOld " + isOld); if (isOld) { if (theWakeLock != null) { theWakeLock.release(); } if (theWifiLock != null) { theWifiLock.release(); } } theWakeLock = null; theWifiLock = null; isOld = true; ContextManager cm = Basic.getContextManager(); cm.registerContext(ContextManager.ACTIVITY_RUN, this); cm.setCurrent(ContextManager.ACTIVITY_RUN); mConsoleIntent = getIntent(); // keep a reference to the Intent that started Run InitRunVars(); // Establish the output screen setContentView(R.layout.console); TextStyle style = new TextStyle(Basic.defaultTextStyle, Settings.getConsoleTypeface(this)); mConsole = new Basic.ColoredTextAdapter(this, mOutput, style); clearConsole(); lv = (ConsoleListView) findViewById(R.id.console); lv.setAdapter(mConsole); lv.setKeyboardManager(mKeyboardChangeListener); lv.setTextFilterEnabled(false); lv.setBackgroundColor(Settings.getEmptyConsoleColor(this).equals("line") ? mConsole.getLineColor() : mConsole.getBackgroundColor()); // default is "background" if (Settings.getLinedConsole(this)) { lv.setDivider(new ColorDrawable(mConsole.getLineColor())); // override default from theme, sometimes it's invisible if (lv.getDividerHeight() < 1) { lv.setDividerHeight(1); } // make sure the divider shows } else { lv.setDividerHeight(0); // don't show the divider } setVolumeControlStream(AudioManager.STREAM_MUSIC); setRequestedOrientation(Settings.getSreenOrientation(this)); headsetBroadcastReceiver = new BroadcastsHandler(); this.registerReceiver(headsetBroadcastReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG)); // Listeners for Console Touch lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { triggerInterrupt(Interrupt.CONS_TOUCH_BIT); TouchedConsoleLine = position + 1; ConsoleLongTouch = false; } }); lv.setOnItemLongClickListener(new OnItemLongClickListener() { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { triggerInterrupt(Interrupt.CONS_TOUCH_BIT); TouchedConsoleLine = position + 1; ConsoleLongTouch = true; return true; } }); mInterpreter = new Interpreter(); // start the interpreter in a background Thread mInterpreter.start(); }
From source file:com.klinker.android.launcher.launcher3.Launcher.java
private void setWorkspaceBackground(int background) { switch (background) { case WORKSPACE_BACKGROUND_TRANSPARENT: getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); break;//from w w w . j ava 2 s. c om case WORKSPACE_BACKGROUND_BLACK: getWindow().setBackgroundDrawable(null); break; default: getWindow().setBackgroundDrawable(mWorkspaceBackgroundDrawable); } }
From source file:com.xplink.android.carchecklist.CarCheckListActivity.java
private void SlideSettingLayout() { SharedPreferences mSharedPrefs = getSharedPreferences("mysettings", Context.MODE_PRIVATE); // Bundle seek = getIntent().getExtras(); final Dialog settingdialog = new Dialog(CarCheckListActivity.this, R.style.backgrounddialog); settingdialog.requestWindowFeature(Window.FEATURE_NO_TITLE); settingdialog.setContentView(R.layout.settingdialoglayout); final SeekBar powerseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Powerbar); final SeekBar engineseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Enginebar); final SeekBar exteriorseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Exteriorbar); // exteriorseekbar.setIndeterminate(false); final SeekBar interiorseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Interiorbar); final SeekBar documentseekbar = (SeekBar) settingdialog.getWindow().findViewById(R.id.Documentbar); // seekbar.putInt("Powerbar", powerseekbarValue).commit(); // if(seek != null){ Log.i("insettings", "seekbar : power-> " + mSharedPrefs.getInt("Powerbar", 0)); Log.i("insettings", "seekbar : engine->" + mSharedPrefs.getInt("Enginebar", 0)); Log.i("insettings", "seekbar : exterior->" + mSharedPrefs.getInt("Exteriorbar", 0)); Log.i("insettings", "seekbar : interior->" + mSharedPrefs.getInt("Interiorbar", 0)); Log.i("insettings", "seekbar : document->" + mSharedPrefs.getInt("Documentbar", 0)); powerseekbar.setProgress(mSharedPrefs.getInt("Powerbar", 0)); engineseekbar.setProgress(mSharedPrefs.getInt("Enginebar", 0)); exteriorseekbar.setProgress(mSharedPrefs.getInt("Exteriorbar", 0)); interiorseekbar.setProgress(mSharedPrefs.getInt("Interiorbar", 0)); documentseekbar.setProgress(mSharedPrefs.getInt("Documentbar", 0)); /*//from w w w.ja va2 s. com * for(Map.Entry<String, Integer> entry : mapSetting.entrySet()){ * if("interior".equals(entry.getKey())) edit.putInt("Interiorbar", * entry.getValue()); else if("power".equals(entry.getKey())) * edit.putInt("Powerbar", entry.getValue()); else * if("engine".equals(entry.getKey())) edit.putInt("Enginebar", * entry.getValue()); else if("exterior".equals(entry.getKey())) * edit.putInt("Exteriorbar", entry.getValue()); else * edit.putInt("Documentbar", entry.getValue()); * * //Log.i("checkSettingsName", "checkSettingsName : " + * entry.getKey()); } */ // ****************************************************check exist // current setting int powerBar = mSharedPrefs.getInt("Powerbar", 0); int engineBar = mSharedPrefs.getInt("Enginebar", 0); int exteriorBar = mSharedPrefs.getInt("Exteriorbar", 0); int interiorBar = mSharedPrefs.getInt("Interiorbar", 0); int documentBar = mSharedPrefs.getInt("Documentbar", 0); Log.i("power_setting", "*****in setting******power setting : " + powerBar); Log.i("engine_setting", "engine setting : " + engineBar); Log.i("exterior_setting", "exterior setting : " + exteriorBar); Log.i("interior_setting", "interior setting : " + interiorBar); Log.i("document_setting", "document setting : " + documentBar); // } TextView setting = (TextView) settingdialog.getWindow().findViewById(R.id.Setting); TextView priority = (TextView) settingdialog.getWindow().findViewById(R.id.Priority); TextView low = (TextView) settingdialog.getWindow().findViewById(R.id.Low); TextView high = (TextView) settingdialog.getWindow().findViewById(R.id.High); TextView textexterior = (TextView) settingdialog.getWindow().findViewById(R.id.textexterior); TextView textinterior = (TextView) settingdialog.getWindow().findViewById(R.id.textinterior); TextView textpower = (TextView) settingdialog.getWindow().findViewById(R.id.textpower); TextView textengine = (TextView) settingdialog.getWindow().findViewById(R.id.textengine); TextView textdocument = (TextView) settingdialog.getWindow().findViewById(R.id.textdocument); TextView one = (TextView) settingdialog.getWindow().findViewById(R.id.one); TextView two = (TextView) settingdialog.getWindow().findViewById(R.id.two); TextView three = (TextView) settingdialog.getWindow().findViewById(R.id.three); TextView four = (TextView) settingdialog.getWindow().findViewById(R.id.four); TextView five = (TextView) settingdialog.getWindow().findViewById(R.id.five); setting.setTypeface(type); priority.setTypeface(type); low.setTypeface(type); high.setTypeface(type); textexterior.setTypeface(type); textinterior.setTypeface(type); textpower.setTypeface(type); textengine.setTypeface(type); textdocument.setTypeface(type); one.setTypeface(type); two.setTypeface(type); three.setTypeface(type); four.setTypeface(type); five.setTypeface(type); settingdialog.getWindow().getAttributes().windowAnimations = R.style.SettingDialogAnimation; settingdialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); // make everything around Dialog brightness than default WindowManager.LayoutParams lp = settingdialog.getWindow().getAttributes(); lp.dimAmount = 0f; settingdialog.setCanceledOnTouchOutside(true); settingdialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { headsetting.setVisibility(ImageView.VISIBLE); TranslateAnimation slideoutheadsetting = new TranslateAnimation(0, 0, 0, -468); slideoutheadsetting.setDuration(500); slideoutheadsetting.setFillAfter(true); headsetting.startAnimation(slideoutheadsetting); } }); Button btnsave = (Button) settingdialog.getWindow().findViewById(R.id.save); btnsave.setTypeface(type); btnsave.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { settingdialog.dismiss(); headsetting.setVisibility(ImageView.VISIBLE); TranslateAnimation slideoutheadsetting = new TranslateAnimation(0, 0, 0, -468); slideoutheadsetting.setDuration(500); slideoutheadsetting.setFillAfter(true); headsetting.startAnimation(slideoutheadsetting); powerseekbarValue = powerseekbar.getProgress(); engineseekbarValue = engineseekbar.getProgress(); exteriorseekbarValue = exteriorseekbar.getProgress(); interiorseekbarValue = interiorseekbar.getProgress(); documentseekbarValue = documentseekbar.getProgress(); Priority(); SharedPreferences mSharedPrefs = getSharedPreferences("mysettings", Context.MODE_PRIVATE); Editor seekbar = mSharedPrefs.edit(); seekbar.putInt("Powerbar", powerseekbarValue); seekbar.putInt("Enginebar", engineseekbarValue); seekbar.putInt("Exteriorbar", exteriorseekbarValue); seekbar.putInt("Interiorbar", interiorseekbarValue); seekbar.putInt("Documentbar", documentseekbarValue); seekbar.commit(); /* * int powerBar = shared2.getInt("Powerbar", 0); int engineBar = * shared2.getInt("Enginebar", 0); int exteriorBar = * shared2.getInt("Exteriorbar", 0); int interiorBar = * shared2.getInt("Interiorbar", 0); int documentBar = * shared2.getInt("Documentbar", 0); */ RatioProgress.setProgress(PercenRatio); Ratiotext.setText("Rating of the Vehicle. " + PercenRatio + " %"); CheckRatio(); } }); Button btnreset = (Button) settingdialog.getWindow().findViewById(R.id.reset); btnreset.setTypeface(type); btnreset.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { AlertDialog alertDialog = new AlertDialog.Builder(CarCheckListActivity.this).setTitle("Reset") .setMessage("Do you really want to clear data?") .setPositiveButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // do nothing } }).setNegativeButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent intent = getIntent(); SharedPreferences sharedPreferences = getSharedPreferences("mysettings", Context.MODE_PRIVATE); sharedPreferences.edit().clear().commit(); /* * int CheckDocumentTotal, * CheckPowerTotal, CheckEngineTotal, * CheckExteriorTotal, * CheckInteriorTotal, PercenDocument, * PercenPower, PercenEngine, * PercenExterior, PercenInterior, * PercenRatio, Checknum, * powerseekbarValue, * engineseekbarValue, * exteriorseekbarValue, * interiorseekbarValue, * documentseekbarValue, sumPriority, * PowerPriority, EnginePriority, * ExteriorPriority, InteriorPriority, * DocumentPriority, * documentprogressValue; */ /* * Log.i("checkreset", * "BEFORE CLEAR -> CheckDocumentTotal : " * + CheckDocumentTotal); * Log.i("checkreset", * "CheckPowerTotal : " + * CheckPowerTotal); Log.i("checkreset", * "CheckEngineTotal : " + * CheckEngineTotal); * Log.i("checkreset", * "CheckExteriorTotal : " + * CheckExteriorTotal); * Log.i("checkreset", * "CheckInteriorTotal : " + * CheckInteriorTotal); * Log.i("checkreset", * "PercenDocument : " + * PercenDocument); Log.i("checkreset", * "PercenPower : " + PercenPower); * Log.i("checkreset", "PercenEngine : " * + PercenEngine); Log.i("checkreset", * "PercenExterior : " + * PercenExterior); Log.i("checkreset", * "PercenInterior : " + * PercenInterior); Log.i("checkreset", * "PercenRatio : " + PercenRatio); * Log.i("checkreset", "Checknum : " + * Checknum); Log.i("checkreset", * "powerseekbarValue : " + * powerseekbarValue); * Log.i("checkreset", * "engineseekbarValue : " + * engineseekbarValue); * Log.i("checkreset", * "interiorseekbarValue : " + * interiorseekbarValue); * Log.i("checkreset", * "exteriorseekbarValue : " + * exteriorseekbarValue); * Log.i("checkreset", * "documentseekbarValue : " + * documentseekbarValue); * Log.i("checkreset", "sumPriority : " * + sumPriority); Log.i("checkreset", * "PowerPriority : " + PowerPriority); * Log.i("checkreset", * "EnginePriority : " + * EnginePriority); Log.i("checkreset", * "ExteriorPriority : " + * ExteriorPriority); * Log.i("checkreset", * "InteriorPriority : " + * InteriorPriority); * Log.i("checkreset", * "DocumentPriority : " + * DocumentPriority); */ getIntent().removeExtra("power"); getIntent().removeExtra("engine"); getIntent().removeExtra("exterior"); getIntent().removeExtra("interior"); getIntent().removeExtra("document"); //startActivity(intent); Intent ii = new Intent(getApplicationContext(), CarCheckListActivity.class); startActivity(ii); finish(); } }).show(); } }); Button btnChangeLanguage = (Button) settingdialog.getWindow().findViewById(R.id.change_language); btnChangeLanguage.setTypeface(type); btnChangeLanguage.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(CarCheckListActivity.this, ChangeLanguage.class); // th myIntent.putExtra("power", PercenPower); myIntent.putExtra("engine", PercenEngine); myIntent.putExtra("exterior", PercenExterior); myIntent.putExtra("interior", PercenInterior); myIntent.putExtra("document", PercenDocument); myIntent.putExtra("numpower", CheckPowerTotal); myIntent.putExtra("numengine", CheckEngineTotal); myIntent.putExtra("numexterior", CheckExteriorTotal); myIntent.putExtra("numinterior", CheckInteriorTotal); myIntent.putExtra("numdocument", CheckDocumentTotal); SharedPreferences shared = getSharedPreferences("mysettings", Context.MODE_PRIVATE); Editor editor = shared.edit(); int powerBar = shared.getInt("Powerbar", 0); int engineBar = shared.getInt("Enginebar", 0); int exteriorBar = shared.getInt("Exteriorbar", 0); int interiorBar = shared.getInt("Interiorbar", 0); int documentBar = shared.getInt("Documentbar", 0); Log.i("power_setting", "power setting : " + powerBar); Log.i("engine_setting", "engine setting : " + engineBar); Log.i("exterior_setting", "exterior setting : " + exteriorBar); Log.i("interior_setting", "interior setting : " + interiorBar); Log.i("document_setting", "document setting : " + documentBar); Log.i("checkInList", "Check in List : " + shared.getInt("checknum", 0)); CarCheckListActivity.this.startActivity(myIntent); finish(); } }); Button btnRecord = (Button) settingdialog.getWindow().findViewById(R.id.record); btnRecord.setTypeface(type); btnRecord.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.i("record", "record onClick"); final AlertDialog.Builder adb = new AlertDialog.Builder(getApplicationContext()); adb.setTitle("Warning Dialog"); adb.setMessage("you must select more than one checklist."); adb.setPositiveButton("Ok", null); SharedPreferences shared = getSharedPreferences("mysettings", MODE_PRIVATE); powerWeight = shared.getInt("Powerbar", 0); engineWeight = shared.getInt("Enginebar", 0); exteriorWeight = shared.getInt("Exteriorbar", 0); interiorWeight = shared.getInt("Interiorbar", 0); documentWeight = shared.getInt("Documentbar", 0); String display = "before record activity >> " + powerWeight + "|" + engineWeight + "|" + exteriorWeight + "|" + interiorWeight + "|" + documentWeight; Log.i("display", display); Log.i("checklist", "" + PercenPower); Log.i("checklist", "" + PercenEngine); Log.i("checklist", "" + PercenExterior); Log.i("checklist", "" + PercenInterior); Log.i("checklist", "" + PercenDocument); // checking scope isSaveCheckBox(); // progressCheckListLog(); // checking scope CarCheckListActivity.this.startActivity(intent); finish(); } }); Button btnList = (Button) settingdialog.getWindow().findViewById(R.id.list); btnList.setTypeface(type); btnList.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Checknumcheckbox(); Intent listSaving = new Intent(getApplicationContext(), ListSaveActivity.class); startActivity(listSaving); finish(); } }); headsetting.setVisibility(ImageView.VISIBLE); TranslateAnimation slideheadsetting = new TranslateAnimation(0, 0, -468, 0); slideheadsetting.setDuration(500); slideheadsetting.setFillAfter(true); headsetting.startAnimation(slideheadsetting); settingdialog.show(); WindowManager.LayoutParams params = settingdialog.getWindow().getAttributes(); params.y = 0; params.x = 60; params.gravity = Gravity.TOP | Gravity.LEFT; settingdialog.getWindow().setAttributes(params); powerseekbarValue = mSharedPrefs.getInt("Powerbar", 0); engineseekbarValue = mSharedPrefs.getInt("Enginebar", 0); exteriorseekbarValue = mSharedPrefs.getInt("Exteriorbar", 0); interiorseekbarValue = mSharedPrefs.getInt("Interiorbar", 0); documentseekbarValue = mSharedPrefs.getInt("Documentbar", 0); PowerPriority = powerseekbarValue + 1; EnginePriority = engineseekbarValue + 1; ExteriorPriority = exteriorseekbarValue + 1; InteriorPriority = interiorseekbarValue + 1; DocumentPriority = documentseekbarValue + 1; /* * powerseekbar.setProgress(mSharedPrefs.getInt("Powerbar", 0)); * engineseekbar.setProgress(mSharedPrefs.getInt("Enginebar", 0)); * exteriorseekbar.setProgress(mSharedPrefs.getInt("Exteriorbar", 0)); * interiorseekbar.setProgress(mSharedPrefs.getInt("Interior", 0)); * documentseekbar.setProgress(mSharedPrefs.getInt("Documentbar", 0)); */ powerseekbar.setProgress(powerseekbarValue); engineseekbar.setProgress(engineseekbarValue); exteriorseekbar.setProgress(exteriorseekbarValue); interiorseekbar.setProgress(interiorseekbarValue); documentseekbar.setProgress(documentseekbarValue); }
From source file:com.cognizant.trumobi.PersonaLauncher.java
public void showPreviews(final View anchor, int start, int end) { if (mWorkspace != null && mWorkspace.getChildCount() > 0) { if (newPreviews) { showingPreviews = true;// w w w .ja va 2s . c o m hideDesktop(true); mWorkspace.lock(); mWorkspace.openSense(true); } else { // check first if it's already open final PopupWindow window = (PopupWindow) anchor.getTag(R.id.TAG_PREVIEW); if (window != null) return; Resources resources = getResources(); PersonaWorkspace personaWorkspace = mWorkspace; PersonaCellLayout cell = ((PersonaCellLayout) personaWorkspace.getChildAt(start)); float max; ViewGroup preview; max = personaWorkspace.getChildCount(); preview = new LinearLayout(this); Rect r = new Rect(); // ADW: seems sometimes this throws an out of memory error.... // so... try { resources.getDrawable(R.drawable.pr_preview_background).getPadding(r); } catch (OutOfMemoryError e) { } int extraW = (int) ((r.left + r.right) * max); int extraH = r.top + r.bottom; int aW = cell.getWidth() - extraW; float w = aW / max; int width = cell.getWidth(); int height = cell.getHeight(); // width -= (x + cell.getRightPadding()); // height -= (y + cell.getBottomPadding()); if (width != 0 && height != 0) { showingPreviews = true; float scale = w / width; int count = end - start; final float sWidth = width * scale; float sHeight = height * scale; PreviewTouchHandler handler = new PreviewTouchHandler(anchor); ArrayList<Bitmap> bitmaps = new ArrayList<Bitmap>(count); for (int i = start; i < end; i++) { ImageView image = new ImageView(this); cell = (PersonaCellLayout) personaWorkspace.getChildAt(i); Bitmap bitmap = Bitmap.createBitmap((int) sWidth, (int) sHeight, Bitmap.Config.ARGB_8888); cell.setDrawingCacheEnabled(false); Canvas c = new Canvas(bitmap); c.scale(scale, scale); c.translate(-cell.getLeftPadding(), -cell.getTopPadding()); cell.dispatchDraw(c); image.setBackgroundDrawable(resources.getDrawable(R.drawable.pr_preview_background)); image.setImageBitmap(bitmap); image.setTag(i); image.setOnClickListener(handler); image.setOnFocusChangeListener(handler); image.setFocusable(true); if (i == mWorkspace.getCurrentScreen()) image.requestFocus(); preview.addView(image, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); bitmaps.add(bitmap); } PopupWindow p = new PopupWindow(this); p.setContentView(preview); p.setWidth((int) (sWidth * count + extraW)); p.setHeight((int) (sHeight + extraH)); p.setAnimationStyle(R.style.AnimationPreview); p.setOutsideTouchable(true); p.setFocusable(true); p.setBackgroundDrawable(new ColorDrawable(0)); p.showAsDropDown(anchor, 0, 0); p.setOnDismissListener(new PopupWindow.OnDismissListener() { public void onDismiss() { dismissPreview(anchor); } }); anchor.setTag(R.id.TAG_PREVIEW, p); anchor.setTag(R.id.workspace, preview); anchor.setTag(R.id.icon, bitmaps); } } } }
From source file:com.cognizant.trumobi.PersonaLauncher.java
public void setWindowBackground(boolean lwp) { wallpaperHack = lwp;// w w w .ja v a 2 s. c o m if (!lwp) { getWindow().setBackgroundDrawable(null); getWindow().setFormat(PixelFormat.OPAQUE); // getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER); } else { getWindow().setBackgroundDrawable(new ColorDrawable(0)); getWindow().setFormat(PixelFormat.TRANSPARENT); // getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER); } }
From source file:com.xmobileapp.rockplayer.RockPlayer.java
/******************************** * //from www.j ava 2s. com * set Background * ********************************/ public void setBackground() { try { String bgPath = null; RockOnPreferenceManager settings = new RockOnPreferenceManager(FILEX_PREFERENCES_PATH); Log.i("BG", "BG"); if (settings.getBoolean(PREFS_CUSTOM_BACKGROUND, false)) { Log.i("DBG", "Setting up background"); if (display.getOrientation() == 0) bgPath = FILEX_BACKGROUND_PATH + PREFS_CUSTOM_BACKGROUND_PORTRAIT; else bgPath = FILEX_BACKGROUND_PATH + PREFS_CUSTOM_BACKGROUND_LANDSCAPE; Bitmap bgBitmap = BitmapFactory.decodeStream(new FileInputStream(new File(bgPath))); findViewById(R.id.songfest_container).setBackgroundDrawable(new BitmapDrawable(bgBitmap)); } else if (settings.getBoolean(PREFS_BACKGROUND_BLUR, false)) { Log.i("DBG", "Blurring Background"); System.gc(); /* * Blur&Dim the BG */ // getTheme().applyStyle(arg0, arg1) getWindow().setBackgroundDrawable(new ColorDrawable(Color.argb(0, 0, 0, 0))); // Have the system blur any windows behind this one. getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND); // getWindow().setFlags(WindowManager.LayoutParams.FLAG_DITHER, // WindowManager.LayoutParams.FLAG_DITHER); getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_DIM_BEHIND); WindowManager.LayoutParams params = getWindow().getAttributes(); params.dimAmount = 0.625f; getWindow().setAttributes(params); } else { Log.i("DBG", "Clearing out background"); System.gc(); findViewById(R.id.songfest_container).setBackgroundDrawable(null); getWindow().setBackgroundDrawable(null); // Do something } // BitmapFactory.Options opts = new BitmapFactory.Options(); // opts.inJustDecodeBounds = true; // BitmapFactory.decodeFile(bgPath, opts); // int sampling = 1; // TODO::::: // opts.inJustDecodeBounds = false; // Bitmap bgBitmap = null; // if(opts.outHeight/display.getHeight() > opts.outWidth/display.getWidth()){ // int newHeight = (int)Math.round(opts.outHeight*(display.getWidth()/opts.outWidth)); // Bitmap tmpBitmap = Bitmap.createScaledBitmap( // BitmapFactory.decodeStream(new FileInputStream(bgPath), null, opts), // display.getWidth(), // newHeight, // false); // bgBitmap = Bitmap.createBitmap( // tmpBitmap, // 0, // (newHeight-display.getHeight())/2, // display.getWidth(), // display.getHeight(), // null, // false); // } else { // int newWidth = (int)Math.round(opts.outWidth*(display.getHeight()/opts.outHeight)); // Bitmap tmpBitmap = Bitmap.createScaledBitmap( // BitmapFactory.decodeStream(new FileInputStream(bgPath), null, opts), // newWidth, // display.getHeight(), // false); // bgBitmap = Bitmap.createBitmap( // tmpBitmap, // (newWidth-display.getWidth())/2, // 0, // display.getWidth(), // display.getHeight(), // null, // false); // } // findViewById(R.id.songfest_container) // .setBackgroundDrawable(new BitmapDrawable(bgBitmap)); } catch (Exception e) { e.printStackTrace(); } }