Java Code Examples for android.app.Dialog#setTitle()

The following examples show how to use android.app.Dialog#setTitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PreferActivity.java    From AndroidWebServ with Apache License 2.0 6 votes vote down vote up
@Override
protected void onPrepareDialog(int id, Dialog dialog) {
    switch (id) {
    case DLG_EDIT_PORT:
        final EditText editText = (EditText) dialog.findViewById(R.id.dlg_edittext);
        String text = Config.PORT + "";
        editText.setText(text);
        editText.setSelection(text.length());
        break;
    case DLG_LIST_ROOT:
        currentRoot = Config.WEBROOT;
        dialog.setTitle(currentRoot);
        final FileBrowser fileBrowser = (FileBrowser) dialog.findViewById(R.id.filebrowser);
        fileBrowser.browse(currentRoot);
        break;
    }
    super.onPrepareDialog(id, dialog);
}
 
Example 2
Source File: SendScreen.java    From smartcoins-wallet with MIT License 6 votes vote down vote up
@OnClick(R.id.contactButton)
void OnClickContactBtn(View view) {

    ArrayList<ContactListAdapter.ListviewContactItem> contacts = tinyDB.getContactObject("Contacts", ContactListAdapter.ListviewContactItem.class);

    if (contacts.size() > 0) {
        contactListDialog = new Dialog(this);
        contactListDialog.setTitle(getString(R.string.contacts));
        contactListDialog.setContentView(R.layout.contacts_list_send_screen);
        ListView listView = (ListView) contactListDialog.findViewById(R.id.contactsListSendScreen);
        listView.setAdapter(new ContactListDialogAdapter(this, this));
        int childCount = listView.getAdapter().getCount();
        setListViewHeightBasedOnChildren(listView, Math.min(5, childCount));
        contactListDialog.show();
    } else {
        Toast.makeText(this, R.string.empty_list, Toast.LENGTH_SHORT).show();
    }
}
 
Example 3
Source File: FileSelector.java    From IPTVFree with Apache License 2.0 6 votes vote down vote up
public FileSelector(final Context context, final FileOperation operation,
		final OnHandleFileListener onHandleFileListener, final String[] fileFilters) {
	mContext = context;
	mOnHandleFileListener = onHandleFileListener;

	final File sdCard = Environment.getExternalStorageDirectory();
	if (sdCard.canRead()) {
		mCurrentLocation = sdCard;
	} else {
		mCurrentLocation = Environment.getRootDirectory();
	}

	mDialog = new Dialog(context);
	mDialog.setContentView(R.layout.dialog);
	mDialog.setTitle(mCurrentLocation.getAbsolutePath());

	prepareFilterSpinner(fileFilters);
	prepareFilesList();

	setSaveLoadButton(operation);
	setNewFolderButton(operation);
	setCancelButton();
}
 
Example 4
Source File: EssayCommentActivity.java    From WeCenterMobile-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
	// TODO Auto-generated method stub
	aDialog = new Dialog(this);
	LayoutInflater inflater = LayoutInflater.from(this);
	View view = inflater.inflate(R.layout.dialog, null);
    zan = (Button) view.findViewById(R.id.zan);
	Button back = (Button) view.findViewById(R.id.backanswer);
	Button cancel = (Button) view.findViewById(R.id.cancel);
	voteval = comitems.get(arg2).getVotevalue();
	zanstatus();
	aDialog.setTitle("ѡ��");
	aDialog.setCanceledOnTouchOutside(true);
	aDialog.setContentView(view);
	zan.setOnClickListener(new Click(arg2));
	back.setOnClickListener(new Click(arg2));
	cancel.setOnClickListener(new Click(arg2));
	aDialog.show();
}
 
Example 5
Source File: CommentListActivity.java    From WeCenterMobile-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
	// TODO Auto-generated method stub
	aDialog = new Dialog(this);
	LayoutInflater inflater = LayoutInflater.from(this);
	View view = inflater.inflate(R.layout.dialog, null);
	Button zan = (Button) view.findViewById(R.id.zan);
	zan.setVisibility(View.GONE);
	Button back = (Button) view.findViewById(R.id.backanswer);
	Button cancel = (Button) view.findViewById(R.id.cancel);
	aDialog.setTitle("ѡ��");
	aDialog.setCanceledOnTouchOutside(true);
	aDialog.setContentView(view);
	zan.setOnClickListener(new Click(arg2));
	back.setOnClickListener(new Click(arg2));
	cancel.setOnClickListener(new Click(arg2));
	aDialog.show();
}
 
Example 6
Source File: About.java    From experimental-fall-detector-android-app with MIT License 6 votes vote down vote up
private void eula(Context context) {
    // Run the guardian
    Guardian.initiate(this);
    // Load the EULA
    final Dialog dialog = new Dialog(context);
    dialog.setContentView(R.layout.eula);
    dialog.setTitle("EULA");
    WebView web = (WebView) dialog.findViewById(R.id.eula);
    web.loadUrl("file:///android_asset/eula.html");
    Button accept = (Button) dialog.findViewById(R.id.accept);
    accept.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });
    dialog.show();
}
 
Example 7
Source File: CaptureActivity.java    From PacketCaptureTool with Eclipse Public License 1.0 6 votes vote down vote up
public void showCapturingDialog()
{
	/* 创建新的对话框显示抓包状态 */
	dlgCapturing = new Dialog(CaptureActivity.this.getActivity());
	dlgCapturing.setContentView(R.layout.capture_dialog);
	dlgCapturing.setTitle(R.string.capturing);
	dlgCapturing.setCancelable(false);
    
    btnStopCapture = (Button)dlgCapturing.findViewById(R.id.btnStopCapture);
    btnStopCapture.setText(R.string.stop_capture);
    btnStopCapture.setOnClickListener(new OnBtnStopCaptureClickListener());
    
    txtvwCaptureAmount = (TextView)dlgCapturing.findViewById(R.id.txtvwCaptureAmount);
    
    /* 启动统计线程 */
    enCaptureStatus = CaptureStatus.STATUS_CAPTURING;
    new Thread(new StatisticThread()).start();
    
    dlgCapturing.show();
}
 
Example 8
Source File: SortingDialogFragment.java    From MovieGuide with MIT License 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View dialogView = inflater.inflate(R.layout.sorting_options, null);
    unbinder = ButterKnife.bind(this, dialogView);
    initViews();

    Dialog dialog = new Dialog(getActivity());
    dialog.setContentView(dialogView);
    dialog.setTitle(R.string.sort_by);
    dialog.show();
    return dialog;
}
 
Example 9
Source File: ActivityMain.java    From XPrivacy with GNU General Public License v3.0 5 votes vote down vote up
private void optionTutorial() {
	((ScrollView) findViewById(R.id.svTutorialHeader)).setVisibility(View.VISIBLE);
	((ScrollView) findViewById(R.id.svTutorialDetails)).setVisibility(View.VISIBLE);
	int userId = Util.getUserId(Process.myUid());
	PrivacyManager.setSetting(userId, PrivacyManager.cSettingTutorialMain, Boolean.FALSE.toString());

	Dialog dlgUsage = new Dialog(this);
	dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON);
	dlgUsage.setTitle(R.string.title_usage_header);
	dlgUsage.setContentView(R.layout.usage);
	dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher));
	dlgUsage.setCancelable(true);
	dlgUsage.show();
}
 
Example 10
Source File: PickerDialog.java    From ColorPickerDialog with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.setTitle(getTitle());
    return dialog;
}
 
Example 11
Source File: TrackSave.java    From Androzic with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
	View rootView = inflater.inflate(R.layout.act_save, container);

	filename = (TextView) rootView.findViewById(R.id.filename_text);

	if (track.filepath != null)
	{
		File file = new File(track.filepath);
		filename.setText(file.getName());
	}
	else
	{
		filename.setText(FileUtils.sanitizeFilename(track.name) + ".plt");
	}

	final Dialog dialog = getDialog();

	Button cancelButton = (Button) rootView.findViewById(R.id.cancel_button);
	cancelButton.setOnClickListener(new View.OnClickListener() {
		@Override
		public void onClick(View v)
		{
			dialog.cancel();
		}
	});
	Button saveButton = (Button) rootView.findViewById(R.id.save_button);
	saveButton.setOnClickListener(saveOnClickListener);

	dialog.setTitle(R.string.savetrack_name);
	dialog.setCanceledOnTouchOutside(false);

	return rootView;
}
 
Example 12
Source File: SearchPrinterDialog.java    From esc-pos-android with Apache License 2.0 5 votes vote down vote up
public SearchPrinterDialog(Activity activity, BTService service) {
  this.activity = activity;
  this.service = service;
  deviceItems = new HashMap<>();

  @SuppressLint("InflateParams")
  View view = LayoutInflater.from(activity).inflate(R.layout.serach_dialog_layout, null, false);

  insets = dpToPx(16);
  activity.registerReceiver(receiver, new IntentFilter(BluetoothDevice.ACTION_FOUND));
  activity.registerReceiver(receiver, new IntentFilter(BluetoothDevice.ACTION_CLASS_CHANGED));
  activity.registerReceiver(receiver, new IntentFilter(BluetoothDevice.ACTION_NAME_CHANGED));
  activity.registerReceiver(receiver, new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED));

  Set<BluetoothDevice> pairedDevices = service.getBondedDevices();

  availableDevicesContainer = (LinearLayout) view.findViewById(R.id.available_devices_container);
  progress = view.findViewById(R.id.search_devices_progress);
  if (pairedDevices.size() > 0) {
    fillPairedDevices(pairedDevices, (LinearLayout) view.findViewById(R.id.paired_devices_container));
  } else {
    view.findViewById(R.id.paired_devices).setVisibility(View.GONE);
  }

  service.startDiscovery();

  dialog = new Dialog(activity);
  dialog.setCancelable(true);
  dialog.setContentView(view);
  dialog.setTitle(R.string.pos_title_choose_printer);
  dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
    @Override
    public void onCancel(DialogInterface dialogInterface) {
      SearchPrinterDialog.this.onCancel();
    }
  });
  dialog.show();
}
 
Example 13
Source File: DateFilterActivity.java    From financisto with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected Dialog onCreateDialog(final int id) {
	final Dialog d = new Dialog(this);
	d.setCancelable(true);
	d.setTitle(id == 1 ? R.string.period_from : R.string.period_to);
	d.setContentView(R.layout.filter_period_select);
	Button bOk = d.findViewById(R.id.bOK);
	bOk.setOnClickListener(v -> {
           setDialogResult(d, id == 1 ? cFrom : cTo);
           d.dismiss();
       });
	Button bCancel = d.findViewById(R.id.bCancel);
	bCancel.setOnClickListener(v -> d.cancel());
	return d;
}
 
Example 14
Source File: AboutAria2Dialog.java    From Aria2App with GNU General Public License v3.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.setTitle(R.string.about_aria2);
    return dialog;
}
 
Example 15
Source File: ActivityApp.java    From XPrivacy with GNU General Public License v3.0 5 votes vote down vote up
@SuppressLint("InflateParams")
public static void showHelp(ActivityBase context, View parent, Hook hook) {
	// Build dialog
	Dialog dlgHelp = new Dialog(context);
	dlgHelp.requestWindowFeature(Window.FEATURE_LEFT_ICON);
	dlgHelp.setTitle(R.string.app_name);
	dlgHelp.setContentView(R.layout.helpfunc);
	dlgHelp.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, context.getThemed(R.attr.icon_launcher));
	dlgHelp.setCancelable(true);

	// Set title
	TextView tvTitle = (TextView) dlgHelp.findViewById(R.id.tvTitle);
	tvTitle.setText(hook.getName());

	// Set info
	TextView tvInfo = (TextView) dlgHelp.findViewById(R.id.tvInfo);
	tvInfo.setText(Html.fromHtml(hook.getAnnotation()));
	tvInfo.setMovementMethod(LinkMovementMethod.getInstance());

	// Set permissions
	String[] permissions = hook.getPermissions();
	if (permissions != null && permissions.length > 0)
		if (!permissions[0].equals("")) {
			TextView tvPermissions = (TextView) dlgHelp.findViewById(R.id.tvPermissions);
			tvPermissions.setText(Html.fromHtml(TextUtils.join("<br />", permissions)));
		}

	dlgHelp.show();
}
 
Example 16
Source File: TrackExportDialog.java    From Androzic with GNU General Public License v3.0 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
	SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());

	View view = inflater.inflate(R.layout.dlg_exporttrack, container);

	nameText = (EditText) view.findViewById(R.id.name_text);
	nameText.setFilters(new InputFilter[] { filter });
	nameText.addTextChangedListener(this);
	formatSpinner = (Spinner) view.findViewById(R.id.format_spinner);

	color = (ColorButton) view.findViewById(R.id.color_button);
	color.setColor(prefs.getInt(getString(R.string.pref_tracking_currentcolor), getResources().getColor(R.color.currenttrack)), Color.RED);

	Calendar startTime = Calendar.getInstance();
	startTime.setTimeInMillis(locationService.getTrackStartTime());
	Calendar endTime = Calendar.getInstance();
	endTime.setTimeInMillis(locationService.getTrackEndTime());

	fromSliderContainer = (SliderContainer) view.findViewById(R.id.fromSliderContainer);
	fromSliderContainer.setMinuteInterval(1);
	fromSliderContainer.setTime(endTime);
	fromSliderContainer.setMinTime(startTime);
	fromSliderContainer.setMaxTime(endTime);
	fromSliderContainer.setMinuteInterval(60);
	fromSliderContainer.setOnTimeChangeListener(onFromTimeChangeListener);
	tillSliderContainer = (SliderContainer) view.findViewById(R.id.tillSliderContainer);
	tillSliderContainer.setMinuteInterval(1);
	tillSliderContainer.setTime(endTime);
	tillSliderContainer.setMinTime(startTime);
	tillSliderContainer.setMaxTime(endTime);
	tillSliderContainer.setMinuteInterval(60);
	tillSliderContainer.setOnTimeChangeListener(onTillTimeChangeListener);

	final Dialog dialog = getDialog();

	Button cancelButton = (Button) view.findViewById(R.id.cancel_button);
	cancelButton.setOnClickListener(new View.OnClickListener() {
		@Override
		public void onClick(View v)
		{
			dialog.cancel();
		}
	});
	saveButton = (Button) view.findViewById(R.id.save_button);
	saveButton.setOnClickListener(saveOnClickListener);

	validName = false;
	validDates = true;
	updateSaveButton();

	dialog.setTitle(R.string.exporttrack_name);
	dialog.setCanceledOnTouchOutside(false);
	return view;
}
 
Example 17
Source File: DynamicGridSizeFragment.java    From Trebuchet with GNU General Public License v3.0 4 votes vote down vote up
private void showNumberPicker() {
    mDialog = new Dialog(getActivity());
    mDialog.setTitle(getResources().getString(
            R.string.preferences_interface_homescreen_custom));
    mDialog.setContentView(R.layout.custom_grid_size_dialog);

    NumberPicker nPRows = (NumberPicker) mDialog.findViewById(R.id.custom_rows);
    NumberPicker nPColumns = (NumberPicker) mDialog.findViewById(R.id.custom_columns);

    InvariantDeviceProfile grid = getInvariantDeviceProfile();
    int rows = grid.numRowsBase;
    int columns = grid.numColumnsBase;

    nPRows.setMinValue(Math.max(MIN_DYNAMIC_GRID_ROWS, rows - InvariantDeviceProfile.GRID_SIZE_MIN));
    nPRows.setMaxValue(rows + InvariantDeviceProfile.GRID_SIZE_MAX);
    nPRows.setValue(mCustomGridRows);
    nPRows.setWrapSelectorWheel(false);
    nPRows.setOnValueChangedListener(this);
    nPRows.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);

    nPColumns.setMinValue(Math.max(MIN_DYNAMIC_GRID_COLUMNS,
            columns - InvariantDeviceProfile.GRID_SIZE_MIN));
    nPColumns.setMaxValue(columns + InvariantDeviceProfile.GRID_SIZE_MAX);
    nPColumns.setValue(mCustomGridColumns);
    nPColumns.setWrapSelectorWheel(false);
    nPColumns.setOnValueChangedListener(this);
    nPColumns.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);

    Button button = (Button) mDialog.findViewById(R.id.dialog_confirm_button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mDialog != null) {
                mDialog.dismiss();
            }
        }
    });

    mDialog.setOnDismissListener(this);
    mDialog.show();
}
 
Example 18
Source File: ListsDialog.java    From cathode with Apache License 2.0 4 votes vote down vote up
@NonNull @Override public Dialog onCreateDialog(@Nullable Bundle inState) {
  Dialog dialog = super.onCreateDialog(inState);
  dialog.setTitle(R.string.action_list_add);
  return dialog;
}
 
Example 19
Source File: RoomMembersDialogFragment.java    From matrix-android-console with Apache License 2.0 4 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog d = super.onCreateDialog(savedInstanceState);
    d.setTitle(getString(R.string.members_list));
    return d;
}
 
Example 20
Source File: PopupDialog.java    From zom-android-matrix with Apache License 2.0 4 votes vote down vote up
public static Dialog showPopupFromAnchor(final View anchor, int idLayout, boolean cancelable) {
    try {
        if (anchor == null || idLayout == 0) {
            return null;
        }

        final Context context = anchor.getContext();

        View rootView = anchor.getRootView();

        Rect rectAnchor = new Rect();
        int[] location = new int[2];
        anchor.getLocationInWindow(location);
        rectAnchor.set(location[0], location[1], location[0] + anchor.getWidth(), location[1] + anchor.getHeight());
        Rect rectRoot = new Rect();
        rootView.getLocationInWindow(location);
        rectRoot.set(location[0], location[1], location[0] + rootView.getWidth(), location[1] + rootView.getHeight());

        final Dialog dialog = new Dialog(context,
                android.R.style.Theme_Translucent_NoTitleBar);

        View dialogView = LayoutInflater.from(context).inflate(idLayout, (ViewGroup)anchor.getRootView(), false);

        dialogView.measure(
                    View.MeasureSpec.makeMeasureSpec(rectRoot.width(), View.MeasureSpec.AT_MOST),
                    View.MeasureSpec.makeMeasureSpec((rectAnchor.top - rectRoot.top), View.MeasureSpec.AT_MOST));

        dialog.setTitle(null);
        dialog.setContentView(dialogView);
        dialog.setCancelable(true);

        // Setting dialogview
        Window window = dialog.getWindow();
        WindowManager.LayoutParams wlp = window.getAttributes();
        wlp.x = rectAnchor.left - PopupDialog.dpToPx(20, context);
        wlp.y = rectAnchor.top - dialogView.getMeasuredHeight();
        wlp.width = dialogView.getMeasuredWidth();
        wlp.height = dialogView.getMeasuredHeight();
        wlp.gravity = Gravity.TOP | Gravity.START;
        wlp.dimAmount = 0.6f;
        wlp.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
        window.setAttributes(wlp);

        if (cancelable) {
            dialog.setCanceledOnTouchOutside(true);
        }

        View btnClose = dialogView.findViewById(R.id.btnClose);
        if (btnClose != null) {
            btnClose.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dialog.dismiss();
                }
            });
        }

        dialog.show();
        return dialog;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}