use of android.widget.ArrayAdapter in project Rashr by DsLNeXuS.
the class RecoverySystemFragment method onCreateView.
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
mActivity = (RashrActivity) getActivity();
final ScrollView root = (ScrollView) inflater.inflate(R.layout.fragment_recovery_system, container, false);
mContext = root.getContext();
final AppCompatTextView tvTitle = (AppCompatTextView) root.findViewById(R.id.tvSysName);
tvTitle.setText(mTitle.toUpperCase());
final AppCompatTextView tvDesc = (AppCompatTextView) root.findViewById(R.id.tvRecSysDesc);
tvDesc.setText(mDesc);
final AppCompatSpinner spVersions = (AppCompatSpinner) root.findViewById(R.id.spVersions);
ArrayList<String> formatedVersions = new ArrayList<>();
for (String versionLinks : mVersions) {
formatedVersions.add(formatName(versionLinks, mTitle));
}
final ArrayAdapter<String> adapter = new ArrayAdapter<>(root.getContext(), android.R.layout.simple_list_item_1, formatedVersions);
spVersions.setAdapter(adapter);
spVersions.setSelection(0);
final AppCompatTextView tvDev = (AppCompatTextView) root.findViewById(R.id.tvDevName);
tvDev.setText(mDev);
final AppCompatImageView imLogo = (AppCompatImageView) root.findViewById(R.id.ivRecLogo);
if (mLogo == 0) {
root.removeView(imLogo);
} else {
imLogo.setImageResource(mLogo);
}
final AppCompatButton bFlash = (AppCompatButton) root.findViewById(R.id.bFlashRecovery);
bFlash.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
flashSupportedRecovery(mTitle, mVersions.get(spVersions.getSelectedItemPosition()));
}
});
final LinearLayout ScreenshotLayout = (LinearLayout) root.findViewById(R.id.ScreenshotLayout);
if (mScreenshotURL == null) {
((ViewGroup) ScreenshotLayout.getParent()).removeView(ScreenshotLayout);
} else {
try {
Downloader jsonDownloader = new Downloader(new URL(mScreenshotURL + "/getScreenshots.php"), new File(mContext.getExternalCacheDir(), "screenhots.json"));
jsonDownloader.setOverrideFile(true);
jsonDownloader.setOnDownloadListener(new Downloader.OnDownloadListener() {
@Override
public void onSuccess(File file) {
try {
JSONArray arr = new JSONArray(Common.fileContent(file));
for (int i = 0; i < arr.length(); i++) {
final String name = arr.get(i).toString();
if (name.equals(".") || name.equals("..") || name.equals("getScreenshots.php"))
continue;
Downloader imageDownloader = new Downloader(new URL(mScreenshotURL + "/" + name), new File(file.getParentFile(), name));
//Do not redownload predownloaded images
imageDownloader.setOverrideFile(false);
imageDownloader.setOnDownloadListener(new Downloader.OnDownloadListener() {
@Override
public void onSuccess(File file) {
AppCompatImageView iv = (AppCompatImageView) inflater.inflate(R.layout.recovery_screenshot, null);
try {
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 8;
Bitmap screenshot = BitmapFactory.decodeFile(file.toString());
iv.setImageBitmap(screenshot);
ScreenshotLayout.addView(iv);
} catch (OutOfMemoryError e) {
App.ERRORS.add("Screenshot " + file.toString() + " could not be decoded " + e.toString());
}
}
@Override
public void onFail(Exception e) {
}
});
imageDownloader.download();
}
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e) {
onFail(e);
}
}
@Override
public void onFail(Exception e) {
e.printStackTrace();
}
});
jsonDownloader.download();
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
return root;
}
use of android.widget.ArrayAdapter in project android_frameworks_base by ResurrectionRemix.
the class PopupWindowVisibility method onCreate.
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.popup_window_visibility);
mFrame = findViewById(R.id.frame);
mHide = (Button) findViewById(R.id.hide);
mHide.setOnClickListener(this);
mShow = (Button) findViewById(R.id.show);
mShow.setOnClickListener(this);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mStrings);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerAdapter);
ArrayAdapter<String> autoAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES);
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.auto);
textView.setAdapter(autoAdapter);
}
use of android.widget.ArrayAdapter in project android_frameworks_base by ResurrectionRemix.
the class ScoAudioTest method onCreate.
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.scoaudiotest);
mScoStateTxt = (TextView) findViewById(R.id.scoStateTxt);
mVdStateTxt = (TextView) findViewById(R.id.vdStateTxt);
IntentFilter intentFilter = new IntentFilter(BluetoothHeadset.ACTION_AUDIO_STATE_CHANGED);
intentFilter.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED);
intentFilter.addAction(AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED);
registerReceiver(mReceiver, intentFilter);
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mAudioManager2 = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
mHandler = new Handler();
mMediaControllers[0] = new SimplePlayerController(this, R.id.playPause1, R.id.stop1, R.raw.sine440_mo_16b_16k, AudioManager.STREAM_BLUETOOTH_SCO);
TextView name = (TextView) findViewById(R.id.playPause1Text);
name.setText("VOICE_CALL stream");
mScoButton = (ToggleButton) findViewById(R.id.ForceScoButton);
mScoButton.setOnCheckedChangeListener(mForceScoChanged);
mForceScoOn = false;
mScoButton.setChecked(mForceScoOn);
mVoiceDialerButton = (ToggleButton) findViewById(R.id.VoiceDialerButton);
mVoiceDialerButton.setOnCheckedChangeListener(mVoiceDialerChanged);
mVoiceDialerOn = false;
mVoiceDialerButton.setChecked(mVoiceDialerOn);
mMediaControllers[1] = new SimpleRecordController(this, R.id.recStop1, 0, "Sco_record_");
mTtsInited = false;
mTts = new TextToSpeech(this, new TtsInitListener());
mTtsParams = new HashMap<String, String>();
mTtsParams.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_BLUETOOTH_SCO));
mTtsParams.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, UTTERANCE);
mSpeakText = (EditText) findViewById(R.id.speakTextEdit);
mSpeakText.setOnKeyListener(mSpeakKeyListener);
mSpeakText.setText("sco audio test sentence");
mTtsToFileButton = (ToggleButton) findViewById(R.id.TtsToFileButton);
mTtsToFileButton.setOnCheckedChangeListener(mTtsToFileChanged);
mTtsToFile = true;
mTtsToFileButton.setChecked(mTtsToFile);
mModeSpinner = (Spinner) findViewById(R.id.modeSpinner);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mModeStrings);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mModeSpinner.setAdapter(adapter);
mModeSpinner.setOnItemSelectedListener(mModeChanged);
mCurrentMode = mAudioManager.getMode();
mModeSpinner.setSelection(mCurrentMode);
mBluetoothHeadsetDevice = null;
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
if (btAdapter != null) {
btAdapter.getProfileProxy(this, mBluetoothProfileServiceListener, BluetoothProfile.HEADSET);
}
sVoiceCommandIntent = new Intent(Intent.ACTION_VOICE_COMMAND);
sVoiceCommandIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
use of android.widget.ArrayAdapter in project Synthese_2BIN by TheYoungSensei.
the class BusinessDayDetailFragment method notifyChange.
@Override
public void notifyChange() {
if (this.getContext() == null)
return;
ArrayAdapter<String> ad = new ArrayAdapter<String>(this.getContext().getApplicationContext(), android.R.layout.simple_expandable_list_item_1, model.displayCompanies());
ListView v = (ListView) rootView.findViewById(R.id.businessday_detail);
v.setAdapter(ad);
}
use of android.widget.ArrayAdapter in project android_frameworks_base by ResurrectionRemix.
the class FrameworkPerfActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set the layout for this activity. You can find it
// in res/layout/hello_activity.xml
setContentView(R.layout.main);
mFgSpinner = (Spinner) findViewById(R.id.fgspinner);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mAvailOpLabels);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mFgSpinner.setAdapter(adapter);
mFgSpinner.setOnItemSelectedListener(this);
mBgSpinner = (Spinner) findViewById(R.id.bgspinner);
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mAvailOpLabels);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mBgSpinner.setAdapter(adapter);
mBgSpinner.setOnItemSelectedListener(this);
mLimitSpinner = (Spinner) findViewById(R.id.limitspinner);
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mLimitLabels);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mLimitSpinner.setAdapter(adapter);
mLimitSpinner.setOnItemSelectedListener(this);
mTestTime = (TextView) findViewById(R.id.testtime);
mLimitLabel = (TextView) findViewById(R.id.limitlabel);
mStartButton = (Button) findViewById(R.id.start);
mStartButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startRunning();
}
});
mStopButton = (Button) findViewById(R.id.stop);
mStopButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
stopRunning();
}
});
mStopButton.setEnabled(false);
mLocalCheckBox = (CheckBox) findViewById(R.id.local);
mLog = (TextView) findViewById(R.id.log);
mLog.setTextColor(Color.RED);
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
mPartialWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Scheduler");
mPartialWakeLock.setReferenceCounted(false);
}
Aggregations