mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
add news view
This commit is contained in:
parent
6c98952e28
commit
1e3e852f06
3 changed files with 57 additions and 1 deletions
16
Habitica/res/layout/fragment_news.xml
Normal file
16
Habitica/res/layout/fragment_news.xml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbarSize="3dp"
|
||||
android:scrollbarThumbVertical="@color/md_grey_500"
|
||||
|
||||
android:scrollbars="vertical">
|
||||
|
||||
<WebView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/news_webview"/>
|
||||
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
|
@ -11,6 +11,7 @@ import com.habitrpg.android.habitica.ui.activities.MainActivity;
|
|||
import com.habitrpg.android.habitica.ui.activities.PrefsActivity;
|
||||
import com.habitrpg.android.habitica.ui.fragments.BaseMainFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.GemsPurchaseFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.NewsFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.SkillsFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.faq.FAQOverviewFragment;
|
||||
import com.habitrpg.android.habitica.ui.fragments.inventory.customization.AvatarOverviewFragment;
|
||||
|
|
@ -92,7 +93,7 @@ public class MainDrawerBuilder {
|
|||
new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_stable)).withIdentifier(SIDEBAR_STABLE).withEnabled(false).withBadge(R.string.coming_soon),
|
||||
new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_purchaseGems)).withIdentifier(SIDEBAR_PURCHASE),
|
||||
|
||||
new SectionIconDrawerItem().withName(activity.getString(R.string.sidebar_section_inventory)).withIcon(GoogleMaterial.Icon.gmd_info_outline),
|
||||
new SectionIconDrawerItem().withName(activity.getString(R.string.sidebar_about)).withIcon(GoogleMaterial.Icon.gmd_info_outline),
|
||||
new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_news)).withIdentifier(SIDEBAR_NEWS).withSelectable(false),
|
||||
new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_settings)).withIdentifier(SIDEBAR_SETTINGS).withSelectable(false),
|
||||
new PrimaryDrawerItem().withName(activity.getString(R.string.sidebar_help)).withIdentifier(SIDEBAR_HELP),
|
||||
|
|
@ -140,6 +141,10 @@ public class MainDrawerBuilder {
|
|||
fragment = new GemsPurchaseFragment();
|
||||
break;
|
||||
}
|
||||
case SIDEBAR_NEWS: {
|
||||
fragment= new NewsFragment();
|
||||
break;
|
||||
}
|
||||
case SIDEBAR_SETTINGS: {
|
||||
newActivityClass = PrefsActivity.class;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.habitrpg.android.habitica.ui.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.ui.adapter.SkillsRecyclerViewAdapter;
|
||||
|
||||
import butterknife.Bind;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class NewsFragment extends BaseMainFragment {
|
||||
|
||||
private View view;
|
||||
|
||||
@Bind(R.id.news_webview)
|
||||
WebView newsWebview;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (view == null)
|
||||
view = inflater.inflate(R.layout.fragment_news, container, false);
|
||||
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
newsWebview.loadUrl("https://habitica.com/static/new-stuff");
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue