List of usage examples for android.widget LinearLayout setVisibility
@RemotableViewMethod public void setVisibility(@Visibility int visibility)
From source file:org.xingjitong.InCallActivity.java
private void displayCall(Resources resources, LinphoneCall call, int index) { String sipUri = call.getRemoteAddress().asStringUriOnly(); LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); // Control Row LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.active_call_control_row, container, false); setContactPhone(callView, lAddress, sipUri, resources); //yyppcallingfun del //displayCallStatusIconAndReturnCallPaused(callView, call); setRowBackground(callView, index);// ww w . j ava 2 s .c o m registerCallDurationTimer(callView, call); callsList.addView(callView); // Image Row LinearLayout imageView = (LinearLayout) inflater.inflate(R.layout.active_call_image_row, container, false); Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, imageView.getContext().getContentResolver()); final TextView name = (TextView) imageView.findViewById(R.id.call_name); //yyppcalling //yyppcallingui add //callhint = (TextView) imageView.findViewById(R.id.incall_callhint); phone = sipUri.substring(sipUri.indexOf(":") + 1, sipUri.indexOf("@")); if (phone.startsWith("01") && !phone.startsWith("010")) { phone = phone.substring(1); } else if (phone.startsWith("51201")) { phone = phone.substring(4); } else if (phone.startsWith("512")) { phone = phone.substring(3); } if (!phone.startsWith("1") && !phone.startsWith("0")) { phone = "0" + phone; } handler.post(new Runnable() { @Override public void run() { String n = ContactDB.Instance().getName(phone); if (!n.equals(phone) && n != null) { name.invalidate(); name.setText(n); } } }); displayOrHideContactPicture(imageView, pictureUri, false); callsList.addView(imageView); callView.setTag(imageView); callView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (v.getTag() != null) { View imageView = (View) v.getTag(); if (imageView.getVisibility() == View.VISIBLE) imageView.setVisibility(View.GONE); else imageView.setVisibility(View.VISIBLE); callsList.invalidate(); } } }); }
From source file:cl.gisred.android.PowerOnActivity.java
public void dialogBusqueda() { AlertDialog.Builder dialogBusqueda = new AlertDialog.Builder(this); dialogBusqueda.setTitle("Busqueda"); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.dialog_busqueda, null); dialogBusqueda.setView(v);//from ww w .j a v a 2s .c o m Spinner spinner = (Spinner) v.findViewById(R.id.spinnerBusqueda); final LinearLayout llBuscar = (LinearLayout) v.findViewById(R.id.llBuscar); final LinearLayout llDireccion = (LinearLayout) v.findViewById(R.id.llBuscarDir); final LinearLayout llOrden = (LinearLayout) v.findViewById(R.id.llBuscarOrden); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, R.layout.support_simple_spinner_dropdown_item, searchArray); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { SpiBusqueda = position; if (position == 6) { if (llDireccion != null) llDireccion.setVisibility(View.GONE); if (llBuscar != null) llBuscar.setVisibility(View.GONE); if (llOrden != null) llOrden.setVisibility(View.VISIBLE); } else if (position == 4) { if (llBuscar != null) llBuscar.setVisibility(View.GONE); if (llOrden != null) llOrden.setVisibility(View.GONE); if (llDireccion != null) llDireccion.setVisibility(View.VISIBLE); } else { if (llDireccion != null) llDireccion.setVisibility(View.GONE); if (llOrden != null) llOrden.setVisibility(View.GONE); if (llBuscar != null) llBuscar.setVisibility(View.VISIBLE); } } @Override public void onNothingSelected(AdapterView<?> parent) { Toast.makeText(getApplicationContext(), "Nada seleccionado", Toast.LENGTH_SHORT).show(); } }); final EditText eSearch = (EditText) v.findViewById(R.id.txtBuscar); final EditText eStreet = (EditText) v.findViewById(R.id.txtCalle); final EditText eNumber = (EditText) v.findViewById(R.id.txtNum); final EditText eOrder = (EditText) v.findViewById(R.id.txtOrden); dialogBusqueda.setPositiveButton("Buscar", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (SpiBusqueda == 4) { txtBusqueda = new String(); if (!eStreet.getText().toString().isEmpty()) txtBusqueda = (eNumber.getText().toString().trim().isEmpty()) ? "0 " : eNumber.getText().toString().trim() + " "; txtBusqueda = txtBusqueda + eStreet.getText().toString(); } else if (SpiBusqueda == 6) { txtBusqueda = eOrder.getText().toString() + "-1"; } else { txtBusqueda = eSearch.getText().toString(); } if (txtBusqueda.trim().isEmpty()) { Toast.makeText(myMapView.getContext(), "Debe ingresar un valor", Toast.LENGTH_SHORT).show(); } else { // Escala de calle para busquedas por default iBusqScale = 4000; switch (SpiBusqueda) { case 0: callQuery(txtBusqueda, getValueByEmp("CLIENTES_XY_006.nis"), LyCLIENTES.getUrl().concat("/0")); if (LyCLIENTES.getLayers() != null && LyCLIENTES.getLayers().length > 0) iBusqScale = LyCLIENTES.getLayers()[0].getLayerServiceInfo().getMinScale(); break; case 1: callQuery(txtBusqueda, "codigo", LySED.getUrl().concat("/1")); if (LySED.getLayers() != null && LySED.getLayers().length > 1) iBusqScale = LySED.getLayers()[1].getLayerServiceInfo().getMinScale(); break; case 2: callQuery(txtBusqueda, "rotulo", LyPOSTES.getUrl().concat("/0")); if (LyPOSTES.getLayers() != null && LyPOSTES.getLayers().length > 0) iBusqScale = LyPOSTES.getLayers()[0].getLayerServiceInfo().getMinScale(); break; case 3: callQuery(txtBusqueda, "serie_medidor", LyMEDIDORES.getUrl().concat("/1")); if (LyMEDIDORES.getLayers() != null && LyMEDIDORES.getLayers().length > 1) iBusqScale = LyMEDIDORES.getLayers()[1].getLayerServiceInfo().getMinScale(); break; case 4: iBusqScale = 5000; String[] sBuscar = { eStreet.getText().toString(), eNumber.getText().toString() }; String[] sFields = { "nombre_calle", "numero" }; callQuery(sBuscar, sFields, LyDIRECCIONES.getUrl().concat("/0")); break; case 5: callQuery(txtBusqueda, new String[] { "id_equipo", "nombre" }, LyEQUIPOSLINEA.getUrl().concat("/0")); if (LyEQUIPOSLINEA.getLayers() != null && LyEQUIPOSLINEA.getLayers().length > 0) iBusqScale = LyEQUIPOSLINEA.getLayers()[0].getLayerServiceInfo().getMinScale(); break; case 6: callQuery(txtBusqueda, getValueByEmp("ARCGIS.dbo.POWERON_CLIENTES.id_orden"), LyPOCLIENTES.getUrl().concat("/1")); if (LyPOCLIENTES.getLayers() != null && LyPOCLIENTES.getLayers().length > 0) if (LyPOCLIENTES.getLayers()[1].getLayerServiceInfo().getMinScale() > 0) iBusqScale = LyPOCLIENTES.getLayers()[1].getLayerServiceInfo().getMinScale(); break; case 7: callQueryInt(txtBusqueda, getValueByEmp("ARCGIS.dbo.POWERON_CLIENTES.id_incidencia"), LyPOCLIENTES.getUrl().concat("/1")); if (LyPOCLIENTES.getLayers() != null && LyPOCLIENTES.getLayers().length > 0) if (LyPOCLIENTES.getLayers()[1].getLayerServiceInfo().getMinScale() > 0) iBusqScale = LyPOCLIENTES.getLayers()[1].getLayerServiceInfo().getMinScale(); break; } } } }); dialogBusqueda.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); dialogBusqueda.show(); }
From source file:com.synox.android.ui.activity.FileActivity.java
/** * Retrieves user quota if available//from w ww. j a v a2 s . c o m * * @param navigationDrawerLayout */ private void getUserQuota(final NavigationView navigationDrawerLayout, final String user) { // set user space information Thread t = new Thread(new Runnable() { public void run() { try { OwnCloudAccount ocAccount = new OwnCloudAccount(mAccount, MainApp.getAppContext()); OwnCloudClient client = OwnCloudClientManagerFactory.getDefaultSingleton() .getClientFor(ocAccount, MainApp.getAppContext()); GetMethod get = null; final ProgressBar quotaProgress = (ProgressBar) navigationDrawerLayout .findViewById(R.id.usage_progress); final LinearLayout quotaInformation = (LinearLayout) navigationDrawerLayout .findViewById(R.id.quotaInformation); try { get = new GetMethod( client.getBaseUri() + "/ocs/v1.php/cloud/users/" + user + "?format=json"); int status = client.executeMethod(get); if (status == HttpStatus.SC_OK) { JSONObject json = new JSONObject(get.getResponseBodyAsString()); JSONObject ocs = json.getJSONObject("ocs"); JSONObject meta = ocs.getJSONObject("meta"); JSONObject data = ocs.getJSONObject("data"); JSONObject quota = data.getJSONObject("quota"); if (meta.getString("statuscode").equals("100")) { try { final long used = Long.parseLong(quota.getString("used")); final long total = Long.parseLong(quota.getString("total")); final int relative = (int) Math.ceil(quota.getDouble("relative")); runOnUiThread(new Runnable() { @Override public void run() { if (quotaProgress != null) { if (quotaInformation.getVisibility() == View.INVISIBLE) { Animation animation = AnimationUtils.loadAnimation( navigationDrawerLayout.getContext(), R.anim.abc_slide_in_bottom); quotaInformation.setAnimation(animation); } quotaInformation.setVisibility(View.VISIBLE); quotaProgress.setProgress(relative); } else { quotaInformation.setVisibility(View.INVISIBLE); } TextView usageText = (TextView) navigationDrawerLayout .findViewById(R.id.usage_text); usageText.setText(String.format(getString(R.string.usage_text), DisplayUtils.bytesToHumanReadable(used), DisplayUtils.bytesToHumanReadable(total))); } }); } catch (NumberFormatException nfe) { Log_OC.e(this.getClass().getName(), "Error retrieving quota usage from server."); } } } else { client.exhaustResponse(get.getResponseBodyAsStream()); } } catch (final Exception e) { runOnUiThread(new Runnable() { @Override public void run() { quotaInformation.setVisibility(View.INVISIBLE); e.printStackTrace(); } }); } finally { if (get != null) { get.releaseConnection(); } } } catch (com.synox.android.lib.common.accounts.AccountUtils.AccountNotFoundException e) { Log_OC.e(this.getClass().getName(), e.getMessage()); } catch (AuthenticatorException | OperationCanceledException | IOException e) { Log_OC.e(this.getClass().getName(), e.getMessage()); } } }); t.start(); }
From source file:com.daiv.android.twitter.ui.drawer_activities.DrawerActivity.java
public void setUpDrawer(int number, final String actName) { int currentAccount = sharedPrefs.getInt("current_account", 1); for (int i = 0; i < TimelinePagerAdapter.MAX_EXTRA_PAGES; i++) { String pageIdentifier = "account_" + currentAccount + "_page_" + (i + 1); int type = sharedPrefs.getInt(pageIdentifier, AppSettings.PAGE_TYPE_NONE); if (type != AppSettings.PAGE_TYPE_NONE) { number++;/*from w w w .j av a 2s . co m*/ } } try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ex) { // Ignore } actionBar = getActionBar(); adapter = new MainDrawerArrayAdapter(context); MainDrawerArrayAdapter.setCurrent(context, number); TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.drawerIcon }); int resource = a.getResourceId(0, 0); a.recycle(); a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.read_button }); openMailResource = a.getResourceId(0, 0); a.recycle(); a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.unread_button }); closedMailResource = a.getResourceId(0, 0); a.recycle(); mDrawerLayout = (NotificationDrawerLayout) findViewById(R.id.drawer_layout); mDrawer = (LinearLayout) findViewById(R.id.left_drawer); HoloTextView name = (HoloTextView) mDrawer.findViewById(R.id.name); HoloTextView screenName = (HoloTextView) mDrawer.findViewById(R.id.screen_name); backgroundPic = (NetworkedCacheableImageView) mDrawer.findViewById(R.id.background_image); profilePic = (NetworkedCacheableImageView) mDrawer.findViewById(R.id.profile_pic_contact); final ImageButton showMoreDrawer = (ImageButton) mDrawer.findViewById(R.id.options); final LinearLayout logoutLayout = (LinearLayout) mDrawer.findViewById(R.id.logoutLayout); final Button logoutDrawer = (Button) mDrawer.findViewById(R.id.logoutButton); drawerList = (ListView) mDrawer.findViewById(R.id.drawer_list); notificationList = (EnhancedListView) findViewById(R.id.notificationList); try { mDrawerLayout = (NotificationDrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow_rev, Gravity.END); mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ resource, /* nav drawer icon to replace 'Up' caret */ R.string.app_name, /* "open drawer" description */ R.string.app_name /* "close drawer" description */ ) { public void onDrawerClosed(View view) { actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); if (logoutVisible) { Animation ranim = AnimationUtils.loadAnimation(context, R.anim.drawer_rotate_back); ranim.setFillAfter(true); showMoreDrawer.startAnimation(ranim); logoutLayout.setVisibility(View.GONE); drawerList.setVisibility(View.VISIBLE); logoutVisible = false; } if (MainDrawerArrayAdapter.current > adapter.pageTypes.size()) { actionBar.setTitle(actName); } else { int position = mViewPager.getCurrentItem(); String title = ""; try { title = "" + mSectionsPagerAdapter.getPageTitle(position); } catch (NullPointerException e) { title = ""; } actionBar.setTitle(title); } try { if (oldInteractions.getText().toString() .equals(getResources().getString(R.string.new_interactions))) { oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); notificationList.enableSwipeToDismiss(); notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getUnreadCursor(DrawerActivity.settings.currentAccount)); notificationList.setAdapter(notificationAdapter); } } catch (Exception e) { // don't have Test pull on } invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { actionBar.setTitle(getResources().getString(R.string.app_name)); actionBar.setIcon(R.mipmap.ic_launcher); try { notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getUnreadCursor(settings.currentAccount)); notificationList.setAdapter(notificationAdapter); notificationList.enableSwipeToDismiss(); oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); sharedPrefs.edit().putBoolean("new_notification", false).commit(); } catch (Exception e) { // don't have Test pull on } invalidateOptionsMenu(); } public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, slideOffset); if (!actionBar.isShowing()) { actionBar.show(); } if (translucent) { statusBar.setVisibility(View.VISIBLE); } } }; mDrawerLayout.setDrawerListener(mDrawerToggle); } catch (Exception e) { // landscape mode } actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); showMoreDrawer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (logoutLayout.getVisibility() == View.GONE) { Animation ranim = AnimationUtils.loadAnimation(context, R.anim.drawer_rotate); ranim.setFillAfter(true); showMoreDrawer.startAnimation(ranim); Animation anim = AnimationUtils.loadAnimation(context, R.anim.fade_out); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { drawerList.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim.setDuration(300); drawerList.startAnimation(anim); Animation anim2 = AnimationUtils.loadAnimation(context, R.anim.fade_in); anim2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { logoutLayout.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim2.setDuration(300); logoutLayout.startAnimation(anim2); logoutVisible = true; } else { Animation ranim = AnimationUtils.loadAnimation(context, R.anim.drawer_rotate_back); ranim.setFillAfter(true); showMoreDrawer.startAnimation(ranim); Animation anim = AnimationUtils.loadAnimation(context, R.anim.fade_in); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { drawerList.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim.setDuration(300); drawerList.startAnimation(anim); Animation anim2 = AnimationUtils.loadAnimation(context, R.anim.fade_out); anim2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { logoutLayout.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim2.setDuration(300); logoutLayout.startAnimation(anim2); logoutVisible = false; } } }); logoutDrawer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { logoutFromTwitter(); } }); final String sName = settings.myName; final String sScreenName = settings.myScreenName; final String backgroundUrl = settings.myBackgroundUrl; final String profilePicUrl = settings.myProfilePicUrl; final BitmapLruCache mCache = App.getInstance(context).getProfileCache(); if (!backgroundUrl.equals("")) { backgroundPic.loadImage(backgroundUrl, false, null); //ImageUtils.loadImage(context, backgroundPic, backgroundUrl, mCache); } else { backgroundPic.setImageDrawable(getResources().getDrawable(R.drawable.default_header_background)); } backgroundPic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { mDrawerLayout.closeDrawer(Gravity.START); } catch (Exception e) { } new Handler().postDelayed(new Runnable() { @Override public void run() { } }, 400); } }); backgroundPic.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { try { mDrawerLayout.closeDrawer(Gravity.START); } catch (Exception e) { } return false; } }); try { name.setText(sName); screenName.setText("@" + sScreenName); name.setTextSize(15); screenName.setTextSize(15); } catch (Exception e) { // 7 inch tablet in portrait } try { if (settings.roundContactImages) { //profilePic.loadImage(profilePicUrl, false, null, NetworkedCacheableImageView.CIRCLE); ImageUtils.loadCircleImage(context, profilePic, profilePicUrl, mCache); } else { profilePic.loadImage(profilePicUrl, false, null); ImageUtils.loadImage(context, profilePic, profilePicUrl, mCache); } } catch (Exception e) { // empty path again } drawerList.setAdapter(adapter); drawerList.setOnItemClickListener(new MainDrawerClickListener(context, mDrawerLayout, mViewPager)); // set up for the second account int count = 0; // number of accounts logged in if (sharedPrefs.getBoolean("is_logged_in_1", false)) { count++; } if (sharedPrefs.getBoolean("is_logged_in_2", false)) { count++; } RelativeLayout secondAccount = (RelativeLayout) findViewById(R.id.second_profile); HoloTextView name2 = (HoloTextView) findViewById(R.id.name_2); HoloTextView screenname2 = (HoloTextView) findViewById(R.id.screen_name_2); NetworkedCacheableImageView proPic2 = (NetworkedCacheableImageView) findViewById(R.id.profile_pic_2); name2.setTextSize(15); screenname2.setTextSize(15); final int current = sharedPrefs.getInt("current_account", 1); // make a second account if (count == 1) { name2.setText(getResources().getString(R.string.new_account)); screenname2.setText(getResources().getString(R.string.tap_to_setup)); secondAccount.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (canSwitch) { if (current == 1) { sharedPrefs.edit().putInt("current_account", 2).commit(); } else { sharedPrefs.edit().putInt("current_account", 1).commit(); } context.sendBroadcast(new Intent("com.daiv.android.twitter.STOP_PUSH_SERVICE")); context.sendBroadcast(new Intent("com.daiv.android.twitter.MARK_POSITION")); Intent login = new Intent(context, LoginActivity.class); AppSettings.invalidate(); finish(); startActivity(login); } } }); } else { // switch accounts if (current == 1) { name2.setText(sharedPrefs.getString("twitter_users_name_2", "")); screenname2.setText("@" + sharedPrefs.getString("twitter_screen_name_2", "")); try { if (settings.roundContactImages) { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_2", ""), true, null, NetworkedCacheableImageView.CIRCLE); ImageUtils.loadCircleImage(context, proPic2, sharedPrefs.getString("profile_pic_url_2", ""), mCache); } else { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_2", ""), true, null); ImageUtils.loadImage(context, proPic2, sharedPrefs.getString("profile_pic_url_2", ""), mCache); } } catch (Exception e) { } secondAccount.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (canSwitch) { context.sendBroadcast(new Intent("com.daiv.android.twitter.STOP_PUSH_SERVICE")); context.sendBroadcast(new Intent("com.daiv.android.twitter.MARK_POSITION") .putExtra("current_account", current)); Toast.makeText(context, "Preparing to switch", Toast.LENGTH_SHORT).show(); // we want to wait a second so that the mark position broadcast will work new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(1000); } catch (Exception e) { } sharedPrefs.edit().putInt("current_account", 2).commit(); sharedPrefs.edit().remove("new_notifications").remove("new_retweets") .remove("new_favorites").remove("new_follows").commit(); AppSettings.invalidate(); finish(); Intent next = new Intent(context, MainActivity.class); startActivity(next); } }).start(); } } }); } else { name2.setText(sharedPrefs.getString("twitter_users_name_1", "")); screenname2.setText("@" + sharedPrefs.getString("twitter_screen_name_1", "")); try { if (settings.roundContactImages) { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_1", ""), true, null, NetworkedCacheableImageView.CIRCLE); ImageUtils.loadCircleImage(context, proPic2, sharedPrefs.getString("profile_pic_url_1", ""), mCache); } else { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_1", ""), true, null); ImageUtils.loadImage(context, proPic2, sharedPrefs.getString("profile_pic_url_1", ""), mCache); } } catch (Exception e) { } secondAccount.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (canSwitch) { context.sendBroadcast(new Intent("com.daiv.android.twitter.STOP_PUSH_SERVICE")); context.sendBroadcast(new Intent("com.daiv.android.twitter.MARK_POSITION") .putExtra("current_account", current)); Toast.makeText(context, "Preparing to switch", Toast.LENGTH_SHORT).show(); new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(1000); } catch (Exception e) { } sharedPrefs.edit().putInt("current_account", 1).commit(); sharedPrefs.edit().remove("new_notifications").remove("new_retweets") .remove("new_favorites").remove("new_follows").commit(); AppSettings.invalidate(); finish(); Intent next = new Intent(context, MainActivity.class); startActivity(next); } }).start(); } } }); } } statusBar = findViewById(R.id.activity_status_bar); statusBarHeight = Utils.getStatusBarHeight(context); navBarHeight = Utils.getNavBarHeight(context); try { RelativeLayout.LayoutParams statusParams = (RelativeLayout.LayoutParams) statusBar.getLayoutParams(); statusParams.height = statusBarHeight; statusBar.setLayoutParams(statusParams); } catch (Exception e) { try { LinearLayout.LayoutParams statusParams = (LinearLayout.LayoutParams) statusBar.getLayoutParams(); statusParams.height = statusBarHeight; statusBar.setLayoutParams(statusParams); } catch (Exception x) { // in the trends } } View navBarSeperater = findViewById(R.id.nav_bar_seperator); if (translucent && Utils.hasNavBar(context)) { try { RelativeLayout.LayoutParams navParams = (RelativeLayout.LayoutParams) navBarSeperater .getLayoutParams(); navParams.height = navBarHeight; navBarSeperater.setLayoutParams(navParams); } catch (Exception e) { try { LinearLayout.LayoutParams navParams = (LinearLayout.LayoutParams) navBarSeperater .getLayoutParams(); navParams.height = navBarHeight; navBarSeperater.setLayoutParams(navParams); } catch (Exception x) { // in the trends } } } if (translucent) { if (Utils.hasNavBar(context)) { View footer = new View(context); footer.setOnClickListener(null); footer.setOnLongClickListener(null); ListView.LayoutParams params = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, Utils.getNavBarHeight(context)); footer.setLayoutParams(params); drawerList.addFooterView(footer); drawerList.setFooterDividersEnabled(false); } View drawerStatusBar = findViewById(R.id.drawer_status_bar); LinearLayout.LayoutParams status2Params = (LinearLayout.LayoutParams) drawerStatusBar.getLayoutParams(); status2Params.height = statusBarHeight; drawerStatusBar.setLayoutParams(status2Params); drawerStatusBar.setVisibility(View.VISIBLE); statusBar.setVisibility(View.VISIBLE); drawerStatusBar = findViewById(R.id.drawer_status_bar_2); status2Params = (LinearLayout.LayoutParams) drawerStatusBar.getLayoutParams(); status2Params.height = statusBarHeight; drawerStatusBar.setLayoutParams(status2Params); drawerStatusBar.setVisibility(View.VISIBLE); } if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE || getResources().getBoolean(R.bool.isTablet)) { actionBar.setDisplayHomeAsUpEnabled(false); } if (!settings.pushNotifications || !settings.useInteractionDrawer) { try { mDrawerLayout.setDrawerLockMode(NotificationDrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.END); } catch (Exception e) { // no drawer? } } else { mDrawerLayout.setDrawerRightEdgeSize(this, .1f); try { if (Build.VERSION.SDK_INT < 18 && DrawerActivity.settings.uiExtras) { View viewHeader2 = context.getLayoutInflater().inflate(R.layout.ab_header, null); notificationList.addHeaderView(viewHeader2, null, false); notificationList.setHeaderDividersEnabled(false); } } catch (Exception e) { // i don't know why it does this to be honest... } notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource.getInstance(context) .getUnreadCursor(DrawerActivity.settings.currentAccount)); try { notificationList.setAdapter(notificationAdapter); } catch (Exception e) { } View viewHeader = context.getLayoutInflater().inflate(R.layout.interactions_footer_1, null); notificationList.addFooterView(viewHeader, null, false); oldInteractions = (HoloTextView) findViewById(R.id.old_interactions_text); readButton = (ImageView) findViewById(R.id.read_button); LinearLayout footer = (LinearLayout) viewHeader.findViewById(R.id.footer); footer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (oldInteractions.getText().toString() .equals(getResources().getString(R.string.old_interactions))) { oldInteractions.setText(getResources().getString(R.string.new_interactions)); readButton.setImageResource(closedMailResource); notificationList.disableSwipeToDismiss(); notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getCursor(DrawerActivity.settings.currentAccount)); } else { oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); notificationList.enableSwipeToDismiss(); notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getUnreadCursor(DrawerActivity.settings.currentAccount)); } notificationList.setAdapter(notificationAdapter); } }); if (DrawerActivity.translucent) { if (Utils.hasNavBar(context)) { View nav = new View(context); nav.setOnClickListener(null); nav.setOnLongClickListener(null); ListView.LayoutParams params = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, Utils.getNavBarHeight(context)); nav.setLayoutParams(params); notificationList.addFooterView(nav); notificationList.setFooterDividersEnabled(false); } } notificationList.setDismissCallback(new EnhancedListView.OnDismissCallback() { @Override public EnhancedListView.Undoable onDismiss(EnhancedListView listView, int position) { Log.v("Test_interactions_delete", "position to delete: " + position); InteractionsDataSource data = InteractionsDataSource.getInstance(context); data.markRead(settings.currentAccount, position); notificationAdapter = new InteractionsCursorAdapter(context, data.getUnreadCursor(DrawerActivity.settings.currentAccount)); notificationList.setAdapter(notificationAdapter); oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); if (notificationAdapter.getCount() == 0) { setNotificationFilled(false); } return null; } }); notificationList.enableSwipeToDismiss(); notificationList.setSwipeDirection(EnhancedListView.SwipeDirection.START); notificationList .setOnItemClickListener(new InteractionClickListener(context, mDrawerLayout, mViewPager)); } }
From source file:ua.mkh.settings.full.MainActivity.java
@SuppressLint("NewApi") @Override//from www . j a va 2s .com protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //try { String roman = "fonts/Regular.otf"; String medium = "fonts/Medium.otf"; String bold = "fonts/Bold.otf"; String thin = "fonts/Thin.otf"; typefaceRoman = Typeface.createFromAsset(getAssets(), roman); typefaceMedium = Typeface.createFromAsset(getAssets(), medium); typefaceBold = Typeface.createFromAsset(getAssets(), bold); typefaceThin = Typeface.createFromAsset(getAssets(), thin); mSettings = getSharedPreferences(APP_PREFERENCES, Context.MODE_PRIVATE); ll1 = (LinearLayout) findViewById(R.id.ll1); ll1.requestFocus(); searchView = (SearchView) findViewById(R.id.search); searchView.setIconifiedByDefault(false); searchView.setOnQueryTextListener(this); searchView.setOnCloseListener(this); mListView = (ListView) findViewById(R.id.list); b1 = (Button) findViewById(R.id.button1); b2 = (Button) findViewById(R.id.button2); b11 = (Button) findViewById(R.id.button11); b21 = (Button) findViewById(R.id.button21); ed1 = (EditText) findViewById(R.id.EditText01); ed11 = (EditText) findViewById(R.id.EditText011); b21.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { b11.setVisibility(View.GONE); b21.setVisibility(View.GONE); ed11.clearFocus(); ed1.clearFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(ed1.getWindowToken(), 0); ed11.setText(""); ed1.setText(""); LinearLayout list_res_top = (LinearLayout) findViewById(R.id.list_res_top); list_res_top.setVisibility(View.GONE); LinearLayout list_res = (LinearLayout) findViewById(R.id.list_res); list_res.setVisibility(View.GONE); ll1.setVisibility(View.VISIBLE); sear = false; } }); ed1.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { b11.setVisibility(View.VISIBLE); b21.setVisibility(View.VISIBLE); LinearLayout list_res_top = (LinearLayout) findViewById(R.id.list_res_top); list_res_top.setVisibility(View.VISIBLE); LinearLayout list_res = (LinearLayout) findViewById(R.id.list_res); list_res.setVisibility(View.VISIBLE); sear = true; //ll1.setVisibility(View.INVISIBLE); ed11.requestFocus(); ed1.clearFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(ed11, InputMethodManager.SHOW_IMPLICIT); //LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); //lp.setMargins(0, 0, 0, 0); //ll1.setLayoutParams(lp); } else { ll1.setVisibility(View.GONE); b11.setVisibility(View.VISIBLE); LinearLayout list_res = (LinearLayout) findViewById(R.id.list_res); list_res.setVisibility(View.VISIBLE); //LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); //lp.setMargins(0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 39, getResources().getDisplayMetrics()), 0, 0); //ll1.setLayoutParams(lp); } } }); ed11.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) { // When user changed the Text searchView.setQuery(cs, false); mListView.setVisibility(View.VISIBLE); } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } @Override public void afterTextChanged(Editable arg0) { } }); mDbHelper = new CustomersDbAdapter(this); mDbHelper.open(); /* //Clean all Customers mDbHelper.deleteAllCustomers(); */ ////////////////////// LinearLayoutWiFi = (LinearLayout) findViewById(R.id.LinearLayoutWiFi); LinearLayoutBluetooth = (LinearLayout) findViewById(R.id.LinearLayoutBluetooth); LinearLayoutSotSvyaz = (LinearLayout) findViewById(R.id.LinearLayoutSotSvyaz); LinearLayoutOperator = (LinearLayout) findViewById(R.id.LinearLayoutOperator); LinearLayoutGeo = (LinearLayout) findViewById(R.id.LinearLayoutGeo); LinearLayoutNotif = (LinearLayout) findViewById(R.id.LinearLayoutNotif); LinearLayoutControl = (LinearLayout) findViewById(R.id.LinearLayoutControl); LinearLayoutMail = (LinearLayout) findViewById(R.id.LinearLayoutMail); LinearLayoutNotes = (LinearLayout) findViewById(R.id.LinearLayoutNotes); LinearLayoutMessages = (LinearLayout) findViewById(R.id.LinearLayoutMessages); LinearLayoutPhone = (LinearLayout) findViewById(R.id.LinearLayoutPhone); LinearLayoutSafari = (LinearLayout) findViewById(R.id.LinearLayoutSafari); LinearLayoutMusic = (LinearLayout) findViewById(R.id.LinearLayoutMusic); LinearLayoutCompass = (LinearLayout) findViewById(R.id.LinearLayoutCompass); LinearLayoutWeather = (LinearLayout) findViewById(R.id.LinearLayoutWeather); LinearLayoutGameCenter = (LinearLayout) findViewById(R.id.LinearLayoutGameCenter); LinearLayoutPasscode = (LinearLayout) findViewById(R.id.LinearLayoutPasscode); LinearLayoutPrivacy = (LinearLayout) findViewById(R.id.LinearLayoutPrivacy); LinearLayoutApn = (LinearLayout) findViewById(R.id.LinearLayoutApn); LinearLayoutCloud = (LinearLayout) findViewById(R.id.LinearLayoutCloud); LinearLayoutTunes = (LinearLayout) findViewById(R.id.LinearLayoutTunes); LinearLayoutMaps = (LinearLayout) findViewById(R.id.LinearLayoutMaps); LinearLayoutVk = (LinearLayout) findViewById(R.id.LinearLayoutVk); LinearLayoutViber = (LinearLayout) findViewById(R.id.LinearLayoutViber); LinearLayoutOk = (LinearLayout) findViewById(R.id.LinearLayoutOK); LinearLayoutSkype = (LinearLayout) findViewById(R.id.LinearLayoutSkype); LinearLayoutWhatsapp = (LinearLayout) findViewById(R.id.LinearLayoutWhatsApp); LinearLayoutTwitter = (LinearLayout) findViewById(R.id.LinearLayoutTwitter); LinearLayoutFacebook = (LinearLayout) findViewById(R.id.LinearLayoutFacebook); LinearLayoutInstagram = (LinearLayout) findViewById(R.id.LinearLayoutInstagram); LinearLayoutNew1 = (LinearLayout) findViewById(R.id.LinearLayoutApp1); LinearLayoutNew2 = (LinearLayout) findViewById(R.id.LinearLayoutApp2); LinearLayoutNew3 = (LinearLayout) findViewById(R.id.LinearLayoutApp3); LinearLayoutNew4 = (LinearLayout) findViewById(R.id.LinearLayoutApp4); LinearLayoutNew1.setVisibility(View.GONE); LinearLayoutNew2.setVisibility(View.GONE); LinearLayoutNew3.setVisibility(View.GONE); LinearLayoutNew4.setVisibility(View.GONE); LinearLayoutGeo.setVisibility(View.GONE); LinearLayoutMail.setVisibility(View.GONE); LinearLayoutNotes.setVisibility(View.GONE); LinearLayoutMessages.setVisibility(View.GONE); LinearLayoutPhone.setVisibility(View.GONE); LinearLayoutSafari.setVisibility(View.GONE); LinearLayoutMusic.setVisibility(View.GONE); LinearLayoutCompass.setVisibility(View.GONE); LinearLayoutWeather.setVisibility(View.GONE); LinearLayoutGameCenter.setVisibility(View.GONE); LinearLayoutNotif.setVisibility(View.GONE); LinearLayoutControl.setVisibility(View.GONE); LinearLayoutTunes.setVisibility(View.GONE); LinearLayoutMaps.setVisibility(View.GONE); LinearLayoutVk.setVisibility(View.GONE); LinearLayoutViber.setVisibility(View.GONE); LinearLayoutOk.setVisibility(View.GONE); LinearLayoutSkype.setVisibility(View.GONE); LinearLayoutWhatsapp.setVisibility(View.GONE); LinearLayoutTwitter.setVisibility(View.GONE); LinearLayoutFacebook.setVisibility(View.GONE); LinearLayoutInstagram.setVisibility(View.GONE); textwifi = (TextView) findViewById(R.id.textwifi); textbt = (TextView) findViewById(R.id.textbt); TextOper = (TextView) findViewById(R.id.TextOper); textVPN = (TextView) findViewById(R.id.TextView01); wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); btn_avia = (Button) findViewById(R.id.Button01); tb_am = (ToggleButton) findViewById(R.id.ToggleButton01); tb_am.setOnClickListener(this); btn_wifi = (Button) findViewById(R.id.ButtonWifi); btn_wifi.setOnClickListener(this); btn_bluetooth = (Button) findViewById(R.id.ButtonBluetooth); btn_bluetooth.setOnClickListener(this); btn_sota = (Button) findViewById(R.id.ButtonSota); btn_sota.setOnClickListener(this); startService(new Intent(this, NotificationService.class)); btn_operator = (Button) findViewById(R.id.ButtonOperator); btn_operator.setOnClickListener(this); btn_osnova = (Button) findViewById(R.id.ButtonOsnova); btn_osnova.setOnClickListener(this); btn_zvuki = (Button) findViewById(R.id.ButtonZvuki); btn_zvuki.setOnClickListener(this); btn_oboi = (Button) findViewById(R.id.ButtonOboi); btn_oboi.setOnClickListener(this); btn_gps = (Button) findViewById(R.id.ButtonGeo); btn_gps.setOnClickListener(this); btn_passcode = (Button) findViewById(R.id.ButtonPasscode); btn_passcode.setOnClickListener(this); btn_battery = (Button) findViewById(R.id.ButtonBattery); btn_battery.setOnClickListener(this); btn_privacy = (Button) findViewById(R.id.ButtonPrivacy); btn_privacy.setOnClickListener(this); btn_notification = (Button) findViewById(R.id.ButtonNotification); btn_notification.setOnClickListener(this); btn_control = (Button) findViewById(R.id.ButtonControl); btn_control.setOnClickListener(this); btn_disturb = (Button) findViewById(R.id.ButtonDisturb); btn_disturb.setOnClickListener(this); btn_mail = (Button) findViewById(R.id.ButtonMail); btn_mail.setOnClickListener(this); btn_notes = (Button) findViewById(R.id.ButtonNotes); btn_notes.setOnClickListener(this); btn_messages = (Button) findViewById(R.id.ButtonMessages); btn_messages.setOnClickListener(this); btn_phone = (Button) findViewById(R.id.ButtonPhone); btn_phone.setOnClickListener(this); btn_safari = (Button) findViewById(R.id.ButtonSafari); btn_safari.setOnClickListener(this); btn_music = (Button) findViewById(R.id.ButtonMusic); btn_music.setOnClickListener(this); btn_compass = (Button) findViewById(R.id.ButtonCompass); btn_compass.setOnClickListener(this); btn_weather = (Button) findViewById(R.id.ButtonWeather); btn_weather.setOnClickListener(this); btn_games = (Button) findViewById(R.id.ButtonGameCenter); btn_games.setOnClickListener(this); btn_maps = (Button) findViewById(R.id.ButtonMaps); btn_maps.setOnClickListener(this); btn_vk = (Button) findViewById(R.id.ButtonVk); btn_vk.setOnClickListener(this); btn_viber = (Button) findViewById(R.id.ButtonViber); btn_viber.setOnClickListener(this); btn_ok = (Button) findViewById(R.id.ButtonOk); btn_ok.setOnClickListener(this); btn_skype = (Button) findViewById(R.id.ButtonSkype); btn_skype.setOnClickListener(this); btn_whatsapp = (Button) findViewById(R.id.ButtonWhatsapp); btn_whatsapp.setOnClickListener(this); btn_twitter = (Button) findViewById(R.id.ButtonTwitter); btn_twitter.setOnClickListener(this); btn_facebook = (Button) findViewById(R.id.ButtonFacebook); btn_facebook.setOnClickListener(this); btn_instagram = (Button) findViewById(R.id.ButtonInstagram); btn_instagram.setOnClickListener(this); btn_new1 = (Button) findViewById(R.id.Button02); btn_new1.setOnClickListener(this); btn_new2 = (Button) findViewById(R.id.Button03); btn_new2.setOnClickListener(this); btn_new3 = (Button) findViewById(R.id.Button04); btn_new3.setOnClickListener(this); btn_new4 = (Button) findViewById(R.id.Button05); btn_new4.setOnClickListener(this); btn_vpn = (Button) findViewById(R.id.Button06); btn_vpn.setOnClickListener(this); btn_display = (Button) findViewById(R.id.ButtonDisplay); btn_display.setOnClickListener(this); btn_iCloud = (Button) findViewById(R.id.ButtonCloud); btn_iCloud.setOnClickListener(this); btn_iTunes = (Button) findViewById(R.id.ButtonTunes); btn_iTunes.setOnClickListener(this); buttonBack = (Button) findViewById(R.id.buttonBack); btn_menu_settings = (Button) findViewById(R.id.ButtonMenuSettings); btn_menu_cancel = (Button) findViewById(R.id.ButtonMenuCancel); textView1 = (TextView) findViewById(R.id.textView1); textView2 = (TextView) findViewById(R.id.textView2); textView3 = (TextView) findViewById(R.id.textView3); text_app_main = (TextView) findViewById(R.id.text_app_main); text_app_main.setText(R.string.text_app_name); ImageView imageView2 = (ImageView) findViewById(R.id.imageView2); imageView2.setVisibility(View.GONE); text_app_main.setTypeface(typefaceBold); btn_avia.setTypeface(typefaceRoman); //textView1.setTypeface(typefaceRoman); textView3.setTypeface(typefaceRoman); btn_wifi.setTypeface(typefaceRoman); btn_bluetooth.setTypeface(typefaceRoman); btn_sota.setTypeface(typefaceRoman); btn_operator.setTypeface(typefaceRoman); btn_osnova.setTypeface(typefaceRoman); btn_passcode.setTypeface(typefaceRoman); btn_battery.setTypeface(typefaceRoman); btn_privacy.setTypeface(typefaceRoman); btn_zvuki.setTypeface(typefaceRoman); btn_oboi.setTypeface(typefaceRoman); btn_notification.setTypeface(typefaceRoman); btn_control.setTypeface(typefaceRoman); btn_disturb.setTypeface(typefaceRoman); btn_gps.setTypeface(typefaceRoman); btn_mail.setTypeface(typefaceRoman); btn_notes.setTypeface(typefaceRoman); btn_messages.setTypeface(typefaceRoman); btn_phone.setTypeface(typefaceRoman); btn_safari.setTypeface(typefaceRoman); btn_music.setTypeface(typefaceRoman); btn_compass.setTypeface(typefaceRoman); btn_weather.setTypeface(typefaceRoman); btn_games.setTypeface(typefaceRoman); btn_new1.setTypeface(typefaceRoman); btn_new2.setTypeface(typefaceRoman); btn_new3.setTypeface(typefaceRoman); btn_new4.setTypeface(typefaceRoman); btn_vpn.setTypeface(typefaceRoman); btn_display.setTypeface(typefaceRoman); btn_maps.setTypeface(typefaceRoman); btn_vk.setTypeface(typefaceRoman); btn_viber.setTypeface(typefaceRoman); btn_ok.setTypeface(typefaceRoman); btn_skype.setTypeface(typefaceRoman); btn_whatsapp.setTypeface(typefaceRoman); btn_twitter.setTypeface(typefaceRoman); btn_facebook.setTypeface(typefaceRoman); btn_instagram.setTypeface(typefaceRoman); btn_iCloud.setTypeface(typefaceRoman); btn_iTunes.setTypeface(typefaceRoman); textwifi.setTypeface(typefaceRoman); textbt.setTypeface(typefaceRoman); TextOper.setTypeface(typefaceRoman); textVPN.setTypeface(typefaceRoman); //LinearLayoutPrivacy.setVisibility(View.GONE); //LinearLayoutApn.setVisibility(View.GONE); //LinearLayoutPasscode.setVisibility(View.GONE); //layoutTunes.setVisibility(View.GONE); //////////////////START/////////////////// ///////////////////APP////////////// pm = this.getPackageManager(); //Notification notif_inoty = pm.getLaunchIntentForPackage("net.suckga.inoty"); notif_espier = pm.getLaunchIntentForPackage("mobi.espier.launcher.plugin.notifications7pro"); //Control Center control_hi = pm.getLaunchIntentForPackage("com.hi.apps.studio.control.center"); control_espier = pm.getLaunchIntentForPackage("mobi.espier.launcher.plugin.controller7pro"); //Mail mail_stok = pm.getLaunchIntentForPackage("com.android.email"); //Phone phone_stok = pm.getLaunchIntentForPackage("com.android.dialer"); //Messages messages_stok = pm.getLaunchIntentForPackage("com.android.mms"); //Safari safari_stok = pm.getLaunchIntentForPackage("com.android.browser"); //Music; music_stok = pm.getLaunchIntentForPackage("com.android.music"); //VK vk_stok = pm.getLaunchIntentForPackage("com.vkontakte.android"); //Viber viber_stok = pm.getLaunchIntentForPackage("com.viber.voip"); //Ok ok_stok = pm.getLaunchIntentForPackage("ru.ok.android"); //Skype skype_stok = pm.getLaunchIntentForPackage("com.skype.raider"); //WhatsApp!!!! whatsapp_stok = pm.getLaunchIntentForPackage("com.whatsapp"); //Twitter twitter_stok = pm.getLaunchIntentForPackage("com.twitter.android"); //Facebook facebook_stok = pm.getLaunchIntentForPackage("com.facebook.katana"); //Instagram instagram_stok = pm.getLaunchIntentForPackage("com.instagram.android"); //Maps maps_stok = pm.getLaunchIntentForPackage("com.google.android.apps.maps"); bt = BluetoothAdapter.getDefaultAdapter(); //Check Availability of bluetooth if (bt == null) { LinearLayoutBluetooth.setVisibility(View.GONE); } }
From source file:com.klinker.android.twitter.ui.drawer_activities.DrawerActivity.java
public void setUpDrawer(int number, final String actName) { try {/*from w ww . j a v a 2s .com*/ ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ex) { // Ignore } actionBar = getActionBar(); MainDrawerArrayAdapter.current = number; TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.drawerIcon }); int resource = a.getResourceId(0, 0); a.recycle(); a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.read_button }); openMailResource = a.getResourceId(0, 0); a.recycle(); a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.unread_button }); closedMailResource = a.getResourceId(0, 0); a.recycle(); mDrawerLayout = (NotificationDrawerLayout) findViewById(R.id.drawer_layout); mDrawer = (LinearLayout) findViewById(R.id.left_drawer); HoloTextView name = (HoloTextView) mDrawer.findViewById(R.id.name); HoloTextView screenName = (HoloTextView) mDrawer.findViewById(R.id.screen_name); backgroundPic = (NetworkedCacheableImageView) mDrawer.findViewById(R.id.background_image); profilePic = (NetworkedCacheableImageView) mDrawer.findViewById(R.id.profile_pic_contact); final ImageButton showMoreDrawer = (ImageButton) mDrawer.findViewById(R.id.options); final LinearLayout logoutLayout = (LinearLayout) mDrawer.findViewById(R.id.logoutLayout); final Button logoutDrawer = (Button) mDrawer.findViewById(R.id.logoutButton); drawerList = (ListView) mDrawer.findViewById(R.id.drawer_list); notificationList = (EnhancedListView) findViewById(R.id.notificationList); try { mDrawerLayout = (NotificationDrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow_rev, Gravity.END); mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ resource, /* nav drawer icon to replace 'Up' caret */ R.string.app_name, /* "open drawer" description */ R.string.app_name /* "close drawer" description */ ) { public void onDrawerClosed(View view) { actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); if (logoutVisible) { Animation ranim = AnimationUtils.loadAnimation(context, R.anim.drawer_rotate_back); ranim.setFillAfter(true); showMoreDrawer.startAnimation(ranim); logoutLayout.setVisibility(View.GONE); drawerList.setVisibility(View.VISIBLE); logoutVisible = false; } if (MainDrawerArrayAdapter.current > 2) { actionBar.setTitle(actName); } else { int position = mViewPager.getCurrentItem(); String title = ""; try { title = "" + mSectionsPagerAdapter.getPageTitle(position); } catch (NullPointerException e) { title = ""; } actionBar.setTitle(title); } try { if (oldInteractions.getText().toString() .equals(getResources().getString(R.string.new_interactions))) { oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); notificationList.enableSwipeToDismiss(); notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getUnreadCursor(DrawerActivity.settings.currentAccount)); notificationList.setAdapter(notificationAdapter); } } catch (Exception e) { // don't have talon pull on } invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { actionBar.setTitle(getResources().getString(R.string.app_name)); actionBar.setIcon(R.mipmap.ic_launcher); try { notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getUnreadCursor(settings.currentAccount)); notificationList.setAdapter(notificationAdapter); notificationList.enableSwipeToDismiss(); oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); sharedPrefs.edit().putBoolean("new_notification", false).commit(); } catch (Exception e) { // don't have talon pull on } invalidateOptionsMenu(); } public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, slideOffset); if (!actionBar.isShowing()) { actionBar.show(); } if (translucent) { statusBar.setVisibility(View.VISIBLE); } } }; mDrawerLayout.setDrawerListener(mDrawerToggle); } catch (Exception e) { // landscape mode } actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); showMoreDrawer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (logoutLayout.getVisibility() == View.GONE) { Animation ranim = AnimationUtils.loadAnimation(context, R.anim.drawer_rotate); ranim.setFillAfter(true); showMoreDrawer.startAnimation(ranim); Animation anim = AnimationUtils.loadAnimation(context, R.anim.fade_out); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { drawerList.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim.setDuration(300); drawerList.startAnimation(anim); Animation anim2 = AnimationUtils.loadAnimation(context, R.anim.fade_in); anim2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { logoutLayout.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim2.setDuration(300); logoutLayout.startAnimation(anim2); logoutVisible = true; } else { Animation ranim = AnimationUtils.loadAnimation(context, R.anim.drawer_rotate_back); ranim.setFillAfter(true); showMoreDrawer.startAnimation(ranim); Animation anim = AnimationUtils.loadAnimation(context, R.anim.fade_in); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { drawerList.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim.setDuration(300); drawerList.startAnimation(anim); Animation anim2 = AnimationUtils.loadAnimation(context, R.anim.fade_out); anim2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { logoutLayout.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim2.setDuration(300); logoutLayout.startAnimation(anim2); logoutVisible = false; } } }); logoutDrawer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { logoutFromTwitter(); } }); final String sName = settings.myName; final String sScreenName = settings.myScreenName; final String backgroundUrl = settings.myBackgroundUrl; final String profilePicUrl = settings.myProfilePicUrl; final BitmapLruCache mCache = App.getInstance(context).getProfileCache(); if (!backgroundUrl.equals("")) { backgroundPic.loadImage(backgroundUrl, false, null); //ImageUtils.loadImage(context, backgroundPic, backgroundUrl, mCache); } else { backgroundPic.setImageDrawable(getResources().getDrawable(R.drawable.default_header_background)); } backgroundPic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { mDrawerLayout.closeDrawer(Gravity.START); } catch (Exception e) { } new Handler().postDelayed(new Runnable() { @Override public void run() { Intent viewProfile = new Intent(context, ProfilePager.class); viewProfile.putExtra("name", sName); viewProfile.putExtra("screenname", sScreenName); viewProfile.putExtra("proPic", profilePicUrl); viewProfile.putExtra("tweetid", 0); viewProfile.putExtra("retweet", false); viewProfile.putExtra("long_click", false); context.startActivity(viewProfile); } }, 400); } }); backgroundPic.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { try { mDrawerLayout.closeDrawer(Gravity.START); } catch (Exception e) { } new Handler().postDelayed(new Runnable() { @Override public void run() { Intent viewProfile = new Intent(context, ProfilePager.class); viewProfile.putExtra("name", sName); viewProfile.putExtra("screenname", sScreenName); viewProfile.putExtra("proPic", profilePicUrl); viewProfile.putExtra("tweetid", 0); viewProfile.putExtra("retweet", false); viewProfile.putExtra("long_click", true); context.startActivity(viewProfile); } }, 400); return false; } }); try { name.setText(sName); screenName.setText("@" + sScreenName); name.setTextSize(15); screenName.setTextSize(15); } catch (Exception e) { // 7 inch tablet in portrait } try { if (settings.roundContactImages) { //profilePic.loadImage(profilePicUrl, false, null, NetworkedCacheableImageView.CIRCLE); ImageUtils.loadCircleImage(context, profilePic, profilePicUrl, mCache); } else { profilePic.loadImage(profilePicUrl, false, null); ImageUtils.loadImage(context, profilePic, profilePicUrl, mCache); } } catch (Exception e) { // empty path again } MainDrawerArrayAdapter adapter = new MainDrawerArrayAdapter(context, new ArrayList<String>(Arrays.asList(MainDrawerArrayAdapter.getItems(context)))); drawerList.setAdapter(adapter); drawerList.setOnItemClickListener(new MainDrawerClickListener(context, mDrawerLayout, mViewPager)); // set up for the second account int count = 0; // number of accounts logged in if (sharedPrefs.getBoolean("is_logged_in_1", false)) { count++; } if (sharedPrefs.getBoolean("is_logged_in_2", false)) { count++; } RelativeLayout secondAccount = (RelativeLayout) findViewById(R.id.second_profile); HoloTextView name2 = (HoloTextView) findViewById(R.id.name_2); HoloTextView screenname2 = (HoloTextView) findViewById(R.id.screen_name_2); NetworkedCacheableImageView proPic2 = (NetworkedCacheableImageView) findViewById(R.id.profile_pic_2); name2.setTextSize(15); screenname2.setTextSize(15); final int current = sharedPrefs.getInt("current_account", 1); // make a second account if (count == 1) { name2.setText(getResources().getString(R.string.new_account)); screenname2.setText(getResources().getString(R.string.tap_to_setup)); secondAccount.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (canSwitch) { if (current == 1) { sharedPrefs.edit().putInt("current_account", 2).commit(); } else { sharedPrefs.edit().putInt("current_account", 1).commit(); } context.sendBroadcast(new Intent("com.klinker.android.twitter.STOP_PUSH_SERVICE")); context.sendBroadcast(new Intent("com.klinker.android.twitter.MARK_POSITION")); Intent login = new Intent(context, LoginActivity.class); AppSettings.invalidate(); finish(); startActivity(login); } } }); } else { // switch accounts if (current == 1) { name2.setText(sharedPrefs.getString("twitter_users_name_2", "")); screenname2.setText("@" + sharedPrefs.getString("twitter_screen_name_2", "")); try { if (settings.roundContactImages) { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_2", ""), true, null, NetworkedCacheableImageView.CIRCLE); ImageUtils.loadCircleImage(context, proPic2, sharedPrefs.getString("profile_pic_url_2", ""), mCache); } else { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_2", ""), true, null); ImageUtils.loadImage(context, proPic2, sharedPrefs.getString("profile_pic_url_2", ""), mCache); } } catch (Exception e) { } secondAccount.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (canSwitch) { context.sendBroadcast(new Intent("com.klinker.android.twitter.STOP_PUSH_SERVICE")); context.sendBroadcast(new Intent("com.klinker.android.twitter.MARK_POSITION") .putExtra("current_account", current)); Toast.makeText(context, "Preparing to switch", Toast.LENGTH_SHORT).show(); // we want to wait a second so that the mark position broadcast will work new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(1000); } catch (Exception e) { } sharedPrefs.edit().putInt("current_account", 2).commit(); sharedPrefs.edit().remove("new_notifications").remove("new_retweets") .remove("new_favorites").remove("new_follows").commit(); AppSettings.invalidate(); finish(); Intent next = new Intent(context, MainActivity.class); startActivity(next); } }).start(); } } }); } else { name2.setText(sharedPrefs.getString("twitter_users_name_1", "")); screenname2.setText("@" + sharedPrefs.getString("twitter_screen_name_1", "")); try { if (settings.roundContactImages) { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_1", ""), true, null, NetworkedCacheableImageView.CIRCLE); ImageUtils.loadCircleImage(context, proPic2, sharedPrefs.getString("profile_pic_url_1", ""), mCache); } else { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_1", ""), true, null); ImageUtils.loadImage(context, proPic2, sharedPrefs.getString("profile_pic_url_1", ""), mCache); } } catch (Exception e) { } secondAccount.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (canSwitch) { context.sendBroadcast(new Intent("com.klinker.android.twitter.STOP_PUSH_SERVICE")); context.sendBroadcast(new Intent("com.klinker.android.twitter.MARK_POSITION") .putExtra("current_account", current)); Toast.makeText(context, "Preparing to switch", Toast.LENGTH_SHORT).show(); new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(1000); } catch (Exception e) { } sharedPrefs.edit().putInt("current_account", 1).commit(); sharedPrefs.edit().remove("new_notifications").remove("new_retweets") .remove("new_favorites").remove("new_follows").commit(); AppSettings.invalidate(); finish(); Intent next = new Intent(context, MainActivity.class); startActivity(next); } }).start(); } } }); } } statusBar = findViewById(R.id.activity_status_bar); statusBarHeight = Utils.getStatusBarHeight(context); navBarHeight = Utils.getNavBarHeight(context); try { RelativeLayout.LayoutParams statusParams = (RelativeLayout.LayoutParams) statusBar.getLayoutParams(); statusParams.height = statusBarHeight; statusBar.setLayoutParams(statusParams); } catch (Exception e) { try { LinearLayout.LayoutParams statusParams = (LinearLayout.LayoutParams) statusBar.getLayoutParams(); statusParams.height = statusBarHeight; statusBar.setLayoutParams(statusParams); } catch (Exception x) { // in the trends } } View navBarSeperater = findViewById(R.id.nav_bar_seperator); if (translucent && Utils.hasNavBar(context)) { try { RelativeLayout.LayoutParams navParams = (RelativeLayout.LayoutParams) navBarSeperater .getLayoutParams(); navParams.height = navBarHeight; navBarSeperater.setLayoutParams(navParams); } catch (Exception e) { try { LinearLayout.LayoutParams navParams = (LinearLayout.LayoutParams) navBarSeperater .getLayoutParams(); navParams.height = navBarHeight; navBarSeperater.setLayoutParams(navParams); } catch (Exception x) { // in the trends } } } if (translucent) { if (Utils.hasNavBar(context)) { View footer = new View(context); footer.setOnClickListener(null); footer.setOnLongClickListener(null); ListView.LayoutParams params = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, Utils.getNavBarHeight(context)); footer.setLayoutParams(params); drawerList.addFooterView(footer); drawerList.setFooterDividersEnabled(false); } View drawerStatusBar = findViewById(R.id.drawer_status_bar); LinearLayout.LayoutParams status2Params = (LinearLayout.LayoutParams) drawerStatusBar.getLayoutParams(); status2Params.height = statusBarHeight; drawerStatusBar.setLayoutParams(status2Params); drawerStatusBar.setVisibility(View.VISIBLE); statusBar.setVisibility(View.VISIBLE); drawerStatusBar = findViewById(R.id.drawer_status_bar_2); status2Params = (LinearLayout.LayoutParams) drawerStatusBar.getLayoutParams(); status2Params.height = statusBarHeight; drawerStatusBar.setLayoutParams(status2Params); drawerStatusBar.setVisibility(View.VISIBLE); } if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE || getResources().getBoolean(R.bool.isTablet)) { actionBar.setDisplayHomeAsUpEnabled(false); } if (!settings.pushNotifications) { try { mDrawerLayout.setDrawerLockMode(NotificationDrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.END); } catch (Exception e) { // no drawer? } } else { try { if (Build.VERSION.SDK_INT < 18 && DrawerActivity.settings.uiExtras) { View viewHeader2 = ((Activity) context).getLayoutInflater().inflate(R.layout.ab_header, null); notificationList.addHeaderView(viewHeader2, null, false); notificationList.setHeaderDividersEnabled(false); } } catch (Exception e) { // i don't know why it does this to be honest... } notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource.getInstance(context) .getUnreadCursor(DrawerActivity.settings.currentAccount)); try { notificationList.setAdapter(notificationAdapter); } catch (Exception e) { } View viewHeader = ((Activity) context).getLayoutInflater().inflate(R.layout.interactions_footer_1, null); notificationList.addFooterView(viewHeader, null, false); oldInteractions = (HoloTextView) findViewById(R.id.old_interactions_text); readButton = (ImageView) findViewById(R.id.read_button); LinearLayout footer = (LinearLayout) viewHeader.findViewById(R.id.footer); footer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (oldInteractions.getText().toString() .equals(getResources().getString(R.string.old_interactions))) { oldInteractions.setText(getResources().getString(R.string.new_interactions)); readButton.setImageResource(closedMailResource); notificationList.disableSwipeToDismiss(); notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getCursor(DrawerActivity.settings.currentAccount)); } else { oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); notificationList.enableSwipeToDismiss(); notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getUnreadCursor(DrawerActivity.settings.currentAccount)); } notificationList.setAdapter(notificationAdapter); } }); if (DrawerActivity.translucent) { if (Utils.hasNavBar(context)) { View nav = new View(context); nav.setOnClickListener(null); nav.setOnLongClickListener(null); ListView.LayoutParams params = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, Utils.getNavBarHeight(context)); nav.setLayoutParams(params); notificationList.addFooterView(nav); notificationList.setFooterDividersEnabled(false); } } notificationList.setDismissCallback(new EnhancedListView.OnDismissCallback() { @Override public EnhancedListView.Undoable onDismiss(EnhancedListView listView, int position) { Log.v("talon_interactions_delete", "position to delete: " + position); InteractionsDataSource data = InteractionsDataSource.getInstance(context); data.markRead(settings.currentAccount, position); notificationAdapter = new InteractionsCursorAdapter(context, data.getUnreadCursor(DrawerActivity.settings.currentAccount)); notificationList.setAdapter(notificationAdapter); oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); if (notificationAdapter.getCount() == 0) { setNotificationFilled(false); } return null; } }); notificationList.enableSwipeToDismiss(); notificationList.setSwipeDirection(EnhancedListView.SwipeDirection.START); notificationList .setOnItemClickListener(new InteractionClickListener(context, mDrawerLayout, mViewPager)); } }
From source file:com.klinker.android.twitter.activities.drawer_activities.DrawerActivity.java
public void setUpDrawer(int number, final String actName) { int currentAccount = sharedPrefs.getInt("current_account", 1); for (int i = 0; i < TimelinePagerAdapter.MAX_EXTRA_PAGES; i++) { String pageIdentifier = "account_" + currentAccount + "_page_" + (i + 1); int type = sharedPrefs.getInt(pageIdentifier, AppSettings.PAGE_TYPE_NONE); if (type != AppSettings.PAGE_TYPE_NONE) { number++;/*from ww w . j av a 2 s. c om*/ } } try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ex) { // Ignore } actionBar = getActionBar(); adapter = new MainDrawerArrayAdapter(context); MainDrawerArrayAdapter.setCurrent(context, number); TypedArray a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.drawerIcon }); int resource = a.getResourceId(0, 0); a.recycle(); a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.read_button }); openMailResource = a.getResourceId(0, 0); a.recycle(); a = context.getTheme().obtainStyledAttributes(new int[] { R.attr.unread_button }); closedMailResource = a.getResourceId(0, 0); a.recycle(); mDrawerLayout = (NotificationDrawerLayout) findViewById(R.id.drawer_layout); mDrawer = (LinearLayout) findViewById(R.id.left_drawer); HoloTextView name = (HoloTextView) mDrawer.findViewById(R.id.name); HoloTextView screenName = (HoloTextView) mDrawer.findViewById(R.id.screen_name); backgroundPic = (NetworkedCacheableImageView) mDrawer.findViewById(R.id.background_image); profilePic = (NetworkedCacheableImageView) mDrawer.findViewById(R.id.profile_pic_contact); final ImageButton showMoreDrawer = (ImageButton) mDrawer.findViewById(R.id.options); final LinearLayout logoutLayout = (LinearLayout) mDrawer.findViewById(R.id.logoutLayout); final Button logoutDrawer = (Button) mDrawer.findViewById(R.id.logoutButton); drawerList = (ListView) mDrawer.findViewById(R.id.drawer_list); notificationList = (EnhancedListView) findViewById(R.id.notificationList); try { mDrawerLayout = (NotificationDrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, Gravity.START); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow_rev, Gravity.END); mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ resource, /* nav drawer icon to replace 'Up' caret */ R.string.app_name, /* "open drawer" description */ R.string.app_name /* "close drawer" description */ ) { public void onDrawerClosed(View view) { actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); if (logoutVisible) { Animation ranim = AnimationUtils.loadAnimation(context, R.anim.drawer_rotate_back); ranim.setFillAfter(true); showMoreDrawer.startAnimation(ranim); logoutLayout.setVisibility(View.GONE); drawerList.setVisibility(View.VISIBLE); logoutVisible = false; } if (MainDrawerArrayAdapter.current > adapter.pageTypes.size()) { actionBar.setTitle(actName); } else { int position = mViewPager.getCurrentItem(); String title = ""; try { title = "" + mSectionsPagerAdapter.getPageTitle(position); } catch (NullPointerException e) { title = ""; } actionBar.setTitle(title); } try { if (oldInteractions.getText().toString() .equals(getResources().getString(R.string.new_interactions))) { oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); notificationList.enableSwipeToDismiss(); notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getUnreadCursor(DrawerActivity.settings.currentAccount)); notificationList.setAdapter(notificationAdapter); } } catch (Exception e) { // don't have talon pull on } invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { actionBar.setTitle(getResources().getString(R.string.app_name)); actionBar.setIcon(R.mipmap.ic_launcher); try { notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getUnreadCursor(settings.currentAccount)); notificationList.setAdapter(notificationAdapter); notificationList.enableSwipeToDismiss(); oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); sharedPrefs.edit().putBoolean("new_notification", false).commit(); } catch (Exception e) { // don't have talon pull on } invalidateOptionsMenu(); } public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, slideOffset); if (!actionBar.isShowing()) { actionBar.show(); } if (translucent) { statusBar.setVisibility(View.VISIBLE); } } }; mDrawerLayout.setDrawerListener(mDrawerToggle); } catch (Exception e) { // landscape mode } actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); showMoreDrawer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (logoutLayout.getVisibility() == View.GONE) { Animation ranim = AnimationUtils.loadAnimation(context, R.anim.drawer_rotate); ranim.setFillAfter(true); showMoreDrawer.startAnimation(ranim); Animation anim = AnimationUtils.loadAnimation(context, R.anim.fade_out); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { drawerList.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim.setDuration(300); drawerList.startAnimation(anim); Animation anim2 = AnimationUtils.loadAnimation(context, R.anim.fade_in); anim2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { logoutLayout.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim2.setDuration(300); logoutLayout.startAnimation(anim2); logoutVisible = true; } else { Animation ranim = AnimationUtils.loadAnimation(context, R.anim.drawer_rotate_back); ranim.setFillAfter(true); showMoreDrawer.startAnimation(ranim); Animation anim = AnimationUtils.loadAnimation(context, R.anim.fade_in); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { drawerList.setVisibility(View.VISIBLE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim.setDuration(300); drawerList.startAnimation(anim); Animation anim2 = AnimationUtils.loadAnimation(context, R.anim.fade_out); anim2.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { logoutLayout.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); anim2.setDuration(300); logoutLayout.startAnimation(anim2); logoutVisible = false; } } }); logoutDrawer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { logoutFromTwitter(); } }); final String sName = settings.myName; final String sScreenName = settings.myScreenName; final String backgroundUrl = settings.myBackgroundUrl; final String profilePicUrl = settings.myProfilePicUrl; final BitmapLruCache mCache = App.getInstance(context).getProfileCache(); if (!backgroundUrl.equals("")) { backgroundPic.loadImage(backgroundUrl, false, null); //ImageUtils.loadImage(context, backgroundPic, backgroundUrl, mCache); } else { backgroundPic.setImageDrawable(getResources().getDrawable(R.drawable.default_header_background)); } backgroundPic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { mDrawerLayout.closeDrawer(Gravity.START); } catch (Exception e) { } new Handler().postDelayed(new Runnable() { @Override public void run() { Intent viewProfile = new Intent(context, ProfilePager.class); viewProfile.putExtra("name", sName); viewProfile.putExtra("screenname", sScreenName); viewProfile.putExtra("proPic", profilePicUrl); viewProfile.putExtra("tweetid", 0); viewProfile.putExtra("retweet", false); viewProfile.putExtra("long_click", false); context.startActivity(viewProfile); } }, 400); } }); backgroundPic.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { try { mDrawerLayout.closeDrawer(Gravity.START); } catch (Exception e) { } new Handler().postDelayed(new Runnable() { @Override public void run() { Intent viewProfile = new Intent(context, ProfilePager.class); viewProfile.putExtra("name", sName); viewProfile.putExtra("screenname", sScreenName); viewProfile.putExtra("proPic", profilePicUrl); viewProfile.putExtra("tweetid", 0); viewProfile.putExtra("retweet", false); viewProfile.putExtra("long_click", true); context.startActivity(viewProfile); } }, 400); return false; } }); try { name.setText(sName); screenName.setText("@" + sScreenName); name.setTextSize(15); screenName.setTextSize(15); } catch (Exception e) { // 7 inch tablet in portrait } try { if (settings.roundContactImages) { //profilePic.loadImage(profilePicUrl, false, null, NetworkedCacheableImageView.CIRCLE); ImageUtils.loadCircleImage(context, profilePic, profilePicUrl, mCache); } else { profilePic.loadImage(profilePicUrl, false, null); ImageUtils.loadImage(context, profilePic, profilePicUrl, mCache); } } catch (Exception e) { // empty path again } drawerList.setAdapter(adapter); drawerList.setOnItemClickListener(new MainDrawerClickListener(context, mDrawerLayout, mViewPager)); // set up for the second account int count = 0; // number of accounts logged in if (sharedPrefs.getBoolean("is_logged_in_1", false)) { count++; } if (sharedPrefs.getBoolean("is_logged_in_2", false)) { count++; } RelativeLayout secondAccount = (RelativeLayout) findViewById(R.id.second_profile); HoloTextView name2 = (HoloTextView) findViewById(R.id.name_2); HoloTextView screenname2 = (HoloTextView) findViewById(R.id.screen_name_2); NetworkedCacheableImageView proPic2 = (NetworkedCacheableImageView) findViewById(R.id.profile_pic_2); name2.setTextSize(15); screenname2.setTextSize(15); final int current = sharedPrefs.getInt("current_account", 1); // make a second account if (count == 1) { name2.setText(getResources().getString(R.string.new_account)); screenname2.setText(getResources().getString(R.string.tap_to_setup)); secondAccount.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (canSwitch) { if (current == 1) { sharedPrefs.edit().putInt("current_account", 2).commit(); } else { sharedPrefs.edit().putInt("current_account", 1).commit(); } context.sendBroadcast(new Intent("com.klinker.android.twitter.STOP_PUSH_SERVICE")); context.sendBroadcast(new Intent("com.klinker.android.twitter.MARK_POSITION")); Intent login = new Intent(context, LoginActivity.class); AppSettings.invalidate(); finish(); startActivity(login); } } }); } else { // switch accounts if (current == 1) { name2.setText(sharedPrefs.getString("twitter_users_name_2", "")); screenname2.setText("@" + sharedPrefs.getString("twitter_screen_name_2", "")); try { if (settings.roundContactImages) { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_2", ""), true, null, NetworkedCacheableImageView.CIRCLE); ImageUtils.loadCircleImage(context, proPic2, sharedPrefs.getString("profile_pic_url_2", ""), mCache); } else { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_2", ""), true, null); ImageUtils.loadImage(context, proPic2, sharedPrefs.getString("profile_pic_url_2", ""), mCache); } } catch (Exception e) { } secondAccount.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (canSwitch) { context.sendBroadcast(new Intent("com.klinker.android.twitter.STOP_PUSH_SERVICE")); context.sendBroadcast(new Intent("com.klinker.android.twitter.MARK_POSITION") .putExtra("current_account", current)); Toast.makeText(context, "Preparing to switch", Toast.LENGTH_SHORT).show(); // we want to wait a second so that the mark position broadcast will work new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(1000); } catch (Exception e) { } sharedPrefs.edit().putInt("current_account", 2).commit(); sharedPrefs.edit().remove("new_notifications").remove("new_retweets") .remove("new_favorites").remove("new_follows").commit(); AppSettings.invalidate(); finish(); Intent next = new Intent(context, MainActivity.class); startActivity(next); } }).start(); } } }); } else { name2.setText(sharedPrefs.getString("twitter_users_name_1", "")); screenname2.setText("@" + sharedPrefs.getString("twitter_screen_name_1", "")); try { if (settings.roundContactImages) { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_1", ""), true, null, NetworkedCacheableImageView.CIRCLE); ImageUtils.loadCircleImage(context, proPic2, sharedPrefs.getString("profile_pic_url_1", ""), mCache); } else { //proPic2.loadImage(sharedPrefs.getString("profile_pic_url_1", ""), true, null); ImageUtils.loadImage(context, proPic2, sharedPrefs.getString("profile_pic_url_1", ""), mCache); } } catch (Exception e) { } secondAccount.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (canSwitch) { context.sendBroadcast(new Intent("com.klinker.android.twitter.STOP_PUSH_SERVICE")); context.sendBroadcast(new Intent("com.klinker.android.twitter.MARK_POSITION") .putExtra("current_account", current)); Toast.makeText(context, "Preparing to switch", Toast.LENGTH_SHORT).show(); new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(1000); } catch (Exception e) { } sharedPrefs.edit().putInt("current_account", 1).commit(); sharedPrefs.edit().remove("new_notifications").remove("new_retweets") .remove("new_favorites").remove("new_follows").commit(); AppSettings.invalidate(); finish(); Intent next = new Intent(context, MainActivity.class); startActivity(next); } }).start(); } } }); } } statusBar = findViewById(R.id.activity_status_bar); statusBarHeight = Utils.getStatusBarHeight(context); navBarHeight = Utils.getNavBarHeight(context); try { RelativeLayout.LayoutParams statusParams = (RelativeLayout.LayoutParams) statusBar.getLayoutParams(); statusParams.height = statusBarHeight; statusBar.setLayoutParams(statusParams); } catch (Exception e) { try { LinearLayout.LayoutParams statusParams = (LinearLayout.LayoutParams) statusBar.getLayoutParams(); statusParams.height = statusBarHeight; statusBar.setLayoutParams(statusParams); } catch (Exception x) { // in the trends } } View navBarSeperater = findViewById(R.id.nav_bar_seperator); if (translucent && Utils.hasNavBar(context)) { try { RelativeLayout.LayoutParams navParams = (RelativeLayout.LayoutParams) navBarSeperater .getLayoutParams(); navParams.height = navBarHeight; navBarSeperater.setLayoutParams(navParams); } catch (Exception e) { try { LinearLayout.LayoutParams navParams = (LinearLayout.LayoutParams) navBarSeperater .getLayoutParams(); navParams.height = navBarHeight; navBarSeperater.setLayoutParams(navParams); } catch (Exception x) { // in the trends } } } if (translucent) { if (Utils.hasNavBar(context)) { View footer = new View(context); footer.setOnClickListener(null); footer.setOnLongClickListener(null); ListView.LayoutParams params = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, Utils.getNavBarHeight(context)); footer.setLayoutParams(params); drawerList.addFooterView(footer); drawerList.setFooterDividersEnabled(false); } View drawerStatusBar = findViewById(R.id.drawer_status_bar); LinearLayout.LayoutParams status2Params = (LinearLayout.LayoutParams) drawerStatusBar.getLayoutParams(); status2Params.height = statusBarHeight; drawerStatusBar.setLayoutParams(status2Params); drawerStatusBar.setVisibility(View.VISIBLE); statusBar.setVisibility(View.VISIBLE); drawerStatusBar = findViewById(R.id.drawer_status_bar_2); status2Params = (LinearLayout.LayoutParams) drawerStatusBar.getLayoutParams(); status2Params.height = statusBarHeight; drawerStatusBar.setLayoutParams(status2Params); drawerStatusBar.setVisibility(View.VISIBLE); } if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE || getResources().getBoolean(R.bool.isTablet)) { actionBar.setDisplayHomeAsUpEnabled(false); } if (!settings.pushNotifications || !settings.useInteractionDrawer) { try { mDrawerLayout.setDrawerLockMode(NotificationDrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.END); } catch (Exception e) { // no drawer? } } else { mDrawerLayout.setDrawerRightEdgeSize(this, .1f); try { if (Build.VERSION.SDK_INT < 18 && DrawerActivity.settings.uiExtras) { View viewHeader2 = ((Activity) context).getLayoutInflater().inflate(R.layout.ab_header, null); notificationList.addHeaderView(viewHeader2, null, false); notificationList.setHeaderDividersEnabled(false); } } catch (Exception e) { // i don't know why it does this to be honest... } notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource.getInstance(context) .getUnreadCursor(DrawerActivity.settings.currentAccount)); try { notificationList.setAdapter(notificationAdapter); } catch (Exception e) { } View viewHeader = ((Activity) context).getLayoutInflater().inflate(R.layout.interactions_footer_1, null); notificationList.addFooterView(viewHeader, null, false); oldInteractions = (HoloTextView) findViewById(R.id.old_interactions_text); readButton = (ImageView) findViewById(R.id.read_button); LinearLayout footer = (LinearLayout) viewHeader.findViewById(R.id.footer); footer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (oldInteractions.getText().toString() .equals(getResources().getString(R.string.old_interactions))) { oldInteractions.setText(getResources().getString(R.string.new_interactions)); readButton.setImageResource(closedMailResource); notificationList.disableSwipeToDismiss(); notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getCursor(DrawerActivity.settings.currentAccount)); } else { oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); notificationList.enableSwipeToDismiss(); notificationAdapter = new InteractionsCursorAdapter(context, InteractionsDataSource .getInstance(context).getUnreadCursor(DrawerActivity.settings.currentAccount)); } notificationList.setAdapter(notificationAdapter); } }); if (DrawerActivity.translucent) { if (Utils.hasNavBar(context)) { View nav = new View(context); nav.setOnClickListener(null); nav.setOnLongClickListener(null); ListView.LayoutParams params = new ListView.LayoutParams(ListView.LayoutParams.MATCH_PARENT, Utils.getNavBarHeight(context)); nav.setLayoutParams(params); notificationList.addFooterView(nav); notificationList.setFooterDividersEnabled(false); } } notificationList.setDismissCallback(new EnhancedListView.OnDismissCallback() { @Override public EnhancedListView.Undoable onDismiss(EnhancedListView listView, int position) { Log.v("talon_interactions_delete", "position to delete: " + position); InteractionsDataSource data = InteractionsDataSource.getInstance(context); data.markRead(settings.currentAccount, position); notificationAdapter = new InteractionsCursorAdapter(context, data.getUnreadCursor(DrawerActivity.settings.currentAccount)); notificationList.setAdapter(notificationAdapter); oldInteractions.setText(getResources().getString(R.string.old_interactions)); readButton.setImageResource(openMailResource); if (notificationAdapter.getCount() == 0) { setNotificationFilled(false); } return null; } }); notificationList.enableSwipeToDismiss(); notificationList.setSwipeDirection(EnhancedListView.SwipeDirection.START); notificationList .setOnItemClickListener(new InteractionClickListener(context, mDrawerLayout, mViewPager)); } }
From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java
private void mirrorTaskEnded(String result_code, String result_msg) { setUiEnabled();// www . ja v a 2s . c o m final LinearLayout ll_spin = (LinearLayout) findViewById(R.id.profile_progress_spin); ll_spin.setVisibility(LinearLayout.GONE); // mGp.syncHistoryAdapter=new AdapterSyncHistory(mContext, R.layout.sync_history_list_item_view, // mGp.syncHistoryList); // mGp.syncHistoryListView.setAdapter(mGp.syncHistoryAdapter); // setHistoryViewItemClickListener(); mGp.syncHistoryAdapter.setSyncHistoryList(mGp.syncHistoryList); mGp.syncHistoryAdapter.notifyDataSetChanged(); // playBackDefaultNotification(); // vibrateDefaultPattern(); mGp.msgListView.setFastScrollEnabled(true); util.flushLogFile(); setWifiOff(); if ((!isExtraSpecAutoTerm && mGp.settingAutoStart && mGp.settingAutoTerm) || (isExtraSpecAutoTerm && extraValueAutoTerm)) { if (mGp.settingErrorOption) { showMirrorThreadResult(result_code, result_msg); autoTerminateDlg(result_code, result_msg); } else { if (result_code.equals("OK")) { showMirrorThreadResult(result_code, result_msg); autoTerminateDlg(result_code, result_msg); } else { mGp.settingAutoTerm = false; showMirrorThreadResult(result_code, result_msg); if (!util.isActivityForeground()) saveTaskData(); util.rotateLogFile(); mGp.mirrorThreadActive = false; } } } else { showMirrorThreadResult(result_code, result_msg); util.rotateLogFile(); if (!util.isActivityForeground()) saveTaskData(); mGp.mirrorThreadActive = false; } }
From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java
private void autoTimer(final ThreadCtrl threadCtl, final NotifyEvent at_ne, final String msg) { setUiDisabled();/*from w w w . ja v a 2 s.c o m*/ final Handler handler = new Handler(); new Thread(new Runnable() { @Override public void run() {//non UI thread ProgressBar pb = (ProgressBar) findViewById(R.id.profile_progress_bar_progress); pb.setMax(ATERM_WAIT_TIME); final TextView pm = (TextView) findViewById(R.id.profile_progress_bar_msg); for (int i = 0; i < ATERM_WAIT_TIME; i++) { try { if (threadCtl.isEnabled()) { final int ix = i; handler.post(new Runnable() { //UI thread @Override public void run() { String t_msg = String.format(msg, (ATERM_WAIT_TIME - ix)); pm.setText(t_msg); showNotificationMsg(t_msg); } }); // non UI thread pb.setProgress(i); } else { break; } Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } // dismiss progress bar dialog handler.post(new Runnable() {// UI thread @Override public void run() { LinearLayout ll_bar = (LinearLayout) findViewById(R.id.profile_progress_bar); ll_bar.setVisibility(LinearLayout.GONE); setUiEnabled(); if (mRequestAutoTimerExpired) {//Immediate process requested at_ne.notifyToListener(true, null); } else { if (threadCtl.isEnabled()) at_ne.notifyToListener(true, null); else at_ne.notifyToListener(false, null); } } }); } }).start(); }
From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java
private void autoStartDlg() { final ThreadCtrl threadCtl = new ThreadCtrl(); threadCtl.setEnabled();//enableAsyncTask(); final LinearLayout ll_bar = (LinearLayout) findViewById(R.id.profile_progress_bar); ll_bar.setVisibility(LinearLayout.VISIBLE); ll_bar.setBackgroundColor(Color.BLACK); ll_bar.bringToFront();// www.j av a 2 s .c o m final TextView title = (TextView) findViewById(R.id.profile_progress_bar_msg); title.setText(getString(R.string.msgs_progress_bar_dlg_astart_starting)); final Button btnCancel = (Button) findViewById(R.id.profile_progress_bar_btn_cancel); btnCancel.setText(getString(R.string.msgs_progress_bar_dlg_astart_cancel)); final Button btnImmed = (Button) findViewById(R.id.profile_progress_bar_btn_immediate); btnImmed.setText(getString(R.string.msgs_progress_bar_dlg_astart_immediate)); // CANCEL? btnCancel.setEnabled(true); btnCancel.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mGp.settingAutoTerm = false; btnCancel.setText(getString(R.string.msgs_progress_dlg_canceling)); btnCancel.setEnabled(false); threadCtl.setDisabled();//disableAsyncTask(); util.addLogMsg("W", getString(R.string.msgs_astart_canceling)); showNotificationMsg(getString(R.string.msgs_astart_canceling)); } }); final NotifyEvent at_ne = new NotifyEvent(mContext); at_ne.setListener(new NotifyEventListener() { @Override public void positiveResponse(Context c, Object[] o) { util.addDebugLogMsg(1, "I", "Auto timer was expired."); // showNotificationMsg(getString(R.string.msgs_astart_expired)); if (mGp.settingAutoStart || (isExtraSpecAutoStart && extraValueAutoStart)) { util.addDebugLogMsg(1, "I", "Auto sync was invoked."); boolean sel_prof = false; for (int i = 0; i < mGp.profileAdapter.getCount(); i++) { if (mGp.profileAdapter.getItem(i).getType().equals(SMBSYNC_PROF_TYPE_SYNC) && mGp.profileAdapter.getItem(i).isChecked()) { sel_prof = true; } } if (sel_prof) syncSelectedProfile(); else syncActiveProfile(); } } @Override public void negativeResponse(Context c, Object[] o) { util.addLogMsg("W", getString(R.string.msgs_astart_cancelled)); showNotificationMsg(getString(R.string.msgs_astart_cancelled)); mGp.mirrorThreadActive = false; clearScreenOn(); } }); // Immediate? btnImmed.setEnabled(true); btnImmed.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mRequestAutoTimerExpired = true; threadCtl.setDisabled();//disableAsyncTask(); } }); showNotificationMsg(getString(R.string.msgs_astart_started)); util.addLogMsg("I", getString(R.string.msgs_astart_started)); tabHost.setCurrentTab(1); if (extraValueAutoStart) { ll_bar.setVisibility(LinearLayout.GONE); at_ne.notifyToListener(true, null); } else { mRequestAutoTimerExpired = false; autoTimer(threadCtl, at_ne, getString(R.string.msgs_astart_after)); } }