Add new welcome screen, made compatible with older...
...devices
... | ... |
@@ -28,6 +28,11 @@ |
28 | 28 |
</intent-filter> |
29 | 29 |
</receiver> |
30 | 30 |
|
31 |
+ <activity |
|
32 |
+ android:name=".views.WelcomeActivity" |
|
33 |
+ android:configChanges="orientation|keyboardHidden|screenSize" |
|
34 |
+ android:label="@string/title_activity_welcome" |
|
35 |
+ android:theme="@style/FullscreenTheme"></activity> |
|
31 | 36 |
</application> |
32 | 37 |
|
33 | 38 |
</manifest> |
... | ... |
@@ -4,6 +4,7 @@ import android.app.NotificationManager; |
4 | 4 |
import android.content.Context; |
5 | 5 |
import android.content.SharedPreferences; |
6 | 6 |
import android.net.Uri; |
7 |
+import android.os.Build; |
|
7 | 8 |
import android.preference.PreferenceManager; |
8 | 9 |
import android.support.v4.app.NotificationCompat; |
9 | 10 |
|
... | ... |
@@ -19,10 +20,14 @@ public class DebugManager { |
19 | 20 |
if(prefs.getBoolean("debug", false)){ |
20 | 21 |
NotificationCompat.Builder mBuilder = |
21 | 22 |
new NotificationCompat.Builder(context) |
22 |
- .setSmallIcon(R.drawable.ic_debug) |
|
23 | 23 |
.setStyle(new NotificationCompat.BigTextStyle() |
24 | 24 |
.bigText(message)) |
25 | 25 |
.setContentText(message); |
26 |
+ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
|
27 |
+ mBuilder.setSmallIcon(R.drawable.ic_debug); |
|
28 |
+ } else { |
|
29 |
+ mBuilder.setSmallIcon(R.drawable.ic_debug_compat); |
|
30 |
+ } |
|
26 | 31 |
NotificationManager mNotificationManager = |
27 | 32 |
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); |
28 | 33 |
|
... | ... |
@@ -7,6 +7,7 @@ import android.content.Intent; |
7 | 7 |
import android.content.SharedPreferences; |
8 | 8 |
import android.graphics.Color; |
9 | 9 |
import android.net.Uri; |
10 |
+import android.os.Build; |
|
10 | 11 |
import android.preference.PreferenceManager; |
11 | 12 |
import android.support.v4.app.NotificationCompat; |
12 | 13 |
import android.widget.Toast; |
... | ... |
@@ -179,14 +180,17 @@ public class FlashManager { |
179 | 180 |
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); |
180 | 181 |
NotificationCompat.Builder mBuilder = |
181 | 182 |
new NotificationCompat.Builder(context) |
182 |
- .setSmallIcon(R.drawable.ic_alert) |
|
183 | 183 |
.setContentTitle(flash.getChannel() + " • " + flash.getSource()) |
184 | 184 |
.setStyle(new NotificationCompat.BigTextStyle() |
185 | 185 |
.bigText(flash.getText())) |
186 | 186 |
.setContentText(flash.getText()) |
187 | 187 |
.setSound(Uri.parse(prefs.getString("notification_sound", "DEFAULT"))) |
188 | 188 |
.setContentIntent(pendingIntent); |
189 |
- |
|
189 |
+ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
|
190 |
+ mBuilder.setSmallIcon(R.drawable.ic_alert); |
|
191 |
+ } else { |
|
192 |
+ mBuilder.setSmallIcon(R.drawable.ic_alert_compat); |
|
193 |
+ } |
|
190 | 194 |
NotificationManager mNotificationManager = |
191 | 195 |
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); |
192 | 196 |
|
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
package app.librenews.io.librenews.views; |
2 | 2 |
|
3 |
+import android.content.Intent; |
|
3 | 4 |
import android.content.SharedPreferences; |
4 | 5 |
import android.preference.PreferenceManager; |
5 | 6 |
import android.support.v7.app.AppCompatActivity; |
... | ... |
@@ -13,6 +14,7 @@ import app.librenews.io.librenews.controllers.FlashManager; |
13 | 14 |
|
14 | 15 |
public class MainFlashActivity extends AppCompatActivity { |
15 | 16 |
public static MainFlashActivity activeInstance; |
17 |
+ public static boolean forceDisableWelcomeScreen = false; |
|
16 | 18 |
|
17 | 19 |
FlashManager manager; |
18 | 20 |
|
... | ... |
@@ -54,6 +56,10 @@ public class MainFlashActivity extends AppCompatActivity { |
54 | 56 |
activeInstance = this; |
55 | 57 |
setContentView(R.layout.activity_flash_view); |
56 | 58 |
manager = new FlashManager(this); |
59 |
+ if(manager.getLatestPushedFlashes().size() == 0 && !forceDisableWelcomeScreen){ |
|
60 |
+ Intent intent = new Intent(this, WelcomeActivity.class); |
|
61 |
+ startActivity(intent); |
|
62 |
+ } |
|
57 | 63 |
findViewById(R.id.refresh_button).setOnClickListener(new View.OnClickListener() { |
58 | 64 |
@Override |
59 | 65 |
public void onClick(View view) { |
... | ... |
@@ -0,0 +1,34 @@ |
1 |
+package app.librenews.io.librenews.views; |
|
2 |
+ |
|
3 |
+import android.annotation.SuppressLint; |
|
4 |
+import android.content.Intent; |
|
5 |
+import android.support.v7.app.ActionBar; |
|
6 |
+import android.support.v7.app.AppCompatActivity; |
|
7 |
+import android.os.Bundle; |
|
8 |
+import android.os.Handler; |
|
9 |
+import android.view.MotionEvent; |
|
10 |
+import android.view.View; |
|
11 |
+ |
|
12 |
+import app.librenews.io.librenews.R; |
|
13 |
+ |
|
14 |
+/** |
|
15 |
+ * An example full-screen activity that shows and hides the system UI (i.e. |
|
16 |
+ * status bar and navigation/system bar) with user interaction. |
|
17 |
+ */ |
|
18 |
+public class WelcomeActivity extends AppCompatActivity { |
|
19 |
+ @Override |
|
20 |
+ protected void onCreate(Bundle savedInstanceState) { |
|
21 |
+ super.onCreate(savedInstanceState); |
|
22 |
+ |
|
23 |
+ setContentView(R.layout.activity_welcome); |
|
24 |
+ |
|
25 |
+ findViewById(R.id.startLibreNews).setOnTouchListener(new View.OnTouchListener() { |
|
26 |
+ @Override |
|
27 |
+ public boolean onTouch(View view, MotionEvent motionEvent) { |
|
28 |
+ MainFlashActivity.forceDisableWelcomeScreen = true; |
|
29 |
+ startActivity(new Intent(getApplicationContext(), MainFlashActivity.class)); |
|
30 |
+ return true; |
|
31 |
+ } |
|
32 |
+ }); |
|
33 |
+ } |
|
34 |
+} |
... | ... |
@@ -5,5 +5,5 @@ |
5 | 5 |
android:viewportHeight="24.0"> |
6 | 6 |
<path |
7 | 7 |
android:fillColor="#FF000000" |
8 |
- android:pathData="M23,12l-2.44,-2.78 0.34,-3.68 -3.61,-0.82 -1.89,-3.18L12,3 8.6,1.54 6.71,4.72l-3.61,0.81 0.34,3.68L1,12l2.44,2.78 -0.34,3.69 3.61,0.82 1.89,3.18L12,21l3.4,1.46 1.89,-3.18 3.61,-0.82 -0.34,-3.68L23,12zM13,17h-2v-2h2v2zM13,13h-2L11,7h2v6z"/> |
|
8 |
+ android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/> |
|
9 | 9 |
</vector> |
... | ... |
@@ -0,0 +1,110 @@ |
1 |
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
2 |
+ xmlns:app="http://schemas.android.com/apk/res-auto" |
|
3 |
+ xmlns:tools="http://schemas.android.com/tools" |
|
4 |
+ android:layout_width="match_parent" |
|
5 |
+ android:layout_height="match_parent" |
|
6 |
+ android:background="#0099cc" |
|
7 |
+ tools:context="app.librenews.io.librenews.views.WelcomeActivity"> |
|
8 |
+ |
|
9 |
+ <!-- The primary full-screen view. This can be replaced with whatever view |
|
10 |
+ is needed to present your content, e.g. VideoView, SurfaceView, |
|
11 |
+ TextureView, etc. --> |
|
12 |
+ |
|
13 |
+ <!-- This FrameLayout insets its children based on system windows using |
|
14 |
+ android:fitsSystemWindows. --> |
|
15 |
+ |
|
16 |
+ <android.support.constraint.ConstraintLayout |
|
17 |
+ android:layout_width="match_parent" |
|
18 |
+ android:layout_height="match_parent" |
|
19 |
+ android:background="@color/colorPrimaryDark"> |
|
20 |
+ |
|
21 |
+ <TextView |
|
22 |
+ android:id="@+id/textView" |
|
23 |
+ android:layout_width="0dp" |
|
24 |
+ android:layout_height="wrap_content" |
|
25 |
+ android:layout_marginLeft="16dp" |
|
26 |
+ android:layout_marginRight="16dp" |
|
27 |
+ android:text="@string/short_description_of_app" |
|
28 |
+ android:textAppearance="@style/TextAppearance.AppCompat.Title.Inverse" |
|
29 |
+ app:layout_constraintLeft_toLeftOf="parent" |
|
30 |
+ app:layout_constraintRight_toRightOf="parent" |
|
31 |
+ app:layout_constraintHorizontal_bias="0.0" |
|
32 |
+ android:layout_marginStart="16dp" |
|
33 |
+ android:layout_marginEnd="16dp" |
|
34 |
+ app:layout_constraintTop_toTopOf="parent" |
|
35 |
+ android:layout_marginTop="8dp" /> |
|
36 |
+ |
|
37 |
+ <TextView |
|
38 |
+ android:id="@+id/textView2" |
|
39 |
+ android:layout_width="0dp" |
|
40 |
+ android:layout_height="wrap_content" |
|
41 |
+ android:text="@string/short_description" |
|
42 |
+ android:textAppearance="@style/TextAppearance.AppCompat.Inverse" |
|
43 |
+ android:textSize="16sp" |
|
44 |
+ app:layout_constraintHorizontal_bias="0.0" |
|
45 |
+ app:layout_constraintLeft_toLeftOf="@+id/textView" |
|
46 |
+ app:layout_constraintRight_toRightOf="@+id/textView" |
|
47 |
+ android:layout_marginTop="8dp" |
|
48 |
+ app:layout_constraintTop_toBottomOf="@+id/textView" /> |
|
49 |
+ |
|
50 |
+ <TextView |
|
51 |
+ android:id="@+id/textView3" |
|
52 |
+ android:layout_width="0dp" |
|
53 |
+ android:layout_height="wrap_content" |
|
54 |
+ android:text="@string/how_to_use" |
|
55 |
+ android:textAppearance="@style/TextAppearance.AppCompat.Inverse" |
|
56 |
+ android:textSize="16sp" |
|
57 |
+ android:textStyle="bold" |
|
58 |
+ app:layout_constraintHorizontal_bias="0.0" |
|
59 |
+ app:layout_constraintLeft_toLeftOf="@+id/textView2" |
|
60 |
+ app:layout_constraintRight_toRightOf="@+id/textView2" |
|
61 |
+ android:layout_marginTop="8dp" |
|
62 |
+ app:layout_constraintTop_toBottomOf="@+id/view2" /> |
|
63 |
+ |
|
64 |
+ <TextView |
|
65 |
+ android:id="@+id/textView4" |
|
66 |
+ android:layout_width="0dp" |
|
67 |
+ android:layout_height="wrap_content" |
|
68 |
+ android:layout_marginLeft="0dp" |
|
69 |
+ android:layout_marginRight="0dp" |
|
70 |
+ android:text="@string/final_notes_welcome_screen" |
|
71 |
+ android:textAppearance="@style/TextAppearance.AppCompat.Inverse" |
|
72 |
+ android:textSize="16sp" |
|
73 |
+ app:layout_constraintHorizontal_bias="0.0" |
|
74 |
+ app:layout_constraintLeft_toLeftOf="@+id/textView3" |
|
75 |
+ app:layout_constraintRight_toRightOf="@+id/textView3" |
|
76 |
+ android:layout_marginTop="8dp" |
|
77 |
+ app:layout_constraintTop_toBottomOf="@+id/textView2" /> |
|
78 |
+ |
|
79 |
+ <View |
|
80 |
+ android:layout_width="fill_parent" |
|
81 |
+ android:layout_height="1dp" |
|
82 |
+ android:background="#ffffff" |
|
83 |
+ android:layout_marginTop="8dp" |
|
84 |
+ app:layout_constraintTop_toBottomOf="@+id/textView4" |
|
85 |
+ android:id="@+id/view2" |
|
86 |
+ android:layout_marginLeft="16dp" |
|
87 |
+ app:layout_constraintLeft_toLeftOf="@+id/textView4" |
|
88 |
+ android:layout_marginRight="16dp" |
|
89 |
+ app:layout_constraintRight_toRightOf="@+id/textView4" /> |
|
90 |
+ |
|
91 |
+ <Button |
|
92 |
+ android:id="@+id/startLibreNews" |
|
93 |
+ style="@style/Widget.AppCompat.Button.Borderless.Colored" |
|
94 |
+ android:layout_width="wrap_content" |
|
95 |
+ android:layout_height="wrap_content" |
|
96 |
+ android:layout_marginBottom="8dp" |
|
97 |
+ android:layout_marginLeft="8dp" |
|
98 |
+ android:layout_marginRight="8dp" |
|
99 |
+ android:elevation="0dp" |
|
100 |
+ android:text="@string/start_app" |
|
101 |
+ android:textAppearance="@style/TextAppearance.AppCompat.Button" |
|
102 |
+ android:textColor="@color/colorAccent" |
|
103 |
+ android:textSize="18sp" |
|
104 |
+ android:textStyle="bold|italic" |
|
105 |
+ app:layout_constraintBottom_toBottomOf="parent" |
|
106 |
+ app:layout_constraintLeft_toLeftOf="parent" |
|
107 |
+ app:layout_constraintRight_toRightOf="parent" /> |
|
108 |
+ |
|
109 |
+ </android.support.constraint.ConstraintLayout> |
|
110 |
+</FrameLayout> |
... | ... |
@@ -31,7 +31,7 @@ |
31 | 31 |
<string name="status_text" formatted="false">Synchronisation tout les {rate}</string> |
32 | 32 |
<string name="short_description"> |
33 | 33 |
<![CDATA[ |
34 |
- <p>Les notifications d\'actualités sont parmi les canaux les plus importants par lesquels nous recevons des informations.</p><p><strong>LibreNews vise à démocratiser ce processus en fournissant un service de notification d\'actualités <i>minimaliste, libre, open source, rapide, sécurisé</i> et <i>décentralisé</i></strong> qui fonctionnera sur presque n\'importe quel smartphone.</p> |
|
34 |
+ Les notifications d\'actualités sont parmi les canaux les plus importants par lesquels nous recevons des informations. LibreNews vise à démocratiser ce processus en fournissant un service de notification d\'actualités minimaliste, libre, open source, rapide, sécurisé et décentralisé qui fonctionnera sur presque n\'importe quel smartphone.</p> |
|
35 | 35 |
]]> |
36 | 36 |
</string> |
37 | 37 |
|
... | ... |
@@ -31,7 +31,7 @@ |
31 | 31 |
|
32 | 32 |
<string name="short_description"> |
33 | 33 |
<![CDATA[ |
34 |
- <p>最新ニュースの通知は、情報を受け取るために最も重要なチャネルの 1 つです。</p><p><strong>LibreNews はほぼすべての携帯で動作して、 <i>ミニマリスト、フリー、オープンソース、ファースト、セキュア、 </i>そして <i>分散</i> ニュース通知サービス</strong> を提供することで、このプロセスを民主化することを目指しています。</p> |
|
34 |
+ 最新ニュースの通知は、情報を受け取るために最も重要なチャネルの 1 つです。LibreNews はほぼすべての携帯で動作して、 <i>ミニマリスト、フリー、オープンソース、ファースト、セキュア、 そして 分散 ニュース通知サービス を提供することで、このプロセスを民主化することを目指しています。 |
|
35 | 35 |
]]> |
36 | 36 |
</string> |
37 | 37 |
|
... | ... |
@@ -0,0 +1,12 @@ |
1 |
+<resources> |
|
2 |
+ |
|
3 |
+ <!-- Declare custom theme attributes that allow changing which styles are |
|
4 |
+ used for button bars depending on the API level. |
|
5 |
+ ?android:attr/buttonBarStyle is new as of API 11 so this is |
|
6 |
+ necessary to support previous API levels. --> |
|
7 |
+ <declare-styleable name="ButtonBarContainerTheme"> |
|
8 |
+ <attr name="metaButtonBarStyle" format="reference" /> |
|
9 |
+ <attr name="metaButtonBarButtonStyle" format="reference" /> |
|
10 |
+ </declare-styleable> |
|
11 |
+ |
|
12 |
+</resources> |
... | ... |
@@ -1,7 +1,9 @@ |
1 | 1 |
<?xml version="1.0" encoding="utf-8"?> |
2 | 2 |
<resources> |
3 | 3 |
<color name="colorPrimary">#3F51B5</color> |
4 |
- <color name="colorPrimaryDark">#303F9F</color> |
|
4 |
+ <color name="colorPrimaryDark">#303f9f</color> |
|
5 | 5 |
<color name="colorAccent">#ff4081</color> |
6 | 6 |
<color name="colorPrimarySub">#5b64c0</color> |
7 |
+ |
|
8 |
+ <color name="black_overlay">#66000000</color> |
|
7 | 9 |
</resources> |
... | ... |
@@ -31,8 +31,15 @@ |
31 | 31 |
<string name="status_text" formatted="false">syncing every {rate}</string> |
32 | 32 |
<string name="short_description"> |
33 | 33 |
<![CDATA[ |
34 |
- <p>Breaking news notifications are among the most important channels by which we receive information.</p><p><strong>LibreNews aims to democratize this process by providing a <i>minimalist, free, open source, fast, secure, </i>and <i>decentralized</i> news notification service</strong> that will run on almost any phone.</p> |
|
34 |
+ Breaking news notifications are among the most important channels by which we receive information. LibreNews aims to democratize this medium by providing a minimalist, free, open source, fast, secure, and decentralized news notification service that will run on almost any phone. |
|
35 | 35 |
]]> |
36 | 36 |
</string> |
37 | 37 |
|
38 |
+ <string name="title_activity_welcome">Welcome to LibreNews</string> |
|
39 |
+ <string name="dummy_button">Dummy Button</string> |
|
40 |
+ <string name="dummy_content">DUMMY\nCONTENT</string> |
|
41 |
+ <string name="short_description_of_app">LibreNews provides ad-free, decentralized, and secure breaking news notifications.</string> |
|
42 |
+ <string name="how_to_use">You\'ll mostly interact with LibreNews through its notifications, as the app itself is just settings. \n\nYou\'ll probably get around 3 breaking news notifications per day, if you stick with the default settings.</string> |
|
43 |
+ <string name="final_notes_welcome_screen">LibreNews doesn\'t track you in any way, and doesn\'t have ads. It\'s completely open source, making the code free for anyone to see.</string> |
|
44 |
+ <string name="start_app">START LIBRENEWS</string> |
|
38 | 45 |
</resources> |
... | ... |
@@ -17,4 +17,16 @@ |
17 | 17 |
|
18 | 18 |
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> |
19 | 19 |
|
20 |
+ <style name="FullscreenTheme" parent="AppTheme"> |
|
21 |
+ <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item> |
|
22 |
+ <item name="android:windowActionBarOverlay">true</item> |
|
23 |
+ <item name="android:windowBackground">@null</item> |
|
24 |
+ <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item> |
|
25 |
+ <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item> |
|
26 |
+ </style> |
|
27 |
+ |
|
28 |
+ <style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar"> |
|
29 |
+ <item name="android:background">@color/black_overlay</item> |
|
30 |
+ </style> |
|
31 |
+ |
|
20 | 32 |
</resources> |