Merge pull request #174 from iHub/bugfixes

Merging in updates
This commit is contained in:
Brian Mwadime 2016-07-16 10:45:44 +03:00 коммит произвёл GitHub
Родитель 87838254e4 249d125401
Коммит 60e2ab7083
9 изменённых файлов: 34 добавлений и 19 удалений

Просмотреть файл

@ -25,12 +25,11 @@
android:windowSoftInputMode="stateHidden"/>
<activity
android:name=".activities.WelcomeActivity"
android:label="@string/title_activity_iconquiz"
android:windowSoftInputMode="stateHidden">
</activity>
<activity
android:name=".activities.DashboardActivity"
android:label="Jisort - What would you like to do?"
android:label="@string/title_dashboard"
android:launchMode="singleTop"
android:theme="@style/AppTheme.SplashTheme"
android:windowSoftInputMode="stateHidden">

Просмотреть файл

@ -46,7 +46,7 @@ public class App extends Application {
// .setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pIntent)
.setAutoCancel(true)
.addAction(0, "Lear More", pIntent).build();
.addAction(0, getContext().getString(R.string.btn_more), pIntent).build();
NotificationManager notificationManager = (NotificationManager) getContext().getSystemService(NOTIFICATION_SERVICE);
// hide the notification after its selected
notification.flags |= Notification.FLAG_AUTO_CANCEL;

Просмотреть файл

@ -1,28 +1,24 @@
package com.mozilla.hackathon.kiboko.activities;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.widget.LinearLayout;
import com.mozilla.hackathon.kiboko.Analytics;
import com.mozilla.hackathon.kiboko.R;
import com.mozilla.hackathon.kiboko.settings.SettingsUtils;
public class DashboardActivity extends DSOActivity {
public static boolean active = false;
public static FragmentActivity mDashboard;
private String TAG = DashboardActivity.class.getSimpleName();
SharedPreferences prefs = null;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dashboard_layout);
mDashboard = DashboardActivity.this;
prefs = getSharedPreferences("com.mycompany.myAppName", MODE_PRIVATE);
Analytics.add("Dashboard", "create");
}
@ -32,8 +28,9 @@ public class DashboardActivity extends DSOActivity {
super.onResume();
active = true;
if (prefs.getBoolean("firstrun", true)) {
prefs.edit().putBoolean("firstrun", false).commit();
if (!SettingsUtils.isWelcomeDone(this)) {
// Mark Welcome screen as shown
SettingsUtils.markWelcomeDone(this);
Intent intent = new Intent(DashboardActivity.this, WelcomeActivity.class);
startActivity(intent);
finish();

Просмотреть файл

@ -18,7 +18,7 @@ public class WelcomeActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
ActionBar ab = getSupportActionBar();
ab.setDisplayHomeAsUpEnabled(true);
ab.hide();
}
public void dismissWelcome(View view){

Просмотреть файл

@ -25,6 +25,8 @@ public class SettingsUtils {
* Boolean preference indicating whether the app is in fun mode
*/
public static final String PREF_FUNMODE_ENABLED = "pref_funmode_enabled";
public static final String PREF_WELCOME_DONE = "pref_welcome_done";
/**
* Mark that the app has finished loading the {@code R.raw.bootstrap_data bootstrap data}.
*
@ -34,6 +36,15 @@ public class SettingsUtils {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
sp.edit().putBoolean(PREF_DATA_BOOTSTRAP_DONE, true).apply();
}
/**
* Mark that the app has shown the welcome screen {@link com.mozilla.hackathon.kiboko.activities.WelcomeActivity}.
*
* @param context Context to be used to edit the {@link android.content.SharedPreferences}.
*/
public static void markWelcomeDone(final Context context) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
sp.edit().putBoolean(PREF_WELCOME_DONE, true).apply();
}
/**
* Return true when the {@code R.raw.bootstrap_data_json bootstrap data} has been marked loaded.
*
@ -43,6 +54,16 @@ public class SettingsUtils {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
return sp.getBoolean(PREF_DATA_BOOTSTRAP_DONE, false);
}
/**
* Return true when the {@link com.mozilla.hackathon.kiboko.activities.WelcomeActivity} has been shown.
*
* @param context Context to be used to lookup the {@link android.content.SharedPreferences}.
*/
public static boolean isWelcomeDone(final Context context) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
return sp.getBoolean(PREF_WELCOME_DONE, false);
}
/**
* Set fun mode.
*

Просмотреть файл

@ -9,9 +9,10 @@
android:id="@+id/topic_icon"
android:src="@drawable/welcome"
android:layout_marginTop="15dp"
android:layout_gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_marginBottom="15dp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_width="200dp"
android:layout_height="200dp" />
<TextView
android:layout_width="match_parent"

Просмотреть файл

@ -1,9 +1,6 @@
<resources xmlns:xliff="http://schemas.android.com/tools">
<string name="app_name">Jisort</string>
<string name="action_settings">Settings</string>
<string name="title_activity_details">DetailsActivity</string>
<string name="title_activity_dashboard">How can we help you?</string>
<string name="en_desc">I am your friendly Android helper, here to guide you on how to use your smartphone.</string>
<string name="dashboard_find_icons_label">Find Icons</string>
<string name="dashbord_screenshots_icon_label">Screenshots</string>
@ -54,4 +51,5 @@
<string name="welcome_title">Jisort!</string>
<string name="welcome_description">Explore the topics in this app to learn more about your phone.</string>
<string name="welcome_button">Ok\! Let\'s go\!</string>
<string name="title_dashboard">Jisort</string>
</resources>

Просмотреть файл

@ -48,7 +48,6 @@
</style>
<declare-styleable name="CheckableLinearLayout">
<attr name="is_checked" format="boolean" />
<attr name="type">
<enum name="radio" value="0" />
<enum name="check" value="1" />

Просмотреть файл

@ -14,7 +14,7 @@
# If versions end in odd numbers they are development builds, even versions are release candidates.
# The AndroidManifest.xml must also be updated currently.
org.gradle.jvmargs=-Xmx2048M
version=0.2.3-SNAPSHOT
version=0.2.4-SNAPSHOT
# Using these variables to sync dependency version numbers across sub-projects.
android_support_lib_version = 23.4.0