11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Burak
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # İçerik
2 |
3 | - [Nasıl İndirilir ve Kurulum Yapılır](#nasıl-İndirilir-ve-kurulum-yapılır)
4 | - [Ana Sayfa Link Değiştirme](#ana-sayfa-link-değiştirme)
5 | - [Kategori Menüsü Değiştirme](#kategori-menüsü-değiştirme)
6 | - [Kategori Arka Planı Değiştirme](#kategori-arka-planı-değiştirme)
7 | - [Alt Menüyü Değiştirme](#alt-menüyü-değiştirme)
8 | - [Uygulama Yazılarını Değiştirme](#uygulama-yazılarını-değiştirme)
9 | - [Splash Screen Görüntüsünü Değiştirme/Kaldırma](#splash-screen-görüntüsünü-değiştirmekaldırma)
10 | - [Uygulamaya Logo Eklemek](#uygulamaya-logo-eklemek)
11 | - [Ayarlar Menüsünü Değiştirmek](#ayarlar-menüsünü-değiştirmek)
12 | - [ADMOB Ekleme](#admob-ekleme)
13 | - [Renkleri Değiştirme](#renkleri-değiştirme)
14 | - [One Signal Ayarlarını Yapma](#one-signal-ayarlarını-yapma)
15 | - [Toolbar Ayarları](#toolbar-ayarları)
16 | - [Toolbar Kaldırma](#toolbar-kaldırma)
17 |
18 | # Nasıl İndirilir ve Kurulum Yapılır
19 |
20 | 
21 |
22 | Resimdeki butona bastıp projeyi indirin. Daha sonrasında Android Studio açıp aşağıdaki resimde görülen butona basın.
23 |
24 | 
25 |
26 | Daha sonra indirdiğiniz dosyayı bulup onu seçmeniz yeterlidir.
27 |
28 | # Ana Sayfa Link Değiştirme
29 |
30 | 
31 |
32 | ```web_url="``` kısmına websitesi adresinizi yazınız.
33 |
34 | # Kategori Menüsü Değiştirme
35 |
36 | **navigation_menu.xml** Dosyasından Kategori menüsündeki menüleri değiştirebilirsiniz. Örnek menü ekleme yöntemleri:
37 |
38 | Menü arası ayıraç ile
39 | ```xml
40 |
47 |
48 | ```
49 | Menü arası ayıraç olmadan
50 | ```xml
51 |
56 | ```
57 |
58 |
BURAYA ID yazan kısıma başlığa uygun bir id yazın.
59 |
BURAYA BAŞLIK yazan kısıma istediğiniz başlığı yazın.
60 |
BURAYA RESIM yazan kısma drawable dosyasındaki iconun adını yazın.
61 |
62 |
63 | 
64 |
65 | **navigation.menu.xml** dosyasından eklemeleri yaptıktan sonra **categories.java** dosyasındaki resimdeki alanı menü itemlarınıza göre değiştirin. Örneğin:
66 |
67 |
68 | ```xml
69 |
70 |
75 | ```
76 | Menü item için aşağıdaki eklemeyi yapabilirsinizi
77 |
78 | ```java
79 | case R.id.ID_BURAYA:
80 | webviewSetup(““);
81 | break;
82 | ```
83 | ## Kategori Arka Planı Değiştirme
84 |
85 | **fragment_categories.xml** dosyasında resimde görülen alanı değiştirmeniz yeterlidir.
86 |
87 | 
88 |
89 | # Alt Menüyü Değiştirme
90 |
91 | **bottomnavigation_menu.xml** Dosyasından Alt Menüyü değiştirebiliriz.
92 |
93 | - Örnek Menü Ekleme:
94 | ```xml
95 |
100 | ```
101 |
102 |
BURAYA ID yazan kısıma başlığa uygun bir id yazın.
103 |
BURAYA BAŞLIK yazan kısıma istediğiniz başlığı yazın.
104 |
BURAYA RESIM yazan kısma drawable dosyasındaki iconun adını yazın.
105 |
106 | Daha sonrasında
107 |
108 | 
109 |
110 | **MainActivity.java** içerisindeki resimdeki alana menü itemlarınıza göre değiştirin. Örneğin:
111 |
112 | ```xml
113 |
118 | ```
119 | Itemı için aşağıdaki eklemeyi yapmanız gerekir.
120 |
121 | ```java
122 | case R.id.ana_sayfa:
123 | fragmentClass=MainPage.class;
124 | break;
125 | ```
126 |
127 | # Uygulama Yazılarını Değiştirme
128 |
129 | **strings.xml** dosyası içinden istediğiniz şekilde değişiklik yapabilirsiniz.
130 |
131 | # Splash Screen Görüntüsünü Değiştirme/Kaldırma
132 |
133 | ### Splash Screen Görüntüsünü Değiştirmek
134 |
135 | Splash screen görüntüsünü değiştirmek için **splash_screen.xml** dosyasını açıp aşağıdaki resimdeki alana resmi eklemeniz yeterlidir.
136 |
137 | 
138 |
139 | ### Splash Screen Görüntüsünü Kaldırmak
140 |
141 | **MainActivity.java** dosyası içindeki resimde görülen alanı silmeniz yeterlidir.
142 |
143 | 
144 |
145 | # Uygulamaya Logo Eklemek
146 |
147 | [Bu linkteki](https://www.youtube.com/watch?v=5Y4plQv8c4s) videoyu izleyerek hızlı bir şekilde değişikliklerinizi yapabilirsiniz.
148 |
149 | # Ayarlar Menüsünü Değiştirmek
150 | [Bu](https://github.com/jrvansuita/MaterialAbout) linke tıklayarak detaylı bilgi alabilirsiniz. Kullanımı çok basittir.
151 |
152 | # ADMOB Ekleme
153 |
fragment_mainpage_fragment.xml
154 |
fragment_categories.xml
155 | Dosyalarında bulunan resimdeki yerleri Admob ID'niz ile değiştirin.
156 |
157 | 
158 |
159 |
AndroidManifest.xml
160 | AndroidManifest.xml içinde gösterilen alana da Admob Uygulama ID'nizi ekleyin.
161 | 
162 |
163 | # Renkleri Değiştirme
164 |
165 | Renkleri değiştirmek için **colors.xml** dosyasındaki renkleri değiştirmeniz yeterlidir.
166 |
167 | 
168 |
169 | # One Signal Ayarlarını Yapma
170 |
171 | 
172 |
173 | Resimde gördüğünüz dosyayı açtıktan sonra aşağıdaki resimdeki işaretli alanları doldurmanız yeterlidir.
174 |
175 | 
176 |
177 | # Toolbar Ayarları
178 |
179 | **MainActivity.java** içerisindeki resimde görülen kod toolbar ayarlarının olduğu yerdir.
180 |
181 | 
182 |
183 | ```toolbar.setLogo();``` **BURAYA LOGO** yazan yere resmi eklemeniz yeterlidir. Örneğin, ```toolbar.setLogo(R.drawable.logo);```
184 |
185 | ```toolbar.setTitleTextColor(getResources().getColor(R.color.));``` **SENIN RENGIN** yazan yere **colors.xml** dosyasından renk ekledikten sonra o rengin ismini yazmanız yeterlidir bu sayede Toolbar'daki **Başlığın rengi** değişecektir.
186 |
187 | ```toolbar.setElevation(2);``` setElevation methodu Toolbar'ın altındaki gölgeyi bize verir. 0 yazarsanız gölge ortadan kalkacaktır. Sayı arttıkça gölge de artacaktır.
188 |
189 | # Toolbar Kaldırma
190 |
191 | 
192 |
193 | Toolbarı kaldırmak için ***MainActivity.java** içerisinde yukarıdaki resimde görülen ```addToolbar();``` silin. Daha sonrasında **activity_main.xml** içinde aşağıdaki resimde görülen alanı kaldırmanız yeterlidir.
194 |
195 | 
196 |
197 |
198 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | maven { url 'https://plugins.gradle.org/m2/'}
4 | }
5 | dependencies {
6 | classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.6'
7 | }
8 | }
9 | apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
10 |
11 | apply plugin: 'com.android.application'
12 |
13 | android {
14 | compileSdkVersion 29
15 | defaultConfig {
16 | manifestPlaceholders = [
17 | onesignal_app_id: '',
18 | // Project number pulled from dashboard, local value is ignored.
19 | onesignal_google_project_number: ''] //TODO ONESIGNAL ADD
20 | applicationId "com.zeniwork.webviewproject"
21 | minSdkVersion 21
22 | targetSdkVersion 29
23 | versionCode 1
24 | versionName "1.0"
25 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
26 | }
27 | buildTypes {
28 | release {
29 | minifyEnabled false
30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
31 | }
32 | }
33 | }
34 |
35 | dependencies {
36 | implementation fileTree(include: ['*.jar'], dir: 'libs')
37 | implementation 'androidx.appcompat:appcompat:1.1.0'
38 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
39 | implementation 'androidx.legacy:legacy-support-v4:1.0.0'
40 | implementation 'com.google.firebase:firebase-messaging:20.1.0'
41 | implementation 'com.github.jrvansuita:MaterialAbout:+'
42 | implementation 'com.google.firebase:firebase-core:17.2.2'
43 | implementation 'com.onesignal:OneSignal:3.10.1'
44 | implementation 'com.github.GrenderG:Toasty:1.4.2'
45 | implementation 'com.google.android.material:material:1.0.0'
46 | implementation 'com.google.android.gms:play-services-ads:18.3.0'
47 | }
48 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
19 |
22 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/main/java/com/mrntlu/webviewproject/Categories.java:
--------------------------------------------------------------------------------
1 | package com.mrntlu.webviewproject;
2 |
3 | import android.os.Bundle;
4 | import com.google.android.material.navigation.NavigationView;
5 | import androidx.annotation.NonNull;
6 | import androidx.fragment.app.Fragment;
7 | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
8 | import android.view.LayoutInflater;
9 | import android.view.MenuItem;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.webkit.WebView;
13 | import android.widget.ProgressBar;
14 | import com.google.android.gms.ads.AdRequest;
15 | import com.google.android.gms.ads.AdView;
16 |
17 | public class Categories extends Fragment implements FragmentOnBackPressed{
18 |
19 | public static Categories newInstance() {
20 | return new Categories();
21 | }
22 |
23 | private WebView webView;
24 | private NavigationView navigationView;
25 | private SwipeRefreshLayout swipeRefreshLayout;
26 | private AdView adView;
27 |
28 | @Override
29 | public void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | }
32 |
33 | @Override
34 | public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
35 | return inflater.inflate(R.layout.fragment_categories, container, false);
36 | }
37 |
38 | @Override
39 | public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
40 | super.onViewCreated(view, savedInstanceState);
41 | navigationView=view.findViewById(R.id.full_nav_view);
42 | webView=view.findViewById(R.id.categories_webview);
43 | swipeRefreshLayout=view.findViewById(R.id.swipeRefresh_categories);
44 | ProgressBar progressBar = view.findViewById(R.id.categories_progress);
45 | adView=view.findViewById(R.id.categoriesAd);
46 |
47 | setAds();
48 |
49 | WebviewInits webviewInits=new WebviewInits(webView,swipeRefreshLayout, progressBar,getContext());
50 | webviewInits.initWeb();
51 | registerForContextMenu(webView);
52 |
53 | //TODO Categories Menu Items
54 | navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
55 | @Override
56 | public boolean onNavigationItemSelected(@NonNull MenuItem item) {
57 | switch (item.getItemId()){
58 | case R.id.bank_news:
59 | webviewSetup("");
60 | break;
61 | case R.id.economy:
62 | webviewSetup("");
63 | break;
64 | case R.id.credits:
65 | webviewSetup("");
66 | break;
67 | case R.id.carreer:
68 | webviewSetup("");
69 | break;
70 | case R.id.pano:
71 | webviewSetup("");
72 | break;
73 | case R.id.bank_hire:
74 | webviewSetup("");
75 | break;
76 | case R.id.kamu_hire:
77 | webviewSetup("");
78 | break;
79 | case R.id.other_hire:
80 | webviewSetup("");
81 | break;
82 | }
83 | return true;
84 | }
85 | });
86 | }
87 |
88 | private void setAds() {
89 | AdRequest adRequest = new AdRequest.Builder().build();
90 | adView.loadAd(adRequest);
91 | }
92 |
93 | private void webviewSetup(String url){
94 | webView.loadUrl(url);
95 | swipeRefreshLayout.setVisibility(View.VISIBLE);
96 | navigationView.setVisibility(View.GONE);
97 | adView.setVisibility(View.VISIBLE);
98 | }
99 |
100 | @Override
101 | public void onBackPressed() {
102 | if (webView.canGoBack()){
103 | webView.goBack();
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrntlu/webviewproject/FragmentOnBackPressed.java:
--------------------------------------------------------------------------------
1 | package com.mrntlu.webviewproject;
2 |
3 | public interface FragmentOnBackPressed {
4 | void onBackPressed();
5 | }
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrntlu/webviewproject/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.mrntlu.webviewproject;
2 |
3 | import android.app.AlertDialog;
4 | import android.app.Dialog;
5 | import android.content.BroadcastReceiver;
6 | import android.content.Context;
7 | import android.content.DialogInterface;
8 | import android.content.Intent;
9 | import android.content.IntentFilter;
10 | import android.os.Handler;
11 | import com.google.android.material.bottomnavigation.BottomNavigationView;
12 | import androidx.annotation.NonNull;
13 | import androidx.fragment.app.Fragment;
14 | import androidx.fragment.app.FragmentManager;
15 | import androidx.appcompat.app.AppCompatActivity;
16 | import android.os.Bundle;
17 | import androidx.appcompat.widget.Toolbar;
18 | import android.view.KeyEvent;
19 | import android.view.MenuItem;
20 | import android.widget.Toast;
21 |
22 | import com.onesignal.OneSignal;
23 |
24 | import es.dmoral.toasty.Toasty;
25 |
26 | public class MainActivity extends AppCompatActivity {
27 | Dialog splashScreenDialog;
28 | BottomNavigationView bottomNavigationView;
29 | BroadcastReceiver broadcastReceiver;
30 |
31 | //TODO Back button functionality
32 | @Override
33 | public boolean onKeyDown(int keyCode, KeyEvent event) {
34 | if (event.getAction() == KeyEvent.ACTION_DOWN) {
35 | if (keyCode == KeyEvent.KEYCODE_BACK) {
36 | Fragment fragment=getSupportFragmentManager().findFragmentById(R.id.frame_layout);
37 | if (fragment instanceof FragmentOnBackPressed){
38 | ((FragmentOnBackPressed) fragment).onBackPressed();
39 | }else {
40 | AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
41 | builder.setTitle(R.string.emin_misin);
42 | builder.setMessage(R.string.cikmak_istiyor_musun);
43 | builder.setPositiveButton(R.string.evet, new DialogInterface.OnClickListener() {
44 | @Override
45 | public void onClick(DialogInterface dialog, int which) {
46 | finish();
47 | }
48 | });
49 | builder.setNegativeButton(R.string.hayir, new DialogInterface.OnClickListener() {
50 | @Override
51 | public void onClick(DialogInterface dialog, int which) {
52 | dialog.cancel();
53 | }
54 | });
55 | builder.show();
56 | }
57 | return true;
58 | }
59 | }
60 | return super.onKeyDown(keyCode, event);
61 | }
62 |
63 | //TODO Checks internet state if there is no internet warning pops up
64 | private void checkInternet(){
65 | IntentFilter intentFilter=new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE");
66 | broadcastReceiver=new BroadcastReceiver() {
67 | @Override
68 | public void onReceive(Context context, Intent intent) {
69 | if (WebviewInits.isNetworkAvailable(getBaseContext())){
70 | Toasty.success(context,getString(R.string.baglanti_basarili), Toast.LENGTH_LONG).show();
71 | return;
72 | }
73 | else{
74 | Toasty.error(context,getString(R.string.baglanti_basarisiz),Toast.LENGTH_LONG).show();
75 | }
76 | }
77 | };
78 | registerReceiver(broadcastReceiver,intentFilter);
79 | }
80 |
81 | @Override
82 | protected void onCreate(Bundle savedInstanceState) {
83 | super.onCreate(savedInstanceState);
84 | OneSignal.startInit(this)
85 | .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
86 | .unsubscribeWhenNotificationsAreDisabled(true)
87 | .init();
88 | setContentView(R.layout.activity_main);
89 | FragmentManager fragmentManager=getSupportFragmentManager();
90 | fragmentManager.beginTransaction().replace(R.id.frame_layout, MainPage.newInstance()).commit();
91 | showSplash();//TODO Delete if you don't want splash screen
92 | checkInternet();//TODO Delete if you don't want internet control
93 | addToolbar();//TODO Adds toolbar to the project
94 | //TODO If you don't want toolbar delete it from activity.xml and here
95 |
96 | bottomNavigationView=findViewById(R.id.bottom_navigation);
97 |
98 | bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
99 | @Override
100 | public boolean onNavigationItemSelected(@NonNull MenuItem item) {
101 | selectItem(item);
102 | return false;
103 | }
104 | });
105 | }
106 |
107 | //TODO Adds Toolbar
108 | void addToolbar(){
109 | Toolbar toolbar=findViewById(R.id.main_toolbar);
110 | setSupportActionBar(toolbar);
111 | toolbar.setTitleTextColor(getResources().getColor(R.color.backgroundWhite));//TODO Title color of toolbar
112 | toolbar.setLogo(R.mipmap.ic_launcher);//TODO Logo of toolbar
113 | toolbar.setElevation(2);//TODO Shadow under the toolbar
114 | }
115 |
116 | //TODO Bottom Navigation Menu Items
117 | void selectItem(MenuItem menuItem){
118 | Fragment fragment;
119 | Class fragmentClass;
120 | switch (menuItem.getItemId()){
121 | case R.id.main_page:
122 | fragmentClass=MainPage.class;
123 | break;
124 | case R.id.settings:
125 | fragmentClass=Settings.class;
126 | break;
127 | case R.id.categories:
128 | fragmentClass=Categories.class;
129 | break;
130 | default:
131 | fragmentClass=MainPage.class;
132 | }
133 | try{
134 | fragment=(Fragment)fragmentClass.newInstance();
135 | }catch(Exception e){
136 | e.printStackTrace();
137 | fragment=MainPage.newInstance();
138 | }
139 | FragmentManager fragmentManager=getSupportFragmentManager();
140 | fragmentManager.beginTransaction().replace(R.id.frame_layout,fragment).commit();
141 | menuItem.setChecked(true);
142 | setTitle(menuItem.getTitle());
143 | }
144 |
145 | //TODO SplashScreen Method
146 | void showSplash(){
147 | splashScreenDialog=new Dialog(this,android.R.style.Theme_DeviceDefault_Light_NoActionBar_Fullscreen);
148 | splashScreenDialog.setContentView(R.layout.splash_screen);
149 | splashScreenDialog.show();
150 | Handler handler = new Handler();
151 | handler.postDelayed(new Runnable() {
152 | public void run() {
153 | splashScreenDialog.dismiss();
154 | }
155 | }, 4000);
156 | }
157 |
158 | }
159 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrntlu/webviewproject/MainPage.java:
--------------------------------------------------------------------------------
1 | package com.mrntlu.webviewproject;
2 |
3 | import android.os.Bundle;
4 | import androidx.annotation.NonNull;
5 | import androidx.fragment.app.Fragment;
6 | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.webkit.WebView;
11 | import android.widget.ProgressBar;
12 |
13 | import com.google.android.gms.ads.AdRequest;
14 | import com.google.android.gms.ads.AdView;
15 |
16 | public class MainPage extends Fragment implements FragmentOnBackPressed{
17 | //TODO Website Link
18 | private final String web_url="";
19 | private WebView webView;
20 | private AdView adView;
21 |
22 | public static MainPage newInstance() {
23 | return new MainPage();
24 | }
25 |
26 | @Override
27 | public void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | }
30 |
31 | @Override
32 | public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
33 | return inflater.inflate(R.layout.fragment_mainpage_fragment, container, false);
34 | }
35 |
36 | @Override
37 | public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
38 | super.onViewCreated(view, savedInstanceState);
39 | webView=view.findViewById(R.id.myWebview);
40 | final SwipeRefreshLayout swipeRefreshLayout=view.findViewById(R.id.swipeRefreshLayout);
41 | final ProgressBar progressBar=view.findViewById(R.id.progressBar);
42 | adView=view.findViewById(R.id.adMob);
43 |
44 | setAds();
45 | WebviewInits webviewInits=new WebviewInits(webView,swipeRefreshLayout,progressBar,getContext());
46 | webviewInits.initWeb();
47 |
48 | registerForContextMenu(webView);
49 | webView.loadUrl(web_url);
50 | }
51 |
52 | private void setAds() {
53 | AdRequest adRequest = new AdRequest.Builder().build();
54 | adView.loadAd(adRequest);
55 | }
56 |
57 | @Override
58 | public void onBackPressed() {
59 | if (webView.canGoBack()) {
60 | webView.goBack();
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrntlu/webviewproject/Settings.java:
--------------------------------------------------------------------------------
1 | package com.mrntlu.webviewproject;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 |
6 | import androidx.annotation.NonNull;
7 | import androidx.fragment.app.Fragment;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 |
12 | import com.vansuita.materialabout.builder.AboutBuilder;
13 | import com.vansuita.materialabout.views.AboutView;
14 |
15 | public class Settings extends Fragment {
16 |
17 | public static Settings newInstance() {
18 | return new Settings();
19 | }
20 |
21 | @Override
22 | public void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | }
25 |
26 | @Override
27 | public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
28 | return inflater.inflate(R.layout.fragment_settings, container, false);
29 | }
30 |
31 | @Override
32 | public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
33 | super.onViewCreated(view, savedInstanceState);
34 | //TODO CHANGE THEM
35 | AboutView aboutView = AboutBuilder.with(getContext())
36 | .setPhoto(R.mipmap.ic_launcher)
37 | .setCover(R.color.backgroundWhite)
38 | .setName(R.string.app_name)
39 | .setSubTitle("")
40 | .setAppIcon(R.mipmap.ic_launcher)
41 | .setAppName(R.string.app_name)
42 | .addFacebookLink("")
43 | .addTwitterLink("")
44 | .addInstagramLink("")
45 | .addYoutubeChannelLink("")
46 | .addGooglePlusLink("")
47 | .addFiveStarsAction()
48 | .setVersionNameAsAppSubTitle()
49 | .addFeedbackAction("")
50 | .addShareAction(R.string.app_name)
51 | .setWrapScrollView(true)
52 | .setLinksAnimated(true)
53 | .setShowAsCard(true)
54 | .build();
55 | AboutView aboutViewLayout=view.findViewById(R.id.about_view);
56 | aboutViewLayout.addView(aboutView);
57 | }
58 |
59 | @Override
60 | public void onAttach(@NonNull Context context) {
61 | super.onAttach(context);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mrntlu/webviewproject/WebviewInits.java:
--------------------------------------------------------------------------------
1 | package com.mrntlu.webviewproject;
2 |
3 | import android.app.Activity;
4 | import android.content.ActivityNotFoundException;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.graphics.Bitmap;
8 | import android.net.ConnectivityManager;
9 | import android.net.NetworkCapabilities;
10 | import android.net.NetworkInfo;
11 | import android.net.Uri;
12 | import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
13 | import android.os.Build;
14 | import android.view.View;
15 | import android.webkit.DownloadListener;
16 | import android.webkit.WebResourceRequest;
17 | import android.webkit.WebSettings;
18 | import android.webkit.WebView;
19 | import android.webkit.WebViewClient;
20 | import android.widget.ProgressBar;
21 |
22 | class WebviewInits {
23 |
24 | private WebView webView;
25 | private SwipeRefreshLayout swipeRefreshLayout;
26 | private ProgressBar progressBar;
27 | private Context context;
28 |
29 | WebviewInits(WebView webView, SwipeRefreshLayout swipeRefreshLayout, ProgressBar progressBar, Context context) {
30 | this.webView = webView;
31 | this.swipeRefreshLayout = swipeRefreshLayout;
32 | this.progressBar = progressBar;
33 | this.context=context;
34 | }
35 |
36 | void initWeb(){
37 | webView.getSettings().setJavaScriptEnabled( true );
38 | webView.getSettings().setDomStorageEnabled(true);
39 | webView.getSettings().setAppCachePath("caches");
40 | webView.getSettings().setAppCacheEnabled(true);
41 | webView.getSettings().setSavePassword(true);
42 | webView.getSettings().setSaveFormData(true);
43 | offlineLoad();//TODO Delete if you don't want offline load
44 |
45 | webView.setDownloadListener(new DownloadListener() {
46 | @Override
47 | public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
48 | Uri uri = Uri.parse(url);
49 | Intent intent = new Intent(Intent.ACTION_VIEW,uri);
50 | context.startActivity(intent);
51 | }
52 | });
53 |
54 | swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
55 | @Override
56 | public void onRefresh() {
57 | webView.loadUrl(webView.getUrl());
58 | }
59 | });
60 |
61 | webView.setWebViewClient(new WebViewClient(){
62 | @Override
63 | public void onPageStarted(WebView view, String url, Bitmap favicon) {
64 | if (!swipeRefreshLayout.isRefreshing()){ //If you didn't refresh the page by using swiperefresh it will show progressbar.
65 | progressBar.setVisibility(View.VISIBLE);
66 | }
67 | super.onPageStarted(view, url, favicon);
68 | }
69 |
70 | @Override
71 | public boolean shouldOverrideUrlLoading(WebView view, String url) {
72 | if (url.startsWith("https://play.google.com/") || url.startsWith("http://play.google.com/")) {
73 | try {
74 | Intent intent = new Intent(Intent.ACTION_VIEW);
75 | intent.setData(Uri.parse(url));
76 | Activity host = (Activity) view.getContext();
77 | host.startActivity(intent);
78 | return true;
79 | } catch (ActivityNotFoundException e) {
80 | // Google Play app is not installed, you may want to open the app store link
81 | Uri uri = Uri.parse(url);
82 | view.loadUrl("https://play.google.com/store/apps/" + uri.getHost() + "?" + uri.getQuery());
83 | return false;
84 | }
85 | }
86 | return false;
87 | }
88 |
89 | @Override
90 | public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
91 | return super.shouldOverrideUrlLoading(view, request);
92 | }
93 |
94 | @Override
95 | public void onPageFinished(WebView view, String url) {
96 | progressBar.setVisibility(View.INVISIBLE); //It will hide progressbar because our page loaded.
97 | if (swipeRefreshLayout.isRefreshing()){
98 | swipeRefreshLayout.setRefreshing(false); //This will hide swiperefresh icon if we refreshed.
99 | }
100 | super.onPageFinished(view, url);
101 | }
102 | }); webView.getSettings().setUseWideViewPort(true);
103 | webView.getSettings().setLoadWithOverviewMode(true);
104 | }
105 |
106 | //TODO Offline Cache Load
107 | private void offlineLoad(){
108 | webView.getSettings().setAppCacheMaxSize( 5 * 1024 * 1024 ); // 5MB Size of storage that it will take
109 | webView.getSettings().setAppCachePath( context.getApplicationContext().getCacheDir().getAbsolutePath() );
110 | webView.getSettings().setAllowFileAccess( true );
111 | webView.getSettings().setAppCacheEnabled( true );
112 | webView.getSettings().setCacheMode( WebSettings.LOAD_DEFAULT ); // load online by default
113 |
114 | if ( !WebviewInits.isNetworkAvailable(context) ) { // loading offline
115 | webView.getSettings().setCacheMode( WebSettings.LOAD_CACHE_ELSE_NETWORK );
116 | }
117 | }
118 |
119 | //TODO Checks if network available or not
120 | static boolean isNetworkAvailable(Context context) {
121 | ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
122 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
123 | if (connectivityManager!=null) {
124 | NetworkCapabilities networkCapabilities=connectivityManager.getNetworkCapabilities(connectivityManager.getActiveNetwork());
125 | if (networkCapabilities!=null) {
126 | if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI))
127 | return true;
128 | else if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR))
129 | return true;
130 | else
131 | return networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET);
132 | } else
133 | return false;
134 | }else
135 | return false;
136 | }else {
137 | NetworkInfo activeNetworkInfo = null;
138 | if (connectivityManager != null)
139 | activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
140 | return activeNetworkInfo != null && activeNetworkInfo.isConnected();
141 | }
142 | }
143 |
144 | }
145 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/career.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/drawable/career.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_apps_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_home_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_settings_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/job_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/drawable/job_search.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/line_chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/drawable/line_chart.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/money.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/drawable/money.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/newspaper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/drawable/newspaper.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pano.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/drawable/pano.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
26 |
27 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_categories.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
25 |
26 |
32 |
33 |
37 |
38 |
39 |
40 |
49 |
50 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_mainpage_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
19 |
20 |
21 |
22 |
30 |
31 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/bottomnavigation_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/navigation_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #b70101
4 | #b70101
5 | #515151
6 | #f5f5f5
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #D32F2F
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Webview Project
3 | Kategoriler
4 | Ana Sayfa
5 | Ayarlar
6 | Emin Misiniz?
7 | Çıkmak İstiyor Musunuz?
8 | Evet
9 | HAYIR!
10 | Bağlantı Başarılı.
11 | Bağlantı Başarısız!
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.5.3'
11 | classpath 'com.google.gms:google-services:4.3.3'
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 | maven { url "https://jitpack.io" }
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | android.enableJetifier=true
10 | android.useAndroidX=true
11 | org.gradle.jvmargs=-Xmx1536m
12 | # When configured, Gradle will run in incubating parallel mode.
13 | # This option should only be used with decoupled projects. More details, visit
14 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
15 | # org.gradle.parallel=true
16 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MrNtlu/WebviewProject/964dc0e9b652d81e0ce6524e36eacb03545a9723/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Jan 21 21:06:06 EET 2020
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-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
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 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/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 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
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 Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------