added welcome activity

This commit is contained in:
Massimiliano Lentini 2018-09-09 18:52:57 +02:00
parent c19049e8cf
commit 50a1437a75
7 changed files with 105 additions and 21 deletions

View File

@ -20,3 +20,4 @@
* Added exit button
* Tapping on a disroot domain from external app (such as browser or chat app) opens Disroot app
* Added reload button
* Welcome activity added

View File

@ -15,6 +15,7 @@
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
@ -22,20 +23,23 @@
android:name="org.disroot.disrootapp.ui.MainActivity"
android:configChanges="orientation|screenSize"
android:hardwareAccelerated="true"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="*.disroot.org"
android:scheme="https" />
</intent-filter>
</activity>
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="*.disroot.org"
android:scheme="https" />
</intent-filter>
</activity>
<activity
android:name="org.disroot.disrootapp.ui.AboutActivity"
android:label="@string/title_activity_about"
android:theme="@style/DisTheme"></activity>
android:theme="@style/DisTheme" />
<activity android:name="org.disroot.disrootapp.ui.WelcomeActivity"></activity>
</application>
</manifest>

View File

@ -2,6 +2,7 @@ package org.disroot.disrootapp.ui;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
@ -296,7 +297,8 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
//first start
if (firstStart.getBoolean("firstrun", true)) {
// Do first run stuff here then set 'firstrun' as false
showWelcome();
Intent welcome = new Intent(MainActivity.this, WelcomeActivity.class);
MainActivity.this.startActivity(welcome);
// using the following line to edit/commit prefs
firstStart.edit().putBoolean("firstrun", false).apply();
}
@ -538,19 +540,21 @@ public class MainActivity extends AppCompatActivity implements View.OnLongClickL
}
private void showMailInfo() {
final ScrollView dashboard = (ScrollView)findViewById(R.id.dashboard);
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle(R.string.MailInfoTitle);
//builder.setMessage(getString(R.string.activity_main_manteiners, DeviceProvider.getAppVersion(this)));
builder.setMessage(getString(R.string.MailInfo));
builder.setPositiveButton(R.string.global_ok, null);
builder.show();
}
builder.setNegativeButton(R.string.more_help, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
webView.loadUrl(Constants.URL_DisApp_K9HELP);
webView.setVisibility(View.VISIBLE);
dashboard.setVisibility(View.GONE);
private void showWelcome() {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle(R.string.WelcomeTitle);
builder.setMessage(getString(R.string.WelcomeInfo));
builder.setPositiveButton(R.string.global_ok, null);
}
});
builder.show();
}

View File

@ -0,0 +1,27 @@
package org.disroot.disrootapp.ui;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.example.webview.R;
public class WelcomeActivity extends AppCompatActivity {
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
button = (Button) findViewById(R.id.homeBtn);//Home
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent goHome = new Intent(WelcomeActivity.this, MainActivity.class);
WelcomeActivity.this.startActivity(goHome);
}
});
}
}

View File

@ -23,4 +23,5 @@ public class Constants {
public static final String URL_DisApp_USER = "https://user.disroot.org";
public static final String URL_DisApp_STATE = "https://state.disroot.org";
public static final String URL_DisApp_HOWTO = "https://howto.disroot.org";
public static final String URL_DisApp_K9HELP = "https://howto.disroot.org/en/email/email-clients/mobile/androidk9";
}

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.WelcomeActivity"
android:orientation="vertical">
<TextView
android:id="@+id/WelcomeTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:gravity="center"
android:text="@string/WelcomeTitle"
android:textSize="25dp"
/>
<TextView
android:id="@+id/WelcomeInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="30dp"
android:gravity="left"
android:text="@string/WelcomeInfo"
tools:ignore="MissingConstraints" />
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<Button
android:id="@+id/homeBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_reload"
android:text="@string/action_home"
android:layout_margin="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</LinearLayout>

View File

@ -27,14 +27,15 @@
<string name="activity_main_manteiners">%s\n\nDeveloper: Massimiliano\n\ncontact us:\n<EMAIL mailto="contact@disroot.org">support@disroot.org</EMAIL></string>
<string name="view_loading_description">Loading...</string>
<string name="global_ok">ok</string>
<string name="more_help">Need more help?</string>
<string name="title_activity_about">AboutActivity</string>
<string name="MailInfoTitle">Mail settings.</string>
<string name="MailInfo">IMAP: disroot.org | SSL Port 993 | Authentication: Normal Password\n\nSMTP: disroot.org | STARTTLS Port 587 | Authentication: Normal Password\n\nPOP: disroot.org | SSL Port 995 | Authentication: Normal Password</string>
<string name="MailInfo">IMAP: disroot.org\nSSL Port 993\nAuthentication: Normal Password\n\nSMTP: disroot.org\nSTARTTLS Port 587\nAuthentication: Normal Password\n\nPOP: disroot.org\nSSL Port 995\nAuthentication: Normal Password</string>
<string name="CloudInfoTitle">Nextcloud settings.</string>
<string name="CloudInfo">Information about cloud.\nLike Nextcloud settings etc...\nAnd other stuff like:\nA button to how to page.</string>
<string name="WelcomeTitle">Welcome</string>
<string name="WelcomeInfo">Welcome\nThis window is temporary\nIt will be replaced by welcome activity</string>
<string name="WelcomeInfo">Welcome\nThis window is temporary\nMust create content for this window\nI may need some helpe here :-p</string>
<string name="tab_text_1">Help</string>
<string name="tab_text_2">About</string>
@ -43,4 +44,5 @@
<string name="section_format">Hello World from section: %1$d</string>
</resources>