@Override public void performSync( Context context, Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { LeadDB lead = new LeadDB(context); OEHelper oe = lead.getOEInstance(); if (oe != null) { if (oe.syncWithServer()) { Intent intent = new Intent(SyncFinishReceiver.SYNC_FINISH); sendBroadcast(intent); } } }
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { OEHelper oehelper1 = new OEHelper(getActivity()); oehelper1.Qr_Equipment_Detail(); checkforeditornot = false; position1 = 0; position1 = position; OEHelper.selected_Assets_id = ""; if (OEHelper.id.size() > position1) { OEHelper.selected_Assets_id = OEHelper.id.get(position1); } QR_equip_detail qr_detail = new QR_equip_detail(); FragmentListener frag1 = (FragmentListener) getActivity(); android.support.v4.app.FragmentManager fm1 = getActivity().getSupportFragmentManager(); frag1.startDetailFragment(qr_detail); }
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true); check_back_or_not = false; View rootView = inflater.inflate(R.layout.qr_equipmentlist, container, false); getActivity().setTitle("Assets"); MainActivity.global = 2; mListView = (ListView) rootView.findViewById(R.id.listforqr_equip); oehelper = new OEHelper(getActivity()); List<String> k = oehelper.qr_equipmentname(); List<String> img = oehelper.qr_equipmentimage(); // items= new ArrayList<Object>(getItems()); // mListAdapter = new OEListAdapter(getActivity(),R.layout.qr_equip_item, items) mListView.setAdapter( new ArrayAdapter<String>(getActivity(), R.layout.qr_equip_item, oehelper.qr_equip_name) { public View getView(int position, View convertView, ViewGroup parent) { View mView = convertView; if (mView == null) mView = getActivity().getLayoutInflater().inflate(R.layout.qr_equip_item, parent, false); // IMAGE... /* OEDataRow row = (OEDataRow) items.get(position); ImageView imgPic = (ImageView) mView.findViewById(R.id.imgPic); Bitmap row1 =OEHelper.image_of_asset.get(QR_Equipment.position1); imgPic.setImageBitmap(row1); */ TextView txv = (TextView) mView.findViewById(R.id.qr_name); Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Georgia.ttf"); txv.setTypeface(font); txv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20); txv.setTextColor(Color.rgb(84, 84, 84)); if (OEHelper.qr_equip_name.size() != 0 && OEHelper.qr_equip_name.size() > position) { txv.setText("" + OEHelper.qr_equip_name.get(position)); } // txv.setTextAppearance(getActivity(), android.R.attr.textAppearance); Log.i("ASSET NAME IS....:" + OEHelper.qr_equip_name, "THAT IS OK...NAMe.."); return mView; } }); mListView.setOnItemClickListener(this); // mListView.setAdapter(mListAdapter); return rootView; }