public static void handlePreferenceAppearance(ListActivity activity) {
    PreferenceConfiguration configuration = PreferenceConfiguration.getInstance();
    boolean valid = null == configuration ? false : configuration.isPreferenceConfigurationValid();
    if (valid) {
      int style = configuration.getTitleStyle();
      if (style > 0) {
        activity.setTheme(style);
      }

      int color = configuration.getTitleColor();
      if (color != 0) {
        TextView titleView =
            (TextView) activity.getWindow().getDecorView().findViewById(android.R.id.title);
        if (null != titleView) {
          titleView.setTextColor(color);
        }
      }

      Drawable line = configuration.getSeparateLine();
      if (null != line) {
        activity.getListView().setDivider(line);
      }

      Drawable bg = configuration.getBackground();
      if (null != bg) {
        activity.getListView().setCacheColorHint(0x00000000);
        // activity.getListView().setBackgroundDrawable(bg);
        activity.getWindow().setBackgroundDrawable(bg);
      }

      // 滚动条等有图之后再看看
    }
  }
 /**
  * Called to select an item in the list of levels.
  *
  * @param lv the <tt>ListView</tt> that was clicked on
  * @param v the individual <tt>View</tt> of the clicked item
  * @param position the position of the clicked item in the list
  * @param id the <tt>id</tt> of the item that was clicked
  */
 @Override
 public void onListItemClick(ListView lv, View v, int position, long id) {
   // end this activity and tell the parent to start the specified level
   int level = (int) id;
   Intent intent = new Intent();
   Bundle extras = new Bundle();
   extras.putSerializable(Game.LEVEL_KEY, level);
   intent.putExtras(extras);
   super.setResult(AtomicActivity.START_NEW_LEVEL_RESULT_CODE, intent);
   super.finish();
 }
 /** creates the context menu for items when they get a long click */
 @Override
 public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
   super.onCreateContextMenu(menu, view, menuInfo);
   menu.add(0, SET_STOP_OPTION, SET_STOP_OPTION, "Set alarm for this stop");
   menu.add(0, REMOVE_STOP_OPTION, REMOVE_STOP_OPTION, "Remove this stop");
   menu.add(0, CANCEL, CANCEL, "Cancel");
 }
Example #4
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.fileselect);
   mPath = (TextView) findViewById(R.id.mPath);
   getFileDir(rootPath);
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActionBar().setTitle(R.string.title_devices);
    mHandler = new Handler();

    // Use this check to determine whether BLE is supported on the device.  Then you can
    // selectively disable BLE-related features.
    if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
      Toast.makeText(this, R.string.ble_not_supported, Toast.LENGTH_SHORT).show();
      finish();
    }

    // Initializes a Bluetooth adapter.  For API level 18 and above, get a reference to
    // BluetoothAdapter through BluetoothManager.
    final BluetoothManager bluetoothManager =
        (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
    mBluetoothAdapter = bluetoothManager.getAdapter();

    // Checks if Bluetooth is supported on the device.
    if (mBluetoothAdapter == null) {
      Toast.makeText(this, R.string.error_bluetooth_not_supported, Toast.LENGTH_SHORT).show();
      finish();
      return;
    }

    Log.i("SCAN", "" + mBluetoothAdapter.isMultipleAdvertisementSupported());
    Log.i("SCAN", "" + mBluetoothAdapter.isOffloadedFilteringSupported());
    Log.i("SCAN", "" + mBluetoothAdapter.isOffloadedScanBatchingSupported());
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main12);

    ConnectivityManager cManager =
        (ConnectivityManager) getSystemService(this.CONNECTIVITY_SERVICE);
    NetworkInfo ninfo = cManager.getActiveNetworkInfo();
    if (ninfo != null && ninfo.isConnected()) {

    } else {
      AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
      builder1.setMessage("Sorry There is no internet please check your connection!");
      builder1.setCancelable(true);
      builder1.setPositiveButton(
          "I Will!",
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
              dialog.cancel();
            }
          });

      AlertDialog alert11 = builder1.create();
      alert11.show();
    }

    itemlist = new ArrayList<RSSItem>();

    new RetrieveRSSFeeds().execute();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_history);
    listView = (ListView) findViewById(android.R.id.list);
    Intent intent = getIntent();

    String stringUrl = urlText;
    ConnectivityManager connMgr =
        (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
    if (networkInfo != null && networkInfo.isConnected()) {
      new DownloadFilesTask().execute(stringUrl);
    } else {
      Log.v("info", "network ocnnection unaavailable");
      // textView.setText("No network connection available.");
    }

    // Bundle extras = intent.getExtras();

    // this.historyArray = new ArrayList<QuestionResponseModel>();
    // if(null!=intent) {
    // this.historyArray =
    // (ArrayList<QuestionResponseModel>)intent.getSerializableExtra("historyArray");
    // }
    // historyArray.
    // Log.v("testing", "thisishistoyarray"+historyArray.size());

    //        adapter = new HistoryAdapter(this, android.R.layout.simple_list_item_2, qrArray);
    //        listView.setAdapter(adapter);
  }
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    mPositions.put(mDirectory.getAbsolutePath(), getListView().getFirstVisiblePosition());

    if (position < (mParent == null ? 0 : 1)) {
      mDirectory = mParent;
      mHandler.post(mUpdateFiles);
      return;
    }

    position -= (mParent == null ? 0 : 1);

    if (position < mDirs.length) {
      mDirectory = mDirs[position];
      mHandler.post(mUpdateFiles);
      return;
    }

    position -= mDirs.length;

    Uri uri = Uri.parse(mFiles[position].getAbsolutePath());
    Intent intent = new Intent(this, MuPDFActivity.class);
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(uri);
    startActivity(intent);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.drinklistview);

    View left = findViewById(R.id.left_button);
    left.setOnClickListener(this);
    View events = findViewById(R.id.events_button);
    events.setOnClickListener(this);
    View right = findViewById(R.id.right_button);
    right.setOnClickListener(this);

    Intent thisIntent = getIntent();
    bar = thisIntent.getIntExtra("_bar", 0);
    // day = thisIntent.getIntExtra("_day", 0);
    bar =
        thisIntent.getIntExtra(
            "_bar",
            0); // gets the intent that started this mess and gets an extra value that was passed
    // called _bar.
    // 0 is the default argument is nothing is passed.
    day = thisIntent.getIntExtra("_day", 0); // same idea as above.

    fillList();
  }
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    if (isNetworkAvailable() == false) noInternetAccess();

    super.onListItemClick(l, v, position, id);
    ParseObject message = mMessages.get(position);
    String post = message.getString(ParseConstants.KEY_POST);
    String sendername = message.getString(ParseConstants.KEY_SENDER_NAME);

    final Dialog dialog = new Dialog(RumourActivity.this, R.style.Theme_Dialog);
    dialog.setContentView(R.layout.rumour_custom_alert);

    final TextView userInput3 = (TextView) dialog.findViewById(R.id.rumour_custom_et);
    final TextView sender = (TextView) dialog.findViewById(R.id.sender_custom_et);
    final Button ok = (Button) dialog.findViewById(R.id.btn_ok);

    sender.setText(sendername);
    userInput3.setText(post);
    dialog.show();
    ok.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            dialog.dismiss();
          }
        });
  }
Example #11
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mpref = this.getSharedPreferences("mypref", 0);
    handler = new Handler();
    bargeStatus = new ArrayList<String>();
    bargeNames = new ArrayList<String>();
    bargeTimes = new ArrayList<String>();
    latList = new ArrayList<Integer>();
    lonList = new ArrayList<Integer>();
    toBargeMap = new Intent(BargeList.this, BargeMap.class);
    bargeList = getListView();
    bargeList.setClickable(true);
    bargeList.setItemsCanFocus(false);

    helpcolor = new Dialog(BargeList.this);
    helpcolor.setContentView(R.layout.helpcolor);
    helpcolor.setTitle("Help");
    Button helpok = (Button) helpcolor.findViewById(R.id.helpok);
    helpok.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            helpcolor.dismiss();
          }
        });
  }
Example #12
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    // This is our one standard application action -- inserting a
    // new record into the list.
    menu.add(0, MENU_ITEM_INSERT, 0, R.string.menu_insert)
        .setShortcut('3', 'a')
        .setIcon(android.R.drawable.ic_menu_add);

    // Generate any additional actions that can be performed on the
    // overall list.  In a normal install, there are no additional
    // actions found here, but this allows other applications to extend
    // our menu with their own actions.
    Intent intent = new Intent(null, getIntent().getData());
    intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
    menu.addIntentOptions(
        Menu.CATEGORY_ALTERNATIVE,
        0,
        0,
        new ComponentName(this, RecordsList.class),
        null,
        intent,
        0,
        null);

    return true;
  }
Example #13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);

    // If no data was given in the intent (because we were started
    // as a MAIN activity), then use our default content provider.
    Intent intent = getIntent();
    if (intent.getData() == null) {
      intent.setData(Records.CONTENT_URI);
    }

    // Inform the list we provide context menus for items
    getListView().setOnCreateContextMenuListener(this);

    // Perform a managed query. The Activity will handle closing and requerying the cursor
    // when needed.
    Cursor cursor =
        managedQuery(getIntent().getData(), PROJECTION, null, null, Records.DEFAULT_SORT_ORDER);

    // Used to map records entries from the database to views
    SimpleCursorAdapter adapter =
        new SimpleCursorAdapter(
            this,
            R.layout.recordslist_item,
            cursor,
            new String[] {Records.DESCRIPTION, Records.CATEGORY, Records.AMOUNT},
            new int[] {android.R.id.text1, android.R.id.text2, android.R.id.text3});
    setListAdapter(adapter);
  }
Example #14
0
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    final boolean haveItems = getListAdapter().getCount() > 0;

    // If there are any records in the list (which implies that one of
    // them is selected), then we need to generate the actions that
    // can be performed on the current selection.  This will be a combination
    // of our own specific actions along with any extensions that can be
    // found.
    if (haveItems) {
      // This is the selected item.
      Uri uri = ContentUris.withAppendedId(getIntent().getData(), getSelectedItemId());

      // Build menu...  always starts with the EDIT action...
      Intent[] specifics = new Intent[1];
      specifics[0] = new Intent(Intent.ACTION_EDIT, uri);
      MenuItem[] items = new MenuItem[1];

      // ... is followed by whatever other actions are available...
      Intent intent = new Intent(null, uri);
      intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
      menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0, null, specifics, intent, 0, items);

      // Give a shortcut to the edit action.
      if (items[0] != null) {
        items[0].setShortcut('1', 'e');
      }
    } else {
      menu.removeGroup(Menu.CATEGORY_ALTERNATIVE);
    }

    return true;
  }
Example #15
0
  public void onDestroy() {
    super.onDestroy();

    // Replace mDbHelper as needed with your database connection, or
    // whatever wraps your database connection. (See below.)
    //        mDbHelper.close();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.list_doctors);

    contactList = new ArrayList<HashMap<String, String>>();
    // new GetContacts().execute();

    ListView lv = getListView();

    // Listview on item click listener
    lv.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            String pid = ((TextView) view.findViewById(R.id.pid)).getText().toString();
            Intent in = new Intent(getApplicationContext(), DoctorDetails.class);
            // sending pid to next activity
            in.putExtra(TAG_DID, pid);
            startActivityForResult(in, 100);
            // startActivity(in);

          }
        });

    // Calling async task to get json

    new GetContacts().execute();
  }
Example #17
0
 /// M: refresh listview when activity display again. @{
 @Override
 public void onResume() {
   super.onResume();
   getListView().invalidateViews();
   /// M: If user has select one audio, we should set ok button enable
   mOkayButton.setEnabled(mSelectedId >= 0);
 }
Example #18
0
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   Intent i = new Intent(this, AirNoteEdit.class);
   i.putExtra(AirNotesDbAdapter.KEY_ROWID, id);
   startActivityForResult(i, ACTIVITY_EDIT);
 } // onListItemClick
  @Override
  protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    Intent intent = getIntent();
    if (intent == null) {
      finish();
      return;
    }

    mEventId = intent.getLongExtra(EXTRA_EVENT_ID, -1);
    if (mEventId == -1) {
      finish();
      return;
    }

    // Set listener
    getListView().setOnItemClickListener(QuickResponseActivity.this);

    // Populate responses
    String[] responses = Utils.getQuickResponses(this);
    Arrays.sort(responses);

    // Add "Custom response..."
    mResponses = new String[responses.length + 1];
    int i;
    for (i = 0; i < responses.length; i++) {
      mResponses[i] = responses[i];
    }
    mResponses[i] = getResources().getString(R.string.quick_response_custom_msg);

    setListAdapter(new ArrayAdapter<String>(this, R.layout.quick_response_item, mResponses));
  }
Example #20
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   menu.add(0, INSERT_ID, 0, R.string.menu_insert);
   menu.add(0, COUNTRY_VIEW_ID, 1, R.string.menu_country_view);
   return true;
 } // onCreateOptionsMenu
  @Override
  public void onCreate(Bundle icicle) {

    // onCreate - save the instance state
    super.onCreate(icicle);

    // Set sharedPreferences
    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    PublicUtils.restoreCookies(this, icicle);

    // Setup the locale
    PublicUtils.setupLocale(this, sharedPreferences);

    // Set the content view
    setContentView(R.layout.forum_search_view);

    // Prepare to tango
    this.layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    // Get the elements
    buttonSearch = (Button) findViewById(R.id.button_search);
    fieldSearch = (EditText) findViewById(R.id.field_search);

    // Threads!
    threads = new ArrayList<ForumSearchResult>();
    setupList(threads);
  }
Example #22
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    Cursor note = extObjDB.fetchNote(id);
    startManagingCursor(note);
    ObjSource s;
    int resource_id = note.getInt(note.getColumnIndexOrThrow(ExternObjDB.KEY_RESRC_ID));
    if (resource_id == -1) {
      // obj from sdcard
      String path = note.getString(note.getColumnIndexOrThrow(ExternObjDB.KEY_PATH));
      s = new ObjFromSDcard(path);
    } else {
      // obj from resource
      s = new ObjFromResource(resource_id);
    }
    s.Title = note.getString(note.getColumnIndexOrThrow(ExternObjDB.KEY_TITLE));
    s.Info = note.getString(note.getColumnIndexOrThrow(ExternObjDB.KEY_INFO));
    s.ID = note.getInt(note.getColumnIndexOrThrow(ExternObjDB.KEY_ROWID));
    Bundle bundle = new Bundle();

    bundle.putSerializable(ObjSource.TITLE, s);

    Intent mIntent = new Intent();
    mIntent.putExtras(bundle);
    setResult(RESULT_OK, mIntent);
    finish();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // progress menu bar
    setContentView(R.layout.list_frame);

    int key = getIntent().getIntExtra(FileParser.BE_A_BARTENDER, -1);

    InputStream in = null;

    switch (key) {
      case FileParser.TERMINOLOGY: // terminology
        in = getResources().openRawResource(R.raw.terminology);
        break;
      case FileParser.GLASSES: // glass info
        isGlasses = true;
        in = getResources().openRawResource(R.raw.glasses);
        break;
      case FileParser.BASIC_TEQ: // techniques
        in = getResources().openRawResource(R.raw.basictechniques);
        break;
      case FileParser.BARSTOCK: // bar stock
        in = getResources().openRawResource(R.raw.barstock);
        break;
    }

    FileParser.loadBarStock(in);

    initialize();
  }
Example #24
0
 @Override
 protected void onStop() {
   super.onStop();
   if (mCursor != null) {
     mCursor.deactivate();
   }
 }
 @Override
 protected void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   Intent intent = new Intent(this, GeatteVotingActivity.class);
   intent.putExtra(Config.GEATTE_ID_PARAM, Long.toString(id));
   startActivityForResult(intent, ACTIVITY_VOTE);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.kontakte_hinzufuegen);

    String[] from = new String[] {Contacts.DISPLAY_NAME, Contacts.CONTACT_STATUS};

    int[] to = new int[] {android.R.id.text1, android.R.id.text2};

    simpleCursorAdapter =
        new SimpleCursorAdapter(this, android.R.layout.simple_list_item_2, null, from, to, 0);

    setListAdapter(simpleCursorAdapter);

    LoaderManager loaderManager = getLoaderManager();
    loaderManager.initLoader(0, null, this);
    String raw_contacts = readFromFile(CONTACTS_FILE_NAME);
    contacts = makeContactList(raw_contacts);

    // Daten vom vorherigen Screen entgegennehmen; ausgewaehlte Grupp
    Bundle zielkorb = getIntent().getExtras();
    String groupname = zielkorb.getString("datenpaket2");

    readFromFile(groupname + ".txt");
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    String[] osLijst =
        new String[] {
          "Android",
          "Iphone",
          "WindowsMobile",
          "Blackberry",
          "WebOS",
          "Ubuntu",
          "Windows7",
          "Mac OS X",
          "Linux",
          "OS/2"
        };

    ArrayAdapter<String> listViewArrayAdapter =
        new ArrayAdapter<String>(this, R.layout.listview_item, R.id.listViewItem, osLijst);

    final ListView listView = getListView();
    listView.setAdapter(listViewArrayAdapter);

    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Toast.makeText(
                    MainActivity.this, "Clicked ListItem number " + position, Toast.LENGTH_SHORT)
                .show();
          }
        });
  }
Example #28
0
  /** Called when the activity is resumed. */
  @Override
  public void onResume() {
    super.onResume();
    accountManager = AccountManager.get(getApplicationContext());
    final Account[] accounts = accountManager.getAccountsByType("com.google");
    this.setListAdapter(
        new ArrayAdapter<Account>(this, R.layout.account_chooser, accounts) {
          @Override
          public View getView(int position, View convertView, ViewGroup parent) {
            View row;

            if (convertView == null) {
              row =
                  ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE))
                      .inflate(R.layout.account_chooser, null);
            } else {
              row = convertView;
            }
            TextView vw = (TextView) row.findViewById(android.R.id.text1);
            vw.setTextSize(Collect.getQuestionFontsize());
            SharedPreferences settings =
                PreferenceManager.getDefaultSharedPreferences(getBaseContext());
            String selected = settings.getString(PreferencesActivity.KEY_ACCOUNT, "");
            if (accounts[position].name.equals(selected)) {
              vw.setBackgroundColor(Color.LTGRAY);
            } else {
              vw.setBackgroundColor(Color.WHITE);
            }
            vw.setText(getItem(position).name);

            return row;
          }
        });
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_list);
   // 初始化数据
   initData();
 }
Example #30
0
 @Override
 public void onCreate(Bundle icicle) {
   super.onCreate(icicle);
   setContentView(R.layout.main);
   setListAdapter(new IconicAdapter());
   selection = (TextView) findViewById(R.id.selection);
 }