Example #1
1
  public static void manageAds(Activity activity) {
    final PackageManager pm = activity.getPackageManager();
    // get a list of installed apps.
    List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);

    boolean yboTvProFound = false;

    for (ApplicationInfo info : packages) {
      if (PACKAGE_PRO.equals(info.packageName)) {
        yboTvProFound = true;
        break;
      }
    }

    // Look up the AdView as a resource and load a request.
    AdView adView = (AdView) activity.findViewById(R.id.adView);
    if (yboTvProFound) {
      View layout = activity.findViewById(R.id.ad_container);
      FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) layout.getLayoutParams();
      layoutParams.bottomMargin = 0;
      layout.setLayoutParams(layoutParams);
      adView.setVisibility(View.GONE);
    } else {
      adView.loadAd(new AdRequest.Builder().build());
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    linearLayout = (LinearLayout) findViewById(R.id.linearLayout);

    adView_1 = new AdView(this);
    adView_1.setAdUnitId("ca-app-pub-2538596252160048/1329783818");
    adView_1.setAdSize(AdSize.BANNER);
    linearLayout.addView(adView_1);

    adView_2 = new AdView(this);
    adView_2.setAdUnitId("ca-app-pub-2538596252160048/1329783818");
    adView_2.setAdSize(AdSize.MEDIUM_RECTANGLE);
    linearLayout.addView(adView_2);

    interstitial = new InterstitialAd(this);
    interstitial.setAdUnitId("ca-app-pub-2538596252160048/1329783818");

    AdRequest adRequest =
        new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("AF8CDE91144F6A31C28629FD2573AB82")
            .build();

    adView_1.setAdListener(
        new AdListener() {
          @Override
          public void onAdLoaded() {
            Log.i("Script", "onAdLoaded()");
          }

          @Override
          public void onAdFailedToLoad(int error) {
            Log.i("Script", "onAdFailedToLoad(" + error + ")");
          }

          @Override
          public void onAdOpened() {
            Log.i("Script", "onAdOpened()");
          }

          @Override
          public void onAdClosed() {
            Log.i("Script", "onAdClosed()");
          }

          @Override
          public void onAdLeftApplication() {
            Log.i("Script", "onAdLeftApplication()");
          }
        });

    adView_1.loadAd(adRequest);
    adView_2.loadAd(adRequest);
    interstitial.loadAd(adRequest);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);

    // Registers the declared buttons with their id's, which were set when the layout was created.
    clearButton = (Button) findViewById(R.id.clearButton);
    oButton = (Button) findViewById(R.id.oButton);
    xButton = (Button) findViewById(R.id.xButton);
    topLeftButton = (Button) findViewById(R.id.topLeftButton);
    topMiddleButton = (Button) findViewById(R.id.topMiddleButton);
    topRightButton = (Button) findViewById(R.id.topRightButton);
    middleLeftButton = (Button) findViewById(R.id.middleLeftButton);
    middleButton = (Button) findViewById(R.id.middleButton);
    middleRightButton = (Button) findViewById(R.id.middleRightButton);
    bottomLeftButton = (Button) findViewById(R.id.bottomLeftButton);
    bottomMiddleButton = (Button) findViewById(R.id.bottomMiddleButton);
    bottomRightButton = (Button) findViewById(R.id.bottomRightButton);

    // calls the setupListeners method
    setupListeners();

    // Gets the ad view defined in layout/ad_fragment.xml with ad unit ID set in
    // values/strings.xml.
    mAdView = (AdView) findViewById(R.id.ad_view);

    // Create an ad request. Check your logcat output for the hashed device ID to
    // get test ads on a physical device. e.g.
    // "Use AdRequest.Builder.addTestDevice("ABCDEF012345") to get test ads on this device."
    AdRequest adRequest =
        new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();

    // Start loading the ad in the background.
    mAdView.loadAd(adRequest);
  }
Example #4
0
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    adView = new AdView(this);
    adView.setAdUnitId("ca-app-pub-9480879598480702/4025467071");
    adView.setAdSize(AdSize.SMART_BANNER);

    RelativeLayout rl = new RelativeLayout(this);
    RelativeLayout.LayoutParams lay =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);

    lay.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    com.google.android.gms.ads.AdRequest adRequest =
        new com.google.android.gms.ads.AdRequest.Builder()
            .addTestDevice("13F77AAABEE7FB57CF4FA6BD90138B61")
            .build();
    panel = new MainGamePanel(this, adView);
    rl.addView(panel);
    rl.addView(adView, lay);

    // Carregar o adView com a solicitação de anúncio.
    adView.loadAd(adRequest);
    setContentView(rl);

    // setContentView(panel);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_main, container, false);

    spinner = (ProgressBar) root.findViewById(R.id.spinner);
    spinner.setVisibility(View.GONE);

    Button btnTellJoke = (Button) root.findViewById(R.id.tell_joke_btn);
    btnTellJoke.setOnClickListener(this);

    mPublisherInterstitialAd = new PublisherInterstitialAd(getActivity());
    mPublisherInterstitialAd.setAdUnitId(getString(R.string.intertistial_ad_unit_id));

    mPublisherInterstitialAd.setAdListener(
        new AdListener() {
          @Override
          public void onAdClosed() {
            requestNewInterstitial();
            displayJokeIntent(joke);
          }
        });

    requestNewInterstitial();

    AdView mAdView = (AdView) root.findViewById(R.id.adView);
    AdRequest adRequest =
        new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
    mAdView.loadAd(adRequest);
    return root;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    ((ReadingChallengeApplication) getApplication()).inject(this);

    gridView = (GridView) findViewById(R.id.gridview);

    ((ReadingChallengeApplication) this.getApplication())
        .setDisplay(readSharedPreferences(getString(R.string.display)));

    // listen refresh event
    layout = (PullRefreshLayout) findViewById(R.id.swipeRefreshLayout);
    layout.setOnRefreshListener(
        new PullRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
            getCategories();
          }
        });
    getCategories();

    // admobs
    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

    // analytics
    ReadingChallengeApplication application = (ReadingChallengeApplication) getApplication();
    Tracker mTracker = application.getDefaultTracker();
    mTracker.setScreenName("HomeActivity");
    mTracker.send(new HitBuilders.ScreenViewBuilder().build());
  }
Example #7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mTracker = AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP);
    // Load an ad into the AdMob banner view.
    AdView adView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest =
        new AdRequest.Builder().setRequestAgent("android_studio:ad_template").build();
    adView.loadAd(adRequest);

    // Toasts the test ad message on the screen. Remove this after defining your own ad unit ID.
    Toast.makeText(this, TOAST_TEXT, Toast.LENGTH_LONG).show();
    mText = (EditText) findViewById(R.id.partno);
    mStart = findViewById(R.id.imageView1);

    mText.setOnEditorActionListener(ActionListener.newInstance(this));
    mStart.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (!TextUtils.isEmpty(mText.getText())) {
              String s = mText.getText().toString();
              Intent i = new Intent(getBaseContext(), Game.class);
              i.putExtra("number", s);
              startActivity(i);
              finish();
            } else {
              Toast.makeText(MainActivity.this, TOAST_TEXT, Toast.LENGTH_LONG).show();
            }
          }
        });
  }
 @Override
 public void setUp(View view) {
   AdView mAdView = (AdView) view.findViewById(R.id.adView);
   AdRequest adRequest =
       new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
   mAdView.loadAd(adRequest);
 }
Example #9
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    getSlidingMenu().setMode(SlidingMenu.LEFT);

    // getSlidingMenu().setSlidingEnabled(false);
    // getSlidingMenu().setSecondaryMenu(R.layout.layout_menu_left);

    me = MainActivity.this;

    initUI();
    Bundle extras = new Bundle();
    extras.putString("appname", "lich_van_lien_2016");
    extras.putString("appcat", "productivity");
    extras.putString("jb", "" + RootSupport.isDeviceRooted());

    AdMobExtras adExtra = new AdMobExtras(extras);

    mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest =
        new AdRequest.Builder()
            .addNetworkExtras(adExtra)
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("EDA8BB96AFAC4D787093E74267389265")
            .addTestDevice("3D7268CC8E6A7666958991A316D08A88")
            .addTestDevice("7AFC6206AD04A3073968C664E902FF5D")
            .addTestDevice("780C9B0B7E4E49713CFE54EEF2C2F0E7")
            .addTestDevice("48A720DA7ABCF53ECC3A00DEB6983B97")
            .build();
    mAdView.loadAd(adRequest);
  }
Example #10
0
 // ADS
 private void startAds() {
   AdView adView = (AdView) findViewById(R.id.adView);
   AdRequest adRequest =
       new AdRequest.Builder().addTestDevice("FA62693DA83DCD07CE56E8226B7FAF61").build();
   adView.loadAd(adRequest);
   adView.setVisibility(View.VISIBLE);
 }
Example #11
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_history);
    ButterKnife.inject(this);

    realm = Realm.getInstance(this);

    getSupportActionBar().setTitle("Riwayat Wisata");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    locationModels = new ArrayList<>();
    adapterRoute = new ListRouteAdapter(this, locationModels);

    updateView();

    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(adapterRoute);
    recyclerView.addOnItemTouchListener(
        new RecyclerItemClickListener(this, this) {
          @Override
          public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {}
        });
    readDataFromDb();

    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
  }
  @SuppressLint("SetJavaScriptEnabled")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_fragment_kqnhnt);
    Bundle extras = new Bundle();
    extras.putString("appname", "lich_van_lien_2016");
    extras.putString("appcat", "productivity");
    extras.putString("jb", "" + RootSupport.isDeviceRooted());

    AdMobExtras adExtra = new AdMobExtras(extras);

    mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest =
        new AdRequest.Builder()
            .addNetworkExtras(adExtra)
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("EDA8BB96AFAC4D787093E74267389265")
            .addTestDevice("3D7268CC8E6A7666958991A316D08A88")
            .addTestDevice("7AFC6206AD04A3073968C664E902FF5D")
            .addTestDevice("780C9B0B7E4E49713CFE54EEF2C2F0E7")
            .addTestDevice("48A720DA7ABCF53ECC3A00DEB6983B97")
            .build();
    mAdView.loadAd(adRequest);
    iv_back = (ImageView) findViewById(R.id.iv_back);
    iv_share = (ImageView) findViewById(R.id.iv_share);
    iv_back.setOnClickListener(this);
    iv_share.setOnClickListener(this);
    wv_ketqua_nhnt = (WebView) findViewById(R.id.wv_ketqua_nhnt);

    // VanTrinhNamDataBaseHelper vanTrinhNamDataBaseHelper = new
    // VanTrinhNamDataBaseHelper(this);
    // Bundle mBundle =getIntent().getExtras().getBundle("Bundle");
    // tv_ngaySinhDuongLich.setText(mBundle.getString("NGAY") + " - " +
    // mBundle.getString("THANG") + " - " + mBundle.getString("NAM"));
    // Calendar calendar = Calendar.getInstance();
    // CalendarUtil calendarUtil = new CalendarUtil();
    // int[] convert =
    // calendarUtil.convertSolar2Lunar(Integer.parseInt(mBundle.getString("NGAY")),
    // Integer.parseInt(mBundle.getString("THANG")),
    // Integer.parseInt(mBundle.getString("NAM")), 7);
    // calendar.set(Calendar.DAY_OF_MONTH, convert[0]);
    // calendar.set(Calendar.MONTH, convert[1] - 1);
    // calendar.set(Calendar.YEAR, convert[2]);
    //		Toast.makeText(getApplicationContext(),
    //				NguHanhNgayTotFragment.thongtin, Toast.LENGTH_LONG).show();
    //		String str = NguHanhNgayTotFragment.thongtin;
    //		html = "<html><body><font color ='#000000'" + NguHanhNgayTotFragment.thongtin
    //				+ "</font></body></html>";
    wv_ketqua_nhnt.getSettings().setJavaScriptEnabled(true);
    wv_ketqua_nhnt.getResources().getDimensionPixelSize(R.dimen.text_size_large);
    wv_ketqua_nhnt.loadDataWithBaseURL(
        null, NguHanhNgayTotFragment.thongtin, "text/html", "utf-8", null);
    // wv_ketqua_vantrinhnam.setBackgroundColor(Color.BLACK);

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
      wv_ketqua_nhnt.setAlpha(0.7f);
    }
  }
Example #13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.learndigits);
    try {

      toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);

      SharedPreferences pref = getSharedPreferences("ASL", Context.MODE_PRIVATE);
      CommonThings.PAID_APP = pref.getString("PAID", "temp");
      if (CommonThings.PAID_APP.equalsIgnoreCase("temp")) {

        AdView adView = (AdView) this.findViewById(R.id.adView);
        AdRequest adRequest =
            new AdRequest.Builder().addTestDevice("A38A51D43110AAD81A8E3AE3AC468C32").build();
        adView.loadAd(adRequest);

        // Interstitials ad

        interstitialAd = new InterstitialAd(this);
        interstitialAd.setAdUnitId(getResources().getString(R.string.interstitialid));
        interstitialAd.loadAd(adRequest);
        interstitialAd.setAdListener(
            new AdListener() {
              @Override
              public void onAdLoaded() {
                // TODO Auto-generated method stub
                DisplayAd();
              }
            });
      }

      //

      btn_nex = (ImageButton) findViewById(R.id.btnForward);
      btn_back = (ImageButton) findViewById(R.id.btnBackward);
      btn_last = (ImageButton) findViewById(R.id.btnNext);
      btn_first = (ImageButton) findViewById(R.id.btnPrevious);
      imageView1 = (ImageView) findViewById(R.id.imageView1);
      tv_hotvines = (TextView) findViewById(R.id.tv_hotvines);
      animationFadeIn = AnimationUtils.loadAnimation(this, R.anim.right_out);

      mp = MediaPlayer.create(this, sounds[curr]);
      mp.start();

      btn_nex.setOnClickListener(this);
      btn_back.setOnClickListener(this);
      btn_first.setOnClickListener(this);
      btn_last.setOnClickListener(this);
      tv_hotvines.setOnClickListener(this);
    } catch (Exception ex) {
      DebugLog.console(ex, "Learn_Digits onCreate Exception");
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
    final ViewGroup mainView = (ViewGroup) findViewById(R.id.container);
    ArrayList<View> buttons = getButtons(mainView);
    for (int i = 0; i < buttons.size(); i++) {
      Button button = (Button) buttons.get(i);
      String title = "Click me";
      switch (i) {
        case 0:
          title = "Top, small, custom color";
          break;
        case 1:
          title = "Top, large, custom font/bg, squared";
          break;
        case 2:
          title = "Bottom, small, square";
          break;
        case 3:
          title = "Bottom, large";
          break;

        case 4:
          title = "Text notification";
          break;

        case 5:
          title = "Facebook, different text colors";
          break;

        case 6:
          title = "Incoming call, persistent, tap to dismiss";
          break;
        case 7:
          title = "Music now playing";
          break;
        case 8:
          title = "Ordinary toast with icon";
          break;

        case 9:
          title = "Attention toast with timeout and custom animations";
          break;

        case 10:
          title = "Google Play Games log-in";
          break;
      }
      button.setText(title);
      button.setTag(i);
      button.setOnClickListener(this);
    }
  }
  private void _initAdView() {
    try {
      mViewAdv = findViewById(R.id.mViewAdv);
      // get value form task manager
      Container container = LazzyBeeSingleton.getContainerHolder().getContainer();
      String admob_pub_id = null;
      String adv_id = null;
      if (container == null) {
      } else {
        admob_pub_id = container.getString(LazzyBeeShare.ADMOB_PUB_ID);
        adv_id = container.getString(LazzyBeeShare.ADV_DETAILS_ID);
        Log.i(TAG, "admob -admob_pub_id:" + admob_pub_id);
        Log.i(TAG, "admob -adv_id:" + adv_id);
      }
      if (admob_pub_id != null) {
        if (adv_id == null || adv_id.equals(LazzyBeeShare.EMPTY)) {
          mViewAdv.setVisibility(View.GONE);
        } else if (adv_id != null
            || adv_id.length() > 1
            || !adv_id.equals(LazzyBeeShare.EMPTY)
            || !adv_id.isEmpty()) {
          String advId = admob_pub_id + "/" + adv_id;
          Log.i(TAG, "admob -AdUnitId:" + advId);
          AdView mAdView = new AdView(this);

          mAdView.setAdSize(AdSize.BANNER);
          mAdView.setAdUnitId(advId);

          AdRequest adRequest =
              new AdRequest.Builder()
                  .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                  .addTestDevice(getResources().getStringArray(R.array.devices)[0])
                  .addTestDevice(getResources().getStringArray(R.array.devices)[1])
                  .addTestDevice(getResources().getStringArray(R.array.devices)[2])
                  .addTestDevice(getResources().getStringArray(R.array.devices)[3])
                  .build();

          mAdView.loadAd(adRequest);

          RelativeLayout relativeLayout = ((RelativeLayout) findViewById(R.id.adView));
          RelativeLayout.LayoutParams adViewCenter =
              new RelativeLayout.LayoutParams(
                  ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          adViewCenter.addRule(RelativeLayout.CENTER_IN_PARENT);
          relativeLayout.addView(mAdView, adViewCenter);

          mViewAdv.setVisibility(View.VISIBLE);
        } else {
          mViewAdv.setVisibility(View.GONE);
        }
      } else {
        mViewAdv.setVisibility(View.GONE);
      }
    } catch (Exception e) {
      LazzyBeeShare.showErrorOccurred(context, "_initAdView", e);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    mSectionsPagerAdapter = new CalculatorPagerAdapter(getSupportFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    mViewPager.addOnPageChangeListener(
        new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageScrolled(
              int position, float positionOffset, int positionOffsetPixels) {}

          /**
           * Refreshes the listView in the history fragment whenever the user moves to it.
           *
           * @param position page index moving to
           */
          @Override
          public void onPageSelected(int position) {
            CalculatorPagerAdapter fragmentPagerAdapter =
                (CalculatorPagerAdapter) mViewPager.getAdapter();
            if (position == HISTORY_PAGE_INDEX)
              ((HistoryFragment) fragmentPagerAdapter.getRegisteredFragment(position))
                  .refreshHistory();
          }

          @Override
          public void onPageScrollStateChanged(int state) {}
        });

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(mViewPager);

    // Show welcome demo if this is the first launch
    mSPref = PreferenceManager.getDefaultSharedPreferences(this);
    if (mSPref.getBoolean(getString(R.string.pref_is_first_launch_key), true)) showWelcomeDemo();

    if (!isPro()) {
      AdView adView = (AdView) findViewById(R.id.main_ad_view);
      AdRequest adRequest = new AdRequest.Builder().build();
      adView.loadAd(adRequest);

      // Move up viewPager to allow room for adView
      ((RelativeLayout.LayoutParams) mViewPager.getLayoutParams())
          .addRule(RelativeLayout.ABOVE, R.id.main_ad_view);
    }
  }
Example #17
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mLeftDrawerList = (LinearLayout) findViewById(R.id.leftNavdrawer);

    llMainContent = (LinearLayout) findViewById(R.id.llMainContent);
    tvSelectedMenuLookUpItem = (TextView) findViewById(R.id.tvSelectedMenuLookUpItem);
    lvMenuLookUpItems = (ListView) findViewById(R.id.lvMenuLookUpItems);
    ArrayList<MenuLookUpItem> menuLookUpItems = StaticData.GetMenuLookUpItems();
    menuLookUpItemAdapter = new MenuLookUpItemAdapter(MainActivity.this, menuLookUpItems);

    lvMenuLookUpItems.setAdapter(menuLookUpItemAdapter);
    lvMenuLookUpItems.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            numberOfSelectItem++;
            checkForShowInterstital();
            MenuLookUpItem menuLookUpItem = (MenuLookUpItem) view.getTag();
            if (menuLookUpItem.hasAction()) {
              tvSelectedMenuLookUpItem.setText(menuLookUpItem.getName());
              // vwMainContent.ad
              llMainContent.removeAllViews();
              mDrawerLayout.closeDrawer(mLeftDrawerList);
              llMainContent.addView(
                  menuLookUpItem.getView(MainActivity.this),
                  0,
                  new LinearLayout.LayoutParams(
                      LinearLayout.LayoutParams.MATCH_PARENT,
                      LinearLayout.LayoutParams.MATCH_PARENT));
            } else {
              Toast.makeText(MainActivity.this, "Not Implemented Yet", Toast.LENGTH_LONG).show();
            }
          }
        });
    numberOfSelectItem = 1;
    timeForRun = 0;
    savedValues = new SavedValues(this);
    if (savedValues.getRecordFirstRun() == 0) {
      isFirstRun = true;
      savedValues.setRecordFirstRun(Calendar.getInstance().getTime().getTime());
    } else {
      isFirstRun = false;
    }

    mAdView = (AdView) this.findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);

    mDrawerLayout.openDrawer(mLeftDrawerList);
  }
  @Override
  public void onCreate(Bundle savedInstanceBundle) {
    super.onCreate(savedInstanceBundle);
    setContentView(R.layout.activity_funny_cheezy);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle("Funny, Cheezy Pickup Lines");

    AdView mAdView = (AdView) findViewById(R.id.funnyAndCheezyAdView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
  }
  /** @see android.app.Activity#onCreate(android.os.Bundle) */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    SharedPreferences myPreferences =
        getApplicationContext().getSharedPreferences("PREFERENCE", MODE_PRIVATE);

    boolean firstrun = myPreferences.getBoolean("firstrun", true);
    if (firstrun) {
      new AlertDialog.Builder(this)
          .setTitle("Warning")
          .setMessage(
              "This app and its developer(s) are not affliated or endorsed by "
                  + "the Port Authority of New York and New Jersey.\n\nThis application obtains your current location "
                  + "and can use it to obtain your three closest stations, then directions to the station you select. To The PATH And Back does not "
                  + "use your location for any other purpose. In addition, neither the location obtained by your device or location "
                  + "you manually entered are stored anywhere by this application.\n\nThe directions provided by this application is obtained from "
                  + "OpenStreetMap via Open MapQuest. The developer(s) of this app, MapQuest and OpenStreetMap, "
                  + "cannot guarentee that the directions given to you are 100% accurate. Use them at your own risk.\n\nFinally, "
                  + "please be aware that the developer(s) cannot guarantee that the station and/or entrance that you want "
                  + "directions for will be open or accurately placed. Again, use the directions and locations provided by this app at your own risk.\n\nAds "
                  + "provided by Google's AdMob/AdSense will be displayed under the tabs in the action bar as well "
                  + "as in the bottom of the screen where you'll select the station you want directions to.")
          .setNeutralButton("OK", null)
          .show();

      myPreferences.edit().putBoolean("firstrun", false).commit();
      myPreferences.edit().putBoolean("imperialUnits", true).commit();
    }

    unitMeasurement = myPreferences.getString("unitMeasurement", "");
    if (unitMeasurement.isEmpty()) {
      myPreferences
          .edit()
          .putString("unitMeasurement", "m")
          .commit(); // Imperial units is the default unit of measurement
      unitMeasurement = myPreferences.getString("unitMeasurement", "");
    }

    AppRater.app_launched(this);

    pathStations = new DatabaseHandler(this);
    getAllStopsAndTrips();
    getAppKey();
    addTabs();

    adView = (AdView) this.findViewById(R.id.adViewMain);
    AdRequest adRequest =
        new AdRequest.Builder().addTestDevice("949F5429A9EC251C1DD4395558D33531").build();
    // AdRequest adRequest = new AdRequest.Builder().build();
    adView.loadAd(adRequest);
  }
  private void addAd() {
    // Create the adView
    AdView adView = new AdView(this);
    adView.setAdSize(AdSize.SMART_BANNER);
    adView.setAdUnitId(getString(R.string.banner_ad_unit_id));

    ((ViewGroup) findViewById(android.R.id.list).getParent().getParent().getParent())
        .addView(adView, 0);

    // Initiate a generic request to load it with an ad
    adView.loadAd(
        new AdRequest.Builder().addTestDevice("5B5C0102B231DC20553952DAC00561A6").build());
  }
Example #21
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ketquact);
    Bundle extras = new Bundle();
    extras.putString("appname", "tu_vi_2016");
    extras.putString("appcat", "productivity");
    extras.putString("jb", "" + RootSupport.isDeviceRooted());

    AdMobExtras adExtra = new AdMobExtras(extras);

    mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest =
        new AdRequest.Builder()
            .addNetworkExtras(adExtra)
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("EDA8BB96AFAC4D787093E74267389265")
            .addTestDevice("3D7268CC8E6A7666958991A316D08A88")
            .addTestDevice("7AFC6206AD04A3073968C664E902FF5D")
            .addTestDevice("780C9B0B7E4E49713CFE54EEF2C2F0E7")
            .addTestDevice("48A720DA7ABCF53ECC3A00DEB6983B97")
            .build();
    mAdView.loadAd(adRequest);
    tv_title = (TextView) findViewById(R.id.tv_title);
    tv_title.setText(ConGiapFragment.ketquapd);
    iv_back = (ImageView) findViewById(R.id.iv_back);
    iv_back.setOnClickListener(this);
    imageView1 = (ImageView) findViewById(R.id.imageView1);
    imageView1.setVisibility(View.VISIBLE);
    imageView1.setOnClickListener(this);
    wv_ketqua_vantrinhnam = (WebView) findViewById(R.id.wv_vanKhan);

    DataNew2DataBaseHelper vanTrinhNamDataBaseHelper = new DataNew2DataBaseHelper(this);
    Category listVanTrinhNam = vanTrinhNamDataBaseHelper.getAllLabelpd(this, ConGiapFragment.idchd);
    str2 = listVanTrinhNam.getCate();
    String youtContentStr =
        String.valueOf(
            Html.fromHtml(
                "<![CDATA[<body style=\"text-align:justify;color:#000000; \">"
                    + str2
                    + "</body>]]>"));
    wv_ketqua_vantrinhnam.getSettings().setJavaScriptEnabled(true);
    wv_ketqua_vantrinhnam.getResources().getDimensionPixelSize(R.dimen.text_size_large);
    wv_ketqua_vantrinhnam.loadDataWithBaseURL(
        "file:///android_asset/", youtContentStr, "text/html", "utf-8", null);
    // wv_ketqua_vantrinhnam.setBackgroundColor(Color.BLACK);

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
      wv_ketqua_vantrinhnam.setAlpha(0.7f);
    }
  }
Example #22
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(LOG_TAG, "onCreate");
    Intent intent = getIntent();
    imageId = intent.getIntExtra(IMAGE_ID_EXTRA, -1);
    Log.d(LOG_TAG, "Image ID: " + String.valueOf(imageId));

    getSupportLoaderManager().restartLoader(0, null, this);

    setContentView(R.layout.activity_comments);
    mCommentsRecyclerView = (RecyclerView) findViewById(R.id.comments_recycler_view);
    mCommentsAdapter = new CommentsAdapter();
    mCommentsAdapter.setOnItemClickListener(this);

    mCommentsRecyclerView.setAdapter(mCommentsAdapter);
    mCommentsRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mCommentsRecyclerView.setLayoutManager(
        new LinearLayoutManager(getApplication().getApplicationContext()));
    mSendButton = (ImageView) findViewById(R.id.send_button);
    mSendButton.setOnClickListener(this);

    mMessageTextInput = (EditText) findViewById(R.id.message_text_input);
    mMessageTextInput.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {}

          @Override
          public void afterTextChanged(Editable s) {
            mSendButton.setImageDrawable(
                getResources()
                    .getDrawable(
                        s.length() >= MIN_INPUT_TEXT_LENGTH
                            ? R.drawable.ic_arrow_forward_white_48dp
                            : R.drawable.ic_arrow_forward_black_48dp));
          }
        });

    if (isNeedToShowAd) {
      mAdView = (AdView) findViewById(R.id.advertising_block);
      mAdView.loadAd(adRequest);
    }

    requestsIdMap.put(
        SendServiceHelper.getInstance(this).requestCommentList(imageId), RequestType.COMMENT_LIST);
  }
Example #23
0
  private void initAdView() {
    LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
    mAdview = new AdView(this);
    mAdview.setAdUnitId(ADID);
    mAdview.setAdSize(AdSize.BANNER);

    layout.addView(mAdview);

    // Initiate a generic request.
    AdRequest adRequest = new AdRequest.Builder().build();

    // Load the adView with the ad request.
    mAdview.loadAd(adRequest);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_main, container, false);
    Toast.makeText(getContext(), "free version", Toast.LENGTH_LONG).show();

    AdView mAdView = (AdView) root.findViewById(R.id.adView);
    // Create an ad request. Check logcat output for the hashed device ID to
    // get test ads on a physical device. e.g.
    // "Use AdRequest.Builder.addTestDevice("ABCDEF012345") to get test ads on this device."
    AdRequest adRequest =
        new AdRequest.Builder().addTestDevice("03771C4932F89866CF4E2662021BF5B4").build();
    mAdView.loadAd(adRequest);
    return root;
  }
Example #25
0
  /** @description function to display the previous exam score of the user. */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(com.raulgupta.exam.R.layout.activity_view_test_score);
    score = (TextView) findViewById(com.raulgupta.exam.R.id.textView2);
    StringBuffer sb = new StringBuffer("\n");
    if (getIntent().getExtras().containsKey("score")
        && getIntent().getExtras().containsKey("test_Name")) {
      String[] allScore = getIntent().getExtras().getStringArray("score");
      String[] allTest = getIntent().getExtras().getStringArray("test_Name");

      // score.setText("Score : "+getIntent().getExtras().getString("score") + " %");
      sb.append("Score\n");
      for (int i = 0; i < 3; i++) {
        if (allScore[i] != null && allTest[i] != null) {
          sb.append(allTest[i].toUpperCase() + " : ");
          sb.append(allScore[i]);
        }
        sb.append("\n");
      }
      score.setText(sb);
      score.setTextColor(Color.BLACK);
    }
    if (getIntent().getExtras().containsKey("score")
        && getIntent().getExtras().containsKey("user_Name")) {
      String[] allScore = getIntent().getExtras().getStringArray("score");
      String[] allTest = getIntent().getExtras().getStringArray("user_Name");
      String[] allCountry = getIntent().getExtras().getStringArray("country");
      // score.setText("Score : "+getIntent().getExtras().getString("score") + " %");
      sb.append("LeaderBoard\n");
      for (int i = 0; i < 5; i++) {
        if (allScore[i] != null && allTest[i] != null) {
          sb.append(allTest[i].toUpperCase() + " : ");
          sb.append(allScore[i] + " : ");
          sb.append(allCountry[i]);
        }
        sb.append("\n");
      }
      score.setTextSize(20);
      score.setText(sb);
      score.setTextColor(Color.BLACK);
    }

    MobileAds.initialize(getApplicationContext(), "ca-app-pub-5127965163149320~6624066694");
    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
  } // end of onCreate()
Example #26
0
  private void addAds() {
    adView = (AdView) findViewById(R.id.adView);
    adView.setAdListener(
        new AdListener() {

          @Override
          public void onAdLoaded() {
            adView.getLayoutParams().height = LayoutParams.WRAP_CONTENT;
          }
        });

    AdRequest adRequest =
        new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();

    adView.loadAd(adRequest);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_main, container, false);

    mInterstitialAd = new InterstitialAd(getContext());
    mInterstitialAd.setAdUnitId(getString(R.string.interstitial_ad_unit_id));
    mInterstitialAd.setAdListener(
        new AdListener() {
          @Override
          public void onAdClosed() {
            super.onAdClosed();
            mInterstitialAd.loadAd(getTestAdRequest());
            launchJokeActivity(mJoke);
          }
        });
    mInterstitialAd.loadAd(getTestAdRequest());

    AdView mAdView = (AdView) root.findViewById(R.id.adView);
    mAdView.loadAd(getTestAdRequest());

    final ProgressBar progressBar = (ProgressBar) root.findViewById(R.id.progress_bar);

    Button tellJokeButton = (Button) root.findViewById(R.id.tell_joke_button);
    tellJokeButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            progressBar.setVisibility(View.VISIBLE);
            new FetchJokeAsyncTask()
                .execute(
                    new FetchJokeAsyncTask.FetchJokeTaskCallback() {
                      @Override
                      public void handleJoke(String joke) {
                        mJoke = joke;
                        progressBar.setVisibility(View.GONE);
                        if (mInterstitialAd.isLoaded()) {
                          mInterstitialAd.show();
                        } else {
                          launchJokeActivity(joke);
                        }
                      }
                    });
          }
        });
    return root;
  }
Example #28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    StartAppSDK.init(this, "104583501", "204414324", true);
    setContentView(R.layout.activity_array03);

    TextView Txt = (TextView) findViewById(R.id.input);
    Txt.setText(Input());

    ActionBar ab = getSupportActionBar();
    ab.setTitle("Initializing Arrays");
    ab.setSubtitle("Powered by DreamGoogle");

    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
  }
  private void initAdView() {
    mAdView = (AdView) findViewById(R.id.adViewSetWallpaper);
    mAdView.setVisibility(View.INVISIBLE);
    AdRequest adRequest =
        new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();

    // Start loading the ad in sthe background.
    mAdView.loadAd(adRequest);
    mAdView.setAdListener(
        new AdListener() {
          @Override
          public void onAdLoaded() {
            super.onAdLoaded();
            mAdView.setVisibility(View.VISIBLE);
          }
        });
  }
Example #30
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    StartAppSDK.init(this, "104583501", "204414324", true);
    setContentView(R.layout.activity_hello06);

    TextView helloTxt = (TextView) findViewById(R.id.input);
    helloTxt.setText(Input());

    ActionBar ab = getSupportActionBar();
    ab.setTitle("Addition of Numbers");
    ab.setSubtitle("Run Time");

    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
  }