public void setToolbar(int res) { toolbar.removeAllViews(); View logo = getLayoutInflater().inflate(res, null); logo.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); toolbar.addView(logo); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); assert actionBar != null; actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); if (res == R.layout.toolbar_main) { } else if (res == R.layout.toolbar_them_giao_dich) { ImageView view = (ImageView) findViewById(R.id.img_back); view.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); } }
@Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { // When the given tab is selected, switch to the corresponding page in // the ViewPager. ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); } assert actionBar != null; switch (tab.getPosition()) { case 0: actionBar.setSubtitle(getString(R.string.title_section_name1)); break; case 1: actionBar.setSubtitle(getString(R.string.title_section_name2)); break; case 2: actionBar.setSubtitle(getString(R.string.title_section_name3)); break; case 3: actionBar.setSubtitle(getString(R.string.title_section_name4)); break; case 4: actionBar.setSubtitle(getString(R.string.title_section_name5)); break; } mViewPager.setCurrentItem(tab.getPosition()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_feed); ActionBar mActionBar = getSupportActionBar(); mActionBar.setDisplayOptions(DISPLAY_SHOW_TITLE | DISPLAY_SHOW_CUSTOM | DISPLAY_SHOW_HOME); // mActionBar.setDisplayOptions(DISPLAY_HOME_AS_UP | DISPLAY_SHOW_CUSTOM | // DISPLAY_SHOW_HOME | DISPLAY_SHOW_TITLE); this.instApi = new InstagramApi(); this.swipeContainer = (SwipeRefreshLayout) findViewById(R.id.swipeContainer); // Setup refresh listener which triggers new data loading swipeContainer.setOnRefreshListener( new OnRefreshListener() { @Override public void onRefresh() { loadFeedItems(); } }); // Configure the refreshing colors swipeContainer.setColorSchemeResources( android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); loadFeedItems(); this.adapter = new FeedViewAdapter(this, items); ListView lvFeed = (ListView) findViewById(R.id.lvFeed); lvFeed.setAdapter(this.adapter); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.proanswerwrite, container, false); dbVersion = ((MainActivity) getActivity()).getDBVersion(); mTwoPane = ((MainActivity) getActivity()).getTwoPane(); num = getArguments().getString("num"); ansCount = getArguments().getString("ansCount"); dbHelper = new DBHelper(getActivity(), dbName, null, dbVersion); db = dbHelper.getWritableDatabase(); sql = "SELECT * FROM inner_db;"; Cursor cursor = db.rawQuery(sql, null); cursor.moveToFirst(); tempnick = cursor.getString(3); abar = ((MainActivity) getActivity()).getSupportActionBar(); abar.setTitle(tempnick + "님에게 답변중"); abar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE); abar.setDisplayHomeAsUpEnabled(true); ldialog = new LoadingDialog(this.getActivity()); // 변경 ldialog .getWindow() .setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); ldialog.show(); answerViewThread = (AnswerViewThread) new AnswerViewThread(); answerViewThread.execute(); conet = (EditText) rootView.findViewById(R.id.replycon); conet.setPadding(20, 20, 20, 20); return rootView; }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_movie); ButterKnife.bind(this); if (toolbar != null) { ViewCompat.setElevation(toolbar, 8); toolbar.setNavigationOnClickListener(view -> finish()); ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); ab.setDisplayHomeAsUpEnabled(true); ab.setDisplayShowHomeEnabled(true); } } Movie movie = getIntent().getParcelableExtra(EXTRA_MOVIE); ViewCompat.setTransitionName(movieDetailsContainer, TRANSITION_SHARED_ELEMENT); if (savedInstanceState == null) { MovieFragment fragment = MovieFragment.newInstance(movie); getSupportFragmentManager() .beginTransaction() .replace(R.id.movie_details_container, fragment, MOVIE_FRAGMENT_TAG) .commit(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.panza_galeria); // Facebook StatusCallback callback = new StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) {} }; uiHelper = new UiLifecycleHelper(this, callback); uiHelper.onCreate(savedInstanceState); g_imagenesBitmap = new ArrayList<Bitmap>(); PanzaActivity_sqlCon db = new PanzaActivity_sqlCon(getApplicationContext()); g_imagenes = db.getImagenes(); g_llContenedor = (LinearLayout) findViewById(R.id.llContenedor); if (g_imagenes.size() > 0) { new LoadImagesFromSDCard().execute(""); } ActionBar barra = getSupportActionBar(); barra.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME); barra.setTitle(""); barra.setIcon(R.drawable.logo02); barra.setBackgroundDrawable(getResources().getDrawable(R.drawable.gradiente)); barra.setDisplayHomeAsUpEnabled(true); }
public void restoreActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP); actionBar.setTitle(R.string.app_name); }
public void init() { // mActionBar.setDisplayHomeAsUpEnabled(true); // mActionBar.setHomeButtonEnabled(true); mTitle = mDrawerTitle = getTitle(); int flag = ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_HOME_AS_UP; mActionBar.setDisplayOptions(flag, flag); mActionBar.removeAllTabs(); mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); }
private void setTitleBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(R.layout.actionbar_title); actionBar.setElevation(0); int actionbarcolor = getResources().getColor(R.color.background_title); actionBar.setBackgroundDrawable(new ColorDrawable(actionbarcolor)); actionBar.setDisplayHomeAsUpEnabled(true); TextView title = (TextView) actionBar.getCustomView().findViewById(R.id.actionbar_title_textview); title.setText("Confirm"); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ViewPager viewPager = new ViewPager(this); viewPager.setId(R.id.pager); setContentView(viewPager); ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayOptions(1, ActionBar.DISPLAY_SHOW_TITLE); actionBar.setDisplayHomeAsUpEnabled(true); TabsAdapter tabsAdapter = new TabsAdapter(this, viewPager, MbwManager.getInstance(this)); buyBitcoinTab = actionBar.newTab(); tabsAdapter.addTab( buyBitcoinTab.setText(getString(R.string.gd_buy_tab)), GlideraBuyFragment.class, null); Tab sellBitcoinTab = actionBar.newTab(); tabsAdapter.addTab( sellBitcoinTab.setText(getString(R.string.gd_sell_tab)), GlideraSellFragment.class, null); Tab transactionHistoryTab = actionBar.newTab(); tabsAdapter.addTab( transactionHistoryTab.setText(getString(R.string.gd_transaction_history_tab)), GlideraTransactionHistoryFragment.class, null); Bundle bundle = getIntent().getExtras(); if (bundle != null) { String tab = getIntent().getExtras().getString("tab"); if (tab.equals("buy")) { actionBar.selectTab(buyBitcoinTab); } else if (tab.equals("sell")) { actionBar.selectTab(sellBitcoinTab); } else if (tab.equals("history")) { actionBar.selectTab(transactionHistoryTab); } else { actionBar.selectTab(buyBitcoinTab); } } else { actionBar.selectTab(buyBitcoinTab); } }
/** * 为Fragment设置ActionBar * * @param VIEWVISIBILITY visible. */ private void initActionbarByFragment(int VIEWVISIBILITY) { View actionBarView = View.inflate(this, R.layout.custom_actionbar, null); // 初始化ActionBar的样式 ActionBar actionBar = getSupportActionBar(); actionBar.setCustomView(actionBarView); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setDisplayShowCustomEnabled(true); // END. actionBarTools = (Button) actionBarView.findViewById(R.id.btn_actionbar_showtools); actionBarTools.setVisibility(VIEWVISIBILITY); if (VIEWVISIBILITY == View.VISIBLE) { actionBarTools = (Button) actionBarView.findViewById(R.id.btn_actionbar_showtools); actionBarTools.setOnClickListener(this); } if (seeFragment == null) { seeFragment = new SeeFragment(); } actionBarView.setOnClickListener(seeFragment.new SeeLvReturnTop()); }
protected void loadFragement(Fragment newFragment) { if (actualFragment == null || !actualFragment.getClass().equals(newFragment.getClass())) { ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); if (newFragment instanceof MainFragment) actionBar.setIcon(R.mipmap.ic_launcher); else if (newFragment instanceof ExperimentalFragment) actionBar.setIcon(R.mipmap.fragement_experimental); else if (newFragment instanceof TechnicalFragment) actionBar.setIcon(R.mipmap.fragement_technical); actualFragment = newFragment; // Create fragment and give it an argument specifying the article it should show FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); // Replace whatever is in the fragment_container view with this fragment, // and add the transaction to the back stack so the user can navigate back transaction.replace(R.id.main, newFragment); // transaction.addToBackStack(null); // Commit the transaction transaction.commit(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); ButterKnife.inject(this); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setHomeAsUpIndicator(R.drawable.ic_up); mVersionTv.setText(getString(R.string.version, DeviceUtil.getVersionName(this))); mDescTv.setMovementMethod(LinkMovementMethod.getInstance()); mDescTv.setText(Html.fromHtml(getString(R.string.about_app))); mDetailTv.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { ActivityNavigator.openWebView(AboutActivity.this, null, RequestUrl.ABOUT_APP_URL); } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(R.layout.custom_action_bar); fragmentManager = getSupportFragmentManager(); fragmentManager.addOnBackStackChangedListener(this); if (savedInstanceState == null) { Log.d("", "SavedInstance = null"); // setFragment(FragmentList.TAG); fragmentAlbumList = FragmentList.create(this); fragmentManager = getSupportFragmentManager(); fragmentManager .beginTransaction() .add(R.id.mainframe, fragmentAlbumList, FragmentList.TAG) .commit(); currentFrag = fragmentAlbumList; } else { Log.d("", "SavedInstance != null"); Fragment temp = fragmentManager.findFragmentByTag(FragmentList.TAG); if (temp != null) ((FragmentList) temp).setListener(this); temp = fragmentManager.findFragmentByTag(FragmentDetail.TAG); if (temp != null) ((FragmentDetail) temp).setListener(this); currentFrag = fragmentManager.getFragments().get(0); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.action_bar, null); ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView( view, new ActionBar.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); new ActionBar.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); setContentView(R.layout.main6); context = this.getApplicationContext(); MyDataBase = new MyDatabase(context); SQLiteDatabase mydb = MyDataBase.getReadableDatabase(); Cursor cursor2 = mydb.rawQuery("SELECT * FROM shop;", null); if (cursor2.moveToFirst()) { do { String name1 = cursor2.getString(cursor2.getColumnIndex("name")); name.add(name1); String price1 = cursor2.getString(cursor2.getColumnIndex("price")); price.add(price1); } while (cursor2.moveToNext()); } String[] name2 = new String[name.size()]; name.toArray(name2); String[] price2 = new String[price.size()]; price.toArray(price2); MyAdapter adapter = new MyAdapter(this, name2, price2, imgid); ListView lv = (ListView) findViewById(R.id.list6); lv.setAdapter(adapter); final int count = lv.getAdapter().getCount(); Button finalbuy = (Button) findViewById(R.id.finalbuy); finalbuy.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { user = ((MyApplication) getApplicationContext()).getuser(); for (int i1 = 0; i1 < count; i1++) { int i2 = i1 + 1; SQLiteDatabase mydb = MyDataBase.getReadableDatabase(); Cursor cursor2 = mydb.rawQuery("SELECT * FROM shop WHERE id=" + i2, null); if (cursor2.moveToFirst()) { do { code = cursor2.getString(cursor2.getColumnIndex("code")); } while (cursor2.moveToNext()); } new AttemptLogin().execute(); } } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_compose_tweet); // get user data from shared prefferences sharedpreferences = this.getSharedPreferences(CURRENT_USER_PREFERECES, 0); final String uName = sharedpreferences.getString(userName, "missing"); final String uScreenName = sharedpreferences.getString(userScreenName, "missing"); final String uPicUrl = sharedpreferences.getString(userPicUrl, "missing"); // set up views tv_userName = (TextView) findViewById(R.id.tv_user_name_compose); tv_userScreenName = (TextView) findViewById(R.id.tv_user_screen_name_compose); iv_userProfilePic = (ImageView) findViewById(R.id.iv_profile_pic_compose); et_tweetText = (EditText) findViewById(R.id.tv_tweet_text); // setting user name and user screen name tv_userName.setText(uName); tv_userScreenName.setText(uScreenName); // setting user pic iv_userProfilePic.setImageResource(0); Picasso.with(this).load(uPicUrl).into(iv_userProfilePic); // action bar settings ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(R.layout.custom_compose_action_bar); // find char count Text view final View customActionBarView = actionBar.getCustomView(); final TextView tv_chCount = (TextView) customActionBarView.findViewById(R.id.tvCharCount_t); tv_chCount.setText("0"); // find button tweet final Button bt_tweet = (Button) customActionBarView.findViewById(R.id.btnTweet_t); // set back button listener customActionBarView .findViewById(R.id.ivCancel_t) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); // set tweet button listener bt_tweet.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (!isNetworkAvailable()) { buildDialog(ComposeTweetActivity.this).show(); } else { String tweetBody = et_tweetText.getText().toString(); client = TwitterApplication.getRestClient(); client.postTweet( new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { Log.d(COMPOSE_TWEET_ACTIVITY_TAG, response.toString()); Tweet tweet = new Tweet(); tweet = Tweet.fromJsonObject(response, "home"); Intent i = new Intent(); i.putExtra("newTweet", tweet); setResult(RESULT_OK, i); finish(); } @Override public void onFailure( int statusCode, Header[] headers, String responseString, Throwable throwable) { // add some messaging } }, tweetBody); } } }); et_tweetText.addTextChangedListener( new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (s.length() > 140) { tv_chCount.setTextColor(Color.RED); bt_tweet.setBackgroundColor(Color.GRAY); bt_tweet.setEnabled(false); } else { tv_chCount.setTextColor(getResources().getColor(R.color.dark_gray)); bt_tweet.setEnabled(true); bt_tweet.setBackgroundColor(getResources().getColor(R.color.skyblue)); } tv_chCount.setText(String.valueOf(s.length())); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void afterTextChanged(Editable s) {} }); }
@Override protected void onCreate(Bundle savedInstanceState) { // always create an instance // dataLogger = DataLogger.getInstance(); dataLogger = new DataLogger(); debug("MainActivity: onCreate"); instance = this; getWindow().requestFeature(Window.FEATURE_ACTION_BAR); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // navigation bar appSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager()); actionBar = getSupportActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); // actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); viewPager = (ViewPager) findViewById(R.id.main); viewPager.setAdapter(appSectionsPagerAdapter); viewPager.setOnPageChangeListener( new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { // actionBar.setSelectedNavigationItem(position); updateActionBar(); } }); updateActionBar(); /* for (int i = 0; i < appSectionsPagerAdapter.getCount(); i++) { actionBar.addTab( actionBar.newTab() .setText(appSectionsPagerAdapter.getPageTitle(i)) .setTabListener(MainActivity.this)); } */ // load the initial "main" fragment // loadFragement(new MainFragment()); setTitle(TAG + " - not connected"); setBluetoothState(BLUETOOTH_DISCONNECTED); // tabs // final ActionBar actionBar = getSupportActionBar(); // Specify that tabs should be displayed in the action bar. // open the database CanzeDataSource.getInstance(getBaseContext()).open(); // cleanup CanzeDataSource.getInstance().cleanUp(); // setup cleaning (once every hour) Runnable cleanUpRunnable = new Runnable() { @Override public void run() { CanzeDataSource.getInstance().cleanUp(); } }; Handler handler = new Handler(); handler.postDelayed(cleanUpRunnable, 60 * 1000); // register for bluetooth changes IntentFilter intentFilter = new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED); this.registerReceiver(broadcastReceiver, intentFilter); // configure Bluetooth manager BluetoothManager.getInstance() .setBluetoothEvent( new BluetoothEvent() { @Override public void onBeforeConnect() { setBluetoothState(BLUETOOTH_SEARCH); } @Override public void onAfterConnect(BluetoothSocket bluetoothSocket) { device.init(visible); device.registerFilters(); // set title debug("MainActivity: onAfterConnect > set title"); runOnUiThread( new Runnable() { @Override public void run() { setTitle( TAG + " - connected to <" + bluetoothDeviceName + "@" + bluetoothDeviceAddress + ">"); setBluetoothState(BLUETOOTH_CONNECTED); } }); } @Override public void onBeforeDisconnect(BluetoothSocket bluetoothSocket) {} @Override public void onAfterDisconnect() { runOnUiThread( new Runnable() { @Override public void run() { setTitle(TAG + " - disconnected"); } }); } }); // detect hardware status int BT_STATE = BluetoothManager.getInstance().getHardwareState(); if (BT_STATE == BluetoothManager.STATE_BLUETOOTH_NOT_AVAILABLE) Toast.makeText( this.getBaseContext(), "Sorry, but your device doesn't seem to have Bluetooth support!", Toast.LENGTH_LONG) .show(); else if (BT_STATE == BluetoothManager.STATE_BLUETOOTH_NOT_ACTIVE) { Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, 1); } // load settings // - includes the reader // - includes the decoder // loadSettings(); --> done in onResume // load fields from static code debug("Loaded fields: " + fields.size()); // load fields // final SharedPreferences settings = getSharedPreferences(PREFERENCES_FILE, 0); (new Thread( new Runnable() { @Override public void run() { debug("Loading fields last field values from database"); for (int i = 0; i < fields.size(); i++) { Field field = fields.get(i); field.setCalculatedValue(CanzeDataSource.getInstance().getLast(field.getSID())); // debug("MainActivity: Setting "+field.getSID()+" = "+field.getValue()); // f.setValue(settings.getFloat(f.getUniqueID(), 0)); } debug("Loading fields last field values from database (done)"); } })) .start(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflater = (LayoutInflater) getSupportActionBar().getThemedContext().getSystemService(LAYOUT_INFLATER_SERVICE); // one time rating shared pref Rated = this.getSharedPreferences("rated_medd", Context.MODE_PRIVATE); RatedEditor = Rated.edit(); // personDB=new PersonDB(this); Bundle extras = getIntent().getExtras(); if (extras != null) { result = extras.getString("key"); } else { result = "nohealth"; } uid = AppControllerSearchTests.getUid(); View customActionBarView = inflater.inflate(R.layout.actionbar_custom, null); TextView title_name = (TextView) customActionBarView.findViewById(R.id.custom_title); title_name.setText("CONFIRMATION"); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setCustomView( customActionBarView, new ActionBar.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); Toolbar parent = (Toolbar) customActionBarView.getParent(); parent.setContentInsetsAbsolute(0, 0); setContentView(R.layout.activity_confirmation); home = (ImageView) findViewById(R.id.home_pressed); home.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(ConfirmationHealth.this, SecondActivityMain.class); startActivity(i); } }); back = (ImageView) findViewById(R.id.back_pressed); back.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(ConfirmationHealth.this, SecondActivityMain.class); startActivity(i); } }); loginPrefs = getSharedPreferences("MeddLoginDetails", Context.MODE_PRIVATE); showPdialog(); hintbox = (LinearLayout) findViewById(R.id.hintbox); pref = getSharedPreferences("confirmation", MODE_PRIVATE); editor = pref.edit(); final String getStatus = pref.getString("confirm", "nil"); Log.d("getstatuscheck", getStatus); if (getStatus.equals("true")) hintbox.setVisibility(View.GONE); else { hintbox.setVisibility(View.VISIBLE); editor.putString("confirm", "true"); editor.commit(); } patientName = AppControllerSearchTests.getPatientName(); patientAge = AppControllerSearchTests.getPatientAge(); patientEmail = AppControllerSearchTests.getPatientEmail(); patientPhone = AppControllerSearchTests.getPatientPhone(); patientGender = AppControllerSearchTests.getPatientGender(); patientID = AppControllerSearchTests.getPatientId(); Log.d("shrey", String.valueOf(patientID)); if (AppControllerSearchTests.getPatientAddressline1() != null) { patientAddress = AppControllerSearchTests.getPatientAddressline1(); if (AppControllerSearchTests.getPatientAddressline2() != null) patientAddress = patientAddress + " " + AppControllerSearchTests.getPatientAddressline2(); if (AppControllerSearchTests.getPatientAddresspincode() != null) patientAddress = patientAddress + " " + AppControllerSearchTests.getPatientAddresspincode(); } else { patientAddress = ""; } event = AppControllerSearchTests.getSelectedEvent(); refferalcode = AppControllerSearchTests.getRefferalcode(); if (AppControllerSearchTests.getSearchType().equals(AppControllerSearchTests.TYPEEVENT)) { eventName = event.getEventName(); eventAddress = event.getEventAddress(); eventPrice = event.getEventPrice(); eventDescription = event.getEventDescription(); amount = Double.valueOf(eventPrice); } /// // try{ if (AppControllerSearchTests.getSearchType().equals(AppControllerSearchTests.TYPELAB)) { labName = AppControllerSearchTests.getLabsname(); labAdd = AppControllerSearchTests.getAddresslab(); labID = AppControllerSearchTests.getLabsIds(); labEmail = ""; list = AppControllerSearchTests.getPriceListHealth(); medd = AppControllerSearchTests.getPriceMeddHealth(); total = AppControllerSearchTests.getPriceTotalHealth(); labPhone = ""; } /* selectedPhar=AppControllerSearchTests.getSelectedPharamcy(); if(selectedPhar!=null) { pharmacy_name = selectedPhar.getPharmacyname(); pharmacy_address = selectedPhar.getPharmacyaddress(); } }catch (Exception e){ selectedPhar=AppControllerSearchTests.getSelectedPharamcy(); if(selectedPhar!=null) { pharmacy_name = selectedPhar.getPharmacyname(); pharmacy_address = selectedPhar.getPharmacyaddress(); } e.printStackTrace(); }*/ moretests = (Button) findViewById(R.id.moretest); final Button moretestspressed = (Button) findViewById(R.id.moretest); // on touch listener to change color of button boolean check = false; moretests.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { // perform your animation when button is touched and held moretestspressed.setBackgroundColor(getResources().getColor(R.color.primary)); } else if (event.getAction() == MotionEvent.ACTION_UP) { // perform your animation when button is released moretestspressed.setBackgroundColor(getResources().getColor(R.color.colorAccent)); } return false; } }); moretests.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { moretests.setBackgroundColor(getResources().getColor(R.color.onclickcolor)); Intent i = new Intent(ConfirmationHealth.this, SecondActivityMain.class); startActivity(i); finish(); } }); /* db = new PastOrdersDB(this); a = new PastOrdersObject();*/ Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); timeStamp = sdf2.format(date); /* a.setPatientName(patientName); a.setAmount(this.getString(R.string.Rs) + medd); a.setTests(AppControllerSearchTests.getHealth_package_name()); a.setDateString(sdf.format(date)); */ Log.d("checklabplz", AppControllerSearchTests.getSearchType()); if (AppControllerSearchTests.getSearchType() == AppControllerSearchTests.TYPELAB) { Log.d("checklabplz", "yes"); /* a.setAddress(labAdd); a.setCenter(labName); a.setChoice(AppControllerSearchTests.getSearchType()); */ bookeddate = sdf.format(date); try { // RegisterPerson(); getCode(); } catch (Exception e) { e.printStackTrace(); } } else if (AppControllerSearchTests.getSearchType() == AppControllerSearchTests.TYPEEVENT) { Log.d("typeEvent", "ineleseif"); patient = new JSONObject(); String urlJsonObj = AppControllerSearchTests.serverUrl + "/api/v1/transactions/create"; HashMap<String, String> jsonParams = new HashMap<>(); JSONObject eventobj = new JSONObject(); try { userID = loginPrefs.getString("UserId", "null"); // for now eventobj.put("_id", event.getEventId()); eventobj.put("name", event.getEventName()); // extra eventobj.put("description", event.getEventDescription()); eventobj.put("address", event.getEventAddress()); patient.put("name", patientName); // patient.put("age", patientAge); //extra patient.put("email", patientEmail); patient.put("phone", patientPhone); if (patientID != null) patient.put("_id", patientID); // patient.put("gender", patientGender);//extra Log.d("typeEvent", patient.toString()); Log.d("typeEvent", eventobj.toString()); JSONObject transaction = new JSONObject(); transaction.put("patient", patient); transaction.put("event", eventobj); transaction.put("user", userID); transaction.put("user_id", userID); Log.d("typeEvent", transaction.toString()); jsonParams.put("transaction", transaction.toString()); Log.d("typeEvent jsonParams", String.valueOf(jsonParams)); } catch (JSONException e) { e.printStackTrace(); } JsonObjectRequest jsonObjReq = new JsonObjectRequest( Request.Method.POST, urlJsonObj, new JSONObject(jsonParams), new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { Log.d("typeEvent response", response.toString()); couponCode = response.getString("coupon"); showViews(); } catch (Exception e) { e.printStackTrace(); // showAlertDialog(); } hidePdialog(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.d("Check", "Error: " + error.getMessage()); Log.d("volleyError", error.getMessage()); hidePdialog(); showAlertDialog(); } }); AppControllerSearchTests.getInstance().addToRequestQueue(jsonObjReq); // a.setChoice(AppControllerSearchTests.getSearchType()); bookeddate = sdf.format(date); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayOptions( ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP); } // Activamos el modo fullscreen this.getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); fragment_tags = new ArrayList<String>(); fragment_tags.add("list_fragment"); fragment_tags.add("images_fragment"); fragment_tags.add("places_fragment"); fragment_tags.add("about_fragment"); setContentView(R.layout.tabs_activity_main); fragments[0].setHasOptionsMenu(true); final ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.addTab( actionBar .newTab() .setText(getResources().getString(R.string.listado)) .setTabListener(this)); actionBar.addTab( actionBar .newTab() .setText(getResources().getString(R.string.imagenes)) .setTabListener(this)); actionBar.addTab( actionBar.newTab().setText(getResources().getString(R.string.places)).setTabListener(this)); actionBar.addTab( actionBar .newTab() .setText(getResources().getString(R.string.acercaDe)) .setTabListener(this)); FragmentManager manager = getSupportFragmentManager(); manager .beginTransaction() .add(R.id.mainContent2, fragments[0], fragment_tags.get(0)) .add(R.id.mainContent2, fragments[1], fragment_tags.get(1)) .add(R.id.mainContent2, fragments[2], fragment_tags.get(2)) .add(R.id.mainContent2, fragments[3], fragment_tags.get(3)) .commit(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); position = getIntent().getIntExtra("position", -1); // setup actionbar LayoutInflater inflater = (LayoutInflater) getSupportActionBar().getThemedContext().getSystemService(LAYOUT_INFLATER_SERVICE); View customActionBarView = inflater.inflate(R.layout.actionbar_custom, null); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setCustomView( customActionBarView, new ActionBar.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); Toolbar parent = (Toolbar) customActionBarView.getParent(); parent.setContentInsetsAbsolute(0, 0); setContentView(R.layout.activity_ehrdetails); TextView title_name = (TextView) customActionBarView.findViewById(R.id.custom_title); title_name.setText("Detailed History"); home = (ImageView) findViewById(R.id.home_pressed); home.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(EHRDetails.this, SecondActivityMain.class); startActivity(i); } }); back = (ImageView) findViewById(R.id.back_pressed); back.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); ArrayList<TransactionObject> transactionObjectArrayList = AppControllerSearchTests.transactionObjectArrayList; patientname = (TextView) findViewById(R.id.personname_ehr_d); labname = (TextView) findViewById(R.id.lab_name_ehr_d); date = (TextView) findViewById(R.id.ehr_date_d); labIcon = (TextView) findViewById(R.id.labIcon); testsIcon = (TextView) findViewById(R.id.testIcon); patientIcon = (TextView) findViewById(R.id.profileIcon); dateIcon = (TextView) findViewById(R.id.dateIcon); downIcon = (TextView) findViewById(R.id.downIcon); // testname=(TextView)findViewById(R.id.test_name_ehr_d); Typeface font = Typeface.createFromAsset(this.getAssets(), "fontawesome-webfont.ttf"); testsIcon.setTypeface(font); patientIcon.setTypeface(font); dateIcon.setTypeface(font); labIcon.setTypeface(font); downIcon.setTypeface(font); labname.setText(transactionObjectArrayList.get(position).getLab_name()); // testname.setText(e.getTest_groups()); date.setText(transactionObjectArrayList.get(position).getDate()); patientname.setText(transactionObjectArrayList.get(position).getPatient_name()); testgroupExpandablelistView = (ExpandableListView) findViewById(R.id.ehr_detail_list); if (transactionObjectArrayList.get(position).testGroupNameArrayList == null) { // TextView no=(TextView)findViewById(R.id.no_result_e); // no.setVisibility(View.VISIBLE); testgroupExpandablelistView.setVisibility(View.INVISIBLE); } else { expandableTestGroupListAdapter = new ExpandableTestGroupListAdapter( this, transactionObjectArrayList.get(position).getTestGroupNameArrayList(), transactionObjectArrayList.get(position).getHashMap()); testgroupExpandablelistView.setAdapter(expandableTestGroupListAdapter); } testgroupExpandablelistView.setOnGroupExpandListener( new ExpandableListView.OnGroupExpandListener() { @Override public void onGroupExpand(int groupPosition) { if (lastExpandedPosition != -1 && lastExpandedPosition != groupPosition) { testgroupExpandablelistView.collapseGroup(lastExpandedPosition); } lastExpandedPosition = groupPosition; } }); }