本文整理汇总了Java中wei.mark.standout.ui.Window类的典型用法代码示例。如果您正苦于以下问题:Java Window类的具体用法?Java Window怎么用?Java Window使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Window类属于wei.mark.standout.ui包,在下文中一共展示了Window类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParams
import wei.mark.standout.ui.Window; //导入依赖的package包/类
@Override
public StandOutLayoutParams getParams(int id, Window window) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String s = prefs.getString("_id" + id, "");
try {
if (!s.equals("")) {
int x = Integer.parseInt(s.split(",")[0]);
int y = Integer.parseInt(s.split(",")[1]);
int w = Math.max((int) pxFromDp(120), Integer.parseInt(s.split(",")[2]));
int h = Math.max((int) pxFromDp(120), Integer.parseInt(s.split(",")[3]));
return new StandOutLayoutParams(id, w, h, x, y, (int) pxFromDp(120), (int) pxFromDp(120));
}
} catch (Exception e) {
e.printStackTrace();
}
return new StandOutLayoutParams(id, (int) pxFromDp(150), (int) pxFromDp(150), StandOutLayoutParams.CENTER, StandOutLayoutParams.CENTER, (int) pxFromDp(120), (int) pxFromDp(120));
}
示例2: bringToFront
import wei.mark.standout.ui.Window; //导入依赖的package包/类
/**
* Bring the window corresponding to this id in front of all other windows.
* The window may flicker as it is removed and restored by the system.
*
* @param id The id of the window to bring to the front.
*/
public final synchronized void bringToFront(int id) {
Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to bringToFront(" + id + ") a null window.");
}
StandOutLayoutParams params = window.getLayoutParams();
// remove from window manager then add back
try {
mWindowManager.removeView(window);
mWindowManager.addView(window, params);
inFront = window.id;
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例3: focus
import wei.mark.standout.ui.Window; //导入依赖的package包/类
/**
* Request focus for the window corresponding to this id. A maximum of one
* window can have focus, and that window will receive all key events,
* including Back and Menu.
*
* @param id The id of the window.
* @return True if focus changed successfully, false if it failed.
*/
public final synchronized boolean focus(int id) {
try {
// check if that window is focusable
final Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to focus(" + id + ") a null window.");
}
if (!Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_FOCUSABLE_DISABLE)) {
// remove focus from previously focused window
if (sFocusedWindow != null) {
unfocus(sFocusedWindow);
}
return window.onFocus(true);
}
} catch (Exception e) {
}
return false;
}
示例4: focus
import wei.mark.standout.ui.Window; //导入依赖的package包/类
/**
* Request focus for the window corresponding to this id. A maximum of one
* window can have focus, and that window will receive all key events,
* including Back and Menu.
*
* @param id
* The id of the window.
* @return True if focus changed successfully, false if it failed.
*/
public final synchronized boolean focus(int id) {
// check if that window is focusable
final Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to focus(" + id
+ ") a null window.");
}
if (!Utils.isSet(window.flags,
StandOutFlags.FLAG_WINDOW_FOCUSABLE_DISABLE)) {
// remove focus from previously focused window
if (sFocusedWindow != null) {
unfocus(sFocusedWindow);
}
return window.onFocus(true);
}
return false;
}
示例5: onReceiveData
import wei.mark.standout.ui.Window; //导入依赖的package包/类
@Override
public void onReceiveData(int id, int requestCode, Bundle data,
Class<? extends StandOutWindow> fromCls, int fromId) {
// receive data from WidgetsWindow's button press
// to show off the data sending framework
switch (requestCode) {
case WidgetsWindow.DATA_CHANGED_TEXT:
Window window = getWindow(id);
if (window == null) {
String errorText = String.format(Locale.US,
"%s received data but Window id: %d is not open.",
getAppName(), id);
Toast.makeText(this, errorText, Toast.LENGTH_SHORT).show();
return;
}
String changedText = data.getString("changedText");
TextView status = (TextView) window.findViewById(R.id.id);
status.setTextSize(20);
status.setText("Received data from WidgetsWindow: "
+ changedText);
break;
default:
Log.d("MultiWindow", "Unexpected data received.");
break;
}
}
示例6: getParams
import wei.mark.standout.ui.Window; //导入依赖的package包/类
@Override
public StandOutLayoutParams getParams(int id, Window window) {
if (APP_SELECTOR_ID == id) {
return new StandOutLayoutParams(id, 400,
StandOutLayoutParams.FILL_PARENT,
StandOutLayoutParams.CENTER, StandOutLayoutParams.TOP);
} else {
FolderModel folder = mFolders.get(id);
int width = folder.width;
int height = folder.height;
if (width == 0) {
width = 400;
}
if (height == 0) {
height = 400;
}
return new StandOutLayoutParams(id, width, height, 50, 50);
}
}
示例7: getParams
import wei.mark.standout.ui.Window; //导入依赖的package包/类
@Override
public StandOutLayoutParams getParams(int id, Window window) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String s = prefs.getString("_id" + id, "");
try {
if (!s.equals("")) {
int x = Integer.parseInt(s.split(",")[0]);
int y = Integer.parseInt(s.split(",")[1]);
int w = Math.max((int) pxFromDp(120), Integer.parseInt(s.split(",")[2]));
int h = Math.max((int) pxFromDp(120), Integer.parseInt(s.split(",")[3]));
return new StandOutLayoutParams(id, w, h, x, y, (int) pxFromDp(120), (int) pxFromDp(120));
}
} catch (Exception e) {
e.printStackTrace();
}
return new StandOutLayoutParams(id, (int) pxFromDp(150), (int) pxFromDp(150), StandOutLayoutParams.CENTER, StandOutLayoutParams.CENTER, (int) pxFromDp(120), (int) pxFromDp(120));
}
示例8: onDoubleTap
import wei.mark.standout.ui.Window; //导入依赖的package包/类
@Override
public boolean onDoubleTap(int id, Window window, MotionEvent event) {
Set<Integer> ids = StandOutWindow.sWindowCache.getCacheIds(FloatingWidget.class);
for (int i: ids)
{
if (i != FLOAT_UNIQUE_ID)
{
//Send data to the Floating Widget service to restore the hidden Widgets
getStandOutContext().sendData(FLOAT_UNIQUE_ID,FloatingWidget.class,i,0,null);
IS_MINIMIZED = false;
break;
}
}
stopSelf();
return super.onDoubleTap(id, window, event);
}
示例9: focus
import wei.mark.standout.ui.Window; //导入依赖的package包/类
/**
* Request focus for the window corresponding to this id. A maximum of one
* window can have focus, and that window will receive all key events,
* including Back and Menu.
*
* @param id
* The id of the window.
* @return True if focus changed successfully, false if it failed.
*/
public final synchronized boolean focus(int id) {
try {
// check if that window is focusable
final Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to focus(" + id + ") a null window.");
}
if (!Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_FOCUSABLE_DISABLE)) {
// remove focus from previously focused window
if (sFocusedWindow != null) {
unfocus(sFocusedWindow);
}
return window.onFocus(true);
}
} catch (Exception e) {
}
return false;
}
示例10: onKeyEvent
import wei.mark.standout.ui.Window; //导入依赖的package包/类
@Override
public boolean onKeyEvent(int id, Window window, KeyEvent event) {
if ((event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_UP && event.getRepeatCount() <= 2))
{
alpha += 0.10f;
if(alpha > 1)alpha=1.0f;
// ? change alpha values below HoneyComb
}
else if(event.getKeyCode() == KeyEvent.KEYCODE_VOLUME_DOWN && event.getRepeatCount() <= 2)
{
alpha -= 0.10f;
if(alpha < 0.30f)alpha=0.30f;
// ? change alpha values below HoneyComb
}
return super.onKeyEvent(id, window, event);
}
示例11: getParams
import wei.mark.standout.ui.Window; //导入依赖的package包/类
@Override
public StandOutLayoutParams getParams(int id, Window window) {
/*
* return new StandOutLayoutParams(id, 200, 200,
* StandOutLayoutParams.CENTER, StandOutLayoutParams.CENTER);
*/
WindowManager win = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
Display display = win.getDefaultDisplay();
@SuppressWarnings("deprecation")
int width = display.getWidth();
@SuppressWarnings({ "deprecation", "unused" })
int height = display.getHeight();
return new StandOutLayoutParams(id, width * 7 / 8,
StandOutLayoutParams.WRAP_CONTENT, StandOutLayoutParams.CENTER,
StandOutLayoutParams.TOP + 20);
}
示例12: onFocusChange
import wei.mark.standout.ui.Window; //导入依赖的package包/类
/**
* Changes the stickies to transparent when unfocused (commented out)
*/
@Override
public boolean onFocusChange(int id, Window window, boolean focus) {
if (focus) {
window.findViewById(R.id.body).getBackground().setAlpha(255);
window.findViewById(R.id.window).getBackground().setAlpha(100);
window.findViewById(R.id.titlebar).getBackground().setAlpha(255);
} else {
window.findViewById(R.id.body).getBackground().setAlpha(160);
window.findViewById(R.id.window).getBackground().setAlpha(80);
window.findViewById(R.id.titlebar).getBackground().setAlpha(160);
}
return false;
}
示例13: save
import wei.mark.standout.ui.Window; //导入依赖的package包/类
public void save() {
new Thread(new Runnable() {
@Override
public void run() {
try {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = prefs.edit();
File sdcard = Environment.getExternalStorageDirectory();
File dir = new File(sdcard.getAbsolutePath() + "/FloatingStickies/");
dir.mkdirs();
for (int id : getExistingIds()) {
String text = getWindow(id).getText();
if (text.length() > 0) {
File file = new File(dir, "sticky" + id + ".txt");
Window window = getWindow(id);
int x = window.getLayoutParams().x;
if (x <= 0) {
editor.putString("_id" + id, x + "," + window.getLayoutParams().y + "," + window.dockW + "," + window.dockH + "," + file.getAbsolutePath()).commit();
} else {
editor.putString("_id" + id, x + "," + window.getLayoutParams().y + "," + window.getWidth() + "," + window.getHeight() + "," + file.getAbsolutePath()).commit();
}
FileOutputStream f = new FileOutputStream(file);
f.write(text.getBytes());
f.flush();
f.close();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
示例14: setTitle
import wei.mark.standout.ui.Window; //导入依赖的package包/类
/**
* Change the title of the window, if such a title exists. A title exists if
* {@link StandOutFlags#FLAG_DECORATION_SYSTEM} is set, or if your own view
* contains a TextView with id R.id.title.
*
* @param id The id of the window.
* @param text The new title.
*/
public final void setTitle(int id, String text) {
Window window = getWindow(id);
if (window != null) {
// View title = window.findViewById(R.id.title);
// if (title instanceof TextView) {
// ((TextView) title).setText(text);
// }
}
}
示例15: setIcon
import wei.mark.standout.ui.Window; //导入依赖的package包/类
/**
* Change the icon of the window, if such a icon exists. A icon exists if
* {@link StandOutFlags#FLAG_DECORATION_SYSTEM} is set, or if your own view
* contains a TextView with id R.id.window_icon.
*
* @param id The id of the window.
* @param drawableRes The new icon.
*/
public final void setIcon(int id, int drawableRes) {
Window window = getWindow(id);
if (window != null) {
// View icon = window.findViewById(R.id.window_icon);
// if (icon instanceof ImageView) {
// ((ImageView) icon).setImageResource(drawableRes);
// }
}
}