Example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE

List of usage examples for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE

Introduction

In this page you can find the example usage for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE.

Prototype

int SCREEN_ORIENTATION_LANDSCAPE

To view the source code for android.content.pm ActivityInfo SCREEN_ORIENTATION_LANDSCAPE.

Click Source Link

Document

Constant corresponding to landscape in the android.R.attr#screenOrientation attribute.

Usage

From source file:com.chess.genesis.activity.Settings.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;

    final Pref pref = new Pref(this);

    // set layout mode
    final boolean isTablet = pref.getBool(R.array.pf_tabletMode);

    if (isTablet)
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    else/* w w  w  . j  a  v a2  s.com*/
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    setContentView(R.layout.activity_settings);
    addPreferencesFromResource(R.xml.settings);

    net = new NetworkClient(this, handle);
    progress = new ProgressMsg(this);

    final View button = findViewById(R.id.topbar_genesis);
    button.setOnLongClickListener(this);

    final boolean isLoggedin = pref.getBool(R.array.pf_isLoggedIn);

    final Preference bench = findPreference("benchmark");
    bench.setOnPreferenceClickListener(this);

    final IntListPreference poll = (IntListPreference) findPreference(pref.key(R.array.pf_notifierPolling));
    poll.setOnPreferenceChangeListener(this);

    CheckBoxPreference check = (CheckBoxPreference) findPreference(pref.key(R.array.pf_emailNoteEnabled));
    check.setOnPreferenceChangeListener(this);
    check.setEnabled(isLoggedin);

    check = (CheckBoxPreference) findPreference(pref.key(R.array.pf_noteEnabled));
    check.setOnPreferenceChangeListener(this);
    check.setEnabled(isLoggedin);

    CallBackPreference callbackPref = (CallBackPreference) findPreference("deleteLocalTable");
    callbackPref.setCallBack(this);
    callbackPref = (CallBackPreference) findPreference("resyncOnlineTable");
    callbackPref.setCallBack(this);
    callbackPref.setEnabled(isLoggedin);
    callbackPref = (CallBackPreference) findPreference("resyncArchiveTable");
    callbackPref.setCallBack(this);
    callbackPref.setEnabled(isLoggedin);
    callbackPref = (CallBackPreference) findPreference("resyncMsgTable");
    callbackPref.setCallBack(this);
    callbackPref.setEnabled(isLoggedin);
    callbackPref = (CallBackPreference) findPreference("bcReset");
    callbackPref.setCallBack(this);

    // Set email note value from server
    if (pref.getBool(R.array.pf_isLoggedIn)) {
        progress.setText("Retrieving Settings");
        net.get_option("emailnote");
        new Thread(net).start();
    }
}

From source file:net.networksaremadeofstring.rhybudd.RhybuddDock.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    setContentView(R.layout.dock);//from  w  ww.j  a v  a 2  s  .co  m
    actionbar = getActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);
    actionbar.setHomeButtonEnabled(true);
    actionbar.setTitle("Rhybudd Dock");

    settings = PreferenceManager.getDefaultSharedPreferences(this);
    list = (ListView) findViewById(R.id.ZenossEventsList);

    ConfigureHandler();
    //Draw some empty graphs
    GaugeHandler.sendEmptyMessage(1);
    GaugeHandler.sendEmptyMessage(2);

    //We're docked we can use as much battery as we like
    Refresh();

    /*if(settings.getBoolean("AllowBackgroundService", false))
    {
       handler.sendEmptyMessageDelayed(1, 1000);
    }
    else
    {
       //rhybuddCache.RefreshEvents();
       //handler.sendEmptyMessageDelayed(1, 1000);
    }*/
}

From source file:eu.geopaparazzi.library.forms.FormActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // make sure the orientation can't be changed once this activity started
    int currentOrientation = getResources().getConfiguration().orientation;
    if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {//from   w w  w.java2 s. c om
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        sectionName = extras.getString(LibraryConstants.PREFS_KEY_FORM_NAME);
        sectionObjectString = extras.getString(LibraryConstants.PREFS_KEY_FORM_JSON);
        latitude = extras.getDouble(LibraryConstants.LATITUDE);
        longitude = extras.getDouble(LibraryConstants.LONGITUDE);
        elevation = extras.getDouble(LibraryConstants.ELEVATION);
        noteId = extras.getLong(LibraryConstants.DATABASE_ID);
    }

    try {
        if (sectionObjectString == null) {
            sectionObject = TagsManager.getInstance(this).getSectionByName(sectionName);
            // copy the section object, which will be kept around along the activity
            sectionObjectString = sectionObject.toString();
        }

        sectionObject = new JSONObject(sectionObjectString);
        formNames4Section = TagsManager.getFormNames4Section(sectionObject);
    } catch (Exception e) {
        e.printStackTrace();
    }
    setContentView(R.layout.form);

}

From source file:org.vqeg.viqet.activities.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //set orientation potrait if its phone
    if (getResources().getBoolean(R.bool.portrait_only)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else {//w w w .j  a  va2 s .c o  m
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }

    // Get max available VM memory, exceeding this amount will throw an
    // OutOfMemory exception. Stored in kilobytes as LruCache takes an
    // int in its constructor.
    final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);

    // Use 1/8th of the available memory for this memory cache.
    final int cacheSize = maxMemory / 8;

    mMemoryCache = new LruCache<String, Bitmap>(cacheSize) {
        @Override
        protected int sizeOf(String key, Bitmap bitmap) {
            // The cache size will be measured in kilobytes rather than
            // number of items.
            return bitmap.getByteCount() / 1024;
        }
    };

    this.mainPage = findViewById(R.id.drawer_layout);
    this.downloadScreen = findViewById(R.id.downloading_screen);
    this.internetRequiredScreen = findViewById(R.id.internet_required_screen);

    mTitle = mDrawerTitle = "VIQET";
    mOptionsTitles = getResources().getStringArray(R.array.options_array);
    mImageResources = new int[] { R.drawable.home, R.drawable.camera_results_icon,
            R.drawable.photo_quality_results, R.drawable.help, R.drawable.about, R.drawable.setting };
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerList = (ListView) findViewById(R.id.left_drawer);

    // set a custom shadow that overlays the main content when the drawer opens
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

    // set up the drawer's list view with items and click listener
    mDrawerList.setAdapter(new CustomDrawerListAdapter(this, mOptionsTitles, mImageResources));
    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

    // enable ActionBar app icon to behave as action to toggle nav drawer
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon
    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description for accessibility */
            R.string.drawer_close /* "close drawer" description for accessibility */
    ) {
        public void onDrawerClosed(View view) {
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    if (savedInstanceState == null) {
        //todo check
        selectItem(0);
        lastClicked = 0;
    } else {
        int pos = savedInstanceState.getInt("FRAGMENT");
        selectItem(pos);
        lastClicked = pos;
    }

    Button retryDownloadButton = (Button) findViewById(R.id.retryDownload);
    retryDownloadButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (SystemInfo.isNetworkPresent(getApplicationContext())) {
                downloadScreen.setVisibility(View.VISIBLE);
                internetRequiredScreen.setVisibility(View.INVISIBLE);
                downloadRemoteInfo(PhotoInspectorService.FETCH_VERSION_ACTION);
            } else {
                Toast.makeText(getApplicationContext(), getString(R.string.noInternetError), Toast.LENGTH_LONG)
                        .show();
            }
        }
    });

    //Check remote info
    RemoteInfo remoteInfo = RemoteInfoProvider.getRemoteInfo();

    if (remoteInfo == null) {
        mainPage.setVisibility(View.INVISIBLE);
        if (SystemInfo.isNetworkPresent(getApplicationContext())) {
            downloadScreen.setVisibility(View.VISIBLE);
            internetRequiredScreen.setVisibility(View.INVISIBLE);
            downloadRemoteInfo(PhotoInspectorService.FETCH_VERSION_ACTION);
        } else {
            downloadScreen.setVisibility(View.INVISIBLE);
            internetRequiredScreen.setVisibility(View.VISIBLE);
        }
    } else {
        //downloadRemoteInfo(PhotoInspectorService.FETCH_VERSION_MODEL_CHANGED_ACTION);
        downloadRemoteInfo(PhotoInspectorService.INSPECT_ALL_PENDING_PHOTOS_ACTION);
    }
    checkFirstRun();
}

From source file:br.org.funcate.dynamicforms.FragmentDetailActivity.java

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

    // don't permit rotation
    int currentOrientation = getResources().getConfiguration().orientation;
    if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {/*from w  ww  . j  a v a  2s .c  om*/
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    String tags = "";
    String defaultSectionName = FormUtilities.DEFAULT_SESSION_NAME;

    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    String geojsonTags = "";
    if (extras != null) {
        pointId = extras.getLong(LibraryConstants.SELECTED_POINT_ID);
        formName = extras.getString(FormUtilities.ATTR_FORMNAME);
        tags = extras.getString(FormUtilities.ATTR_JSON_TAGS);

        if (extras.containsKey(FormUtilities.ATTR_GEOJSON_TAGS)) {
            geojsonTags = extras.getString(FormUtilities.ATTR_GEOJSON_TAGS);
        }
        // here are the attribute values from feature to populate form in edit operation
        if (extras.containsKey(FormUtilities.ATTR_DATA_VALUES)) {
            existingFeatureData = extras.getBundle(FormUtilities.ATTR_DATA_VALUES);
        }
        workingDirectory = extras.getString(FormUtilities.MAIN_APP_WORKING_DIRECTORY);
    }

    try {
        sectionObject = TagsManager.getInstance(tags).getSectionByName(defaultSectionName);

        if (sectionObject == null) {
            Toast.makeText(getApplicationContext(), "Failure on get form session.", Toast.LENGTH_LONG).show();
            System.out.println("Failure on load JSON form from database.");
            this.finish();
        }

        JSONObject geojson = new JSONObject(geojsonTags);
        sectionObject.put(FormUtilities.ATTR_GEOJSON_TAGS, geojson);

    } catch (JSONException e) {
        Toast.makeText(getApplicationContext(), "Incorrect form configuration.", Toast.LENGTH_LONG).show();
        System.out.println("Failure on load JSON form from database.");
        e.printStackTrace();
        this.finish();
    }

    setContentView(R.layout.details_activity_layout);
}

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

public void onCreate(Bundle savedInstanceState) {
    // /* w ww. j a v a2s.  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.web.webmapsoft.barcodescanner.BarcodeCaptureActivity.java

/**
 * Initializes the UI and creates the detector pipeline.
 *//*from www.ja v  a2 s  .com*/
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.barcode_capture);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    mPreview = (CameraSourcePreview) findViewById(R.id.preview);
    mGraphicOverlay = (GraphicOverlay<BarcodeGraphic>) findViewById(R.id.graphicOverlay);

    // read parameters from the intent used to launch the activity.
    boolean autoFocus = getIntent().getBooleanExtra(AutoFocus, false);
    boolean useFlash = getIntent().getBooleanExtra(UseFlash, false);

    // Check for the camera permission before accessing the camera.  If the
    // permission is not granted yet, request permission.
    int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
    if (rc == PackageManager.PERMISSION_GRANTED) {
        createCameraSource(autoFocus, useFlash);
    } else {
        requestCameraPermission();
    }

    gestureDetector = new GestureDetector(this, new CaptureGestureListener());
    scaleGestureDetector = new ScaleGestureDetector(this, new ScaleListener());

    Snackbar.make(mGraphicOverlay, "Tap to capture. Pinch/Stretch to zoom", Snackbar.LENGTH_LONG).show();
}

From source file:org.ednovo.goorusearchwidget.HomeScreenActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home_screen);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    prefsPrivate = getSharedPreferences(PREFS_PRIVATE, Context.MODE_PRIVATE);
    headerSearch = (RelativeLayout) findViewById(R.id.layoutHeader);
    imgViewGooruSearch = (ImageView) findViewById(R.id.ivGooruLogo);
    imgViewSections = (ImageView) findViewById(R.id.imgViewSections);
    imgViewSettings = (ImageView) findViewById(R.id.imgViewSettings);
    imageViewClose = (ImageView) findViewById(R.id.imageViewClose);
    imageViewSearch = (ImageView) findViewById(R.id.imageViewSearch);
    editTexthome = (EditText) findViewById(R.id.textViewSearch);
    switchResColl = (Switch) findViewById(R.id.switchResColl);

    dialog = new ProgressDialog(this);
    imm = (InputMethodManager) this.getSystemService(Service.INPUT_METHOD_SERVICE);
    new Loginform().execute();
    switchResColl.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override//from   w  w  w  .j av a2s.  com
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // TODO Auto-generated method stub
            if (isChecked) {
                Log.i("Hello", "True");
                searchCriteria = true;
            } else {
                Log.i("Hello", "False");
                searchCriteria = false;
            }
        }
    });

    editTexthome.setOnKeyListener(new OnKeyListener() {
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (event.getAction() == KeyEvent.ACTION_DOWN) {
                switch (keyCode) {
                case KeyEvent.KEYCODE_DPAD_CENTER:
                case KeyEvent.KEYCODE_ENTER:
                    searchKeyword = editTexthome.getText().toString().trim();
                    if (searchKeyword.isEmpty() || searchKeyword.length() == 0) {

                    } else {
                        if (!searchCriteria) {
                            Log.i("Resources", searchKeyword);
                            Intent intentResResults = new Intent(getBaseContext(),
                                    SearchResults_resource.class);

                            Bundle extras = new Bundle();
                            extras.putString("keyWord", searchKeyword);
                            intentResResults.putExtras(extras);
                            startActivity(intentResResults);
                            finish();
                        }
                    }
                    return true;
                default:
                    break;
                }
            }
            return false;
        }
    });

    imageViewClose.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            finish();
        }
    });

    imgViewGooruSearch.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            Intent intentResResults = new Intent(getBaseContext(), SearchDialogpopup.class);

            startActivity(intentResResults);

        }
    });

}

From source file:gr.scify.newsum.ui.Facebook.java

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

    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_NORMAL
            & (getResources().getConfiguration().screenLayout
                    & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_SMALL) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    }/*from  www  .  j ava 2 s .  co m*/

    SharedPreferences userlang = getSharedPreferences("lang", 0);
    String newlang = userlang.getString("lang", Locale.getDefault().getLanguage());
    // Changed getApplicationContext() to "this"
    Setlanguage.updateLanguage(this, newlang);

    uiHelper = new UiLifecycleHelper(this, callback);
    uiHelper.onCreate(savedInstanceState);

    if (savedInstanceState != null) {
        String name = savedInstanceState.getString(PENDING_ACTION_BUNDLE_KEY);
        pendingAction = PendingAction.valueOf(name);
    }

    setContentView(R.layout.facebook);

    Bundle extras = getIntent().getExtras();
    summaryF = extras.getString("summaryF");

    loginButton = (LoginButton) findViewById(R.id.login_button);
    loginButton.setUserInfoChangedCallback(new LoginButton.UserInfoChangedCallback() {
        @Override
        public void onUserInfoFetched(GraphUser user) {
            Facebook.this.user = user;
            updateUI();
            // It's possible that we were waiting for this.user to be populated in order to post a
            // status update.
            handlePendingAction();
        }
    });

    profilePictureView = (ProfilePictureView) findViewById(R.id.profilePicture);
    greeting = (TextView) findViewById(R.id.greeting);

    postStatusUpdateButton = (Button) findViewById(R.id.postStatusUpdateButton);
    postStatusUpdateButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            onClickPostStatusUpdate();
        }
    });

    controlsContainer = (ViewGroup) findViewById(R.id.main_ui_container);

    final FragmentManager fm = getSupportFragmentManager();
    Fragment fragment = fm.findFragmentById(R.id.fragment_container);
    if (fragment != null) {
        // If we're being re-created and have a fragment, we need to a) hide the main UI controls and
        // b) hook up its listeners again.
        controlsContainer.setVisibility(View.GONE);
    }

    // Listen for changes in the back stack so we know if a fragment got popped off because the user
    // clicked the back button.
    fm.addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() {
        @Override
        public void onBackStackChanged() {
            if (fm.getBackStackEntryCount() == 0) {
                // We need to re-show our UI.
                controlsContainer.setVisibility(View.VISIBLE);
            }
        }
    });
}

From source file:org.apache.cordova.screenorientation.ScreenOrientation.java

public int getOrientation(String orientation) {
    if (orientation.equals(UNSPECIFIED)) {
        return (ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    } else if (orientation.equals(LANDSCAPE)) {
        return (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else if (orientation.equals(PORTRAIT)) {
        return (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else if (orientation.equals(USER)) {
        return (ActivityInfo.SCREEN_ORIENTATION_USER);
    } else if (orientation.equals(BEHIND)) {
        return (ActivityInfo.SCREEN_ORIENTATION_BEHIND);
    } else if (orientation.equals(SENSOR)) {
        return (ActivityInfo.SCREEN_ORIENTATION_SENSOR);
    } else if (orientation.equals(NOSENSOR)) {
        return (ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    } else if (orientation.equals(SENSOR_LANDSCAPE)) {
        return (ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    } else if (orientation.equals(SENSOR_PORTRAIT)) {
        return (ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    } else if (orientation.equals(REVERSE_LANDSCAPE)) {
        return (ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
    } else if (orientation.equals(REVERSE_PORTRAIT)) {
        return (ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
    } else if (orientation.equals(FULL_SENSOR)) {
        return (ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
    }/*ww w. j  av a 2s  .  co m*/

    return (ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}