-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
443 additions
and
8 deletions.
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
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,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > | ||
|
||
<item> | ||
<bitmap | ||
android:gravity="top|clip_vertical" | ||
android:src="@drawable/stock_dark" /> | ||
</item> | ||
<item> | ||
<shape android:shape="rectangle" > | ||
<solid android:color="#AAFFFFFF" /> | ||
</shape> | ||
</item> | ||
|
||
</layer-list> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,18 @@ | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" > | ||
|
||
<WebView | ||
android:id="@+id/webViewNews" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
|
||
<ProgressBar | ||
android:id="@+id/progressBarWeb" | ||
style="@android:style/Widget.Holo.ProgressBar.Horizontal" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentTop="true" | ||
android:layout_marginTop="-7dp" /> | ||
|
||
</RelativeLayout> |
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,67 @@ | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" > | ||
|
||
<ImageView | ||
android:id="@+id/imageViewGameImage" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_alignBottom="@+id/viewGroupNewsHeaderInfo" | ||
android:layout_alignTop="@+id/viewGroupNewsHeaderInfo" | ||
android:scaleType="centerCrop" | ||
android:src="@drawable/news_background" /> | ||
|
||
<RelativeLayout | ||
android:id="@+id/viewGroupNewsHeaderInfo" | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:paddingBottom="@dimen/news_header_padding_vertical" | ||
android:paddingLeft="@dimen/news_header_padding_horizontal" | ||
android:paddingRight="@dimen/news_header_padding_horizontal" | ||
android:paddingTop="@dimen/news_header_padding_vertical" > | ||
|
||
<TextView | ||
android:id="@+id/textViewNewsHeader" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentTop="true" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginBottom="@dimen/news_latest_margin_bottom" | ||
android:text="@string/news_latest" | ||
android:textAppearance="?android:attr/textAppearanceMedium" | ||
android:textColor="@android:color/black" | ||
android:textStyle="italic|bold" /> | ||
|
||
<TextView | ||
android:id="@+id/textViewNewsTitle" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@+id/textViewNewsHeader" | ||
android:text="Medium Text" | ||
android:textAppearance="?android:attr/textAppearanceLarge" | ||
android:textColor="#A33446" | ||
android:textStyle="bold" /> | ||
|
||
<TextView | ||
android:id="@+id/textViewNewsBody" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@+id/textViewNewsTitle" | ||
android:maxLines="2" | ||
android:text="Large Text" | ||
android:textAppearance="?android:attr/textAppearanceMedium" | ||
android:textColor="@android:color/black" /> | ||
|
||
<TextView | ||
android:id="@+id/textViewNewsReadMore" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentRight="true" | ||
android:layout_below="@+id/textViewNewsBody" | ||
android:layout_marginTop="@dimen/news_header_read_more_margin_top" | ||
android:text="@string/news_read_more" | ||
android:textAppearance="?android:attr/textAppearanceMedium" | ||
android:textColor="@android:color/black" /> | ||
</RelativeLayout> | ||
|
||
</RelativeLayout> |
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
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
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
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,57 @@ | ||
package io.itch.activities; | ||
|
||
import io.itch.R; | ||
import android.annotation.SuppressLint; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.webkit.WebChromeClient; | ||
import android.webkit.WebView; | ||
import android.widget.ProgressBar; | ||
|
||
@SuppressLint("SetJavaScriptEnabled") | ||
public class NewsActivity extends BaseActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_news); | ||
WebView webview = (WebView) findViewById(R.id.webViewNews); | ||
webview.getSettings().setJavaScriptEnabled(true); | ||
final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBarWeb); | ||
webview.setWebChromeClient(new WebChromeClient() { | ||
public void onProgressChanged(WebView view, int progress) { | ||
progressBar.setProgress(progress); | ||
|
||
// remove some of the tumblr crap that we don't want | ||
view.loadUrl("javascript:(function(){ " + | ||
"try {" + | ||
" var header = document.getElementById('header');" + | ||
" header.style.display = 'none';" + | ||
" var hider = function(name) {" + | ||
" var a = document.getElementsByClassName(name); " + | ||
" var item;" + | ||
" for (var i = 0; i < a.length; ++i) {" + | ||
" item = a[i];" + | ||
" item.style.display = 'none';" + | ||
" }" + | ||
" };" + | ||
" hider('nav-menu-wrapper');" + | ||
" hider('nav-menu-bg');" + | ||
"} catch (e) { " + | ||
"}" + | ||
"})();"); | ||
if (progress >= 100) { | ||
progressBar.setVisibility(View.GONE); | ||
} | ||
} | ||
}); | ||
|
||
webview.loadUrl("http://itchio.tumblr.com"); | ||
} | ||
|
||
@Override | ||
protected String getScreenPath() { | ||
return "News"; | ||
} | ||
|
||
} |
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,13 @@ | ||
package io.itch.api; | ||
|
||
import io.itch.api.responses.PostsResponse; | ||
import retrofit.Callback; | ||
import retrofit.http.GET; | ||
import retrofit.http.Query; | ||
|
||
public interface TumblrApi { | ||
|
||
@GET("/posts") | ||
public void listPosts(@Query("limit") Integer limit, Callback<PostsResponse> callback); | ||
|
||
} |
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,44 @@ | ||
package io.itch.api; | ||
|
||
import retrofit.RequestInterceptor; | ||
import retrofit.RestAdapter; | ||
import retrofit.converter.GsonConverter; | ||
|
||
import com.google.gson.FieldNamingPolicy; | ||
import com.google.gson.Gson; | ||
import com.google.gson.GsonBuilder; | ||
|
||
public class TumblrApiClient { | ||
|
||
private static final String KEY = "fWnvNwLMtOaJxKhMJuJPUXa4n0SyNled0byq9dSwRN5hoQJPED"; | ||
private static final Object INSTANCE_LOCK = new Object(); | ||
private static TumblrApi SHARED_INSTANCE; | ||
|
||
// http://api.tumblr.com/v2/blog/citriccomics.tumblr.com/posts/text?api_key={key} | ||
public static TumblrApi getClient() { | ||
if (SHARED_INSTANCE == null) { | ||
synchronized (INSTANCE_LOCK) { | ||
if (SHARED_INSTANCE == null) { | ||
Gson gson = new GsonBuilder() | ||
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES) | ||
.setDateFormat("yyyy-MM-dd HH:mm:ss") | ||
.create(); | ||
String endPoint = "http://api.tumblr.com/v2/blog/itchio.tumblr.com/"; | ||
RequestInterceptor requestInterceptor = new RequestInterceptor() { | ||
@Override | ||
public void intercept(RequestFacade request) { | ||
request.addQueryParam("api_key", KEY); | ||
} | ||
}; | ||
RestAdapter adapter = new RestAdapter.Builder() | ||
.setEndpoint(endPoint) | ||
.setConverter(new GsonConverter(gson)) | ||
.setRequestInterceptor(requestInterceptor) | ||
.build(); | ||
SHARED_INSTANCE = adapter.create(TumblrApi.class); | ||
} | ||
} | ||
} | ||
return SHARED_INSTANCE; | ||
} | ||
} |
Oops, something went wrong.