List of usage examples for android.view LayoutInflater from
public static LayoutInflater from(Context context)
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name : createVideoLayout//from w w w . j a v a 2 s .com * * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ public void createVideoLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutVideo); int size = resincUrls.size(); Log.i("Size to check :", "" + size); int intial = 0; if (videoresGooruOid.size() > 4) { intial = videoresGooruOid.size() - 5; } else { videoRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.video_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + videoresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Video"; resourceGooruId = videoresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", videoresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:apps.junkuvo.alertapptowalksafely.MainActivity.java
private void startBtnClick(final View v) { if (mPasscodeOn) { LayoutInflater inflater = LayoutInflater.from(MainActivity.this); final View layout = inflater.inflate(R.layout.passcode, (ViewGroup) findViewById(R.id.layout_root_passcode)); final MaterialStyledDialog materialStyledDialog = new MaterialStyledDialog(MainActivity.this) .setTitle(getString(R.string.dialog_passcode_title)) .setDescription(getString(R.string.dialog_passcode_description)) .setIcon(R.drawable.ic_lock_blue_grey_100_48dp).setCustomView(layout).show(); final PasscodeView passcodeView = (PasscodeView) layout.findViewById(R.id.passcode); final PasscodeView passcodeViewConfirm = (PasscodeView) layout.findViewById(R.id.passcodeConfirm); final TextView txtPasscodeConfirm = (TextView) layout.findViewById(R.id.txtPasscodeConfirm); txtPasscodeConfirm.setText(getString(R.string.dialog_passcode_confirm)); ((TextView) layout.findViewById(R.id.txtPasscode)) .setText(getString(R.string.dialog_passcode_passcode)); passcodeView.setPasscodeEntryListener(new PasscodeView.PasscodeEntryListener() { @Override// w w w .jav a 2s .c o m public void onPasscodeEntered(String passcode) { if (mAlertService != null && mAlertService.IsRunningAlertService()) { if (passcode.equals(mPasscodeConfirm)) { FlurryAgent.logEvent("Passcode Unlocked"); setStartButtonFunction(v); materialStyledDialog.dismiss(); } else { passcodeView.clearText(); passcodeView.requestFocus(); } } else { passcodeViewConfirm.setVisibility(View.VISIBLE); txtPasscodeConfirm.setVisibility(View.VISIBLE); passcodeViewConfirm.requestFocus(); mPasscode = passcode; } } }); passcodeViewConfirm.setPasscodeEntryListener(new PasscodeView.PasscodeEntryListener() { @Override public void onPasscodeEntered(String passcode) { mPasscodeConfirm = passcodeViewConfirm.getText().toString(); if (mPasscode.equals(mPasscodeConfirm)) { FlurryAgent.logEvent("Passcode Lock"); setStartButtonFunction(v); materialStyledDialog.dismiss(); } else { passcodeView.clearText(); passcodeViewConfirm.clearText(); passcodeView.requestFocus(); passcodeViewConfirm.setVisibility(View.GONE); txtPasscodeConfirm.setVisibility(View.GONE); } } }); } else { setStartButtonFunction(v); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createinteractiveLayout * //w w w .jav a 2 s.com * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // interactive public void createinteractiveLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutInteractive); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (interactiveresGooruOid.size() > 4) { intial = interactiveresGooruOid.size() - 5; } else { interactiveRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.interactive_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + interactiveresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Interactive"; resourceGooruId = interactiveresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", interactiveresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createwebsiteLayout//from w ww .ja v a2 s . c om * * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // website public void createwebsiteLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutWebsite); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (websiteresGooruOid.size() > 4) { intial = websiteresGooruOid.size() - 5; } else { websiteRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.website_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + websiteresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Website"; resourceGooruId = websiteresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", websiteresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createtextbookLayout//from w w w . java2 s. c o m * * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // textbook public void createtextbookLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutTextbook); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (textbookresGooruOid.size() > 4) { intial = textbookresGooruOid.size() - 5; } else { textbookRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.textbook_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + textbookresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Textbook"; resourceGooruId = textbookresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", textbookresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:cm.aptoide.pt.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { AptoideThemePicker.setAptoideTheme(this); super.onCreate(savedInstanceState); serviceDownloadManagerIntent = new Intent(this, ServiceDownloadManager.class); startService(serviceDownloadManagerIntent); mContext = this; File sdcard_file = new File(SDCARD); if (!sdcard_file.exists() || !sdcard_file.canWrite()) { View simpleView = LayoutInflater.from(mContext).inflate(R.layout.dialog_simple_layout, null); Builder dialogBuilder = new AlertDialog.Builder(mContext).setView(simpleView); final AlertDialog noSDDialog = dialogBuilder.create(); noSDDialog.setTitle(getText(R.string.remote_in_noSD_title)); noSDDialog.setIcon(android.R.drawable.ic_dialog_alert); TextView message = (TextView) simpleView.findViewById(R.id.dialog_message); message.setText(getText(R.string.remote_in_noSD)); noSDDialog.setCancelable(false); noSDDialog.setButton(Dialog.BUTTON_NEUTRAL, getString(android.R.string.ok), new Dialog.OnClickListener() { @Override//from w w w. jav a 2s . c om public void onClick(DialogInterface arg0, int arg1) { finish(); } }); noSDDialog.show(); } else { StatFs stat = new StatFs(sdcard_file.getPath()); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); long availableBlocks = stat.getAvailableBlocks(); long total = (blockSize * totalBlocks) / 1024 / 1024; long avail = (blockSize * availableBlocks) / 1024 / 1024; Log.d("Aptoide", "* * * * * * * * * *"); Log.d("Aptoide", "Total: " + total + " Mb"); Log.d("Aptoide", "Available: " + avail + " Mb"); if (avail < 10) { Log.d("Aptoide", "No space left on SDCARD..."); Log.d("Aptoide", "* * * * * * * * * *"); View simpleView = LayoutInflater.from(this).inflate(R.layout.dialog_simple_layout, null); Builder dialogBuilder = new AlertDialog.Builder(this).setView(simpleView); final AlertDialog noSpaceDialog = dialogBuilder.create(); noSpaceDialog.setIcon(android.R.drawable.ic_dialog_alert); TextView message = (TextView) simpleView.findViewById(R.id.dialog_message); message.setText(getText(R.string.remote_in_noSDspace)); noSpaceDialog.setButton(Dialog.BUTTON_NEUTRAL, getText(android.R.string.ok), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { finish(); } }); noSpaceDialog.show(); } else { SharedPreferences sPref = PreferenceManager.getDefaultSharedPreferences(mContext); editor = PreferenceManager.getDefaultSharedPreferences(mContext).edit(); if (!sPref.contains("matureChkBox")) { editor.putBoolean("matureChkBox", ApplicationAptoide.MATURECONTENTSWITCHVALUE); SharedPreferences sPrefOld = getSharedPreferences("aptoide_prefs", MODE_PRIVATE); if (sPrefOld.getString("app_rating", "none").equals("Mature")) { editor.putBoolean("matureChkBox", false); } } if (!sPref.contains("version")) { ApplicationAptoide.setRestartLauncher(true); try { editor.putInt("version", getPackageManager().getPackageInfo(getPackageName(), 0).versionCode); } catch (NameNotFoundException e) { e.printStackTrace(); } } if (sPref.getString("myId", null) == null) { String rand_id = UUID.randomUUID().toString(); editor.putString("myId", rand_id); } if (sPref.getInt("scW", 0) == 0 || sPref.getInt("scH", 0) == 0) { DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); editor.putInt("scW", dm.widthPixels); editor.putInt("scH", dm.heightPixels); } editor.commit(); File file = new File(LOCAL_PATH + "/apks"); if (!file.exists()) { file.mkdirs(); } new Thread(new Runnable() { @Override public void run() { // Note the L that tells the compiler to interpret the // number as a Long final long MAXFILEAGE = 2678400000L; // 1 month in // milliseconds // Get file handle to the directory. In this case the // application files dir File dir = new File(LOCAL_PATH + "/apks"); // Optain list of files in the directory. // listFiles() returns a list of File objects to each // file found. File[] files = dir.listFiles(); // Loop through all files for (File f : files) { // Get the last modified date. Miliseconds since // 1970 long lastmodified = f.lastModified(); // Do stuff here to deal with the file.. // For instance delete files older than 1 month if (lastmodified + MAXFILEAGE < System.currentTimeMillis()) { f.delete(); } } } }).start(); db = Database.getInstance(); Intent i = new Intent(mContext, MainService.class); startService(i); bindService(i, conn, Context.BIND_AUTO_CREATE); order = Order.values()[PreferenceManager.getDefaultSharedPreferences(mContext).getInt("order_list", 0)]; registerReceiver(updatesReceiver, new IntentFilter("update")); registerReceiver(statusReceiver, new IntentFilter("status")); registerReceiver(loginReceiver, new IntentFilter("login")); registerReceiver(storePasswordReceiver, new IntentFilter("401")); registerReceiver(redrawInstalledReceiver, new IntentFilter("pt.caixamagica.aptoide.REDRAW")); if (!ApplicationAptoide.MULTIPLESTORES) { registerReceiver(parseFailedReceiver, new IntentFilter("PARSE_FAILED")); } registerReceiver(newRepoReceiver, new IntentFilter("pt.caixamagica.aptoide.NEWREPO")); registered = true; categoriesStrings = new HashMap<String, Integer>(); // categoriesStrings.put("Applications", R.string.applications); boolean serversFileIsEmpty = true; if (sPref.getBoolean("firstrun", true)) { // Intent shortcutIntent = new Intent(Intent.ACTION_MAIN); // shortcutIntent.setClassName("cm.aptoide.pt", // "cm.aptoide.pt.Start"); // final Intent intent = new Intent(); // intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, // shortcutIntent); // // intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, // getString(R.string.app_name)); // Parcelable iconResource = // Intent.ShortcutIconResource.fromContext(this, // R.drawable.ic_launcher); // // intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, // iconResource); // intent.putExtra("duplicate", false); // intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); // sendBroadcast(intent); if (new File(LOCAL_PATH + "/servers.xml").exists() && ApplicationAptoide.DEFAULTSTORENAME == null) { try { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); MyappHandler handler = new MyappHandler(); sp.parse(new File(LOCAL_PATH + "/servers.xml"), handler); ArrayList<String> server = handler.getServers(); if (server.isEmpty()) { serversFileIsEmpty = true; } else { getIntent().putExtra("newrepo", server); } } catch (Exception e) { e.printStackTrace(); } } editor.putBoolean("firstrun", false); editor.putBoolean("orderByCategory", true); editor.commit(); } if (getIntent().hasExtra("newrepo")) { ArrayList<String> repos = (ArrayList<String>) getIntent().getSerializableExtra("newrepo"); for (final String uri2 : repos) { View simpleView = LayoutInflater.from(mContext).inflate(R.layout.dialog_simple_layout, null); Builder dialogBuilder = new AlertDialog.Builder(mContext).setView(simpleView); final AlertDialog addNewRepoDialog = dialogBuilder.create(); addNewRepoDialog.setTitle(getString(R.string.add_store)); addNewRepoDialog.setIcon(android.R.drawable.ic_menu_add); TextView message = (TextView) simpleView.findViewById(R.id.dialog_message); message.setText((getString(R.string.newrepo_alrt) + uri2 + " ?")); addNewRepoDialog.setCancelable(false); addNewRepoDialog.setButton(Dialog.BUTTON_POSITIVE, getString(android.R.string.yes), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { dialogAddStore(uri2, null, null); } }); addNewRepoDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(android.R.string.no), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { dialog.cancel(); } }); addNewRepoDialog.show(); } } else if (db.getStores(false).getCount() == 0 && ApplicationAptoide.DEFAULTSTORENAME == null && serversFileIsEmpty) { View simpleView = LayoutInflater.from(mContext).inflate(R.layout.dialog_simple_layout, null); Builder dialogBuilder = new AlertDialog.Builder(mContext).setView(simpleView); final AlertDialog addAppsRepoDialog = dialogBuilder.create(); addAppsRepoDialog.setTitle(getString(R.string.add_store)); addAppsRepoDialog.setIcon(android.R.drawable.ic_menu_add); TextView message = (TextView) simpleView.findViewById(R.id.dialog_message); message.setText(getString(R.string.myrepo_alrt) + "\n" + "http://apps.store.aptoide.com/"); addAppsRepoDialog.setCancelable(false); addAppsRepoDialog.setButton(Dialog.BUTTON_POSITIVE, getString(android.R.string.yes), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { dialogAddStore("http://apps.store.aptoide.com", null, null); } }); addAppsRepoDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(android.R.string.no), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { dialog.cancel(); } }); addAppsRepoDialog.show(); } new Thread(new Runnable() { @Override public void run() { try { getUpdateParameters(); if (getPackageManager().getPackageInfo(getPackageName(), 0).versionCode < Integer .parseInt(updateParams.get("versionCode"))) { runOnUiThread(new Runnable() { @Override public void run() { requestUpdateSelf(); } }); } } catch (Exception e) { e.printStackTrace(); } } }).start(); } featuredView = LayoutInflater.from(mContext).inflate(R.layout.page_featured, null); availableView = LayoutInflater.from(mContext).inflate(R.layout.page_available, null); updateView = LayoutInflater.from(mContext).inflate(R.layout.page_updates, null); banner = (LinearLayout) availableView.findViewById(R.id.banner); breadcrumbs = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.breadcrumb_container, null); installedView = new ListView(mContext); updatesListView = (ListView) updateView.findViewById(R.id.updates_list); availableListView = (ListView) availableView.findViewById(R.id.available_list); joinStores = (CheckBox) availableView.findViewById(R.id.join_stores); availableAdapter = new AvailableListAdapter(mContext, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); installedAdapter = new InstalledAdapter(mContext, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER, db); updatesAdapter = new UpdatesAdapter(mContext, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); pb = (TextView) availableView.findViewById(R.id.loading_pb); addStoreButton = availableView.findViewById(R.id.add_store); bannerStoreAvatar = (ImageView) banner.findViewById(R.id.banner_store_avatar); bannerStoreName = (TextView) banner.findViewById(R.id.banner_store_name); bannerStoreDescription = (AutoScaleTextView) banner.findViewById(R.id.banner_store_description); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createexamLayout/*from w w w . j a va2s .c o m*/ * * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // exam public void createexamLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutExam); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (examresGooruOid.size() > 4) { intial = examresGooruOid.size() - 5; } else { examRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.exam_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + examresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Exam"; resourceGooruId = examresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", examresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:org.ednovo.goorusearchwidget.SearchResults_resource.java
/** * @function name :createhandoutLayout//from w ww . java2s. co m * * This function is used to add 5 more resources in horizontallist * view. * * @param 5 list(resUrls, resTitles, resCategory, resDescription, * resGooruOid); * * @return void * * */ // handout public void createhandoutLayout(List<String> resincUrls, List<String> resincTitle, List<String> resincCategory, List<String> resincDescription, List<String> resincGooruid) { LinearLayout scrollChild = (LinearLayout) findViewById(R.id.layoutHandout); int size = resincUrls.size(); Log.i("Size to check :", "" + size); List<String> resTempincGooruid = new ArrayList<String>(); resTempincGooruid = resincGooruid; int intial = 0; if (handoutresGooruOid.size() > 4) { intial = handoutresGooruOid.size() - 5; } else { handoutRight.setVisibility(View.GONE); } Log.i("intial", "" + intial); for (int i = 0; i < size; i++) { resourcelayout = LayoutInflater.from(this).inflate(R.layout.resource_view, null); TextView title = (TextView) resourcelayout.findViewById(R.id.textViewTitle); title.setText(nullCheck(resincTitle.get(i), "None Added")); TextView category = (TextView) resourcelayout.findViewById(R.id.textViewSource); category.setText(nullCheck(resincCategory.get(i), "None Added")); TextView descr = (TextView) resourcelayout.findViewById(R.id.textViewDescription); descr.setText(nullCheck(resincDescription.get(i), "None Added")); FetchableImageView image = (FetchableImageView) resourcelayout.findViewById(R.id.imgViewRes); image.setImage(resUrls.get(i), R.drawable.resourcedefault); resourcelayout.setTag(intial); imageViewCategory = (ImageView) resourcelayout.findViewById(R.id.imageViewCategory); imageViewCategory.setImageDrawable(getResources().getDrawable(R.drawable.handouts_ico)); intial++; scrollChild.addView(resourcelayout, new LinearLayout.LayoutParams(250, 180)); resourcelayout.setPadding(10, 0, 10, 0); resourcelayout.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int s = (Integer) v.getTag(); Log.i("Size completeGooruOid :", "" + handoutresGooruOid.size()); // Flurry Log flag_isPlayerTransition = true; resourceType = "Handout"; resourceGooruId = handoutresGooruOid.get(s); Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putInt("key", s); extras.putString("token", token); extras.putString("searchkey", searchKeyword); extras.putStringArrayList("goor", handoutresGooruOid); intentResPlayer.putExtras(extras); startActivity(intentResPlayer); } }); } }
From source file:cm.aptoide.pt.ApkInfo.java
private void setComments(ArrayList<Comment> result) { viewComments.removeAllViews();/*from w w w . j a va2 s. c o m*/ for (Comment comment : result) { View v = LayoutInflater.from(context).inflate(R.layout.row_comment_item, null); ((TextView) v.findViewById(R.id.author)).setText(comment.username); ((TextView) v.findViewById(R.id.content)).setText(comment.text); ((TextView) v.findViewById(R.id.date)).setText(comment.timeStamp.toString()); viewComments.addView(v); } }
From source file:com.ezac.gliderlogs.FlightOverviewActivity.java
public void DoSettings() { // get settings.xml view LayoutInflater li = LayoutInflater.from(context); settingsView = li.inflate(R.layout.settings, null); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); // set settings.xml to alertdialog builder alertDialogBuilder.setView(settingsView); // get user input for service code final EditText userInput = (EditText) settingsView.findViewById(R.id.editTextDialogUserInput); // set dialog message alertDialogBuilder.setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override/*from w ww .j a va 2s . co m*/ public void onClick(DialogInterface dialog, int id) { SharedPreferences prefs = context.getSharedPreferences("Share", Context.MODE_PRIVATE); prefs.edit().clear(); SharedPreferences.Editor es = prefs.edit(); String[] mTestArray; if (userInput.getText().toString().equals("NoAccess")) { // prefs URL EditText et1 = (EditText) settingsView.findViewById(R.id.setting_url); appURL = et1.getText().toString(); es.putString("com.ezac.gliderlogs.url", appURL).apply(); } // prefs PRE EditText et2 = (EditText) settingsView.findViewById(R.id.setting_pre); appPRE = et2.getText().toString().replace(" ", ""); es.putString("com.ezac.gliderlogs.pre", appPRE).apply(); if (userInput.getText().toString().equals("NoAccess")) { // prefs SCN EditText et3 = (EditText) settingsView.findViewById(R.id.setting_scn); appSCN = et3.getText().toString(); es.putString("com.ezac.gliderlogs.scn", appSCN).apply(); // prefs KEY EditText et4 = (EditText) settingsView.findViewById(R.id.setting_key); appKEY = et4.getText().toString(); es.putString("com.ezac.gliderlogs.key", appKEY).apply(); // prefs KEY EditText et5 = (EditText) settingsView.findViewById(R.id.setting_secret); appSCT = et5.getText().toString(); es.putString("com.ezac.gliderlogs.sct", appSCT).apply(); // prefs Meteo mTestArray = getResources().getStringArray(R.array.meteo_id_arrays); Spinner et6 = (Spinner) settingsView.findViewById(R.id.setting_station); String sel6 = (String) et6.getSelectedItem(); //String sel6_id = ""; for (int i = 0; i < et6.getCount(); i++) { String s1 = (String) et6.getItemAtPosition(i); if (s1.equalsIgnoreCase(sel6)) { appMST = mTestArray[i]; } } es.putString("com.ezac.gliderlogs.mst", appMST).apply(); // prefs Metar EditText et7 = (EditText) settingsView.findViewById(R.id.setting_metar); appMTR = et7.getText().toString(); es.putString("com.ezac.gliderlogs.mst", appMST).apply(); } // prefs Flags CheckBox et9a = (CheckBox) settingsView.findViewById(R.id.setting_menu01); CheckBox et9b = (CheckBox) settingsView.findViewById(R.id.setting_menu02); CheckBox et9c = (CheckBox) settingsView.findViewById(R.id.setting_menu11); CheckBox et9d = (CheckBox) settingsView.findViewById(R.id.setting_menu12); CheckBox et9e = (CheckBox) settingsView.findViewById(R.id.setting_menu13); CheckBox et9f = (CheckBox) settingsView.findViewById(R.id.setting_menu14); CheckBox et9g = (CheckBox) settingsView.findViewById(R.id.setting_menu21); CheckBox et9h = (CheckBox) settingsView.findViewById(R.id.setting_menu22); String et9aa, et9ab; String v[]; if (userInput.getText().toString().equals("To3Myd4T")) { et9aa = et9a.isChecked() ? "true" : "false"; et9ab = et9b.isChecked() ? "true" : "false"; } else { v = appFLG.split(";"); et9aa = v[0]; et9ab = v[1]; } String et9ac = et9c.isChecked() ? "true" : "false"; String et9ad = et9d.isChecked() ? "true" : "false"; String et9ae = et9e.isChecked() ? "true" : "false"; String et9af = et9f.isChecked() ? "true" : "false"; String et9ag = et9g.isChecked() ? "true" : "false"; String et9ah = et9h.isChecked() ? "true" : "false"; appFLG = et9aa + ";" + et9ab + ";" + et9ac + ";" + et9ad + ";" + et9ae + ";" + et9af + ";" + et9ag + ";" + et9ah + ";false;false"; v = appFLG.split(";"); menu.findItem(R.id.action_ezac).setVisible(Boolean.parseBoolean(v[2])); menu.findItem(R.id.action_meteo_group).setVisible(Boolean.parseBoolean(v[3])); menu.findItem(R.id.action_ntm_nld).setVisible(Boolean.parseBoolean(v[4])); menu.findItem(R.id.action_ntm_blx).setVisible(Boolean.parseBoolean(v[4])); menu.findItem(R.id.action_ogn_flarm).setVisible(Boolean.parseBoolean(v[5])); menu.findItem(R.id.action_adsb).setVisible(Boolean.parseBoolean(v[6])); menu.findItem(R.id.action_adsb_lcl).setVisible(Boolean.parseBoolean(v[7])); es.putString("com.ezac.gliderlogs.flg", appFLG).apply(); // adjust value in menu button to value in use MenuItem MenuItem_dur = menu.findItem(R.id.action_45min); MenuItem_dur.setTitle(" " + appPRE + " Min "); if (userInput.getText().toString().equals("To3Myd4T")) { // prefs airfield heading mTestArray = getResources().getStringArray(R.array.heading_arrays); Spinner et10 = (Spinner) settingsView.findViewById(R.id.setting_heading); String sel10 = (String) et10.getSelectedItem(); //String sel10_id = ""; for (int i = 0; i < et10.getCount(); i++) { String s2 = (String) et10.getItemAtPosition(i); if (s2.equalsIgnoreCase(sel10)) { appLND = mTestArray[i]; es.putString("com.ezac.gliderlogs.lnd", appLND).apply(); } } } } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); // create alert dialog & and load it's data AlertDialog alertDialog = alertDialogBuilder.create(); EditText et1 = (EditText) settingsView.findViewById(R.id.setting_url); EditText et2 = (EditText) settingsView.findViewById(R.id.setting_pre); EditText et3 = (EditText) settingsView.findViewById(R.id.setting_scn); EditText et4 = (EditText) settingsView.findViewById(R.id.setting_key); EditText et5 = (EditText) settingsView.findViewById(R.id.setting_secret); Spinner et6 = (Spinner) settingsView.findViewById(R.id.setting_station); EditText et7 = (EditText) settingsView.findViewById(R.id.setting_metar); //EditText et8 = (EditText) settingsView.findViewById(R.id.setting_ntp); CheckBox et9a = (CheckBox) settingsView.findViewById(R.id.setting_menu01); CheckBox et9b = (CheckBox) settingsView.findViewById(R.id.setting_menu02); CheckBox et9c = (CheckBox) settingsView.findViewById(R.id.setting_menu11); CheckBox et9d = (CheckBox) settingsView.findViewById(R.id.setting_menu12); CheckBox et9e = (CheckBox) settingsView.findViewById(R.id.setting_menu13); CheckBox et9f = (CheckBox) settingsView.findViewById(R.id.setting_menu14); CheckBox et9g = (CheckBox) settingsView.findViewById(R.id.setting_menu21); CheckBox et9h = (CheckBox) settingsView.findViewById(R.id.setting_menu22); Spinner et10 = (Spinner) settingsView.findViewById(R.id.setting_heading); et1.setText(appURL); et2.setText(appPRE); et3.setText(appSCN); et4.setText(appKEY); et5.setText(appSCT); // get settings value for meteo station and set spinner String[] mTestArray; mTestArray = getResources().getStringArray(R.array.meteo_id_arrays); for (int i = 0; i < mTestArray.length; i++) { String s = mTestArray[i]; if (s.equals(appMST)) { et6.setSelection(i); } } et7.setText(appMTR); // get settings value for menu tabs and set checkboxes String v[] = appFLG.split(";"); et9a.setChecked(Boolean.parseBoolean(v[0])); et9b.setChecked(Boolean.parseBoolean(v[1])); et9c.setChecked(Boolean.parseBoolean(v[2])); et9d.setChecked(Boolean.parseBoolean(v[3])); et9e.setChecked(Boolean.parseBoolean(v[4])); et9f.setChecked(Boolean.parseBoolean(v[5])); et9g.setChecked(Boolean.parseBoolean(v[6])); et9h.setChecked(Boolean.parseBoolean(v[7])); // re-use mTestArray mTestArray = getResources().getStringArray(R.array.heading_arrays); for (int i = 0; i < mTestArray.length; i++) { String s = mTestArray[i]; if (s.equals(appLND)) { et10.setSelection(i); } } // show it alertDialog.show(); }