Skip to content

Commit

Permalink
Add geo api key
Browse files Browse the repository at this point in the history
  • Loading branch information
Protino committed Feb 25, 2017
1 parent f327e40 commit 7e8ec43
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 52 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/.gradle
/local.properties
/gradle.properties
/app/google-services.json
.DS_Store
/build
/captures
Expand Down
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/build
google-services.json
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ android {
versionName "1.0"
multiDexEnabled true

buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', MyOpenWeatherMapApiKey
resValue 'string', 'GEO_API_KEY', MyGeoApiKey

}
buildTypes {
release {
Expand All @@ -20,9 +23,6 @@ android {
}

}
buildTypes.each {
it.buildConfigField 'String', 'OPEN_WEATHER_MAP_API_KEY', MyOpenWeatherMapApiKey
}
}

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="ENTER_YOU_API_KEY_HERE"/>
android:value="@string/GEO_API_KEY"/>
<activity
android:name=".activity.MainActivity"
android:label="@string/app_name"
Expand Down Expand Up @@ -96,7 +96,7 @@
</service>

<service
android:name=".fcm.MyFirebaseInstanceIDService">
android:name=".fcm.MyFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

public class DetailActivity extends AppCompatActivity {

//Lifecycle start
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -32,6 +33,7 @@ protected void onCreate(Bundle savedInstanceState) {
supportPostponeEnterTransition();
}
}
//Lifecycle end

@Override
public boolean onOptionsItemSelected(MenuItem item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

Expand Down Expand Up @@ -71,13 +70,6 @@ protected void onCreate(Bundle savedInstanceState) {
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putBoolean(PANE_TYPE, mTwoPane);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
public static final int COL_WEATHER_DEGREES = 8;
public static final int COL_WEATHER_CONDITION_ID = 9;
public static final String DETAIL_URI = "URI";
public static final String DETAIL_TRANSITION_ANIMATION = "DTA";
private static final String LOG_TAG = DetailFragment.class.getSimpleName();
private static final String FORECAST_SHARE_HASHTAG = " #SunshineApp";
private static final int DETAIL_LOADER = 0;
Expand All @@ -64,7 +65,6 @@ public class DetailFragment extends Fragment implements LoaderManager.LoaderCall
WeatherEntry.COLUMN_WEATHER_ID,
WeatherContract.LocationEntry.COLUMN_LOCATION_SETTING
};
public static final String DETAIL_TRANSITION_ANIMATION = "DTA";
private Uri mUri;
private ShareActionProvider mShareActionProvider;
private String mForecast;
Expand All @@ -85,6 +85,7 @@ public DetailFragment() {
setHasOptionsMenu(true);
}

//Lifecycle start
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Expand All @@ -110,10 +111,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
return rootView;
}

private void finishCreatingMenu(Menu menu) {
// Retrieve the share menu item
MenuItem menuItem = menu.findItem(R.id.action_share);
menuItem.setIntent(createShareForecastIntent());
@Override
public void onActivityCreated(Bundle savedInstanceState) {
getLoaderManager().initLoader(DETAIL_LOADER, null, this);
super.onActivityCreated(savedInstanceState);
}

@Override
Expand All @@ -124,6 +125,13 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
finishCreatingMenu(menu);
}
}
//Lifecycle end

private void finishCreatingMenu(Menu menu) {
// Retrieve the share menu item
MenuItem menuItem = menu.findItem(R.id.action_share);
menuItem.setIntent(createShareForecastIntent());
}

private Intent createShareForecastIntent() {
Intent shareIntent = new Intent(Intent.ACTION_SEND);
Expand All @@ -133,12 +141,6 @@ private Intent createShareForecastIntent() {
return shareIntent;
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
getLoaderManager().initLoader(DETAIL_LOADER, null, this);
super.onActivityCreated(savedInstanceState);
}

public void onLocationChanged(String newLocation) {
// replace the uri, since the location has changed
Uri uri = mUri;
Expand All @@ -165,7 +167,7 @@ public Loader<Cursor> onCreateLoader(int id, Bundle args) {
);
}
ViewParent viewParent = getView().getParent();
if (viewParent instanceof CardView){
if (viewParent instanceof CardView) {
((CardView) viewParent).setVisibility(View.INVISIBLE);
}
return null;
Expand All @@ -176,7 +178,7 @@ public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (data != null && data.moveToFirst()) {

ViewParent viewParent = getView().getParent();
if (viewParent instanceof CardView){
if (viewParent instanceof CardView) {
((CardView) viewParent).setVisibility(View.VISIBLE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* Created by Gurupad Mamadapur on 11/13/2016.
*/

public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {
public static final String TAG=MyFirebaseInstanceIDService.class.getSimpleName();
public class MyFirebaseInstanceIdService extends FirebaseInstanceIdService {
public static final String TAG=MyFirebaseInstanceIdService.class.getSimpleName();

/**
* Called if InstanceID token is updated. This may occur if the security of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] a
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.widget, pendingIntent);

// Set up the collection
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
setRemoteAdapter(context, views);
} else {
setRemoteAdapterV11(context, views);
}

boolean useDetailActivity = context.getResources()
.getBoolean(R.bool.use_detail_activity);
Intent clickIntentTemplate = useDetailActivity
Expand Down
32 changes: 16 additions & 16 deletions app/src/main/res/layout/detail_extras_grid.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<!-- Detail Layout for Grid -->
<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/detail_additional_pane"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:background="@color/detail_accent_pane_background"
android:paddingBottom="@dimen/abc_list_item_padding_horizontal_material"
android:paddingEnd="@dimen/forecast_detail_horizontal_padding"
android:paddingLeft="@dimen/forecast_detail_horizontal_padding"
android:paddingRight="@dimen/forecast_detail_horizontal_padding"
android:paddingStart="@dimen/forecast_detail_horizontal_padding"
android:paddingTop="@dimen/abc_list_item_padding_horizontal_material"
app:columnCount="2">
<android.support.v7.widget.GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/detail_additional_pane"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:background="@color/detail_accent_pane_background"
android:paddingBottom="@dimen/abc_list_item_padding_horizontal_material"
android:paddingEnd="@dimen/forecast_detail_horizontal_padding"
android:paddingLeft="@dimen/forecast_detail_horizontal_padding"
android:paddingRight="@dimen/forecast_detail_horizontal_padding"
android:paddingStart="@dimen/forecast_detail_horizontal_padding"
android:paddingTop="@dimen/abc_list_item_padding_horizontal_material"
app:columnCount="2">

<TextView
android:id="@+id/detail_humidity_label_textview"
Expand Down Expand Up @@ -66,7 +67,6 @@
app:layout_rowWeight="1"
tools:text="3242432"/>


<TextView
android:id="@+id/detail_wind_textview"
android:gravity="center_vertical"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'

// NOTE: Do not place your application dependencies here; they belong
Expand Down

0 comments on commit 7e8ec43

Please sign in to comment.