This repository has been archived by the owner on Jun 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
2.07 build url with params #310
Open
danieltsoy
wants to merge
15
commits into
1.01_hello_world
Choose a base branch
from
2.07_build_url_with_params
base: 1.01_hello_world
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
e9f367e
1.02 Add list item forecast layout
fab554b
1.03 Update fragment layout
de032c1
1.04 Add dummy data
0281f77
1.05 Create ArrayAdapter to eventually use to populate the ListView
1d42493
1.06 Hook the adapter up to the ListView
ea6e195
2.01 Add the network call code
370d9bf
2.02 rename Placeholder -> Forecast
27e83bd
2.02 refactor ForecastFragment into to separate file
1e4314f
2.02 Refactor logging string into constant
sdspikes fa5e923
2.03 Add xml for refresh menu item
sdspikes f7f49a8
2.04 Inflate menu
sdspikes f18784f
2.05 Execute FetchWeatherTask
sdspikes d1579a4
2.06 Add Internet permission
sdspikes 30afc9f
2.07 Build URL with params
sdspikes affe306
Add API Key Parameter to OpenWeatherMap API Call
cdlei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,32 @@ | ||
/* | ||
* Copyright (C) 2014 The Android Open Source Project | ||
* | ||
* 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.example.android.sunshine.app; | ||
|
||
import android.support.v7.app.ActionBarActivity; | ||
import android.support.v4.app.Fragment; | ||
import android.os.Bundle; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v7.app.ActionBarActivity; | ||
import android.view.LayoutInflater; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import android.widget.ArrayAdapter; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class MainActivity extends ActionBarActivity { | ||
|
||
|
@@ -50,12 +68,38 @@ public boolean onOptionsItemSelected(MenuItem item) { | |
*/ | ||
public static class PlaceholderFragment extends Fragment { | ||
|
||
ArrayAdapter<String> mForecastAdapter; | ||
|
||
public PlaceholderFragment() { | ||
} | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) { | ||
Bundle savedInstanceState) { | ||
|
||
// Create some dummy data for the ListView. Here's a sample weekly forecast | ||
String[] data = { | ||
"Mon 6/23 - Sunny - 31/17", | ||
"Tue 6/24 - Foggy - 21/8", | ||
"Wed 6/25 - Cloudy - 22/17", | ||
"Thurs 6/26 - Rainy - 18/11", | ||
"Fri 6/27 - Foggy - 21/10", | ||
"Sat 6/28 - TRAPPED IN WEATHERSTATION - 23/18", | ||
"Sun 6/29 - Sunny - 20/7" | ||
}; | ||
List<String> weekForecast = new ArrayList<String>(Arrays.asList(data)); | ||
|
||
|
||
// Now that we have some dummy forecast data, create an ArrayAdapter. | ||
// The ArrayAdapter will take data from a source (like our dummy forecast) and | ||
// use it to populate the ListView it's attached to. | ||
mForecastAdapter = | ||
new ArrayAdapter<String>( | ||
getActivity(), // The current context (this activity) | ||
R.layout.list_item_forecast, // The name of the layout ID. | ||
R.id.list_item_forecast_textview, // The ID of the textview to populate. | ||
weekForecast); | ||
|
||
View rootView = inflater.inflate(R.layout.fragment_main, container, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello |
||
return rootView; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" | ||
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:paddingLeft="@dimen/activity_horizontal_margin" | ||
|
||
android:paddingRight="@dimen/activity_horizontal_margin" | ||
android:paddingTop="@dimen/activity_vertical_margin" | ||
android:paddingBottom="@dimen/activity_vertical_margin" | ||
tools:context=".MainActivity$PlaceholderFragment"> | ||
|
||
<TextView android:text="@string/hello_world" android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" /> | ||
|
||
</RelativeLayout> | ||
<ListView | ||
android:id="@+id/listview_forecast" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
|
||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<TextView xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:minHeight="?android:attr/listPreferredItemHeight" | ||
android:gravity="center_vertical" | ||
android:id="@+id/list_item_forecast_textview" /> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of the layout should be more meaningful.