mirror of
https://github.com/TrianguloY/UrlChecker.git
synced 2024-09-20 04:12:14 +02:00
Implemented tutorial
This commit is contained in:
parent
5a7df3adf3
commit
daf50e31c6
@ -24,6 +24,7 @@
|
|||||||
<activity android:name=".activities.AboutActivity" />
|
<activity android:name=".activities.AboutActivity" />
|
||||||
<activity android:name=".activities.ModulesActivity" />
|
<activity android:name=".activities.ModulesActivity" />
|
||||||
<activity android:name=".activities.SettingsActivity" />
|
<activity android:name=".activities.SettingsActivity" />
|
||||||
|
<activity android:name=".activities.TutorialActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".dialogs.MainDialog"
|
android:name=".dialogs.MainDialog"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
|
@ -27,6 +27,9 @@ public class MainActivity extends Activity {
|
|||||||
AndroidSettings.setTheme(this, false);
|
AndroidSettings.setTheme(this, false);
|
||||||
AndroidSettings.setLocale(this);
|
AndroidSettings.setLocale(this);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
if (!TutorialActivity.TUTORIAL(this).get()){
|
||||||
|
openTutorial(this.getCurrentFocus());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -66,4 +69,8 @@ public class MainActivity extends Activity {
|
|||||||
Toast.makeText(this, getString(R.string.app_name) + " - " + getString(R.string.trianguloy), Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, getString(R.string.app_name) + " - " + getString(R.string.trianguloy), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void openTutorial(View view){
|
||||||
|
PackageUtils.startActivity(new Intent(this, TutorialActivity.class), R.string.toast_noApp, this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -198,4 +198,9 @@ public class SettingsActivity extends Activity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ------------------- tutorial ------------------- */
|
||||||
|
public void openTutorial(View view){
|
||||||
|
PackageUtils.startActivity(new Intent(this, TutorialActivity.class), R.string.toast_noApp, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,84 @@
|
|||||||
|
package com.trianguloy.urlchecker.activities;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.ViewFlipper;
|
||||||
|
|
||||||
|
import com.trianguloy.urlchecker.R;
|
||||||
|
import com.trianguloy.urlchecker.utilities.AndroidSettings;
|
||||||
|
import com.trianguloy.urlchecker.utilities.GenericPref;
|
||||||
|
import com.trianguloy.urlchecker.utilities.PackageUtils;
|
||||||
|
|
||||||
|
public class TutorialActivity extends Activity {
|
||||||
|
|
||||||
|
private Button backButton;
|
||||||
|
private Button nextButton;
|
||||||
|
private GenericPref.Bool tutorialDone;
|
||||||
|
private ViewFlipper flipper;
|
||||||
|
private TextView pageIndexText;
|
||||||
|
|
||||||
|
public static GenericPref.Bool TUTORIAL(Context cntx) {
|
||||||
|
return new GenericPref.Bool("tutorial_done", true, cntx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
AndroidSettings.setTheme(this, false);
|
||||||
|
AndroidSettings.setLocale(this);
|
||||||
|
setContentView(R.layout.activity_tutorial);
|
||||||
|
setTitle(R.string.tutorial);
|
||||||
|
|
||||||
|
flipper = findViewById(R.id.flipper);
|
||||||
|
|
||||||
|
backButton = findViewById(R.id.bBack);
|
||||||
|
nextButton = findViewById(R.id.bNext);
|
||||||
|
|
||||||
|
pageIndexText = findViewById(R.id.pageIndex);
|
||||||
|
|
||||||
|
checkEnabled();
|
||||||
|
|
||||||
|
tutorialDone = TUTORIAL(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------- buttons -------------------
|
||||||
|
public void nextSlide(View view){
|
||||||
|
flipper.showNext();
|
||||||
|
checkEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void previousSlide(View view){
|
||||||
|
flipper.showPrevious();
|
||||||
|
checkEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the buttons should be enabled depending on the current page
|
||||||
|
* If on last page "next" will be disabled, if on first page "back" will be disabled
|
||||||
|
* Also sets index text
|
||||||
|
*/
|
||||||
|
private void checkEnabled(){
|
||||||
|
int current = flipper.getDisplayedChild();
|
||||||
|
int max = flipper.getChildCount();
|
||||||
|
|
||||||
|
backButton.setEnabled(current != 0);
|
||||||
|
nextButton.setEnabled(current != max - 1);
|
||||||
|
|
||||||
|
pageIndexText.setText(String.format("%d/%d", current + 1, max));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openModulesActivity(View view) {
|
||||||
|
PackageUtils.startActivity(new Intent(this, ModulesActivity.class), R.string.toast_noApp, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishTutorial(View view){
|
||||||
|
tutorialDone.set(true);
|
||||||
|
this.finish();
|
||||||
|
}
|
||||||
|
}
|
@ -50,6 +50,7 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:onClick="openAppLinks"
|
android:onClick="openAppLinks"
|
||||||
android:text="@string/btn_linksSettings" />
|
android:text="@string/btn_linksSettings" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
style="?android:attr/buttonBarButtonStyle"
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -99,6 +100,23 @@
|
|||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingTop="@dimen/padding"
|
||||||
|
android:paddingBottom="@dimen/padding">
|
||||||
|
|
||||||
|
<include layout="@layout/separator" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="openTutorial"
|
||||||
|
android:text="@string/btn_tutorialSettings" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
73
app/src/main/res/layout/activity_tutorial.xml
Normal file
73
app/src/main/res/layout/activity_tutorial.xml
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="@dimen/padding"
|
||||||
|
tools:context=".activities.TutorialActivity">
|
||||||
|
|
||||||
|
<ViewFlipper
|
||||||
|
android:id="@+id/flipper"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/tutorial_flipper_intro"
|
||||||
|
layout="@layout/view_tutorial_intro"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/tutorial_flipper_app"
|
||||||
|
layout="@layout/view_tutorial_app"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/tutorial_flipper_modules"
|
||||||
|
layout="@layout/view_tutorial_modules"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/tutorial_flipper_tips"
|
||||||
|
layout="@layout/view_tutorial_tips"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
</ViewFlipper>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bBack"
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="previousSlide"
|
||||||
|
android:text="@string/back" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/pageIndex"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center_horizontal|center_vertical" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/bNext"
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="nextSlide"
|
||||||
|
android:text="@string/next" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
56
app/src/main/res/layout/fragment_browser_buttons.xml
Normal file
56
app/src/main/res/layout/fragment_browser_buttons.xml
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/browser_buttons"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
tools:context=".fragments.BrowserButtonsFragment">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/b1"
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/btn_setBrowser" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/b2"
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/btn_configureBrowser" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/b3"
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/btn_linksSettings" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/b4"
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/btn_androidSettings" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
22
app/src/main/res/layout/view_tutorial_app.xml
Normal file
22
app/src/main/res/layout/view_tutorial_app.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/tutorial_txt_app" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</ScrollView>
|
29
app/src/main/res/layout/view_tutorial_intro.xml
Normal file
29
app/src/main/res/layout/view_tutorial_intro.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/tutorial_txt_intro" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/padding"
|
||||||
|
android:onClick="finishTutorial"
|
||||||
|
android:paddingLeft="@dimen/padding"
|
||||||
|
android:paddingRight="@dimen/padding"
|
||||||
|
android:text="@string/tutorial_button_skip" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
33
app/src/main/res/layout/view_tutorial_modules.xml
Normal file
33
app/src/main/res/layout/view_tutorial_modules.xml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/tutorial_txt_modules" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="@dimen/padding"
|
||||||
|
android:drawableStart="@android:drawable/ic_menu_sort_by_size"
|
||||||
|
android:drawableLeft="@android:drawable/ic_menu_sort_by_size"
|
||||||
|
android:drawablePadding="@dimen/smallPadding"
|
||||||
|
android:onClick="openModulesActivity"
|
||||||
|
android:paddingLeft="@dimen/padding"
|
||||||
|
android:paddingRight="@dimen/padding"
|
||||||
|
android:text="@string/a_modules" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
29
app/src/main/res/layout/view_tutorial_tips.xml
Normal file
29
app/src/main/res/layout/view_tutorial_tips.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/tutorial_txt_tips" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="?android:attr/buttonBarButtonStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/padding"
|
||||||
|
android:onClick="finishTutorial"
|
||||||
|
android:paddingLeft="@dimen/padding"
|
||||||
|
android:paddingRight="@dimen/padding"
|
||||||
|
android:text="@string/tutorial_button_end" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</ScrollView>
|
@ -45,6 +45,26 @@ Translations: %s."</string>
|
|||||||
<string name="spin_darkTheme">Dark</string>
|
<string name="spin_darkTheme">Dark</string>
|
||||||
<string name="spin_lightTheme">Light</string>
|
<string name="spin_lightTheme">Light</string>
|
||||||
<string name="txt_locale">Locale:</string>
|
<string name="txt_locale">Locale:</string>
|
||||||
|
<string name="btn_tutorialSettings">Repeat tutorial</string>
|
||||||
|
|
||||||
|
<!-- tutorial -->
|
||||||
|
<string name="tutorial">Tutorial</string>
|
||||||
|
<string name="tutorial_txt_intro">Thanks for downloading the app!
|
||||||
|
|
||||||
|
This is the tutorial, if you want to skip it you can do so with the button below. You can always come back to this tutorial from the settings menu."</string>
|
||||||
|
<string name="tutorial_txt_app">"The app acts as an intermediary when opening or sharing url links. Once an url is sent to the app you can interact with it via the modules. After that you can open the link (in the app you want), share it or copy it to the clipboard.
|
||||||
|
|
||||||
|
For the app to intercept the urls when opening them we need to set it up as a browser first. This is not needed if you intent to pass the urls using the share functionality."</string>
|
||||||
|
<string name="tutorial_txt_modules">"The modules are the way the app interacts with the urls. There are multiple modules, each of them have a specific function, usually they either give you information about the url, or modify it. It is recommended you check them in the modules menu as each one is explained there and you can also change their behaviour.
|
||||||
|
|
||||||
|
If you want you can go to the modules menu by tapping the button below."</string>
|
||||||
|
<string name="tutorial_txt_tips">"That's all. Here are some tips that can be useful.
|
||||||
|
|
||||||
|
When an app doesn't give you a way to open or share a url, but it gives you a way to do the other you can solve the issue using this app. You can also copy the url to the clipboard.
|
||||||
|
|
||||||
|
There are some urls which its only purpose is redirecting you to another url. If the final url can be opened in an app, then you can avoid opening it in a browser."</string>
|
||||||
|
<string name="tutorial_button_skip">Skip tutorial</string>
|
||||||
|
<string name="tutorial_button_end">Finish tutorial</string>
|
||||||
|
|
||||||
<!-- generic -->
|
<!-- generic -->
|
||||||
<string name="toast_noApp">"Can't open application"</string>
|
<string name="toast_noApp">"Can't open application"</string>
|
||||||
@ -65,6 +85,9 @@ Translations: %s."</string>
|
|||||||
<string name="json_edit">Advanced editor</string>
|
<string name="json_edit">Advanced editor</string>
|
||||||
|
|
||||||
|
|
||||||
|
<string name="next">Next</string>
|
||||||
|
<string name="back">Back</string>
|
||||||
|
|
||||||
<!-- modules -->
|
<!-- modules -->
|
||||||
<string name="mPttrn_name">Patterns checker</string>
|
<string name="mPttrn_name">Patterns checker</string>
|
||||||
<string name="mPttrn_desc">"This module checks the url with regexp patterns that warns, suggests or applies replacements. You can modify or create your own patterns, or even use user-created ones.
|
<string name="mPttrn_desc">"This module checks the url with regexp patterns that warns, suggests or applies replacements. You can modify or create your own patterns, or even use user-created ones.
|
||||||
|
Loading…
Reference in New Issue
Block a user