List of usage examples for android.widget ScrollView addView
@Override public void addView(View child)
From source file:net.clcworld.thermometer.TakeTemperatureReadingActivity.java
/** Called when the activity is first created. */ @Override/*from w w w . j a v a 2 s. c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSelf = this; Intent i = new Intent(); i.setClass(this, LauncherActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); PendingIntent relaunchIntent = PendingIntent.getActivity(this, 0, i, 0); mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); Intent data = this.getIntent(); if (data.getBooleanExtra("FROM_ALARM", false)) { // Only show the persistant notification if it's from the alarm. NotificationCompat.Builder builder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.app_icon).setTicker(getString(R.string.notification)) .setContentTitle(getString(R.string.app_name)).setContentText(getString(R.string.notification)) .setOngoing(true).setOnlyAlertOnce(false).setContentIntent(relaunchIntent) .setSound(Settings.System.DEFAULT_NOTIFICATION_URI).setLights(Color.RED, 500, 500); mNotificationManager.notify(NOTIFICATION_NUMBER, builder.build()); } mPrefs = PreferenceManager.getDefaultSharedPreferences(this); mFeeling = mPrefs.getString("lastFeeling", STATUS_WELL); mHistory = mPrefs.getString(PREFSKEY_HISTORY, ""); final String id = mPrefs.getString("ID", ""); setContentView(R.layout.temperature); mTemperatureEditText = (EditText) findViewById(R.id.temperature); mTemperatureEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { hideKeyboard(v); } } }); final LinearLayout symptomsList = (LinearLayout) findViewById(R.id.symptoms); final CheckBox extremeTiredness = (CheckBox) findViewById(R.id.extremetiredness); if (mPrefs.getBoolean(PREFSKEY_SYMPTOMS_EXTREMETIREDNESS, false)) { extremeTiredness.setChecked(true); } final CheckBox musclepain = (CheckBox) findViewById(R.id.musclepain); if (mPrefs.getBoolean(PREFSKEY_SYMPTOMS_MUSCLEPAIN, false)) { musclepain.setChecked(true); } final CheckBox headache = (CheckBox) findViewById(R.id.headache); if (mPrefs.getBoolean(PREFSKEY_SYMPTOMS_HEADACHE, false)) { headache.setChecked(true); } final CheckBox sorethroat = (CheckBox) findViewById(R.id.sorethroat); if (mPrefs.getBoolean(PREFSKEY_SYMPTOMS_SORETHROAT, false)) { sorethroat.setChecked(true); } final CheckBox vomiting = (CheckBox) findViewById(R.id.vomiting); if (mPrefs.getBoolean(PREFSKEY_SYMPTOMS_VOMITING, false)) { vomiting.setChecked(true); } final CheckBox diarrhea = (CheckBox) findViewById(R.id.diarrhea); if (mPrefs.getBoolean(PREFSKEY_SYMPTOMS_DIARRHEA, false)) { diarrhea.setChecked(true); } final CheckBox rash = (CheckBox) findViewById(R.id.rash); if (mPrefs.getBoolean(PREFSKEY_SYMPTOMS_RASH, false)) { rash.setChecked(true); } final CheckBox bleeding = (CheckBox) findViewById(R.id.bleeding); if (mPrefs.getBoolean(PREFSKEY_SYMPTOMS_BLEEDING, false)) { bleeding.setChecked(true); } final CheckBox painrelief = (CheckBox) findViewById(R.id.painrelief); if (mPrefs.getBoolean(PREFSKEY_SYMPTOMS_PAINRELIEF, false)) { painrelief.setChecked(true); } final Button submitButton = (Button) findViewById(R.id.submit); submitButton.setText(R.string.save); final String destination = mPrefs.getString("DEST", ""); if (destination.length() > 0) { submitButton.setText(getString(R.string.submit) + destination); } submitButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { String tempString = mTemperatureEditText.getText().toString(); try { float t = Float.parseFloat(tempString); // Come up with better thresholds + use an alert // confirmation prompt. if ((t < 91) || (t > 120)) { Toast.makeText(mSelf, R.string.retake, Toast.LENGTH_LONG).show(); return; } mTemperatureEditText.setEnabled(false); submitButton.setEnabled(false); Editor editor = mPrefs.edit(); editor.putLong("LAST_READING", System.currentTimeMillis()); ArrayList<String> symptoms = new ArrayList<String>(); if (mFeeling.equals(STATUS_WELL)) { editor.putBoolean(PREFSKEY_SYMPTOMS_EXTREMETIREDNESS, false); editor.putBoolean(PREFSKEY_SYMPTOMS_MUSCLEPAIN, false); editor.putBoolean(PREFSKEY_SYMPTOMS_HEADACHE, false); editor.putBoolean(PREFSKEY_SYMPTOMS_SORETHROAT, false); editor.putBoolean(PREFSKEY_SYMPTOMS_VOMITING, false); editor.putBoolean(PREFSKEY_SYMPTOMS_DIARRHEA, false); editor.putBoolean(PREFSKEY_SYMPTOMS_RASH, false); editor.putBoolean(PREFSKEY_SYMPTOMS_BLEEDING, false); editor.putBoolean(PREFSKEY_SYMPTOMS_PAINRELIEF, false); } else { if (extremeTiredness.isChecked()) { editor.putBoolean(PREFSKEY_SYMPTOMS_EXTREMETIREDNESS, true); symptoms.add(PREFSKEY_SYMPTOMS_EXTREMETIREDNESS); } if (musclepain.isChecked()) { editor.putBoolean(PREFSKEY_SYMPTOMS_MUSCLEPAIN, true); symptoms.add(PREFSKEY_SYMPTOMS_MUSCLEPAIN); } if (headache.isChecked()) { editor.putBoolean(PREFSKEY_SYMPTOMS_HEADACHE, true); symptoms.add(PREFSKEY_SYMPTOMS_HEADACHE); } if (sorethroat.isChecked()) { editor.putBoolean(PREFSKEY_SYMPTOMS_SORETHROAT, true); symptoms.add(PREFSKEY_SYMPTOMS_SORETHROAT); } if (vomiting.isChecked()) { editor.putBoolean(PREFSKEY_SYMPTOMS_VOMITING, true); symptoms.add(PREFSKEY_SYMPTOMS_VOMITING); } if (diarrhea.isChecked()) { editor.putBoolean(PREFSKEY_SYMPTOMS_DIARRHEA, true); symptoms.add(PREFSKEY_SYMPTOMS_DIARRHEA); } if (rash.isChecked()) { editor.putBoolean(PREFSKEY_SYMPTOMS_RASH, true); symptoms.add(PREFSKEY_SYMPTOMS_RASH); } if (bleeding.isChecked()) { editor.putBoolean(PREFSKEY_SYMPTOMS_BLEEDING, true); symptoms.add(PREFSKEY_SYMPTOMS_BLEEDING); } if (painrelief.isChecked()) { editor.putBoolean(PREFSKEY_SYMPTOMS_PAINRELIEF, true); symptoms.add(PREFSKEY_SYMPTOMS_PAINRELIEF); } } editor.commit(); mNotificationManager.cancelAll(); DecimalFormat decFormat = new DecimalFormat("0.0"); sendData(id, decFormat.format(t), mFeeling, symptoms); } catch (Exception e) { e.printStackTrace(); } } }); mFeelingRadioGroup = (RadioGroup) findViewById(R.id.radioGroupFeeling); int selectedId = R.id.radioWell; if (mFeeling.equals(STATUS_SICK)) { selectedId = R.id.radioSick; if (destination.length() > 0) { symptomsList.setVisibility(View.VISIBLE); } } mFeelingRadioGroup.check(selectedId); mFeelingRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.radioSick) { mFeeling = STATUS_SICK; if (destination.length() > 0) { symptomsList.setVisibility(View.VISIBLE); } } else { mFeeling = STATUS_WELL; symptomsList.setVisibility(View.GONE); } Editor editor = mPrefs.edit(); editor.putString("lastFeeling", mFeeling); editor.commit(); } }); Button historyButton = (Button) findViewById(R.id.history); if (mHistory.length() < 1) { historyButton.setVisibility(View.GONE); } historyButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mSelf); alertDialogBuilder.setTitle(R.string.history); alertDialogBuilder.setPositiveButton(R.string.ok, null); AlertDialog dialog = alertDialogBuilder.create(); TextView text = new TextView(mSelf); text.setTextSize(16); text.setPadding(40, 40, 40, 40); text.setText(mHistory); ScrollView scroll = new ScrollView(mSelf); scroll.addView(text); dialog.setView(scroll); dialog.show(); } }); Button viewTosButton = (Button) findViewById(R.id.viewtos); viewTosButton.setText(R.string.tos_title_local); mIsActivated = false; if (destination.length() > 0) { mIsActivated = true; viewTosButton.setText(R.string.tos_title_publichealth); } viewTosButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent viewTosIntent = new Intent(); viewTosIntent.setClass(mSelf, TosActivity.class); viewTosIntent.putExtra("VIEW_ONLY", true); startActivity(viewTosIntent); } }); }
From source file:com.contralabs.inmap.fragments.LegalNoticesDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Context context = getActivity(); ScrollView scrollView = new ScrollView(context); // Set up the TextView final TextView message = new TextView(context); // We'll use a spannablestring to be able to make links clickable final SpannableString s = new SpannableString( GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(context)); // Set some padding int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, getResources().getDisplayMetrics()); message.setPadding(padding, padding, padding, padding); // Set up the final string message.setText(s);//from w w w . j av a 2 s .c o m scrollView.addView(message); // Now linkify the text Linkify.addLinks(message, Linkify.ALL); Linkify.addLinks(message, Pattern.compile("@([A-Za-z0-9_-]+)"), "https://twitter.com/#!/"); return new AlertDialog.Builder(getActivity()).setTitle(R.string.legal_notices).setCancelable(true) .setIcon(R.drawable.ic_launcher) .setPositiveButton(context.getString(R.string.voltar), (OnClickListener) null).setView(scrollView) .create(); }
From source file:com.mikecorrigan.trainscorekeeper.FragmentSummary.java
@SuppressLint("NewApi") @Override//from ww w. ja v a 2s . c o m public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.vc(VERBOSE, TAG, "onCreateView: inflater=" + inflater + ", container=" + container + ", savedInstanceState=" + Utils.bundleToString(savedInstanceState)); View rootView = inflater.inflate(R.layout.fragment_summary, container, false); final MainActivity activity = (MainActivity) getActivity(); final Context context = activity; final Resources resources = context.getResources(); // Get the model and attach a listener. game = activity.getGame(); if (game != null) { game.addListener(mGameListener); } players = activity.getPlayers(); // Get resources. String[] playerNames = resources.getStringArray(R.array.playerNames); TypedArray drawablesArray = resources.obtainTypedArray(R.array.playerDrawables); TypedArray playerTextColorsArray = resources.obtainTypedArray(R.array.playerTextColors); int[] playerTextColorsIds = new int[playerTextColorsArray.length()]; for (int i = 0; i < playerTextColorsArray.length(); i++) { playerTextColorsIds[i] = playerTextColorsArray.getResourceId(i, -1); } // Get root view. ScrollView scrollView = (ScrollView) rootView.findViewById(R.id.scroll_view); // Create table. tableLayout = new TableLayout(context); TableLayout.LayoutParams tableLayoutParams = new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); tableLayout.setLayoutParams(tableLayoutParams); scrollView.addView(tableLayout); // Add header. { TableRow row = new TableRow(context); row.setLayoutParams(new TableRow.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); tableLayout.addView(row); TextView tv = new TextView(context); tv.setGravity(Gravity.CENTER); tv.setPadding(10, 10, 10, 10); tv.setText(resources.getString(R.string.player)); tv.setTypeface(null, Typeface.BOLD); row.addView(tv); tv = new TextView(context); tv.setGravity(Gravity.CENTER); tv.setPadding(10, 10, 10, 10); tv.setText(resources.getString(R.string.trains)); tv.setTypeface(null, Typeface.BOLD); row.addView(tv); tv = new TextView(context); tv.setGravity(Gravity.CENTER); tv.setPadding(10, 10, 10, 10); tv.setText(resources.getString(R.string.contracts)); tv.setTypeface(null, Typeface.BOLD); row.addView(tv); tv = new TextView(context); tv.setGravity(Gravity.CENTER); tv.setPadding(10, 10, 10, 10); tv.setText(resources.getString(R.string.bonuses)); tv.setTypeface(null, Typeface.BOLD); row.addView(tv); } // Add rows. for (int i = 0; i < players.getNum(); i++) { TableRow row = new TableRow(context); row.setLayoutParams(new TableRow.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); tableLayout.addView(row); ToggleButton toggleButton = new ToggleButton(context); toggleButton.setGravity(Gravity.CENTER); toggleButton.setPadding(10, 10, 10, 10); toggleButton.setText(playerNames[i]); toggleButton.setClickable(false); Drawable drawable = drawablesArray.getDrawable(i); int sdk = android.os.Build.VERSION.SDK_INT; if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) { toggleButton.setBackgroundDrawable(drawable); } else { toggleButton.setBackground(drawable); } toggleButton.setTextColor(resources.getColor(playerTextColorsIds[i])); row.addView(toggleButton); TextView tv = new TextView(context); tv.setGravity(Gravity.CENTER); tv.setPadding(10, 10, 10, 10); row.addView(tv); tv = new TextView(context); tv.setGravity(Gravity.CENTER); tv.setPadding(10, 10, 10, 10); row.addView(tv); tv = new TextView(context); tv.setGravity(Gravity.CENTER); tv.setPadding(10, 10, 10, 10); row.addView(tv); } Bundle args = getArguments(); if (args == null) { Log.e(TAG, "onCreateView: missing arguments"); return rootView; } drawablesArray.recycle(); playerTextColorsArray.recycle(); // final int index = args.getInt(ARG_INDEX); // final String tabSpec = args.getString(ARG_TAB_SPEC); return rootView; }
From source file:edu.cnu.PowerTutor.ui.PowerViewer.java
public void refreshView() { if (counterService == null) { TextView loadingText = new TextView(this); loadingText.setText("Waiting for profiler service..."); loadingText.setGravity(Gravity.CENTER); setContentView(loadingText);/* w ww . j a v a 2 s . com*/ return; } chartLayout = new LinearLayout(this); chartLayout.setOrientation(LinearLayout.VERTICAL); if (uid == SystemInfo.AID_ALL) { /* * If we are reporting global power usage then just set noUidMask to * 0 so that all components get displayed. */ noUidMask = 0; } components = 0; for (int i = 0; i < componentNames.length; i++) { if ((noUidMask & 1 << i) == 0) { components++; } } boolean showTotal = prefs.getBoolean("showTotalPower", false); collectors = new ValueCollector[(showTotal ? 1 : 0) + components]; int pos = 0; for (int i = showTotal ? -1 : 0; i < componentNames.length; i++) { if (i != -1 && (noUidMask & 1 << i) != 0) { continue; } String name = i == -1 ? "Total" : componentNames[i]; double mxPower = (i == -1 ? 2100.0 : componentsMaxPower[i]) * 1.05; XYSeries series = new XYSeries(name); XYMultipleSeriesDataset mseries = new XYMultipleSeriesDataset(); mseries.addSeries(series); XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); XYSeriesRenderer srenderer = new XYSeriesRenderer(); renderer.setYAxisMin(0.0); renderer.setYAxisMax(mxPower); renderer.setYTitle(name + "(mW)"); int clr = PowerPie.COLORS[(PowerPie.COLORS.length + i) % PowerPie.COLORS.length]; srenderer.setColor(clr); srenderer.setFillBelowLine(true); srenderer.setFillBelowLineColor(((clr >> 1) & 0x7F7F7F) | (clr & 0xFF000000)); renderer.addSeriesRenderer(srenderer); View chartView = new GraphicalView(this, new CubicLineChart(mseries, renderer, 0.5f)); chartView.setMinimumHeight(100); chartLayout.addView(chartView); collectors[pos] = new ValueCollector(series, renderer, chartView, i); if (handler != null) { // Main Handler? . (debug) handler.post(collectors[pos]); } pos++; } /* * We're giving 100 pixels per graph of vertical space for the chart * view. If we don't specify a minimum height the chart view ends up * having a height of 0 so this is important. */ chartLayout.setMinimumHeight(100 * components); ScrollView scrollView = new ScrollView(this); scrollView.addView(chartLayout); setContentView(scrollView); }
From source file:com.loloof64.android.capturing_audio.MainActivity.java
public void recordingButtonClicked(View view) { try {/*w ww . j av a 2 s.com*/ recorderFragment.toggleRecordingState(); } catch (IOException e) { Log.e("RecordingAudio", e.getMessage(), e); /////////////////////////////////////////////////////////////////////// AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.setTitle("Error"); ScrollView scrollingView = new ScrollView(dialogBuilder.getContext()); scrollingView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); EditText textView = new EditText(dialogBuilder.getContext()); textView.setLayoutParams(new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); textView.setText(Arrays.toString(e.getStackTrace())); scrollingView.addView(textView); dialogBuilder.setView(scrollingView); dialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialogBuilder.show(); //////////////////////////////////////////////////////////////////////// Toast.makeText(this, R.string.could_not_create_temporary_file, Toast.LENGTH_SHORT).show(); } }
From source file:jp.mau.twappremover.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { ScrollView contents = new ScrollView(this); LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); contents.addView(layout); AssetManager asm = getResources().getAssets(); String[] filelist = null; try {//www . ja v a 2s . c om filelist = asm.list("licenses"); } catch (Exception ex) { ex.printStackTrace(); } if (filelist != null) { for (String file : filelist) { Gen.debug(file); InputStream is = null; BufferedReader br = null; String txt = ""; try { is = getAssets().open("licenses/" + file); br = new BufferedReader(new InputStreamReader(is)); String str; while ((str = br.readLine()) != null) { txt += str + "\n"; } } catch (Exception ex) { ex.printStackTrace(); } finally { try { if (is != null) is.close(); } catch (Exception ex) { } try { if (br != null) br.close(); } catch (Exception ex) { } } TextView tv = new TextView(this); tv.setText(txt); layout.addView(tv); } } // final PopupView dialog = new PopupView(this); dialog.setDialog().setLabels(getString(R.string.activity_main_dlgtitle_oss), "") .setView(contents, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) .setCancelable(true) .setPositiveBtn(getString(R.string.activity_main_dlgbtn_oss), new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }).show(); return true; } return super.onOptionsItemSelected(item); }
From source file:in.animeshpathak.nextbus.NextBusMain.java
/** * Creates the Application Info dialog with clickable links. * /*from w ww . j av a2s . c o m*/ * @throws UnsupportedEncodingException * @throws IOException */ private void showVersionInfoDialog() throws UnsupportedEncodingException, IOException { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle(getString(R.string.app_name) + " " + getString(R.string.version_name)); AssetManager assetManager = getResources().getAssets(); String versionInfoFile = getString(R.string.versioninfo_asset); InputStreamReader reader = new InputStreamReader(assetManager.open(versionInfoFile), "UTF-8"); BufferedReader br = new BufferedReader(reader); StringBuffer sbuf = new StringBuffer(); String line; while ((line = br.readLine()) != null) { sbuf.append(line); sbuf.append("\r\n"); } final ScrollView scroll = new ScrollView(this); final TextView message = new TextView(this); final SpannableString sWlinks = new SpannableString(sbuf.toString()); Linkify.addLinks(sWlinks, Linkify.WEB_URLS); message.setText(sWlinks); message.setMovementMethod(LinkMovementMethod.getInstance()); message.setPadding(15, 15, 15, 15); scroll.addView(message); alertDialog.setView(scroll); alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // nothing to do, just dismiss dialog } }); alertDialog.show(); }
From source file:com.sastra.app.timetable.TimetableActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case 0:/*from www .j a v a2 s. com*/ startActivityForResult(intent, 0); break; case 1: action = "insert"; data.open(); ArrayList<HashMap<String, Object>> arrayS = data.selectSubjects2(); data.close(); arraySubjects = new String[arrayS.size()]; colo = new String[arrayS.size()]; Iterator<HashMap<String, Object>> it = arrayS.iterator(); int i = 0; while (it.hasNext()) { HashMap<String, Object> hm = it.next(); arraySubjects[i] = hm.get("SName").toString(); colo[i] = hm.get("SColor").toString(); Log.d("AB", "This is inside the onOptionsItemSelected Function :485"); Log.d("AB", arraySubjects[i]); Log.d("AB", colo[i]); i++; } newSpinnerAdapter ma = new newSpinnerAdapter(TimetableActivity.this, R.id.text1, arraySubjects); SName.setAdapter(ma); //mySpinnerAdapter msa = new mySpinnerAdapter(this,arrayS,R.layout.timetable_spinner_layout,from2, to2,colo ); //msa.setDropDownViewResource(R.layout.timetable_spinner_layout); // SName.setAdapter(msa); addDialog.setTitle("Add Class"); addDialog.show(); // data.open(); // results2 = data.selectSubjects2(); // data.close(); // colorVet2 = new String[results2.size()]; // for(int i=0;i<results2.size();i++) { // HashMap<String, Object> color = new HashMap<String, Object>(); // // color = results2.get(i); // colorVet2[i] = (String) color.get("SColor"); // } // // Sarrayadapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, arraySubjects); //Sarrayadapter = new ArrayAdapter<String>(this,R.layout.timetable_spinner_layout, arraySubjects); //Sarrayadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); break; case 2: alert.show(); break; case 3: Dialog d = new Dialog(this); d.setCanceledOnTouchOutside(true); d.setTitle("ABOUT"); TextView tv2 = new TextView(this); tv2.setText( "This application was developed by R.R.Arun Balaji,a student of SASTRA University.Special Thanks to J.Sivaguru from SASTRA.\n\nLICENSE INFORMATION : \nSASTRA TimeTable\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License for more details.This program makes use of the following libary ViewPageIndicator licensed under Apache License 2.0 and modifies the StudentTimeTable application made by Mazzarelli Alessio and Hopstank,distributed under GNU GPL v3."); ScrollView sv = new ScrollView(this); sv.addView(tv2); LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); d.addContentView(sv, lp); d.setTitle("About"); d.show(); break; case 4: Dialog d2 = new Dialog(this); d2.setTitle("HELP"); d2.setCanceledOnTouchOutside(true); TextView tv = new TextView(this); tv.setText( "This application can be used to store your timetable.\nFirst,click on Manage Subjects Icon(Wrench Icon) inorder to add all your subjects.Click on Add Subjects on top and enter the details of your subject.The fields that appear are optional and not manditory.\n\nOnce you have added all the subjects,go back to the main screen and click on Add Classes icon(Plus Icon) to add the different classes to your timetable.The fields that appear are again optional and all of them need not be filled.You can long press on any particular subject to edit or delete them.You can delete all the informations using Delete All(Garbage Icon) option."); ScrollView sav = new ScrollView(this); sav.addView(tv); LayoutParams lap = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); d2.addContentView(sav, lap); d2.show(); break; } return false; }
From source file:info.semanticsoftware.semassist.android.activity.SemanticAssistantsActivity.java
/** Presents additional information about a specific assistant. * @return a dynamically generated linear layout */// w ww. ja v a2s .c o m private LinearLayout getServiceDescLayout() { final LinearLayout output = new LinearLayout(this); final RelativeLayout topButtonsLayout = new RelativeLayout(this); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); final Button btnBack = new Button(this); btnBack.setText(R.string.btnAllServices); btnBack.setId(5); btnBack.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { output.setVisibility(View.GONE); getListView().setVisibility(View.VISIBLE); lblAvAssist.setVisibility(View.VISIBLE); } }); topButtonsLayout.addView(btnBack); final Button btnInvoke = new Button(this); btnInvoke.setText(R.string.btnInvokeLabel); btnInvoke.setId(6); btnInvoke.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { new InvocationTask().execute(); } }); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, btnInvoke.getId()); btnInvoke.setLayoutParams(layoutParams); topButtonsLayout.addView(btnInvoke); output.addView(topButtonsLayout); TableLayout serviceInfoTbl = new TableLayout(this); output.addView(serviceInfoTbl); serviceInfoTbl.setColumnShrinkable(1, true); /* FIRST ROW */ TableRow rowServiceName = new TableRow(this); TextView lblServiceName = new TextView(this); lblServiceName.setText(R.string.lblServiceName); lblServiceName.setTextAppearance(getApplicationContext(), R.style.titleText); TextView txtServiceName = new TextView(this); txtServiceName.setText(selectedService); txtServiceName.setTextAppearance(getApplicationContext(), R.style.normalText); txtServiceName.setPadding(10, 0, 0, 0); rowServiceName.addView(lblServiceName); rowServiceName.addView(txtServiceName); /* SECOND ROW */ TableRow rowServiceDesc = new TableRow(this); TextView lblServiceDesc = new TextView(this); lblServiceDesc.setText(R.string.lblServiceDesc); lblServiceDesc.setTextAppearance(getApplicationContext(), R.style.titleText); TextView txtServiceDesc = new TextView(this); txtServiceDesc.setTextAppearance(getApplicationContext(), R.style.normalText); txtServiceDesc.setPadding(10, 0, 0, 0); List<GateRuntimeParameter> params = null; ServiceInfoForClientArray list = getServices(); for (int i = 0; i < list.getItem().size(); i++) { if (list.getItem().get(i).getServiceName().equals(selectedService)) { txtServiceDesc.setText(list.getItem().get(i).getServiceDescription()); params = list.getItem().get(i).getParams(); break; } } TextView lblParams = new TextView(this); lblParams.setText(R.string.lblServiceParams); lblParams.setTextAppearance(getApplicationContext(), R.style.titleText); output.addView(lblParams); LayoutParams txtParamsAttrbs = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); LinearLayout paramsLayout = new LinearLayout(this); paramsLayout.setId(0); if (params.size() > 0) { ScrollView scroll = new ScrollView(this); scroll.setLayoutParams(txtParamsAttrbs); paramsLayout.setOrientation(LinearLayout.VERTICAL); scroll.addView(paramsLayout); for (int j = 0; j < params.size(); j++) { TextView lblParamName = new TextView(this); lblParamName.setText(params.get(j).getParamName()); EditText tview = new EditText(this); tview.setId(1); tview.setText(params.get(j).getDefaultValueString()); LayoutParams txtViewLayoutParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); tview.setLayoutParams(txtViewLayoutParams); paramsLayout.addView(lblParamName); paramsLayout.addView(tview); } output.addView(scroll); } else { TextView lblParamName = new TextView(this); lblParamName.setText(R.string.lblRTParams); output.addView(lblParamName); } rowServiceDesc.addView(lblServiceDesc); rowServiceDesc.addView(txtServiceDesc); serviceInfoTbl.addView(rowServiceName); serviceInfoTbl.addView(rowServiceDesc); output.setOrientation(LinearLayout.VERTICAL); output.setGravity(Gravity.TOP); return output; }