Example usage for android.widget LinearLayout setBackgroundColor

List of usage examples for android.widget LinearLayout setBackgroundColor

Introduction

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

Prototype

@RemotableViewMethod
public void setBackgroundColor(@ColorInt int color) 

Source Link

Document

Sets the background color for this view.

Usage

From source file:com.luseen.spacenavigation.SpaceNavigationView.java

@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);

    /**/*w  ww. j a  va 2s  . c o  m*/
     * Restore current item index from savedInstance
     */
    restoreCurrentItem();

    /**
     * Trow exceptions if items size is greater than 4 or lesser than 2
     */
    if (spaceItems.size() < 2) {
        throw new NullPointerException("Your space item count must be greater than 1 ,"
                + " your current items count is : " + spaceItems.size());
    }

    if (spaceItems.size() > 4) {
        throw new IndexOutOfBoundsException(
                "Your items count maximum can be 4," + " your current items count is : " + spaceItems.size());
    }

    /**
     * Get left or right content width
     */
    contentWidth = (w - spaceNavigationHeight) / 2;

    /**
     * Removing all view for not being duplicated
     */
    removeAllViews();

    /**
     * Views initializations and customizing
     */
    RelativeLayout mainContent = new RelativeLayout(context);
    RelativeLayout centreBackgroundView = new RelativeLayout(context);

    LinearLayout leftContent = new LinearLayout(context);
    LinearLayout rightContent = new LinearLayout(context);

    BezierView centreContent = buildBezierView();

    FloatingActionButton fab = new FloatingActionButton(context);
    fab.setSize(FloatingActionButton.SIZE_NORMAL);
    fab.setBackgroundTintList(ColorStateList.valueOf(centreButtonColor));
    fab.setImageResource(centreButtonIcon);
    fab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            if (spaceOnClickListener != null)
                spaceOnClickListener.onCentreButtonClick();
        }
    });

    /**
     * Set fab layout params
     */
    LayoutParams fabParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    fabParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    fabParams.setMargins(centreContentMargin, centreContentMargin, centreContentMargin, centreContentMargin);

    /**
     * Main content size
     */
    LayoutParams mainContentParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, mainContentHeight);
    mainContentParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

    /**
     * Centre content size
     */
    LayoutParams centreContentParams = new LayoutParams(centreContentWight, spaceNavigationHeight);
    centreContentParams.addRule(RelativeLayout.CENTER_HORIZONTAL);

    /**
     * Centre Background View content size and position
     */
    LayoutParams centreBackgroundViewParams = new LayoutParams(centreContentWight, mainContentHeight);
    centreBackgroundViewParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
    centreBackgroundViewParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

    /**
     * Left content size
     */
    LayoutParams leftContentParams = new LayoutParams(contentWidth, ViewGroup.LayoutParams.MATCH_PARENT);
    leftContentParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    leftContentParams.addRule(LinearLayout.HORIZONTAL);

    /**
     * Right content size
     */
    LayoutParams rightContentParams = new LayoutParams(contentWidth, ViewGroup.LayoutParams.MATCH_PARENT);
    rightContentParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    rightContentParams.addRule(LinearLayout.HORIZONTAL);

    /**
     * Adding views background colors
     */
    leftContent.setBackgroundColor(spaceBackgroundColor);
    rightContent.setBackgroundColor(spaceBackgroundColor);
    centreBackgroundView.setBackgroundColor(spaceBackgroundColor);

    /**
     * Adding view to centreContent
     */
    centreContent.addView(fab, fabParams);

    /**
     * Adding views to mainContent
     */
    mainContent.addView(leftContent, leftContentParams);
    mainContent.addView(rightContent, rightContentParams);

    /**
     * Adding views to mainView
     */
    addView(centreBackgroundView, centreBackgroundViewParams);
    addView(centreContent, centreContentParams);
    addView(mainContent, mainContentParams);

    /**
     * Adding current space items to left and right content
     */
    addSpaceItems(leftContent, rightContent);

    /**
     * Redraw main view to make subviews visible
     */
    Utils.postRequestLayout(this);
}

From source file:com.sentaroh.android.SMBSync2.ActivityMain.java

@SuppressLint("InflateParams")
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void createTabView() {
    mMainTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mMainTabHost.setup();/*from  w w  w  .j  a v a 2 s  . co  m*/
    mMainTabWidget = (TabWidget) findViewById(android.R.id.tabs);

    if (Build.VERSION.SDK_INT >= 11) {
        mMainTabWidget.setStripEnabled(false);
        mMainTabWidget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    }

    CustomTabContentView tabViewProf = new CustomTabContentView(this, getString(R.string.msgs_tab_name_prof));
    mMainTabHost.addTab(mMainTabHost.newTabSpec(SMBSYNC_TAB_NAME_TASK).setIndicator(tabViewProf)
            .setContent(android.R.id.tabcontent));

    CustomTabContentView tabViewHist = new CustomTabContentView(this,
            getString(R.string.msgs_tab_name_history));
    mMainTabHost.addTab(mMainTabHost.newTabSpec(SMBSYNC_TAB_NAME_HIST).setIndicator(tabViewHist)
            .setContent(android.R.id.tabcontent));

    CustomTabContentView tabViewMsg = new CustomTabContentView(this, getString(R.string.msgs_tab_name_msg));
    mMainTabHost.addTab(mMainTabHost.newTabSpec(SMBSYNC_TAB_NAME_STATUS).setIndicator(tabViewMsg)
            .setContent(android.R.id.tabcontent));

    LinearLayout ll_main = (LinearLayout) findViewById(R.id.main_view);
    ll_main.setBackgroundColor(mGp.themeColorList.window_background_color_content);

    LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mProfileView = (LinearLayout) vi.inflate(R.layout.main_profile, null);
    mProfileView.setBackgroundColor(mGp.themeColorList.window_background_color_content);
    mHistoryView = (LinearLayout) vi.inflate(R.layout.main_history, null);
    mHistoryView.setBackgroundColor(mGp.themeColorList.window_background_color_content);
    mMessageView = (LinearLayout) vi.inflate(R.layout.main_msg, null);
    mMessageView.setBackgroundColor(mGp.themeColorList.window_background_color_content);

    mGp.msgListView = (ListView) mMessageView.findViewById(R.id.main_msg_view_list);
    mGp.syncTaskListView = (ListView) mProfileView.findViewById(R.id.main_profile_view_list);
    mGp.syncHistoryListView = (ListView) mHistoryView.findViewById(R.id.main_history_list);

    mGp.scheduleInfoView = (TextView) findViewById(R.id.main_schedule_view_info);
    mGp.scheduleInfoView.setTextColor(mGp.themeColorList.text_color_primary);

    mGp.confirmView = (LinearLayout) findViewById(R.id.main_dialog_confirm_view);
    mGp.confirmView.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color);
    mGp.confirmView.setVisibility(LinearLayout.GONE);
    mGp.confirmMsg = (TextView) findViewById(R.id.main_dialog_confirm_msg);
    mGp.confirmMsg.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.confirmCancel = (Button) findViewById(R.id.main_dialog_confirm_sync_cancel);
    setButtonColor(mGp.confirmCancel);
    if (mGp.themeColorList.theme_is_light)
        mGp.confirmCancel.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.confirmYes = (Button) findViewById(R.id.copy_delete_confirm_yes);
    setButtonColor(mGp.confirmYes);
    mGp.confirmYes.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.confirmNo = (Button) findViewById(R.id.copy_delete_confirm_no);
    setButtonColor(mGp.confirmNo);
    mGp.confirmNo.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.confirmYesAll = (Button) findViewById(R.id.copy_delete_confirm_yesall);
    setButtonColor(mGp.confirmYesAll);
    mGp.confirmYesAll.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.confirmNoAll = (Button) findViewById(R.id.copy_delete_confirm_noall);
    setButtonColor(mGp.confirmNoAll);
    mGp.confirmNoAll.setTextColor(mGp.themeColorList.text_color_primary);

    mGp.progressBarView = (LinearLayout) findViewById(R.id.main_dialog_progress_bar_view);
    mGp.progressBarView.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color);
    mGp.progressBarView.setVisibility(LinearLayout.GONE);
    mGp.progressBarMsg = (TextView) findViewById(R.id.main_dialog_progress_bar_msg);
    mGp.progressBarMsg.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.progressBarPb = (ProgressBar) findViewById(R.id.main_dialog_progress_bar_progress);

    mGp.progressBarCancel = (Button) findViewById(R.id.main_dialog_progress_bar_btn_cancel);
    setButtonColor(mGp.progressBarCancel);
    if (mGp.themeColorList.theme_is_light)
        mGp.progressBarCancel.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.progressBarImmed = (Button) findViewById(R.id.main_dialog_progress_bar_btn_immediate);
    setButtonColor(mGp.progressBarImmed);
    if (mGp.themeColorList.theme_is_light)
        mGp.progressBarImmed.setTextColor(mGp.themeColorList.text_color_primary);

    mGp.progressSpinView = (LinearLayout) findViewById(R.id.main_dialog_progress_spin_view);
    mGp.progressSpinView.setBackgroundColor(mGp.themeColorList.dialog_msg_background_color);
    mGp.progressSpinView.setVisibility(LinearLayout.GONE);
    mGp.progressSpinSyncprof = (TextView) findViewById(R.id.main_dialog_progress_spin_syncprof);
    mGp.progressSpinSyncprof.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.progressSpinMsg = (TextView) findViewById(R.id.main_dialog_progress_spin_syncmsg);
    mGp.progressSpinMsg.setTextColor(mGp.themeColorList.text_color_primary);
    mGp.progressSpinCancel = (Button) findViewById(R.id.main_dialog_progress_spin_btn_cancel);
    setButtonColor(mGp.progressSpinCancel);
    if (mGp.themeColorList.theme_is_light)
        mGp.progressSpinCancel.setTextColor(mGp.themeColorList.text_color_primary);

    createContextView();

    mMainViewPagerAdapter = new CustomViewPagerAdapter(this,
            new View[] { mProfileView, mHistoryView, mMessageView });
    mMainViewPager = (CustomViewPager) findViewById(R.id.main_view_pager);
    //       mMainViewPager.setBackgroundColor(mThemeColorList.window_color_background);
    mMainViewPager.setAdapter(mMainViewPagerAdapter);
    mMainViewPager.setOnPageChangeListener(new MainPageChangeListener());
    if (restartType == NORMAL_START) {
        mMainTabHost.setCurrentTabByTag(SMBSYNC_TAB_NAME_TASK);
        mMainViewPager.setCurrentItem(0);
    }
    mMainTabHost.setOnTabChangedListener(new MainOnTabChange());

}

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();/*from   w  w w.j  a  v  a  2s  .com*/

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

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();//from  w  w  w.j ava2 s .  com

    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?
    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//from  www.j a v a  2s  . 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.SMBSync2.ActivityMain.java

@SuppressLint("InflateParams")
private void aboutSMBSync() {
    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.about_dialog);

    final LinearLayout title_view = (LinearLayout) dialog.findViewById(R.id.about_dialog_title_view);
    final TextView title = (TextView) dialog.findViewById(R.id.about_dialog_title);
    title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color);
    title.setTextColor(mGp.themeColorList.text_color_dialog_title);
    title.setText(getString(R.string.msgs_dlg_title_about) + "(Ver " + packageVersionName + ")");

    // get our tabHost from the xml
    final TabHost tab_host = (TabHost) dialog.findViewById(R.id.about_tab_host);
    tab_host.setup();/*w  w  w .j  a  va 2 s  .c o  m*/

    final TabWidget tab_widget = (TabWidget) dialog.findViewById(android.R.id.tabs);

    if (Build.VERSION.SDK_INT >= 11) {
        tab_widget.setStripEnabled(false);
        tab_widget.setShowDividers(LinearLayout.SHOW_DIVIDER_NONE);
    }

    CustomTabContentView tabViewProf = new CustomTabContentView(this,
            getString(R.string.msgs_about_dlg_func_btn));
    tab_host.addTab(tab_host.newTabSpec("func").setIndicator(tabViewProf).setContent(android.R.id.tabcontent));

    CustomTabContentView tabViewHist = new CustomTabContentView(this,
            getString(R.string.msgs_about_dlg_change_btn));
    tab_host.addTab(
            tab_host.newTabSpec("change").setIndicator(tabViewHist).setContent(android.R.id.tabcontent));

    LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout ll_func = (LinearLayout) vi.inflate(R.layout.about_dialog_func, null);
    LinearLayout ll_change = (LinearLayout) vi.inflate(R.layout.about_dialog_change, null);

    final WebView func_view = (WebView) ll_func.findViewById(R.id.about_dialog_function);
    func_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_func_desc));
    func_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    func_view.getSettings().setBuiltInZoomControls(true);

    final WebView change_view = (WebView) ll_change.findViewById(R.id.about_dialog_change_history);
    change_view.loadUrl("file:///android_asset/" + getString(R.string.msgs_dlg_title_about_change_desc));
    change_view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    change_view.getSettings().setBuiltInZoomControls(true);

    final CustomViewPagerAdapter mAboutViewPagerAdapter = new CustomViewPagerAdapter(this,
            new WebView[] { func_view, change_view });
    final CustomViewPager mAboutViewPager = (CustomViewPager) dialog.findViewById(R.id.about_view_pager);
    //       mMainViewPager.setBackgroundColor(mThemeColorList.window_color_background);
    mAboutViewPager.setAdapter(mAboutViewPagerAdapter);
    mAboutViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            //             util.addDebugMsg(2,"I","onPageSelected entered, pos="+position);
            tab_widget.setCurrentTab(position);
            tab_host.setCurrentTab(position);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
            //             util.addDebugMsg(2,"I","onPageScrollStateChanged entered, state="+state);
        }

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
            //             util.addDebugMsg(2,"I","onPageScrolled entered, pos="+position);
        }
    });

    tab_host.setOnTabChangedListener(new OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            util.addDebugMsg(2, "I", "onTabchanged entered. tab=" + tabId);
            mAboutViewPager.setCurrentItem(tab_host.getCurrentTab());
        }
    });

    final Button btnOk = (Button) dialog.findViewById(R.id.about_dialog_btn_ok);

    CommonDialog.setDlgBoxSizeLimit(dialog, true);

    // OK?
    btnOk.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            dialog.dismiss();
        }
    });
    // Cancel?
    dialog.setOnCancelListener(new Dialog.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface arg0) {
            btnOk.performClick();
        }
    });

    dialog.show();
}

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();//from ww  w. ja  va 2  s. com

    btnCancel.setText(getString(R.string.msgs_progress_spin_dlg_sync_cancel));
    btnCancel.setEnabled(true);
    // 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();

}

From source file:com.sentaroh.android.SMBSync2.ActivityMain.java

private void confirmUseAppSpecificDir(final ArrayList<SyncTaskItem> alp, final NotifyEvent p_ntfy) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
    if (!prefs.getBoolean(getString(R.string.settings_suppress_warning_app_specific_dir), false)) {
        boolean app_specific_used = false;
        String prof_list = "", sep = "";
        for (int i = 0; i < alp.size(); i++) {
            if (alp.get(i).getTargetFolderType().equals(SyncTaskItem.SYNC_FOLDER_TYPE_INTERNAL)
                    || alp.get(i).getTargetFolderType().equals(SyncTaskItem.SYNC_FOLDER_TYPE_SDCARD)) {
                if (alp.get(i).getTargetDirectoryName().startsWith(APP_SPECIFIC_DIRECTORY)) {
                    app_specific_used = true;
                    prof_list += sep + alp.get(i).getSyncTaskName();
                    sep = ",";
                }//  ww  w .  ja v  a 2s.c o m
            }
        }
        if (app_specific_used) {
            final Dialog dialog = new Dialog(mActivity);//, android.R.style.Theme_Black);
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setContentView(R.layout.confirm_app_specific_dir_dlg);

            final LinearLayout title_view = (LinearLayout) dialog
                    .findViewById(R.id.confirm_app_specific_dlg_title_view);
            final TextView title = (TextView) dialog.findViewById(R.id.confirm_app_specific_dlg_title);
            title_view.setBackgroundColor(mGp.themeColorList.dialog_title_background_color);
            title.setText(mContext.getString(R.string.msgs_local_mount_point_app_specific_dir_used_title));
            title.setTextColor(mGp.themeColorList.text_color_warning);

            ((TextView) dialog.findViewById(R.id.confirm_app_specific_dlg_msg))
                    .setText(mContext.getString(R.string.msgs_local_mount_point_app_specific_dir_used_msg)
                            + "\n\n" + prof_list + "\n");

            final Button btnOk = (Button) dialog.findViewById(R.id.confirm_app_specific_dlg_ok);
            final Button btnCancel = (Button) dialog.findViewById(R.id.confirm_app_specific_dlg_cancel);
            final CheckedTextView ctvSuppr = (CheckedTextView) dialog
                    .findViewById(R.id.confirm_app_specific_dlg_ctv_suppress);
            CommonUtilities.setCheckedTextView(ctvSuppr);

            CommonDialog.setDlgBoxSizeCompact(dialog);
            ctvSuppr.setChecked(false);
            // OK?
            btnOk.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    dialog.dismiss();
                    if (ctvSuppr.isChecked()) {
                        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
                        prefs.edit().putBoolean(getString(R.string.settings_suppress_warning_app_specific_dir),
                                true).commit();
                    }
                    p_ntfy.notifyToListener(true, null);
                }
            });
            // Cancel?
            btnCancel.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    dialog.dismiss();
                    p_ntfy.notifyToListener(false, null);
                }
            });
            // Cancel?
            dialog.setOnCancelListener(new Dialog.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface arg0) {
                    btnOk.performClick();
                }
            });
            //            dialog.setOnKeyListener(new DialogOnKeyListener(mContext));
            //            dialog.setCancelable(false);
            dialog.show();
        } else {
            p_ntfy.notifyToListener(true, null);
        }
    } else {
        p_ntfy.notifyToListener(true, null);
    }
}