123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562 |
- package kr.co.icontrols.wallpadmain.popup;
- import com.artncore.wallpadapi.WallPadAPI;
- import android.content.Context;
- import android.content.Intent;
- import android.graphics.Color;
- import android.util.Log;
- import android.view.Gravity;
- import android.view.MotionEvent;
- import android.view.View;
- import android.widget.RelativeLayout;
- import com.util.LogUtil;
- import kr.co.icontrols.wallpadmain.MainActivity;
- import kr.co.icontrols.wallpadmain.PopupActivity;
- import kr.co.icontrols.wallpadmain.R;
- import kr.co.icontrols.wallpadmain.declare.*;
- import kr.co.icontrols.wallpadmain.util.IconManager;
- import kr.co.icontrols.wallpadmain.declare.DataClasses.IconInfoTable;
- import kr.co.icontrols.wallpadmain.util.POSITION;
- import kr.co.icontrols.wallpadsupport.*;
- import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
- import kr.co.icontrols.wallpadsupport.WpadSound.SND;
- public class GroupAdd extends WpadScreen {
- String TAG = "GroupAdd";
- Context mContext;
- WallPadAPI mWallPadAPI;
- RelativeLayout mRelativeLayout;
- WpadImageView IMG_BACKGROUND;
- WpadImageView BTN_PREVIOUS;
- WpadImageView BTN_NEXT;
- WpadImageView BTN_CLOSE;
- WpadImageView [] BTN_SHORTCUT_ICON = new WpadImageView[8];
- WpadTextView [] TXT_SHORTCUT_NAME = new WpadTextView[8];
- WpadTextView TXT_TITLE;
- IconManager mIconManager;
- IconInfoTable mIconInfoTable;
- IconInfoTable mPopupIconTable;
- int nMAXPageNo = 1; // 아이콘 화면 페이지 수
- int nCurrentPageNo = 1; // 현재 페이지 번호
- int nMAXIconNoOnaPage = 8; // 한 화면에 들어가는 최대 아이콘 개수
- private int nLongKeyCnt = 0;
- private int nPreviousTargetID = 0;
- private int LONGKEY_THRESHOLD = 3;
- private int shortcutCnt = 0, shortcutMax = 0;
- int nTitleSize = 35;
- int nNameSize = 22;
- String strTitle = "부가";
- private void initInfo() {
- try {
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) {
- nTitleSize = 45;
- nNameSize = 30;
- }
- else {
- nTitleSize = 35;
- nNameSize = 22;
- }
- mPopupIconTable = new IconInfoTable();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] initInfo()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public GroupAdd(Context context, RelativeLayout layout, WallPadAPI wallpadapi) {
- super(context, layout);
- try {
- mContext = context;
- mWallPadAPI = wallpadapi;
- mRelativeLayout = layout;
- initInfo();
- Log.d(TAG, "[GroupAdd] ========== START ==========");
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) {
- IMG_BACKGROUND = new WpadImageView(context, TOUCH_KIND.NONE, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.IMAGES.BACKGROUND).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.IMAGES.BACKGROUND).H, R.drawable.back_popup_05_1280, 0, ID.POPUPS.GROUPADD.ELEMENTS.IMAGES.BACKGROUND);
- ViewRegistration(layout, IMG_BACKGROUND, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.IMAGES.BACKGROUND).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.IMAGES.BACKGROUND).Y);
- BTN_PREVIOUS = new WpadImageView(context, TOUCH_KIND.BUTTON, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS).H, R.drawable.popup_btn_previous_group_normal_1280, R.drawable.popup_btn_previous_group_pressed_1280, ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS);
- ViewRegistration(layout, BTN_PREVIOUS, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS).Y);
- BTN_PREVIOUS.setTouchDelayMs(500);
- BTN_PREVIOUS.setVisibility(View.INVISIBLE);
- BTN_NEXT = new WpadImageView(context, TOUCH_KIND.BUTTON, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT).H, R.drawable.popup_btn_next_group_normal_1280, R.drawable.popup_btn_next_group_pressed_1280, ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT);
- ViewRegistration(layout, BTN_NEXT, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT).Y);
- BTN_NEXT.setTouchDelayMs(500);
- BTN_NEXT.setVisibility(View.INVISIBLE);
- BTN_CLOSE = new WpadImageView(context, TOUCH_KIND.BUTTON, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).H, R.drawable.popup_btn_close_group_normal_1280, R.drawable.popup_btn_close_group_pressed_1280, ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE);
- ViewRegistration(layout, BTN_CLOSE, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).Y);
- BTN_CLOSE.setTouchDelayMs(500);
- TXT_TITLE = new WpadTextView(context, false, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.TITLE).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.TITLE).H, Gravity.CENTER, Color.WHITE, nTitleSize, true, ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.TITLE);
- ViewRegistration(layout, TXT_TITLE, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.TITLE).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.TITLE).Y);
- TXT_TITLE.setText(strTitle);
- // TXT_TITLE.setBackgroundColor(Color.RED);
- }
- else {
- IMG_BACKGROUND = new WpadImageView(context, TOUCH_KIND.NONE, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.IMAGES.BACKGROUND).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.IMAGES.BACKGROUND).H, R.drawable.back_popup_05, 0, ID.POPUPS.GROUPADD.ELEMENTS.IMAGES.BACKGROUND);
- ViewRegistration(layout, IMG_BACKGROUND, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.IMAGES.BACKGROUND).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.IMAGES.BACKGROUND).Y);
- BTN_PREVIOUS = new WpadImageView(context, TOUCH_KIND.BUTTON, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS).H, R.drawable.popup_btn_previous_group_normal, R.drawable.popup_btn_previous_group_pressed, ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS);
- ViewRegistration(layout, BTN_PREVIOUS, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS).Y);
- BTN_PREVIOUS.setTouchDelayMs(500);
- BTN_PREVIOUS.setVisibility(View.INVISIBLE);
- BTN_NEXT = new WpadImageView(context, TOUCH_KIND.BUTTON, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT).H, R.drawable.popup_btn_next_group_normal, R.drawable.popup_btn_next_group_pressed, ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT);
- ViewRegistration(layout, BTN_NEXT, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT).Y);
- BTN_NEXT.setTouchDelayMs(500);
- BTN_NEXT.setVisibility(View.INVISIBLE);
- BTN_CLOSE = new WpadImageView(context, TOUCH_KIND.BUTTON, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).H, R.drawable.popup_btn_close_group_normal, R.drawable.popup_btn_close_group_pressed, ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE);
- ViewRegistration(layout, BTN_CLOSE, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).Y);
- BTN_CLOSE.setTouchDelayMs(500);
- BTN_CLOSE = new WpadImageView(context, TOUCH_KIND.BUTTON, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).H, R.drawable.popup_btn_close_group_normal, R.drawable.popup_btn_close_group_pressed, ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE);
- ViewRegistration(layout, BTN_CLOSE, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE).Y);
- BTN_CLOSE.setTouchDelayMs(500);
- TXT_TITLE = new WpadTextView(context, false, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.TITLE).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.TITLE).H, Gravity.CENTER, Color.WHITE, nTitleSize, true, ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.TITLE);
- ViewRegistration(layout, TXT_TITLE, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.TITLE).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.TITLE).Y);
- TXT_TITLE.setText(strTitle);
- // TXT_TITLE.setBackgroundColor(Color.RED);
- }
- getAddIcons(layout);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] GroupAdd(Context context, RelativeLayout layout)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- protected void onClose() {
- super.onClose();
- try {
- Log.d(TAG, "[GroupAdd] ========== onClose ==========");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] onClose()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- @Override
- protected void onTouchEvent(View v, MotionEvent event) {
- super.onTouchEvent(v, event);
- try {
- int nTargetID = v.getId();
- int nEvent = event.getAction();
- if (nEvent == MotionEvent.ACTION_UP) {
- nLongKeyCnt = 0;
- if (nTargetID == ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE) {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- super.finish();
- }
- else if (nTargetID == ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS) {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- ctrlPageNo(false);
- updateScreen(mRelativeLayout);
- }
- else if (nTargetID == ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT) {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- ctrlPageNo(true);
- updateScreen(mRelativeLayout);
- }
- else if (ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_01 <= nTargetID && nTargetID <= ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_08) {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- int nIndex = (nTargetID - ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_01) + ((nCurrentPageNo - 1) * nMAXIconNoOnaPage);
- Log.d(TAG, "[onTouchEvent] nIndex [" + nIndex + "]");
- int nIconID = mPopupIconTable.getIconInfoByIndex(nIndex).getIconID();
- Log.d(TAG, "[onTouchEvent] nIconID [" + nIconID + "]");
- setPopupResult(nIconID);
- super.finish();
- }
- }
- else if (nEvent == MotionEvent.ACTION_POINTER_DOWN) {
- if (ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_01 <= nTargetID && nTargetID <= ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_08) {
- if (nPreviousTargetID == nTargetID) {
- nLongKeyCnt++;
- Log.v(TAG, "[onTouchEvent] LongKey event [" + nTargetID + "], nLongKeyCnt [" + nLongKeyCnt + "]");
- if (nLongKeyCnt > LONGKEY_THRESHOLD) {
- nLongKeyCnt = 0;
- nPreviousTargetID = 0;
- if (Common.eGUIType == Common.GUI_TYPE.HYOSUNG) {
- shortcutCnt = MainActivity.nShortcutCnt_HS;
- shortcutMax = MainActivity.nShortcutMax_HS;
- }
- else if (Common.eGUIType == Common.GUI_TYPE.METRO) {
- shortcutCnt = MainActivity.nShortcutCnt_Metro;
- shortcutMax = MainActivity.nShortcutMax_Metro;
- }
- Log.v(TAG, "[onTouchEvent] shortcutCnt [" + shortcutCnt + "], shortcutMax [" + shortcutMax + "]");
- if (shortcutMax > 0) {
- if (shortcutCnt >= shortcutMax) {
- Log.w(TAG, "[onTouchEvent] No more Shortcuts allowed!!");
- ((PopupActivity) mContext).setChangeScreen(ID.POPUPS.POPUP_NOMORESHORTCUT, false);
- return;
- } else {
- addShortcut(nTargetID - ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_01);
- }
- }
- }
- }
- else {
- nPreviousTargetID = nTargetID;
- nLongKeyCnt = 0;
- Log.v(TAG, "[onTouchEvent] LongKey event [" + nTargetID + "]");
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] onTouchEvent(View v, MotionEvent event)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private POSITION getPosition(int nID) {
- // LOG("[GetPosition] nID = " + nID);
- POSITION position = new POSITION();
- position.setGroupPopupPosition(117, 27, 790, 546);
- try {
- switch (nID) {
- case ID.POPUPS.GROUPADD.ELEMENTS.IMAGES.BACKGROUND:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(145, 60, 990, 680);
- else position.setGroupPopupPosition(117, 27, 790, 546);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.BTNS.PREVIOUS:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(353 , 60, 110, 90);
- else position.setGroupPopupPosition(297, 29, 75, 68);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.BTNS.NEXT:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(813 , 60, 110, 90);
- else position.setGroupPopupPosition(652, 29, 75, 68);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.BTNS.CLOSE:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(1048 , 67, 80, 80);
- else position.setGroupPopupPosition(830, 29, 75, 68);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_01:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(235, 228, 135, 135);
- else position.setGroupPopupPosition(185, 155, 108, 108);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_02:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(460, 228, 135, 135);
- else position.setGroupPopupPosition(367, 155, 108, 108);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_03:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(685, 228, 135, 135);
- else position.setGroupPopupPosition(549, 155, 108, 108);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_04:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(910, 228, 135, 135);
- else position.setGroupPopupPosition(731, 155, 108, 108);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_05:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(235, 457, 135, 135);
- else position.setGroupPopupPosition(185, 349, 108, 108);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_06:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(460, 457, 135, 135);
- else position.setGroupPopupPosition(367, 349, 108, 108);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_07:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(685, 457, 135, 135);
- else position.setGroupPopupPosition(549, 349, 108, 108);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_08:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(910, 457, 135, 135);
- else position.setGroupPopupPosition(731, 349, 108, 108);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.TITLE:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(463, 60, 350, 90);
- else position.setGroupPopupPosition(372, 29, 280, 68);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_01:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(202, 363, 200, 80);
- else position.setGroupPopupPosition(149, 262, 180, 80);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_02:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(427, 363, 200, 80);
- else position.setGroupPopupPosition(331, 262, 180, 80);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_03:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(652, 363, 200, 80);
- else position.setGroupPopupPosition(513, 262, 180, 80);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_04:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(877, 363, 200, 80);
- else position.setGroupPopupPosition(695, 262, 180, 80);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_05:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(202, 592, 200, 80);
- else position.setGroupPopupPosition(149, 456, 180, 80);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_06:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(427, 592, 200, 80);
- else position.setGroupPopupPosition(331, 456, 180, 80);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_07:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(652, 592, 200, 80);
- else position.setGroupPopupPosition(513, 456, 180, 80);
- return position;
- case ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_08:
- if (Common.SCREEN_TYPE == Common.SCREEN_TYPE_1280x800) position.setGroupPopupPosition(877, 592, 200, 80);
- else position.setGroupPopupPosition(695, 456, 180, 80);
- return position;
- default:
- return position;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return position;
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getPosition(int nID)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- return position;
- }
- }
- private void getAddIcons(RelativeLayout layout) {
- try {
- mIconManager = new IconManager(mContext, mWallPadAPI);
- if (mIconManager == null) {
- Log.w(TAG, "[getAddIcons] mIconManager is null!!");
- return;
- }
- mIconInfoTable = mIconManager.getAvailableIcons();
- if (mIconInfoTable == null) {
- Log.w(TAG, "[getAddIcons] mIconInfoTable is null!!");
- return;
- }
- // mIconInfoTable.printValue();
- int nIconCnt = mIconInfoTable.getCnt();
- Log.w(TAG, "[getAddIcons] nIconCnt [" + nIconCnt + "]");
- for (int i = 0; i < nIconCnt; i++) {
- if ((mIconInfoTable.getIconInfoByIndex(i).getIconID() / 1000) == (ID.ICONS.MENU_ADD / 1000)) {
- Log.d(TAG, "[getAddIcons] i [" + i + "], ID [" + mIconInfoTable.getIconInfoByIndex(i).getIconID() + "], Name [" + mIconInfoTable.getIconInfoByIndex(i).getIconName() + "]");
- mPopupIconTable.addIconInfo(mIconInfoTable.getIconInfoByIndex(i));
- }
- }
- mPopupIconTable.printValue();
- getTotalPageNo();
- updateScreen(layout);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getAddIcons(RelativeLayout layout)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void updateScreen(RelativeLayout layout) {
- try {
- Log.i(TAG, "[updateScreen] nCurrentPageNo [" + nCurrentPageNo + "]");
- if (nMAXPageNo > 1) {
- strTitle = "부가 " + nCurrentPageNo + "/" + nMAXPageNo;
- BTN_PREVIOUS.setVisibility(View.VISIBLE);
- BTN_NEXT.setVisibility(View.VISIBLE);
- }
- else {
- strTitle = "부가";
- BTN_PREVIOUS.setVisibility(View.INVISIBLE);
- BTN_NEXT.setVisibility(View.INVISIBLE);
- }
- TXT_TITLE.setText(strTitle);
- for (int i = 0; i < nMAXIconNoOnaPage; i++) {
- if (BTN_SHORTCUT_ICON[i] != null) BTN_SHORTCUT_ICON[i].setVisibility(View.INVISIBLE);
- if (TXT_SHORTCUT_NAME[i] != null) TXT_SHORTCUT_NAME[i].setVisibility(View.INVISIBLE);
- }
- int nIconStartIndex = (nCurrentPageNo * nMAXIconNoOnaPage) - nMAXIconNoOnaPage;
- int nCurrentIconCnt = nMAXIconNoOnaPage;
- if (nCurrentPageNo >= nMAXPageNo) nCurrentIconCnt = ((mPopupIconTable.getCnt() % nMAXIconNoOnaPage) > 0) ? (mPopupIconTable.getCnt() % nMAXIconNoOnaPage) : nMAXIconNoOnaPage;
- else nCurrentIconCnt = nMAXIconNoOnaPage;
- int nIconEndIndex = ((nCurrentPageNo * nMAXIconNoOnaPage) - nMAXIconNoOnaPage) + nCurrentIconCnt;
- Log.i(TAG, "[updateScreen] nIconStartIndex [" + nIconStartIndex + "], nCurrentIconCnt [" + nCurrentIconCnt + "], nIconEndIndex [" + nIconEndIndex + "]");
- int nIndex = nIconStartIndex;
- for (int i = 0; i < nMAXIconNoOnaPage; i++) {
- Log.i(TAG, "[updateScreen] i [" + i + "], nIndex [" + nIndex + "]");
- if (i < nCurrentIconCnt) {
- BTN_SHORTCUT_ICON[i] = new WpadImageView(mContext, TOUCH_KIND.BUTTON_LC, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_01 + i).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_01 + i).H, mPopupIconTable.getIconInfoByIndex(nIndex).getNormalImage(), mPopupIconTable.getIconInfoByIndex(nIndex).getPressedImage(), ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_01 + i);
- ViewRegistration(layout, BTN_SHORTCUT_ICON[i], getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_01 + i).X, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_01 + i).Y);
- if(BTN_SHORTCUT_ICON[i]!=null) BTN_SHORTCUT_ICON[i].setTouchDelayMs(500);
- if(BTN_SHORTCUT_ICON[i]!=null) BTN_SHORTCUT_ICON[i].setVisibility(View.VISIBLE);
- TXT_SHORTCUT_NAME[i] = new WpadTextView(mContext, false, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_01 + i).W, getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_01 + i).H, Gravity.CENTER_HORIZONTAL, Color.WHITE, nNameSize, false, ID.POPUPS.GROUPADD.ELEMENTS.BTNS.ICON_01 + i);
- ViewRegistration(layout, TXT_SHORTCUT_NAME[i], getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_01 + i).X , getPosition(ID.POPUPS.GROUPADD.ELEMENTS.TEXTS.ICON_01 + i).Y);
- if(TXT_SHORTCUT_NAME[i]!=null) TXT_SHORTCUT_NAME[i].setText(mPopupIconTable.getIconInfoByIndex(nIndex).getIconName());
- if(TXT_SHORTCUT_NAME[i]!=null) TXT_SHORTCUT_NAME[i].setVisibility(View.VISIBLE);
- }
- nIndex++;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] updateScreen()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void getTotalPageNo() {
- try {
- Log.i(TAG, "[getTotalPageNo]");
- nMAXPageNo = mPopupIconTable.getCnt() / nMAXIconNoOnaPage;
- if ((mPopupIconTable.getCnt() % nMAXIconNoOnaPage) > 0) nMAXPageNo++;
- Log.i(TAG, "[getTotalPageNo] nMAXPageNo [" + nMAXPageNo + "]");
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getTotalPageNo()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void ctrlPageNo(boolean bUp) {
- try {
- Log.i(TAG, "[ctrlPageNo] bUp: " + bUp);
- if (bUp) {
- nCurrentPageNo++;
- if (nCurrentPageNo > nMAXPageNo) nCurrentPageNo = 1;
- }
- else {
- nCurrentPageNo--;
- if (nCurrentPageNo < 1) nCurrentPageNo = nMAXPageNo;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlPageNo(boolean bUp)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private void setPopupResult(int nIconID) {
- try {
- Intent intent = new Intent();
- intent.putExtra(Common.BR_SENDER_SCREEN, ID.POPUPS.POPUP_GROUP_ADD);
- intent.putExtra(Common.BR_RECEIVE_SCREEN, ID.SCREENS.SCREEN_METROUI_GROUP);
- intent.putExtra(Common.BR_RUN_WIDGET, true );
- intent.putExtra(Common.BR_RUN_WIDGET_ID , nIconID);
- super.setPopupResult(intent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] setPopupResult(int nIconID)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public void addShortcut(int nTargetID) {
- try {
- Log.i(TAG, "[addShortcut] nTargetID = " + nTargetID);
- int nIndex = nTargetID + (nCurrentPageNo - 1) * nMAXIconNoOnaPage;
- Log.d(TAG, "[addShortcut] nIndex [" + nIndex + "]");
- int nIconID = mPopupIconTable.getIconInfoByIndex(nIndex).getIconID();
- Log.d(TAG, "[addShortcut] nIconID [" + nIconID + "]");
- if (Common.eGUIType == Common.GUI_TYPE.HYOSUNG) {
- for (int i = 0; i < MainActivity.HSScreenShortcutList.size(); i++) {
- if (MainActivity.HSScreenShortcutList.get(i).widgetID == nIconID) {
- Log.w(TAG, "[addShortcut] Duplicated nShortcutID [" + nIconID + "]");
- ((PopupActivity) mContext).setChangeScreen(ID.POPUPS.POPUP_DUPLICATEDSHORTCUT, false);
- return;
- }
- }
- }
- else if (Common.eGUIType == Common.GUI_TYPE.METRO) {
- for (int i = 0; i < MainActivity.MetroScreenShortcutList.size(); i++) {
- if (MainActivity.MetroScreenShortcutList.get(i).widgetID == nIconID) {
- Log.w(TAG, "[addShortcut] Duplicated nShortcutID [" + nIconID + "]");
- ((PopupActivity) mContext).setChangeScreen(ID.POPUPS.POPUP_DUPLICATEDSHORTCUT, false);
- return;
- }
- }
- }
- Intent mIntent = new Intent();
- mIntent.putExtra(Common.WIDGET_SELECTED_ID, nIconID);
- ((PopupActivity) mContext).ChangeScreen(ID.POPUPS.POPUP_ADDSHORTCUT, mIntent);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] addShortcut(int nIndex)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- }
|