Example usage for android.view Window FEATURE_NO_TITLE

List of usage examples for android.view Window FEATURE_NO_TITLE

Introduction

In this page you can find the example usage for android.view Window FEATURE_NO_TITLE.

Prototype

int FEATURE_NO_TITLE

To view the source code for android.view Window FEATURE_NO_TITLE.

Click Source Link

Document

Flag for the "no title" feature, turning off the title at the top of the screen.

Usage

From source file:com.teleca.jamendo.activity.RadioActivity.java

/** Called when the activity is first created. */
@SuppressWarnings("unchecked")
@Override/*ww  w . jav a  2 s  .com*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.search);

    mRadioListView = (ListView) findViewById(R.id.SearchListView);
    mRadioAdapter = new RadioAdapter(this);
    mRadioListView.setAdapter(mRadioAdapter);
    mRadioListView.setOnItemClickListener(mRadioListListener);
    mButton = (Button) findViewById(R.id.SearchButton);
    mButton.setText(R.string.radio);
    mButton.setOnClickListener(mButtonClickListener);
    mEditText = (EditText) findViewById(R.id.SearchEditText);
    mViewFlipper = (ViewFlipper) findViewById(R.id.SearchViewFlipper);

    mSpinner = (Spinner) findViewById(R.id.SearchSpinner);
    ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.radio_modes,
            android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    mSpinner.setAdapter(adapter);
    mEditText.setHint(R.string.radio_hint);

    mRadioLoadingDialog = new RadioLoadingDialog(this, R.string.loading_recomended_radios,
            R.string.failed_recomended_radios);

    mRadioLoadingDialog.execute();

    mSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) {
            switch (position) {
            case 0:
                // recent
                mRadioAdapter.setList(new DatabaseImpl(RadioActivity.this).getRecentRadios(20));
                break;
            case 1:
                // recommended
                switch (mRadioLoadingDialog.getStatus()) {
                case RUNNING:
                    break;
                case FINISHED:
                    mRadioLoadingDialog = new RadioLoadingDialog(RadioActivity.this,
                            R.string.loading_recomended_radios, R.string.failed_recomended_radios);
                    mRadioLoadingDialog.execute();
                    break;
                case PENDING:
                    mRadioLoadingDialog.execute();
                    break;
                }
                break;

            default:
                break;
            }

            setupListView();
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }

    });

    // TODO (maybe) if recent.count > 0 set to recent
    mSpinner.setSelection(1);

    mGestureOverlayView = (GestureOverlayView) findViewById(R.id.gestures);
    mGestureOverlayView
            .addOnGesturePerformedListener(JamendoApplication.getInstance().getPlayerGestureHandler());
}

From source file:com.swetha.easypark.GetIndividualParkingSpotDetails.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.i("GetIndividualParkingSpotDetails", "Before Set ContentView");
    mContext = this.getApplicationContext();
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.listvacantparkingspots);
    Log.i("GetIndividualParkingSpotDetails", "After Set ContentView");

    Intent thisIntent = getIntent();//from w w  w . ja  va  2  s  .c o m
    parkingLotId = thisIntent.getStringExtra("individualParkingLotId");
    fromTime = thisIntent.getLongExtra(GetParkingLots.FROMTIME, 0);
    toTime = thisIntent.getLongExtra(GetParkingLots.TOTIME, 0);

    Log.i("GetIndividualParkingSpotDetails", "After getting from intent" + fromTime + toTime + parkingLotId);

    /*   Test Data
     * parkingSpotMapList = new ArrayList<LinkedHashMap<String, String>>();
       LinkedHashMap<String, String> parkingSpotMap = new LinkedHashMap<String, String>();
               
       parkingSpotMap.put("parkingspotid", parkingLotId);
       Log.i("GetIndividualParkingSpotDetails", "PArking lot id" +parkingLotId);
       parkingSpotMap.put("vacantspotdisplay", "A5");
       LinkedHashMap<String, String> parkingSpotMap2 = new LinkedHashMap<String, String>();
               
       parkingSpotMap2.put("parkingspotid", "2");
       parkingSpotMap2.put("vacantspotdisplay", "A6");
               
       parkingSpotMapList.add(parkingSpotMap);
       parkingSpotMapList.add(parkingSpotMap2);*/

    new GetParkingSpotsFromWebService(this, fromTime, toTime).execute();
    Log.i("GetIndividualParkingSpotDetails", "After adding to hashmap list");

    btn_next = (Button) findViewById(R.id.single_selection_btn_first);
    btn_next.setClickable(true);
    btn_next.setFocusable(true);
    Log.i("GetIndividualParkingSpotDetails", "After firstbutton focussable");
    btn_next.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {

            //ListView l = getListView();
            //TextSelectedView l_v = (TextSelectedView)v;

            HashMap<String, String> hmap = parkingSpotMapList.get(mSelectedItem);
            Log.i("GetIndividualParkingSpotDetails", "The value of mSelectedItem:" + mSelectedItem);
            theParkingSpotName = hmap.get("vacantspotdisplay");
            theParkingSpotId = hmap.get("parkingspotid");

            Log.i("GetIndividualParkingSpotDetails", "The selected parking spot  is " + theParkingSpotName);
            Log.i("GetIndividualParkingSpotDetails", "The selected parking spotid  is " + theParkingSpotId);

            chk_default = (CheckBox) findViewById(R.id.single_selection_chkbox_default);
            new UpdateParkingSpotThroughWebService(GetIndividualParkingSpotDetails.this, theParkingSpotId,
                    fromTime, toTime).execute();

        }
    });
    Log.i("GetIndividualParkingSpotDetails", "After settOnClickListener first button");
    btn_back = (Button) findViewById(R.id.single_selection_btn_second);
    btn_back.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            //close the activity
            finish();
        }
    });
    Log.i("GetIndividualParkingSpotDetails", "After settOnClickListener second button");

    chk_default = (CheckBox) findViewById(R.id.single_selection_chkbox_default);
    chk_default.setChecked(false);
    Log.i("GetIndividualParkingSpotDetails", "After checkbox");

    //tv_ins = (TextView) this.findViewById(R.id.single_selection_chkbox_default_text);
    //tv_ins.setText("Test");
    Log.i("GetIndividualParkingSpotDetails", "After textView end of oncreate");
}

From source file:com.foursquare.android.nativeoauth.TokenExchangeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setTheme(getThemeRes());/*from   w  w w  .j a  va  2  s  .c om*/
    setContentView(R.layout.loading);

    String clientId = getIntent().getStringExtra(INTENT_EXTRA_CLIENT_ID);
    String clientSecret = getIntent().getStringExtra(INTENT_EXTRA_CLIENT_SECRET);
    String authCode = getIntent().getStringExtra(INTENT_EXTRA_AUTH_CODE);

    if (savedInstanceState == null) {
        mTask = new TokenExchangeTask(this);
        mTask.execute(clientId, clientSecret, authCode);

    } else {
        mTask = (TokenExchangeTask) savedInstanceState.getSerializable(INTENT_EXTRA_TOKEN_EXCHANGE_TASK);
        mTask.setActivity(this);
    }
}

From source file:com.example.mycar.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);
    share = MainActivity.this.getSharedPreferences("UUID", Activity.MODE_PRIVATE);
    edit = share.edit();/* ww w  .  j ava2  s.  co m*/
    if (share.getString("duuid", "") != "") {

        du = share.getString("duuid", "");
        devicename = share.getString("nmname", "");

    }
    ti = new leftThread();
    ti.start();
    initView();
    initDevice();
}

From source file:com.RSMSA.policeApp.Dialogues.PaymentConfirmationDialogue.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
    getDialog().setCanceledOnTouchOutside(false);

    RelativeLayout relativeLayout = (RelativeLayout) inflater.inflate(R.layout.dialogue_payment_confirmation,
            container, false);/*from w w  w .j  a va2s.c  o  m*/

    TextView costTextView = (TextView) relativeLayout.findViewById(R.id.place);
    costTextView.setText(cost + "");

    TextView nameTextView = (TextView) relativeLayout.findViewById(R.id.name);
    nameTextView.setText(name);

    TextView licenceNumberTextView = (TextView) relativeLayout.findViewById(R.id.licence_number);
    licenceNumberTextView.setText(offence.getDriver_license_number() + "");

    TextView plate_numberTextView = (TextView) relativeLayout.findViewById(R.id.plate_number);
    plate_numberTextView.setText(offence.getVehicle_plate_number());

    final String[] paymentMethodsArray = this.getResources().getStringArray(R.array.payment_methods);
    Spinner paymentMethodSpinner = (Spinner) relativeLayout.findViewById(R.id.payment_method_spinner);
    PaymentMethodSpinnerAdapter adapter = new PaymentMethodSpinnerAdapter(getActivity(), R.layout.row_menu,
            paymentMethodsArray);
    paymentMethodSpinner.setAdapter(adapter);
    paymentMethodSpinner.setBackground(null);
    paymentMethodSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            paymentMethod = paymentMethodsArray[position];
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });
    receiptEditText = (EditText) relativeLayout.findViewById(R.id.receipt);

    TextView okButton = (TextView) relativeLayout.findViewById(R.id.ok_button);
    okButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (receiptEditText.getText().toString().equals("")) {
                receiptEditText.setHintTextColor(Color.RED);
            } else {
                new ProcessRegister().execute();
            }
        }
    });

    TextView cancelButton = (TextView) relativeLayout.findViewById(R.id.cancel_button);
    cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //mListener.onComplete(false, index);
            dismiss();
        }
    });

    return relativeLayout;
}

From source file:com.ztspeech.weibo.sdk.renren.view.RenrenDialog.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    progress = new ProgressDialog(getContext(), R.style.mydialog);
    progress.requestWindowFeature(Window.FEATURE_NO_TITLE);
    progress.setMessage("...");
    progress.setCanceledOnTouchOutside(false);
    content = new LinearLayout(getContext());
    content.setOrientation(LinearLayout.VERTICAL);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    if (this.showTitle) {
        setUpTitle();/* w ww  .j  av  a2s . co m*/
    }
    setUpWebView();

    Display display = getWindow().getWindowManager().getDefaultDisplay();
    float scale = getContext().getResources().getDisplayMetrics().density;
    float[] dimensions = display.getWidth() < display.getHeight() ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
    addContentView(content, new FrameLayout.LayoutParams((int) (dimensions[0] * scale + 0.5f),
            (int) (dimensions[1] * scale + 0.5f)));
}

From source file:com.codeskraps.sbrowser.home.SBrowserActivity.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override// w w  w .  jav  a 2  s  .c o m
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    sBrowserData = ((SBrowserApplication) getApplication()).getsBrowserData();
    dataBaseData = ((SBrowserApplication) getApplication()).getDataBaseData();

    if (sBrowserData.isChkFullscreen()) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.sbrowser);

    findViewById(R.id.btnWww).setOnClickListener(this);
    findViewById(R.id.btnHome).setOnClickListener(this);
    findViewById(R.id.btnRight).setOnClickListener(this);
    findViewById(R.id.btnRefresh).setOnClickListener(this);
    findViewById(R.id.btnSearch).setOnClickListener(this);
    findViewById(R.id.btnMenu).setOnClickListener(this);

    /*-
    Resources res = getResources();
    if (res.getBoolean(R.bool.isTablet)) {
       findViewById(R.id.btnMenu).setVisibility(View.VISIBLE);
       findViewById(R.id.btnSearch).setVisibility(View.VISIBLE);
            
    } else if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1
    || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && ViewConfiguration
          .get(this).hasPermanentMenuKey())) {
       findViewById(R.id.btnMenu).setVisibility(View.GONE);
       findViewById(R.id.btnSearch).setVisibility(View.VISIBLE);
            
    } else {
       findViewById(R.id.btnMenu).setVisibility(View.VISIBLE);
       findViewById(R.id.btnSearch).setVisibility(View.GONE);
    }*/

    findViewById(R.id.btnMenu).setVisibility(View.GONE);
    findViewById(R.id.btnSearch).setVisibility(View.VISIBLE);

    FrameLayout fragmentContainer = (FrameLayout) findViewById(R.id.fragment_container);
    if (fragmentContainer != null) {
        Log.v(TAG, "bundle:" + savedInstanceState);
        if (savedInstanceState != null) {
            return;
        }
        wF = WebViewFragment.getInstance();
        getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, wF).commit();
    }
}

From source file:cn.com.teamlink.workbench.ExplorerActivity.java

public void onCreate(Bundle savedInstanceState) {
    // /*from  w w  w  .j a v a 2 s.  c o m*/
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    // ?
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_explorer);

    try {
        gridview = (GridView) findViewById(R.id.explorer_grid_view);

        gridViewListItems = new ArrayList<HashMap<String, String>>();
        /*
        gridViewListItemAdapter = new SimpleAdapter(
            this,
            // ???
            gridViewListItems,
            R.layout.explorer_item,
            new String[]{"item_text"},
            new int[]{R.id.item_text_view}
        );
        */

        gridViewListItemAdapter = new BaseAdapter() {

            @Override
            public int getCount() {
                return gridViewListItems.size();
            }

            @Override
            public Object getItem(int position) {
                return null;
            }

            @Override
            public long getItemId(int position) {
                return 0;
            }

            @Override
            public int getItemViewType(int position) {
                // TODO Auto-generated method stub
                Map<String, String> item = gridViewListItems.get(position);
                if (item.get("type").equals("GRID_HEADER")) {
                    return 1;
                }
                return 0;
            }

            @Override
            public int getViewTypeCount() {
                return 2;
            }

            @Override
            public View getView(int position, View convertView, ViewGroup parent) {

                if (getItemViewType(position) == 0) {
                    GridViewHeaderHolder gridViewHeaderHolder = null;

                    if (convertView != null) {
                        gridViewHeaderHolder = (GridViewHeaderHolder) convertView.getTag();
                    } else {
                        gridViewHeaderHolder = new GridViewHeaderHolder();

                        LayoutInflater inflater = LayoutInflater.from(getApplicationContext());
                        convertView = inflater.inflate(R.layout.explorer_item, parent, false);

                        gridViewHeaderHolder.itemTextView = (TextView) convertView
                                .findViewById(R.id.item_text_view);
                        convertView.setTag(gridViewHeaderHolder);
                    }

                    gridViewHeaderHolder.itemTextView
                            .setText(gridViewListItems.get(position).get("item_text").toString());

                } else {

                    GridViewItemHolder gridViewItemHolder = null;

                    if (convertView != null) {
                        gridViewItemHolder = (GridViewItemHolder) convertView.getTag();
                    } else {
                        gridViewItemHolder = new GridViewItemHolder();

                        LayoutInflater inflater = LayoutInflater.from(getApplicationContext());
                        convertView = inflater.inflate(R.layout.explorer_item, parent, false);
                        convertView.setBackgroundResource(R.color.deepGray);

                        gridViewItemHolder.itemTextView = (TextView) convertView
                                .findViewById(R.id.item_text_view);
                        convertView.setTag(gridViewItemHolder);
                    }

                    gridViewItemHolder.itemTextView
                            .setText(gridViewListItems.get(position).get("item_text").toString());

                }

                return convertView;
            }
        };

        // 
        gridview.setAdapter(gridViewListItemAdapter);
        // ??
        gridview.setOnItemClickListener(new ItemClickListener());

        // 
        addHeader();

        // ?
        addData();
    } catch (Exception e) {
        Dialog alertDialog = new AlertDialog.Builder(this).setTitle("??").setMessage(e.getMessage())
                .setIcon(R.mipmap.ic_launcher).create();
        alertDialog.show();
    }

    try {
        // ??
        String fileName = "fileDemo.txt";
        // ??
        FileOutputStream fos = openFileOutput(fileName, Context.MODE_PRIVATE);
        String text = "Some data";
        // ?
        fos.write(text.getBytes());
        // ?
        fos.flush();
        // FileOutputStream
        fos.close();

        // String fileName = "fileDemo.txt";
        FileInputStream fis = openFileInput(fileName);
        byte[] readBytes = new byte[fis.available()];
        while (fis.read(readBytes) != -1) {

        }

        Dialog alertDialog = new AlertDialog.Builder(this).setTitle("??").setMessage(new String(readBytes))
                .setIcon(R.mipmap.ic_launcher).create();
        alertDialog.show();
    } catch (Exception e) {

        Dialog alertDialog = new AlertDialog.Builder(this).setTitle("??")
                .setMessage(e.getLocalizedMessage()).setIcon(R.mipmap.ic_launcher).create();
        alertDialog.show();

        /*
        Dialog alertDialog = new AlertDialog.Builder(this).
            setTitle("").
            setMessage("???").
            setIcon(R.mipmap.ic_launcher).
            setPositiveButton(
                    "",
                    new DialogInterface.OnClickListener() {
                
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            // TODO Auto-generated method stub
                        }
                    }
            ).
            setNegativeButton("?", new DialogInterface.OnClickListener() {
                
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub
                }
            }).
            setNeutralButton("", new DialogInterface.OnClickListener() {
                
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub
                }
            }).
            create();
        alertDialog.show();
        */

        /*
        final String[] arrayFruit = new String[]{"", "?", "?", ""};
        Dialog alertDialog = new AlertDialog
            .Builder(this).
            setTitle("??").
            setIcon(R.mipmap.ic_launcher)
            .setItems(
                    arrayFruit,
                    new DialogInterface.OnClickListener() {
                
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            Toast.makeText(ExplorerActivity.this, arrayFruit[which], Toast.LENGTH_SHORT).show();
                        }
                    }
            )
            .setNegativeButton(
                    "?",
                    new DialogInterface.OnClickListener() {
                
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            // TODO Auto-generated method stub
                        }
                    }
            ).create();
        alertDialog.show();
        */

        /*
        // int selectedFruitIndex = 0;
        final String[] arrayFruit = new String[]{"", "?", "?", ""};
                
        Dialog alertDialog = new AlertDialog.Builder(this)
            .setTitle("??")
            .setIcon(R.mipmap.ic_launcher)
            .setSingleChoiceItems(arrayFruit, 0, new DialogInterface.OnClickListener() {
                
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    selectedFruitIndex = which;
                }
            })
            .setPositiveButton("", new DialogInterface.OnClickListener() {
                
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    Toast.makeText(Dialog_AlertDialogDemoActivity.this, arrayFruit[selectedFruitIndex], Toast.LENGTH_SHORT).show();
                }
            }).setNegativeButton("?", new DialogInterface.OnClickListener() {
                
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub
                }
            }).create();
        alertDialog.show();
        */

        /*
        final String[] arrayFruit = new String[]{"", "?", "?", ""};
        final boolean[] arrayFruitSelected = new boolean[]{true, true, false, false};
                
        Dialog alertDialog = new AlertDialog.Builder(this)
            .setTitle("??")
            .setIcon(R.mipmap.ic_launcher)
            .setMultiChoiceItems(arrayFruit, arrayFruitSelected, new DialogInterface.OnMultiChoiceClickListener() {
                
                @Override
                public void onClick(DialogInterface dialog, int which, boolean isChecked) {
                    arrayFruitSelected[which] = isChecked;
                }
            })
            .setPositiveButton("", new DialogInterface.OnClickListener() {
                
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    StringBuilder stringBuilder = new StringBuilder();
                    for (int i = 0; i < arrayFruitSelected.length; i++) {
                        if (arrayFruitSelected[i] == true) {
                            stringBuilder.append(arrayFruit[i] + "?");
                        }
                    }
                    Toast.makeText(ExplorerActivity.this, stringBuilder.toString(), Toast.LENGTH_SHORT).show();
                }
            })
            .setNegativeButton("?", new DialogInterface.OnClickListener() {
                
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub
                }
            }).create();
        alertDialog.show();
        */

        /*
        // ?View
        LayoutInflater layoutInflater = LayoutInflater.from(this);
        View myLoginView = layoutInflater.inflate(R.layout.login, null);
                
        Dialog alertDialog = new AlertDialog.Builder(this)
            .setTitle("")
            .setIcon(R.mipmap.ic_launcher)
            .setView(myLoginView)
            .setPositiveButton("", new DialogInterface.OnClickListener() {
                
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub
                }
            })
            .setNegativeButton("?", new DialogInterface.OnClickListener() {
                
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub
                }
            }).create();
        alertDialog.show();
        */
    }
}

From source file:com.dlam.activity.GroupsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.fragment_groups);

    instance = this;
    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    grouplist = EMGroupManager.getInstance().getAllGroups();
    groupListView = (ListView) findViewById(R.id.list);

    swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_layout);
    swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
            android.R.color.holo_green_light, android.R.color.holo_orange_light,
            android.R.color.holo_red_light);
    swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override//from   w  w w . j  a v a2 s . c  o  m
        public void onRefresh() {
            MainActivity.asyncFetchGroupsFromServer();
        }
    });

    groupAdapter = new GroupAdapter(this, 1, grouplist);
    groupListView.setAdapter(groupAdapter);
    groupListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position == 1) {
                // ?
                startActivityForResult(new Intent(GroupsActivity.this, NewGroupActivity.class), 0);
            } else if (position == 2) {
                // 
                startActivityForResult(new Intent(GroupsActivity.this, PublicGroupsActivity.class), 0);
            } else {
                // ?
                Intent intent = new Intent(GroupsActivity.this, ChatActivity.class);
                // it is group chat
                intent.putExtra("chatType", ChatActivity.CHATTYPE_GROUP);
                intent.putExtra("groupId", groupAdapter.getItem(position - 3).getGroupId());
                startActivityForResult(intent, 0);
            }
        }

    });
    groupListView.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (getWindow()
                    .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
                if (getCurrentFocus() != null)
                    inputMethodManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
                            InputMethodManager.HIDE_NOT_ALWAYS);
            }
            return false;
        }
    });

    progressBar = (View) findViewById(R.id.progress_bar);

    syncListener = new SyncListener();
    HXSDKHelper.getInstance().addSyncGroupListener(syncListener);

    if (!HXSDKHelper.getInstance().isGroupsSyncedWithServer()) {
        progressBar.setVisibility(View.VISIBLE);
    } else {
        progressBar.setVisibility(View.GONE);
    }

    refresh();
}

From source file:com.fbartnitzek.tasteemall.filter.EntityFilterDialogFragment.java

@NonNull
@Override//  w w  w  .  j a  v  a2 s .c om
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    Bundle bundle = getArguments();
    if (bundle == null) {
        bundle = savedInstanceState;
    }
    if (bundle == null) {
        throw new RuntimeException("neither args nor savedInstance - should never happen...");
    }

    mBaseEntity = bundle.getString(BASE_ENTITY);
    if (bundle.containsKey(FILTER_JSON)) {
        try {
            mFilterJson = new JSONObject(bundle.getString(FILTER_JSON));
        } catch (JSONException e) {
            // conversion did not work ... use new Object, but log error
            Log.e(LOG_TAG, "onCreateDialog: json could not be restored: " + mFilterJson, e);
            e.printStackTrace();
        }
    }

    if (mFilterJson == null) {
        mFilterJson = new JSONObject();
        try {
            mFilterJson.put(mBaseEntity, new JSONObject());
        } catch (JSONException e) {
            e.printStackTrace();// ignore...
        }
    }

    // TODO: restore position

    //dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.YELLOW));
    dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    return dialog;
}