Java tutorial
/* * Copyright 2013 Inmite s.r.o. (www.inmite.eu). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.ldzs.redpackets.ui.dialog; import android.app.Dialog; import android.content.Intent; import android.os.Bundle; import android.provider.Settings; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.widget.RelativeLayout; import com.ldzs.redpackets.R; /** * * * */ public class AlertDialogFragment extends DialogFragment { public static String TAG = "jayne"; private RelativeLayout layout; /*<item name="sdlTextPrimaryColor">@color/red</item> <item name="sdlTextSecondaryColor">@color/deep_red</item> <item name="sdlDividerColor">@color/deep_red</item> <item name="sdlPressedColor">@color/gray</item> <item name="colorAccent">@color/holo_red_light</item>*/ @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.MyAlertDialogStyle); builder.setTitle(R.string.open_service_title); builder.setMessage(R.string.open_service_sub_info); View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_open_service, null); layout = (RelativeLayout) view.findViewById(R.id.rl_container); builder.setView(view); builder.setPositiveButton(R.string.open_service, (dialog, which) -> { // Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS); startActivity(intent); dismiss(); }); // loadBannerAd(); return builder.create(); } public void loadBannerAd() { // // AdSettings.setKey(new String[]{"baidu", " "}); // // AdSettings.setSex(AdSettings.Sex.FEMALE); // // AdSettings.setBirthday(Calendar.getInstance()); // // AdSettings.setCity(""); // // AdSettings.setZip("123456"); // // AdSettings.setJob(""); // // AdSettings.setEducation(AdSettings.Education.BACHELOR); // // AdSettings.setSalary(AdSettings.Salary.F10kT15k); // // AdSettings.setHob(new String[]{"?", "?", "baseball"}); // // AdSettings.setUserAttr("k1","v1"); // // AdSettings.setUserAttr("k2","v2"); // // // View // String adPlaceId = AppConstant.BAIDU_BANNER; // ???ID?? // AdView adView = new AdView(getActivity(), adPlaceId); // // ? // adView.setListener(new AdViewListener() { // public void onAdSwitch() { // } // // public void onAdShow(JSONObject info) { // // ?? // } // // public void onAdReady(AdView adView) { // // ??? // } // // public void onAdFailed(String reason) { // } // // public void onAdClick(JSONObject info) { // // Log.w("", "onAdClick " + info.toString()); // } // }); // // adView(???addView??) // layout.addView(adView, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT)); } }