зеркало из https://github.com/mozilla/Jisort.git
Added toggle on dashboard to enable/disable FUNMODE. references #89
This commit is contained in:
Родитель
03a672475a
Коммит
56d3e3ece8
|
@ -92,7 +92,6 @@ public class TopicsAdapter extends BaseAdapter implements Filterable {
|
|||
holder = (Holder) viewItem.getTag();
|
||||
|
||||
final Topic topic = topics.get(position);
|
||||
holder.tv.setText(topic.getName());
|
||||
|
||||
if(SettingsUtils.isFunModeEnabled(context)){
|
||||
holder.tv.setText(EmojiUtils.parse(topic.getName()));
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mozilla.hackathon.kiboko.fragments;
|
|||
/**
|
||||
* Created by mwadime on 6/9/2016.
|
||||
*/
|
||||
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -18,6 +19,7 @@ import com.mozilla.hackathon.kiboko.settings.SettingsUtils;
|
|||
import com.mozilla.hackathon.kiboko.utilities.Utils;
|
||||
import com.mozilla.hackathon.kiboko.widgets.NotifyingScrollView;
|
||||
|
||||
import org.sufficientlysecure.htmltextview.EmojiUtils;
|
||||
import org.sufficientlysecure.htmltextview.HtmlTextView;
|
||||
|
||||
import pl.droidsonroids.gif.GifDrawable;
|
||||
|
@ -85,8 +87,12 @@ public class ScreenSlidePageFragment extends Fragment {
|
|||
.inflate(R.layout.fragment_screen_slide_page, container, false);
|
||||
|
||||
// ((NotifyingScrollView) rootView.findViewById(R.id.content)).setOnScrollChangedListener(mOnScrollChangedListener);
|
||||
// Set the title view to show the page number.
|
||||
((TextView) rootView.findViewById(R.id.step_title)).setText(mPageTitle);
|
||||
if(SettingsUtils.isFunModeEnabled(getContext())){
|
||||
((TextView) rootView.findViewById(R.id.step_title)).setText(EmojiUtils.parse(mPageTitle));
|
||||
}else{
|
||||
((TextView) rootView.findViewById(R.id.step_title)).setText(mPageTitle);
|
||||
}
|
||||
|
||||
|
||||
((HtmlTextView) rootView.findViewById(R.id.step_description)).setFunMode(SettingsUtils.isFunModeEnabled(getContext()));
|
||||
((HtmlTextView) rootView.findViewById(R.id.step_description)).setHtmlFromString(mPageDescription,new HtmlTextView.LocalImageGetter());
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.mozilla.hackathon.kiboko.R;
|
|||
import com.mozilla.hackathon.kiboko.adapters.TopicsAdapter;
|
||||
import com.mozilla.hackathon.kiboko.models.Topic;
|
||||
import com.mozilla.hackathon.kiboko.services.ChatHeadService;
|
||||
import com.mozilla.hackathon.kiboko.settings.SettingsUtils;
|
||||
import com.mozilla.hackathon.kiboko.utilities.Utils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -27,7 +28,7 @@ public class TopicsFragment extends ListFragment implements CompoundButton.OnChe
|
|||
public static int OVERLAY_PERMISSION_REQ_CODE_CHATHEAD = 1234;
|
||||
TopicsAdapter adapter;
|
||||
private LinearLayout listFooterView;
|
||||
private SwitchCompat toggleSwitch = null;
|
||||
private SwitchCompat toggleSwitch, funmodeSwitch = null;
|
||||
|
||||
public TopicsFragment() {
|
||||
}
|
||||
|
@ -72,9 +73,13 @@ public class TopicsFragment extends ListFragment implements CompoundButton.OnChe
|
|||
// Inflate footer view
|
||||
listFooterView = (LinearLayout) LayoutInflater.from(this.getActivity()).inflate(R.layout.dashboard_footer_view, null);
|
||||
toggleSwitch = (SwitchCompat) listFooterView.findViewById(R.id.toggleSwitch);
|
||||
funmodeSwitch = (SwitchCompat) listFooterView.findViewById(R.id.funmodeSwitch);
|
||||
toggleSwitch.setChecked(App.isServiceRunning());
|
||||
|
||||
funmodeSwitch.setChecked(SettingsUtils.isFunModeEnabled(getContext()));
|
||||
//attach a listener to check for changes in state
|
||||
toggleSwitch.setOnCheckedChangeListener(this);
|
||||
funmodeSwitch.setOnCheckedChangeListener(this);
|
||||
setListAdapter(adapter);
|
||||
getListView().addFooterView(listFooterView);
|
||||
}
|
||||
|
@ -97,6 +102,14 @@ public class TopicsFragment extends ListFragment implements CompoundButton.OnChe
|
|||
}
|
||||
}
|
||||
break;
|
||||
case R.id.funmodeSwitch:
|
||||
if(!isChecked){
|
||||
Analytics.add("TopicsFragment::FunMode Switch", "Off");
|
||||
}else{
|
||||
Analytics.add("TopicsFragment::FunMode Switch", "On");
|
||||
}
|
||||
SettingsUtils.setFunMode(getContext(), isChecked);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -15,4 +15,15 @@
|
|||
android:textColor="@color/colorTextPrimary"
|
||||
android:layout_margin="@dimen/activity_vertical_margin"
|
||||
/>
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/funmodeSwitch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textOn="show"
|
||||
android:textOff="hide"
|
||||
app:showText="false"
|
||||
android:text="@string/enable_funmode_description"
|
||||
android:textColor="@color/colorTextPrimary"
|
||||
android:layout_margin="@dimen/activity_vertical_margin"
|
||||
/>
|
||||
</LinearLayout>
|
|
@ -23,88 +23,4 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
</TextView>
|
||||
<!--<!–Top Layout–>-->
|
||||
<!--<LinearLayout-->
|
||||
<!--android:id="@+id/topView"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content">-->
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:orientation="vertical"-->
|
||||
<!--android:padding="@dimen/activity_vertical_margin"-->
|
||||
<!--android:clickable="true"-->
|
||||
<!--android:onClick="screenshotsClicked"-->
|
||||
<!--android:id="@+id/screenshotView"-->
|
||||
<!--android:background="#222222"-->
|
||||
<!--android:layout_marginRight="5dp"-->
|
||||
<!--android:layout_width="0dp"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_weight="1">-->
|
||||
<!--<ImageView-->
|
||||
<!--android:layout_margin="5dp"-->
|
||||
<!--android:layout_gravity="center"-->
|
||||
<!--android:id="@+id/screenshot_icon"-->
|
||||
<!--android:src="@drawable/ic_camera_alt_white_48dp"-->
|
||||
<!--android:layout_width="48dp"-->
|
||||
<!--android:layout_height="48dp"-->
|
||||
<!--/>-->
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:textColor="#FFFFFF"-->
|
||||
<!--android:layout_gravity="center_horizontal"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:text="@string/dashbord_screenshots_icon_label" />-->
|
||||
|
||||
<!--</LinearLayout>-->
|
||||
|
||||
<!--<LinearLayout-->
|
||||
<!--android:orientation="vertical"-->
|
||||
<!--android:padding="@dimen/activity_vertical_margin"-->
|
||||
<!--android:clickable="true"-->
|
||||
<!--android:onClick="findIconsClicked"-->
|
||||
<!--android:id="@+id/findIconsView"-->
|
||||
<!--android:layout_marginLeft="5dp"-->
|
||||
<!--android:background="@drawable/gray_border"-->
|
||||
<!--android:layout_width="0dp"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_weight="1">-->
|
||||
<!--<ImageView-->
|
||||
<!--android:layout_margin="5dp"-->
|
||||
<!--android:layout_gravity="center"-->
|
||||
<!--android:id="@+id/help_icon"-->
|
||||
<!--android:src="@drawable/ic_live_help_black_48dp"-->
|
||||
<!--android:layout_width="48dp"-->
|
||||
<!--android:layout_height="48dp"-->
|
||||
<!--/>-->
|
||||
<!--<TextView-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_gravity="center_horizontal"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:text="@string/dashboard_find_icons_label" />-->
|
||||
|
||||
<!--</LinearLayout>-->
|
||||
<!--</LinearLayout>-->
|
||||
<!--<!– EditText for Search –>-->
|
||||
<!--<EditText-->
|
||||
<!--android:id="@+id/inputSearch"-->
|
||||
<!--android:layout_width="fill_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:padding="14dp"-->
|
||||
<!--android:layout_below="@+id/topView"-->
|
||||
<!--android:layout_marginTop="@dimen/activity_vertical_margin"-->
|
||||
<!--android:layout_marginBottom="@dimen/activity_vertical_margin"-->
|
||||
<!--android:drawableRight="@drawable/ic_search_black_24dp"-->
|
||||
<!--android:hint="Search"-->
|
||||
<!--android:imeOptions="actionSearch"-->
|
||||
<!--android:inputType="textVisiblePassword"/>-->
|
||||
<!--<!–Bottom Layout–>-->
|
||||
<!--<com.mozilla.hackathon.kiboko.widgets.DSOGridView-->
|
||||
<!--android:id="@+id/dashboardGridView"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:verticalSpacing="10dp"-->
|
||||
<!--android:horizontalSpacing="10dp"-->
|
||||
<!--android:layout_below="@+id/inputSearch"-->
|
||||
<!--android:numColumns="2" />-->
|
||||
|
||||
</LinearLayout>
|
|
@ -50,4 +50,5 @@
|
|||
<string name="play_icon_quiz_text">Play the Icon Quiz!</string>
|
||||
<string name="app_name_actions">Jisort - View Settings</string>
|
||||
<string name="app_name_tutorials">Jisort - View Tutorial</string>
|
||||
<string name="enable_funmode_description">Enable FUN MODE</string>
|
||||
</resources>
|
||||
|
|
Загрузка…
Ссылка в новой задаче