Example usage for android.widget LinearLayout bringToFront

List of usage examples for android.widget LinearLayout bringToFront

Introduction

In this page you can find the example usage for android.widget LinearLayout bringToFront.

Prototype

public void bringToFront() 

Source Link

Document

Change the view's z order in the tree, so it's on top of other sibling views.

Usage

From source file:org.borderstone.tagtags.TTStartActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    this.setTheme(R.style.AppTheme);
    this.setContentView(R.layout.activity_start);

    Toolbar toolbar = (Toolbar) this.findViewById(R.id.toolbar);
    //toolbar.inflateMenu(R.menu.menu_start);
    toolbar.setTitle("TagTags");

    toolbar.setVisibility(View.VISIBLE);

    TTStartActivity.me = getApplicationContext();

    protocol.setAction("android.intent.action.PROTOCOL");
    settings.setAction("android.intent.action.SETTINGS");

    Constants.init(new File(this.getFilesDir(), "bsettings.txt"), this.getApplicationContext());
    Constants.fileListener = this;

    /*Load variables that are stored in a text file
      keeping version info and info about third party
      resources here, for easy editing*/
    try {/*from   w w  w .jav  a 2 s .c o  m*/
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(this.getResources().openRawResource(R.raw.appinfo)));

        String line = reader.readLine();

        String[] t;
        while (line != null) {
            t = line.split(":");
            if (line.startsWith("#thirdparty:"))
                thirdparty += t[1] + "\n";
            else if (line.startsWith("#recentchanges:"))
                recentchanges += "-- " + t[1] + "\n";

            line = reader.readLine();
        }

        //just to remove the final new line.
        if (!thirdparty.equals(""))
            thirdparty = thirdparty.substring(0, thirdparty.length() - 1);
        if (!recentchanges.equals(""))
            recentchanges = recentchanges.substring(0, recentchanges.length() - 1);
    } catch (Exception ignored) {
    }

    //Most of the code below is purely for aesthetics!

    txtPhilosophy = new BTitleLabel(this);
    txtPhilosophy.setTypeface(Typeface.DEFAULT_BOLD);
    txtPhilosophy.setLayoutParams(Constants.defaultParams);
    txtPhilosophy.setOnClickListener(this);
    txtPhilosophy.setTextColor(Color.BLACK);

    txtVersion = new BStandardLabel(this);
    txtVersion.setText("Recent changes:\n" + recentchanges);
    txtVersion.setLayoutParams(Constants.defaultParams);
    txtVersion.setTextColor(Color.BLACK);

    try {
        PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        toolbar.setSubtitle("v. " + pInfo.versionName);
    } catch (PackageManager.NameNotFoundException ignored) {
    }

    toolbar.setNavigationIcon(R.drawable.drawer);

    ImageView slu = new ImageView(this);
    ImageView sites = new ImageView(this);

    slu.setImageResource(R.drawable.slulogo);
    sites.setImageResource(R.drawable.sites);

    LinearLayout llLogos = new LinearLayout(this);
    llLogos.setOrientation(LinearLayout.HORIZONTAL);
    llLogos.setGravity(Gravity.END | Gravity.CENTER_VERTICAL);

    llLogos.addView(slu);
    llLogos.addView(sites);

    setPhiloText();

    LinearLayout back = (LinearLayout) this.findViewById(R.id.back);
    back.setOrientation(LinearLayout.VERTICAL);

    txtPhilosophy.setLayoutParams(Constants.defaultParams);
    txtPhilosophy.setBackgroundResource(R.drawable.border);

    txtVersion.setLayoutParams(Constants.defaultParams);
    txtVersion.setBackgroundResource(R.drawable.border_recurring);

    back.addView(txtPhilosophy);
    back.addView(txtVersion);
    back.addView(llLogos);

    lblSettings = new BButton(this);
    lblDownload = new BButton(this);

    lblDownload.setIcon(R.drawable.download);
    lblSettings.setIcon(R.drawable.settings);

    lblSettings.setText("Settings");
    lblDownload.setText("Download from server");

    lblSettings.setOnClickListener(this);
    lblDownload.setOnClickListener(this);

    if (!checkPermissions()) {
        final Intent intro = new Intent();
        intro.setAction("android.intent.action.INTRO");

        this.startActivity(intro);
    }

    BTitleLabel lblProperties = new BTitleLabel(this);
    BTitleLabel lblLocal = new BTitleLabel(this);
    fileNavView = new BFileNavView(this, this);

    lblProperties.setTextSize(Constants.fontSize + 2);
    lblLocal.setTextSize(Constants.fontSize + 2);

    lblProperties.setText("PROPERTIES");
    lblProperties.setTextColor(Color.WHITE);
    lblProperties.setGravity(Gravity.CENTER);
    lblLocal.setText("LOCAL FILES");
    lblLocal.setTextColor(Color.WHITE);
    lblLocal.setGravity(Gravity.CENTER);

    final DrawerLayout drawerLayout = (DrawerLayout) this.findViewById(R.id.startDrawerLayout);
    final LinearLayout drawer = (LinearLayout) this.findViewById(R.id.drawer);
    drawer.setClickable(false);
    drawer.bringToFront();

    drawer.addView(lblProperties);
    drawer.addView(lblDownload);
    drawer.addView(lblSettings);
    drawer.addView(lblLocal);
    drawer.addView(fileNavView);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!drawerLayout.isDrawerOpen(Gravity.LEFT))
                drawerLayout.openDrawer(Gravity.LEFT);
            else
                drawerLayout.closeDrawer(Gravity.LEFT);
        }
    });
}

From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java

public void setOverlayVisibility(boolean isVisible) {
    final LinearLayout overlay = (LinearLayout) findViewById(R.id.overlay);

    if (isVisible) {
        overlay.setVisibility(View.VISIBLE);
        overlay.setClickable(true);/*  w ww.  j  a v a 2  s  . c o  m*/
        overlay.bringToFront();
    } else {
        overlay.setVisibility(View.GONE);
    }
}

From source file:info.johannblake.shutterstockdemo.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mContext = this;
    mAppTerminating = false;/* w  w w.  j  av  a  2s.  c  o m*/

    // Create a cache to store downloaded images.
    CacheSupport.createCache(mContext);

    restoreAppState();

    NavigationDrawerFragment navigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager()
            .findFragmentById(R.id.navigation_drawer);

    // Set up the drawer.
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    navigationDrawerFragment.setUp(R.id.navigation_drawer, mDrawerLayout);

    if (!INCLUDE_NAV_DRAWER)
        mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(getString(R.string.app_name));
    toolbar.inflateMenu(R.menu.options_menu);

    mMenuItemSearch = toolbar.getMenu().findItem(R.id.search);
    mSearchView = (SearchView) mMenuItemSearch.getActionView();

    mSearchView.setOnQueryTextListener(queryTextListener);

    // Note: Calling mSearchView.setQuery doesn't set the SearchView's input field
    // probably because the SearchView's layout is inflated each time the search
    // icon is tapped. To set the input field, it has to be done after the
    // button has been tapped. Presumably, the SearchView's layout is inflated at that
    // moment.
    mSearchView.setOnSearchClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mSearchView.setQuery(mQuery, false);
        }
    });

    if (INCLUDE_NAV_DRAWER) {
        // Display the hamburger icon.
        toolbar.setNavigationIcon(R.drawable.ic_hamburger);
    }

    // Handle the user tapping on the hamburger icon.
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (INCLUDE_NAV_DRAWER)
                mDrawerLayout.openDrawer(Gravity.START);
        }
    });

    // Move the toolbar up/down as the user scrolls the recyclerview.
    final LinearLayout llHeader = (LinearLayout) findViewById(R.id.llHeader);

    llHeader.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            final CustomRecyclerView rvImages = (CustomRecyclerView) findViewById(R.id.rvImages);
            rvImages.setOverScrollMode(ScrollView.OVER_SCROLL_NEVER);

            rvImages.setY(llHeader.getHeight());
            mJBHeaderScroll = new JBHeaderScroll(llHeader, 0);
            mJBHeaderScroll.registerScroller(rvImages, new JBHeaderScroll.IJBHeaderScroll() {
                @Override
                public void onResize(float top) {
                    ViewGroup.LayoutParams rlLayoutParams = new ViewGroup.LayoutParams(
                            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
                    rvImages.setLayoutParams(rlLayoutParams);
                    rvImages.setY(top);
                    llHeader.bringToFront();
                }

                @Override
                public int onHeaderBeforeAnimation(boolean scrollingUp, float scrollDelta) {
                    return JBHeaderScroll.ANIMATE_HEADER_USE_DEFAULT;
                }

                @Override
                public void onHeaderAfterAnimation(boolean animatedUp, float scrollDelta) {
                }
            });

            rvImages.setJBHeaderRef(mJBHeaderScroll);
            llHeader.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        }
    });
}

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();

    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?//w  w w  .j  a va  2  s.  c  o  m
    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));
    }
}

From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java

private void autoTerminateDlg(final String result_code, final String result_msg) {
    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();

    final TextView title = (TextView) findViewById(R.id.profile_progress_bar_msg);
    title.setText("");
    final Button btnCancel = (Button) findViewById(R.id.profile_progress_bar_btn_cancel);
    btnCancel.setText(getString(R.string.msgs_progress_bar_dlg_aterm_cancel));
    final Button btnImmed = (Button) findViewById(R.id.profile_progress_bar_btn_immediate);
    btnImmed.setText(getString(R.string.msgs_progress_bar_dlg_aterm_immediate));

    // CANCEL?// w w  w .  ja  va 2  s  .c  o  m
    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_aterm_canceling));
            showNotificationMsg(getString(R.string.msgs_aterm_canceling));
        }
    });

    final NotifyEvent at_ne = new NotifyEvent(mContext);
    at_ne.setListener(new NotifyEventListener() {
        @Override
        public void positiveResponse(Context c, Object[] o) {
            util.addLogMsg("I", getString(R.string.msgs_aterm_expired));
            if (mGp.settingAutoTerm || (isExtraSpecAutoStart && extraValueAutoStart)) {
                svcStopForeground(true);
                //Wait until stopForeground() completion 
                Handler hndl = new Handler();
                hndl.post(new Runnable() {
                    @Override
                    public void run() {
                        util.addDebugLogMsg(1, "I", "Auto termination was invoked.");
                        if (!mGp.settingBgTermNotifyMsg.equals(SMBSYNC_BG_TERM_NOTIFY_MSG_NO)) {
                            //                        Log.v("","result code="+result_code+", result_msg="+result_msg);
                            if (mGp.settingBgTermNotifyMsg.equals(SMBSYNC_BG_TERM_NOTIFY_MSG_ALWAYS))
                                NotificationUtil.showNoticeMsg(mContext, mGp, result_msg);
                            else {
                                if (!result_code.equals("OK")) {
                                    NotificationUtil.showNoticeMsg(mContext, mGp, result_msg);
                                } else {
                                    NotificationUtil.clearNotification(mGp);
                                }
                            }
                        } else {
                            NotificationUtil.clearNotification(mGp);
                        }
                        //                     saveTaskData();
                        util.flushLogFile();
                        terminateApplication();
                    }
                });
            }
        }

        @Override
        public void negativeResponse(Context c, Object[] o) {
            util.addLogMsg("W", getString(R.string.msgs_aterm_cancelled));
            showNotificationMsg(getString(R.string.msgs_aterm_cancelled));
            util.rotateLogFile();
            mGp.mirrorThreadActive = false;
        }
    });

    // Immediate?
    btnImmed.setEnabled(true);
    btnImmed.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            mRequestAutoTimerExpired = true;
            threadCtl.setDisabled();//disableAsyncTask();
        }
    });

    //      Log.v("","e="+extraDataSpecifiedAutoTerm);
    util.addLogMsg("I", getString(R.string.msgs_aterm_started));
    if (extraValueAutoTerm) {
        util.addLogMsg("I", getString(R.string.msgs_aterm_back_ground_term));
        at_ne.notifyToListener(true, null);
    } else if (!util.isActivityForeground()) {
        util.addLogMsg("I", getString(R.string.msgs_aterm_back_ground_term));
        at_ne.notifyToListener(true, null);
    } else {
        mRequestAutoTimerExpired = false;
        autoTimer(threadCtl, at_ne, getString(R.string.msgs_aterm_terminate_after));
    }
}

From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java

private void showConfirmDialog(String fp, String method) {

    util.addDebugLogMsg(1, "I", "showConfirmDialog entered");
    final NotifyEvent ntfy = new NotifyEvent(mContext);
    ntfy.setListener(new NotifyEventListener() {
        @Override/*  w  ww  . ja va 2  s  . c  om*/
        public void positiveResponse(Context c, Object[] o) {
            try {
                mSvcClient.aidlConfirmResponse((Integer) o[0]);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }

        @Override
        public void negativeResponse(Context c, Object[] o) {
            try {
                mSvcClient.aidlConfirmResponse((Integer) o[0]);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    });

    final LinearLayout ll_confirm = (LinearLayout) findViewById(R.id.profile_confirm);
    ll_confirm.setVisibility(LinearLayout.VISIBLE);
    ll_confirm.setBackgroundColor(Color.BLACK);
    ll_confirm.bringToFront();
    TextView dlg_title = (TextView) findViewById(R.id.copy_delete_confirm_title);
    TextView dlg_msg = (TextView) findViewById(R.id.copy_delete_confirm_msg);
    dlg_title.setText(mContext.getString(R.string.msgs_common_dialog_warning));
    dlg_title.setTextColor(Color.YELLOW);
    String msg_text = "";
    if (method.equals(SMBSYNC_CONFIRM_FOR_COPY)) {
        msg_text = String.format(getString(R.string.msgs_mirror_confirm_copy_confirm), fp);
    } else {
        msg_text = String.format(getString(R.string.msgs_mirror_confirm_delete_confirm), fp);
    }
    dlg_msg.setText(msg_text);

    showNotificationMsg(msg_text);

    if (method.equals(SMBSYNC_CONFIRM_FOR_COPY))
        dlg_msg.setText(String.format(getString(R.string.msgs_mirror_confirm_copy_confirm), fp));
    else
        dlg_msg.setText(String.format(getString(R.string.msgs_mirror_confirm_delete_confirm), fp));

    Button btnYes = (Button) findViewById(R.id.copy_delete_confirm_yes);
    Button btnYesAll = (Button) findViewById(R.id.copy_delete_confirm_yesall);
    final Button btnNo = (Button) findViewById(R.id.copy_delete_confirm_no);
    Button btnNoAll = (Button) findViewById(R.id.copy_delete_confirm_noall);
    Button btnTaskCancel = (Button) findViewById(R.id.copy_delete_confirm_task_cancel);

    // Yes?
    btnYes.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            ll_confirm.setVisibility(LinearLayout.GONE);
            ntfy.notifyToListener(true, new Object[] { SMBSYNC_CONFIRM_RESP_YES });
        }
    });
    // YesAll?
    btnYesAll.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            ll_confirm.setVisibility(LinearLayout.GONE);
            ntfy.notifyToListener(true, new Object[] { SMBSYNC_CONFIRM_RESP_YESALL });
        }
    });
    // No?
    btnNo.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            ll_confirm.setVisibility(LinearLayout.GONE);
            ntfy.notifyToListener(false, new Object[] { SMBSYNC_CONFIRM_RESP_NO });
        }
    });
    // NoAll?
    btnNoAll.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            ll_confirm.setVisibility(LinearLayout.GONE);
            ntfy.notifyToListener(false, new Object[] { SMBSYNC_CONFIRM_RESP_NOALL });
        }
    });
    // Task cancel?
    btnTaskCancel.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            ll_confirm.setVisibility(LinearLayout.GONE);
            try {
                mSvcClient.aidlCancelThread();
            } catch (RemoteException e) {
                e.printStackTrace();
            }
            ntfy.notifyToListener(false, new Object[] { SMBSYNC_CONFIRM_RESP_NOALL });
        }
    });
}

From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java

private void startMirrorTask(ArrayList<MirrorIoParmList> alp) {
    final LinearLayout ll_spin = (LinearLayout) findViewById(R.id.profile_progress_spin);
    final Button btnCancel = (Button) findViewById(R.id.profile_progress_spin_btn_cancel);
    ll_spin.setVisibility(LinearLayout.VISIBLE);
    ll_spin.setBackgroundColor(Color.BLACK);
    ll_spin.bringToFront();

    btnCancel.setText(getString(R.string.msgs_progress_spin_dlg_sync_cancel));
    btnCancel.setEnabled(true);/*from   ww w  .ja v  a2s . co  m*/
    // CANCEL?
    btnCancel.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            try {
                mSvcClient.aidlCancelThread();
            } catch (RemoteException e) {
                e.printStackTrace();
            }
            btnCancel.setText(getString(R.string.msgs_progress_dlg_canceling));
            btnCancel.setEnabled(false);
            mGp.settingAutoTerm = false;
        }
    });

    mGp.msgListView.setFastScrollEnabled(false);

    mGp.mirrorIoParms = alp;

    setUiDisabled();
    mGp.mirrorThreadActive = true;
    try {
        mSvcClient.aidlStartThread();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    setScreenOn();
    acqWifiLock();

}