Skip to content

Commit

Permalink
Merge pull request #7 from islem19/feature-add-google-ads
Browse files Browse the repository at this point in the history
Feature add google ads
  • Loading branch information
BillelBmsd authored Mar 21, 2020
2 parents 37da38d + a32142e commit 6608f46
Show file tree
Hide file tree
Showing 40 changed files with 361 additions and 307 deletions.
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ android {
buildToolsVersion "29.0.3"

defaultConfig {
applicationId "com.covid19.app"
applicationId "com.covidvirus.app"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
versionName "1.0.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -31,6 +31,8 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.google.android.gms:play-services-ads:19.0.1'

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.1.0'
// cardview
Expand Down
15 changes: 11 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.covid19.app"
package="com.covidvirus.app"
>

<uses-permission android:name="android.permission.INTERNET"/>
Expand All @@ -10,14 +10,19 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".App"
android:name="com.covidvirus.app.App"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/AppTheme">

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-4756765024373725~9622341322"/>

<activity
android:name=".ui.splash.SplashActivity"
android:screenOrientation="portrait"
android:name="com.covidvirus.app.ui.splash.SplashActivity"
android:theme="@style/AppTheme.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -26,7 +31,9 @@
</intent-filter>

</activity>
<activity android:name=".ui.home.MainActivity"
<activity
android:screenOrientation="portrait"
android:name="com.covidvirus.app.ui.home.MainActivity"
android:theme="@style/AppTheme.MainActivity">

</activity>
Expand Down
37 changes: 0 additions & 37 deletions app/src/main/java/com/covid19/app/Utils.java

This file was deleted.

26 changes: 0 additions & 26 deletions app/src/main/java/com/covid19/app/data/DataManager.java

This file was deleted.

101 changes: 0 additions & 101 deletions app/src/main/java/com/covid19/app/ui/home/MainActivity.java

This file was deleted.

10 changes: 0 additions & 10 deletions app/src/main/java/com/covid19/app/ui/splash/SplashViewModel.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.covid19.app;
package com.covidvirus.app;

import android.app.Application;

Expand Down
59 changes: 59 additions & 0 deletions app/src/main/java/com/covidvirus/app/data/DataManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.covidvirus.app.data;

import android.content.SharedPreferences;

import com.covidvirus.app.App;
import com.covidvirus.app.data.network.services.DataService;
import com.covidvirus.app.data.network.services.location.LocationService;

import static android.content.Context.MODE_PRIVATE;

public class DataManager {

private static DataManager mInstance;
private SharedPreferences sharedPreferences;
public static final String MY_PREFS_NAME = "covid_pref";
public static final String COUNTRY_KEY = "county";
public static final String RUN_COUNT_KEY = "run_count";
public static final int MAX_COUNT = 5;

private DataManager(){
sharedPreferences = App.getInstance().getSharedPreferences(MY_PREFS_NAME,MODE_PRIVATE);
}

public static synchronized DataManager getInstance(){
return mInstance == null ? new DataManager() : mInstance;
}

public void setDefaultCountry(String country){
sharedPreferences.edit()
.putString(COUNTRY_KEY, country)
.apply();
}

public String getDefaultCountry(){
return sharedPreferences.getString(COUNTRY_KEY, null);
}

public void setRunCount(){
int count = getRunCount();
if (count == MAX_COUNT || count > MAX_COUNT) count = 0;
else count++;
sharedPreferences.edit()
.putInt(RUN_COUNT_KEY, count)
.apply();
}

public int getRunCount(){
return sharedPreferences.getInt(RUN_COUNT_KEY, 0);
}

public DataService getDataService(){
return DataService.getInstance();
}

public LocationService getLocationService(){
return LocationService.getInstance();
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.covid19.app.data.network.model;
package com.covidvirus.app.data.network.model;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.covid19.app.data.network.model;
package com.covidvirus.app.data.network.model;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.covid19.app.data.network.model;
package com.covidvirus.app.data.network.model;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.covid19.app.data.network.services;
package com.covidvirus.app.data.network.services;

import com.covid19.app.data.network.model.CountryDataModel;
import com.covid19.app.data.network.model.GlobalDataModel;
import com.covidvirus.app.data.network.model.CountryDataModel;
import com.covidvirus.app.data.network.model.GlobalDataModel;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.covid19.app.data.network.services;
package com.covidvirus.app.data.network.services;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.covid19.app.data.network.services.location;
package com.covidvirus.app.data.network.services.location;

import com.covid19.app.data.network.model.Location;
import com.covidvirus.app.data.network.model.Location;
import retrofit2.Call;
import retrofit2.http.GET;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package com.covid19.app.data.network.services.location;

import com.covid19.app.data.network.services.DataApi;
package com.covidvirus.app.data.network.services.location;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.covid19.app.ui.base;
package com.covidvirus.app.ui.base;

import android.os.Bundle;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.covid19.app.ui.base;
package com.covidvirus.app.ui.base;

import android.content.Context;
import android.util.Log;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.covid19.app.ui.base;
package com.covidvirus.app.ui.base;

import androidx.lifecycle.ViewModel;

Expand Down
Loading

0 comments on commit 6608f46

Please sign in to comment.