├── .gitattributes
├── .gitignore
├── Android Studio project
└── Project
│ └── Webview
│ ├── .gitignore
│ ├── Webview.iml
│ ├── app
│ ├── .gitignore
│ ├── app.iml
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── net
│ │ │ └── example
│ │ │ └── matthias
│ │ │ └── webview
│ │ │ └── ApplicationTest.java
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── assets
│ │ ├── contact.html
│ │ └── offline.html
│ │ ├── ic_launcher-web.png
│ │ ├── java
│ │ └── net
│ │ │ └── matthi
│ │ │ └── webview
│ │ │ ├── ListAdapter.java
│ │ │ ├── MainActivity.java
│ │ │ └── Pages.java
│ │ └── res
│ │ ├── drawable-hdpi
│ │ ├── drawer_shadow.9.png
│ │ └── ic_drawer.png
│ │ ├── drawable-mdpi
│ │ ├── drawer_shadow.9.png
│ │ └── ic_drawer.png
│ │ ├── drawable-xhdpi
│ │ ├── drawer_shadow.9.png
│ │ └── ic_drawer.png
│ │ ├── drawable-xxhdpi
│ │ ├── drawer_shadow.9.png
│ │ └── ic_drawer.png
│ │ ├── drawable
│ │ ├── ic_assessment_black_48dp.png
│ │ ├── ic_autorenew_black_36dp.png
│ │ ├── ic_autorenew_white_36dp.png
│ │ ├── ic_get_app_black_48dp.png
│ │ ├── ic_grade_black_48dp.png
│ │ ├── ic_help_black_48dp.png
│ │ ├── ic_home_black_48dp.png
│ │ ├── ic_language_black_48dp.png
│ │ ├── ic_list_black_48dp.png
│ │ ├── ic_people_outline_black_36dp.png
│ │ ├── ic_perm_identity_black_48dp.png
│ │ ├── ic_room_black_48dp.png
│ │ ├── ic_settings_black_48dp.png
│ │ ├── ic_share_black_36dp.png
│ │ ├── ic_share_white_36dp.png
│ │ ├── ic_shop_black_48dp.png
│ │ ├── ic_subject_black_48dp.png
│ │ ├── ic_theaters_black_48dp.png
│ │ ├── ic_today_black_48dp.png
│ │ ├── ic_view_module_black_48dp.png
│ │ ├── ic_visibility_black_48dp.png
│ │ ├── ic_work_black_48dp.png
│ │ ├── material.png
│ │ └── shadow.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ └── drawer_item_layout.xml
│ │ ├── menu
│ │ └── main.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-v19
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── Demo
└── Apk
│ └── app-release.apk
├── Docs
├── Material Webview step by step instructions.docx
└── Material Webview step by step instructions.pdf
├── README.md
└── Screenshots
├── 1.png
├── 2.png
├── 3.png
└── 5.png
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear on external disk
35 | .Spotlight-V100
36 | .Trashes
37 |
38 | # Directories potentially created on remote AFP share
39 | .AppleDB
40 | .AppleDesktop
41 | Network Trash Folder
42 | Temporary Items
43 | .apdisk
44 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/Webview.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | generateDebugAndroidTestSources
19 | generateDebugSources
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 22
5 | buildToolsVersion "20.0.0"
6 |
7 | defaultConfig {
8 | applicationId "net.matthi.materialwebview"
9 | minSdkVersion 15
10 | targetSdkVersion 22
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | compile 'com.android.support:appcompat-v7:22.+'
25 | compile 'com.google.android.gms:play-services-ads:7.5.0'
26 | compile "com.android.support:design:22.2.0"
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Matthias\android-sdks/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/androidTest/java/net/example/matthias/webview/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package net.example.matthias.webview;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
18 |
19 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/assets/contact.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/assets/offline.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Offline page
5 |
6 | Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor
7 | invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et
8 | accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata
9 | sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing
10 | elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
11 | sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
12 | kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/java/net/matthi/webview/ListAdapter.java:
--------------------------------------------------------------------------------
1 | package net.matthi.webview;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.ArrayAdapter;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import com.example.matthias.webview.R;
12 |
13 | import java.util.ArrayList;
14 |
15 | /**
16 | * Created by Matthias on 11.08.2015.
17 | */
18 | public class ListAdapter extends ArrayAdapter {
19 |
20 | private final Context context;
21 | private final ArrayList values;
22 |
23 | public ListAdapter(Context context, ArrayList values) {
24 | super(context, -1, values);
25 | this.context = context;
26 | this.values = values;
27 | }
28 |
29 | @Override
30 | public View getView(int position, View convertView, ViewGroup parent) {
31 | LayoutInflater inflater = (LayoutInflater) context
32 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
33 | View rowView = inflater.inflate(R.layout.drawer_item_layout, parent, false);
34 | TextView textView = (TextView) rowView.findViewById(R.id.textView);
35 | ImageView imageView = (ImageView) rowView.findViewById(R.id.imageView);
36 | textView.setText(values.get(position).title);
37 | if (values.get(position).icon != null)
38 | imageView.setImageResource(values.get(position).icon.value);
39 | return rowView;
40 | }
41 | }
42 |
43 |
44 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/java/net/matthi/webview/MainActivity.java:
--------------------------------------------------------------------------------
1 | package net.matthi.webview;
2 | import android.content.Intent;
3 | import android.content.pm.PackageManager;
4 | import android.content.pm.ResolveInfo;
5 | import android.net.Uri;
6 | import android.support.design.widget.TabLayout;
7 | import android.support.v7.app.ActionBarDrawerToggle;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.os.Bundle;
10 | import android.support.v7.widget.Toolbar;
11 | import android.view.Gravity;
12 | import android.view.Menu;
13 | import android.view.MenuItem;
14 | import android.view.View;
15 | import android.support.v4.widget.DrawerLayout;
16 | import android.webkit.WebView;
17 | import android.webkit.WebViewClient;
18 | import android.widget.AdapterView;
19 | import android.widget.ListView;
20 | import com.example.matthias.webview.R;
21 | import com.google.android.gms.ads.AdRequest;
22 | import com.google.android.gms.ads.AdView;
23 | import java.net.URI;
24 | import java.util.ArrayList;
25 | import java.util.List;
26 |
27 | public class MainActivity extends AppCompatActivity{
28 |
29 | //The application toolbar
30 | Toolbar toolbar;
31 |
32 | //The drawer list
33 | ListView list;
34 |
35 | //The main content display
36 | WebView webView;
37 |
38 | //The drawer menu
39 | DrawerLayout drawerLayout;
40 |
41 | //The refresh button
42 | MenuItem refreshButton;
43 |
44 | //Tabs
45 | TabLayout tabs;
46 |
47 | //The actual displayed page
48 | static Pages actual = null;
49 |
50 | @Override
51 | protected void onCreate(Bundle savedInstanceState) {
52 | super.onCreate(savedInstanceState);
53 | setContentView(R.layout.activity_main);
54 | /*
55 | Views
56 | */
57 | toolbar = (Toolbar) findViewById(R.id.toolbar);
58 | list = (ListView)findViewById(R.id.listView);
59 | webView = (WebView) findViewById(R.id.webView);
60 | drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
61 | tabs = (TabLayout) findViewById(R.id.tabs);
62 |
63 | /*
64 | Tabs
65 | */
66 | //Tabs are invisible
67 | hideTabs();
68 |
69 | //Listener to receive tab changes
70 | tabs.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
71 |
72 | //User selected new tab
73 | @Override
74 | public void onTabSelected(TabLayout.Tab tab) {
75 |
76 | //Find page
77 | for (Pages p: Pages.values()){
78 | if (p.title.equals(actual.title)){
79 |
80 | //Load URL in webview
81 | if (actual.url != null)
82 | actual.actualURL = p.url.split("\\|\\|")[tab.getPosition()];
83 | if (actual.localPage != null)
84 | actual.actualAlternativeURL = actual.localPage.split("\\|\\|")[tab.getPosition()];
85 | }
86 |
87 | }
88 | if (actual.url != null) {
89 | webView.loadUrl(actual.actualURL);
90 | }else{
91 | if (actual.localPage !=null)
92 | webView.loadUrl("file:///android_asset/" + actual.actualAlternativeURL);
93 | }
94 | }
95 |
96 | //We don't need this methods
97 | @Override public void onTabUnselected(TabLayout.Tab tab) {}
98 | @Override public void onTabReselected(TabLayout.Tab tab) {}
99 | });
100 |
101 | /*
102 | Drawer items
103 | */
104 |
105 | //Create list of all items for the drawer
106 | final ArrayList pages = new ArrayList();
107 | for (Pages p: Pages.values()){
108 | if (p.menu == false)
109 | pages.add(p);
110 | }
111 |
112 | //Set actual page to the first item
113 | if (actual == null){
114 | actual = pages.get(0);
115 | }
116 |
117 | /*
118 | White design
119 | */
120 | if (actual.useWhiteFont){
121 | toolbar.setTitleTextColor(0xFFFFFFFF);
122 | tabs.setTabTextColors(0xFFFFFFFF, 0xFFFFFFFF);
123 | }
124 |
125 | /*
126 | Toolbar
127 | */
128 | toolbar.setTitle(actual.title);
129 | setSupportActionBar(toolbar);
130 |
131 | /*
132 | Admob
133 | */
134 | AdView mAdView = (AdView) findViewById(R.id.adView);
135 |
136 | //Hide AdView when not needed
137 | if (!actual.useAds){
138 | mAdView.setVisibility(View.INVISIBLE);
139 | }else{
140 | //Init AdView when needed
141 | AdRequest adRequest = new AdRequest.Builder().build();
142 | mAdView.loadAd(adRequest);
143 | }
144 |
145 | /*
146 | Drawer
147 | */
148 | ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(
149 | this, drawerLayout, toolbar,
150 | R.string.navigation_drawer_open, R.string.navigation_drawer_close
151 | );
152 | drawerLayout.setDrawerListener(mDrawerToggle);
153 | drawerLayout.setDrawerShadow(R.drawable.shadow, Gravity.LEFT);
154 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
155 | getSupportActionBar().setHomeButtonEnabled(true);
156 | mDrawerToggle.syncState();
157 |
158 | /*
159 | Pages to drawer
160 | */
161 |
162 | //Add pages to the drawer
163 | ListAdapter adapter = new ListAdapter(this, pages );
164 | list.setAdapter(adapter);
165 | adapter.notifyDataSetChanged();
166 |
167 | /*
168 | Webview
169 | */
170 | webView.getSettings().setJavaScriptEnabled(true);
171 | webView.setWebViewClient(new WebViewClient() {
172 |
173 |
174 | //Handle URL loading
175 | //Handle Intents (e.g. mailto:)
176 | @Override
177 | public boolean shouldOverrideUrlLoading(WebView view, String url) {
178 | if ((url.contains("http:") || url.contains("https:")) && actual.homeDomains.contains(URI.create(url).getHost())) {
179 | view.loadUrl(url);
180 | return false;
181 | } else {
182 | Intent intent = new Intent(Intent.ACTION_VIEW,
183 | Uri.parse(url));
184 | PackageManager manager = getPackageManager();
185 | List infos = manager.queryIntentActivities(intent, 0);
186 | if (infos.size() > 0) {
187 | startActivity(intent);
188 | }
189 | return true;
190 | }
191 | }
192 |
193 | //Needed for correct back-button functionality
194 | @Override
195 | public void onPageFinished(WebView view, String url) {
196 | webView.clearHistory();
197 | super.onPageFinished(view, url);
198 | }
199 |
200 | //Handle loading errors
201 | @Override
202 | public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
203 | if (actual.actualAlternativeURL !=null)
204 | webView.loadUrl("file:///android_asset/"+actual.actualAlternativeURL);
205 | else
206 | view.loadData(actual.error, "text/html", actual.localEncoding);
207 | }
208 | });
209 |
210 | /*
211 | Site listener
212 | */
213 |
214 | //Change page via drawer
215 | list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
216 | @Override
217 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
218 | changePage(pages.get(position));
219 | }
220 | });
221 |
222 | /*
223 | Update
224 | */
225 |
226 | //Load actual (first) page
227 | changePage(actual);
228 | }
229 |
230 | /*
231 | Tabs
232 | */
233 | //Show the TabView
234 | void showTabs(){
235 | tabs.getLayoutParams().height = TabLayout.LayoutParams.WRAP_CONTENT;
236 | }
237 |
238 | //Hide the TabView
239 | void hideTabs(){
240 | tabs.removeAllTabs();
241 | tabs.getLayoutParams().height = 0;
242 | }
243 |
244 |
245 | //Change the page
246 | //Update Webview, Toolbar, Refresh button...
247 | void changePage(Pages newPage){
248 | actual = newPage;
249 |
250 | //Handle tabs
251 | tabs.removeAllTabs();
252 | if (newPage.tabs != null && newPage.tabs.contains("||")){
253 | showTabs();
254 | for (String s : newPage.tabs.split("\\|\\|")){
255 | tabs.addTab(tabs.newTab().setText(s));
256 | }
257 | if (newPage.url != null) {
258 | newPage.actualURL = newPage.url.split("\\|\\|")[0];
259 | }
260 | if (newPage.localPage != null) {
261 | newPage.actualAlternativeURL = newPage.localPage.split("\\|\\|")[0];
262 | }
263 |
264 | //There are no tabs...
265 | }else{
266 | hideTabs();
267 | newPage.actualURL = newPage.url;
268 | newPage.actualAlternativeURL = newPage.localPage;
269 | }
270 |
271 |
272 | //Enable JS for the webview
273 | webView.getSettings().setJavaScriptEnabled(true);
274 |
275 | //Load URL to the webview...
276 | if (newPage.url != null) {
277 | webView.loadUrl(newPage.actualURL);
278 | }else{
279 | if (newPage.localPage !=null) //...Or use local page
280 | webView.loadUrl("file:///android_asset/" + newPage.actualAlternativeURL);
281 | }
282 |
283 | //Update Toolbar and Statusbar
284 | toolbar.setBackgroundColor(newPage.actionBarColor.value);
285 | drawerLayout.setBackgroundColor(newPage.actionBarColor.value);
286 | drawerLayout.closeDrawers();
287 | toolbar.setTitle(newPage.title);
288 |
289 | //Show refresh button
290 | if (refreshButton!= null) {
291 | if (newPage.refreshButton) {
292 | refreshButton.setVisible(true);
293 | } else {
294 | refreshButton.setVisible(false);
295 | }
296 | }
297 |
298 | actual = newPage;
299 | }
300 |
301 | //Create OptionsMenu
302 | @Override
303 | public boolean onCreateOptionsMenu(Menu menu) {
304 |
305 | //Create the menu
306 | getMenuInflater().inflate(R.menu.main, menu);
307 |
308 | //Add pages to the menu
309 | for (Pages p: Pages.values()){
310 | if (p.menu != false)
311 | menu.add(p.title);
312 | }
313 |
314 | //Refresh button
315 | refreshButton = menu.add(R.string.refresh);
316 | if (actual.useWhiteFont) {
317 | refreshButton.setIcon(R.drawable.ic_autorenew_white_36dp);
318 | }else {
319 | refreshButton.setIcon(R.drawable.ic_autorenew_black_36dp);
320 | }
321 | refreshButton.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
322 |
323 | //Share button
324 | if (Pages.values()[0].share){
325 | MenuItem shareItem = menu.add(getString(R.string.share));
326 | if (actual.shareAsAction){
327 | if (actual.useWhiteFont)
328 | shareItem.setIcon(R.drawable.ic_share_white_36dp);
329 | else
330 | shareItem.setIcon(R.drawable.ic_share_black_36dp);
331 | shareItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
332 | }
333 | }
334 |
335 | //Show/hide refresh button for the first page
336 | if (actual != null) {
337 | if (actual.refreshButton) {
338 | refreshButton.setVisible(true);
339 | } else {
340 | refreshButton.setVisible(false);
341 | }
342 | }
343 | return true;
344 | }
345 |
346 |
347 | //Handle back-button
348 | @Override
349 | public void onBackPressed() {
350 | if (webView.canGoBack()){
351 | webView.goBack();
352 | }else {
353 | //super.onBackPressed(); //Don't close app via back-button
354 | }
355 | }
356 |
357 |
358 | //Handle menu-clicks
359 | @Override
360 | public boolean onOptionsItemSelected(MenuItem item) {
361 |
362 | //Share
363 | if (item.getTitle().toString().equals(getString(R.string.share))){
364 | Intent sharingIntent = new Intent(Intent.ACTION_SEND);
365 | sharingIntent.setType("text/plain");
366 | sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, Pages.values()[0].shareText);
367 | sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "");
368 | startActivity(Intent.createChooser(sharingIntent, getString(R.string.share_using)));
369 | return super.onOptionsItemSelected(item);
370 | }
371 |
372 | //Refresh
373 | if (item.getTitle().toString().equals(getString(R.string.refresh ))){
374 | if (actual.url != null){
375 | System.out.println(actual.url);
376 | webView.reload();
377 | webView.loadUrl(actual.url);
378 | }
379 | return super.onOptionsItemSelected(item);
380 | }
381 |
382 | //Page
383 | for (Pages p: Pages.values()){
384 | if (p.title.equals(item.getTitle().toString())){
385 | if (p.url.contains("http:")||p.url.contains("http:")) {
386 | changePage(p);
387 | }else{
388 |
389 | //Handle special Intents (e.g. for mailto: in the menu)
390 |
391 | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(p.url));
392 | PackageManager manager = getPackageManager();
393 | List infos = manager.queryIntentActivities(intent, 0);
394 | if (infos.size() > 0) {
395 | startActivity(intent);
396 | }
397 |
398 |
399 | }
400 |
401 | }
402 | }
403 | return super.onOptionsItemSelected(item);
404 | }
405 |
406 | }
407 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/java/net/matthi/webview/Pages.java:
--------------------------------------------------------------------------------
1 | package net.matthi.webview;
2 |
3 | import com.example.matthias.webview.R;
4 |
5 | import java.net.URI;
6 |
7 | /**
8 | * Created by Matthias on 11.08.2015.
9 | */
10 | public enum Pages {
11 |
12 | //---------------- Edit here ----------------
13 |
14 | //ID menu title tabs URL(s) offline URL(s) Color Icon Refresh Button
15 |
16 | Home ( false, "Home", null, "http://www.matthi.net/wv_test/home.html", null, Color.CYAN_DARK, Icon.HOME, false),
17 | Newsfeed ( false, "News", null, "http://www.matthi.net/wv_test/newsfeed.html", null, Color.CYAN_DARK, Icon.LIST, true),
18 | Team ( false, "Company", "Team||CEO","http://www.matthi.net/wv_test/team.html||http://www.matthi.net/wv_test/ceo.html" ,null,Color.CYAN_DARK,Icon.PEOPLE, false),
19 | Offline ( false, "Offline page", null, null, "offline.html", Color.PURPLE_DARK, Icon.DOWNLOAD, false),
20 | Contact ( false, "Contact", null, "http://www.matthi.net/wv_test/contact.html", "contact.html", Color.CYAN_DARK, Icon.PERSON, false),
21 | Imprint ( false, "Imprint", null, "http://www.matthi.net/wv_test/imprint.html", null, Color.GRAY_LIGHT, Icon.TEXT, false),
22 | Imprint2 ( true, "Imprint", null, "http://www.matthi.net/wv_test/imprint.html", null, Color.GRAY_LIGHT, null, false),
23 | Mail ( true, "Send me an E-mail", null, "mailto:test@fakemail.com", null, Color.CYAN_DARK, null, false);
24 |
25 |
26 |
27 | //White Design
28 | public boolean useWhiteFont = false;
29 |
30 | //URLs included in your app
31 | public String homeDomains = "";
32 |
33 | //Error message
34 | public String error = " The page couldn't be loaded ";
35 |
36 | //Share
37 | public boolean share = true;
38 | public boolean shareAsAction = false;
39 | public String shareText = "Look at this! http://www.example.org/";
40 |
41 | //Misc
42 | public String localEncoding = "UTF-8";
43 |
44 | //Ads
45 | public boolean useAds = false;
46 | // Enter your unit id at /res/values/strings.xml -> banner_ad_unit_id
47 |
48 |
49 | //---------------- Do not edit ----------------
50 | //
51 | //
52 | //
53 | //
54 |
55 |
56 | Pages(boolean menu, String title, String tabs, String url, String localPage, Color actionBarColor, Icon icon, boolean refreshButton) {
57 | this.menu = menu;
58 | this.title = title;
59 | this.url = url;
60 | this.actionBarColor = actionBarColor;
61 | this.icon = icon;
62 |
63 | //Domain to homeDomains
64 | if (url != null){
65 | if (!url.contains("||")){
66 | homeDomains += ","+ URI.create(url).getHost();
67 | }else{
68 | for (String s:url.split("\\|\\|")){
69 | System.out.println(s);
70 | homeDomains += ","+ URI.create(s).getHost();
71 | }
72 | }
73 | }
74 |
75 | this.tabs = tabs;
76 | this.refreshButton = refreshButton;
77 | this.localPage = localPage;
78 | }
79 |
80 |
81 | public boolean menu;
82 | public String title;
83 | public String url;
84 | public Color actionBarColor;
85 | public Icon icon;
86 | public boolean refreshButton;
87 | public String localPage;
88 | public String tabs;
89 |
90 |
91 | public String actualURL;
92 | public String actualAlternativeURL;
93 |
94 |
95 | //All Colors
96 |
97 | // NAME (0xARGB);
98 |
99 | public static enum Color {
100 | RED (0xFFDD3333),
101 | GREEN (0xFF33DD33),
102 | BLUE (0xFF4444DD),
103 | YELLOW (0xFFDDDD11),
104 | CYAN_DARK (0xFF0088FF),
105 | CYAN_LIGHT (0xFF00DDFF),
106 | GRAY_LIGHT (0xFFBBBBBB),
107 | GRAY_DARK (0xFF555555),
108 | PURPLE_DARK (0xFFBB00BB),
109 | PURPLE_LIGHT (0xFFFF11FF);
110 |
111 | public int value;
112 |
113 | Color(int value){
114 | this.value = value;
115 | }
116 | }
117 |
118 | //All Icons
119 |
120 | //NAME (R.drawable.)
121 |
122 | public static enum Icon {
123 | HOME (R.drawable.ic_home_black_48dp),
124 | DOWNLOAD (R.drawable.ic_get_app_black_48dp),
125 | STAR (R.drawable.ic_grade_black_48dp),
126 | QUESTION (R.drawable.ic_help_black_48dp),
127 | INTERNET (R.drawable.ic_language_black_48dp),
128 | LIST (R.drawable.ic_list_black_48dp),
129 | PERSON (R.drawable.ic_perm_identity_black_48dp),
130 | MAP (R.drawable.ic_room_black_48dp),
131 | SETTINGS (R.drawable.ic_settings_black_48dp),
132 | SHOP (R.drawable.ic_shop_black_48dp),
133 | TEXT (R.drawable.ic_subject_black_48dp),
134 | MOVIE (R.drawable.ic_theaters_black_48dp),
135 | CALENDAR (R.drawable.ic_today_black_48dp),
136 | GALLERY (R.drawable.ic_view_module_black_48dp),
137 | EYE (R.drawable.ic_visibility_black_48dp),
138 | WORK (R.drawable.ic_work_black_48dp),
139 | PEOPLE (R.drawable.ic_people_outline_black_36dp);
140 |
141 |
142 | public int value;
143 |
144 | Icon(int value){
145 | this.value = value;
146 | }
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable-hdpi/drawer_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable-hdpi/drawer_shadow.9.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable-hdpi/ic_drawer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable-hdpi/ic_drawer.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable-mdpi/drawer_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable-mdpi/drawer_shadow.9.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable-mdpi/ic_drawer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable-mdpi/ic_drawer.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable-xhdpi/ic_drawer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable-xhdpi/ic_drawer.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable-xxhdpi/ic_drawer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable-xxhdpi/ic_drawer.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_assessment_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_assessment_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_autorenew_black_36dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_autorenew_black_36dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_autorenew_white_36dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_autorenew_white_36dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_get_app_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_get_app_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_grade_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_grade_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_help_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_help_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_home_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_home_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_language_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_language_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_list_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_list_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_people_outline_black_36dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_people_outline_black_36dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_perm_identity_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_perm_identity_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_room_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_room_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_settings_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_settings_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_share_black_36dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_share_black_36dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_share_white_36dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_share_white_36dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_shop_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_shop_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_subject_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_subject_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_theaters_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_theaters_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_today_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_today_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_view_module_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_view_module_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_visibility_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_visibility_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_work_black_48dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/ic_work_black_48dp.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/material.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/drawable/material.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/drawable/shadow.xml:
--------------------------------------------------------------------------------
1 |
3 |
5 |
6 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
15 |
25 |
26 |
31 |
32 |
38 |
39 |
44 |
45 |
46 |
47 |
55 |
56 |
57 |
58 |
59 |
60 |
66 |
74 |
75 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/layout/drawer_item_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
18 |
19 |
34 |
35 |
41 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/values-v19/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
8 | 240dp
9 |
10 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Webview
5 | ca-app-pub-3940256099942544/6300978111
6 |
7 | Open navigation drawer
8 | Close navigation drawer
9 | refresh
10 | Share using
11 | Share
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.3.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Android Studio project/Project/Webview/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Aug 11 18:06:16 CEST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/Android Studio project/Project/Webview/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/Demo/Apk/app-release.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Demo/Apk/app-release.apk
--------------------------------------------------------------------------------
/Docs/Material Webview step by step instructions.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Docs/Material Webview step by step instructions.docx
--------------------------------------------------------------------------------
/Docs/Material Webview step by step instructions.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Docs/Material Webview step by step instructions.pdf
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #Android Material Webview
2 |
3 | No coding skills? - Create a native Android app from your website.
4 | Web developer with no Android skills? - Develop your own app with html/css/js.
5 |
6 | ##Features:
7 |
8 | - Modern Material Design on every supported version of Android
9 | - Set actionbar color/icon/title for every page seperately
10 | - Supports Android from version 4.0.3, so it runs on > 90% of all Android devices out there
11 | - Save pages offline, or use a offline page, when the online one is not available
12 | - Use a Navigation drawer, the 3-dot menu or Tabs for navigation
13 | - Supports AdMob - make money with your app
14 | - Supports a share button
15 | - Add a refresh button to certain pages (e.g. newsfeed)
16 | - The apk file is very small (less than 3MB for me)
17 | - HTML5 / Js support
18 |
19 | ##Screenshots
20 |
21 |
22 | 
23 | 
24 |
25 |
26 | ##License:
27 |
28 | Copyright 2015 Matthias Rupp
29 |
30 | Licensed under the Apache License, Version 2.0 (the "License");
31 | you may not use this file except in compliance with the License.
32 | You may obtain a copy of the License at
33 |
34 | http://www.apache.org/licenses/LICENSE-2.0
35 |
36 | Unless required by applicable law or agreed to in writing, software
37 | distributed under the License is distributed on an "AS IS" BASIS,
38 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39 | See the License for the specific language governing permissions and
40 | limitations under the License.
41 |
--------------------------------------------------------------------------------
/Screenshots/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Screenshots/1.png
--------------------------------------------------------------------------------
/Screenshots/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Screenshots/2.png
--------------------------------------------------------------------------------
/Screenshots/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Screenshots/3.png
--------------------------------------------------------------------------------
/Screenshots/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthinc/Android-Material-Webview-App-Template/5816747564a6e35d5a6111290ee3c6a8b0fa054e/Screenshots/5.png
--------------------------------------------------------------------------------