Changed HelpActivity and layout for it
This commit is contained in:
parent
b55aa21a1c
commit
f14a03f592
2 changed files with 60 additions and 72 deletions
|
|
@ -1,79 +1,20 @@
|
|||
package orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
public class HelpActivity extends AppCompatActivity {
|
||||
|
||||
boolean isInNextView = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.help_overview);
|
||||
|
||||
setContentView(R.layout.activity_help);
|
||||
setupActionBar();
|
||||
|
||||
final ListView lv = (ListView) findViewById(R.id.listView2);
|
||||
|
||||
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
public void onItemClick(AdapterView<?> myAdapter, View myView, int myItemInt, long mylng) {
|
||||
String selectedFromList =(String) (lv.getItemAtPosition(myItemInt));
|
||||
isInNextView = true;
|
||||
|
||||
setContentView(R.layout.help_content);
|
||||
TextView title = (TextView) findViewById(R.id.titleText);
|
||||
TextView description = (TextView) findViewById(R.id.descriptionText);
|
||||
ImageView img = (ImageView) findViewById(R.id.img);
|
||||
|
||||
switch (myItemInt){
|
||||
case 0:
|
||||
img.setImageResource(R.drawable.help_start_screen);
|
||||
title.setText(R.string.help_start_screen_title);
|
||||
description.setText(R.string.help_start_screen);
|
||||
break;
|
||||
case 1:
|
||||
img.setImageResource(R.drawable.help_settings_screen);
|
||||
title.setText(R.string.help_settings_screen_title);
|
||||
description.setText(R.string.help_settings_screen);
|
||||
break;
|
||||
case 2:
|
||||
img.setImageResource(R.drawable.help_general_screen);
|
||||
title.setText(R.string.help_settings_screen_title);
|
||||
description.setText(R.string.help_settings_screen1);
|
||||
break;
|
||||
case 3:
|
||||
img.setImageResource(R.drawable.help_notification_screen);
|
||||
title.setText(R.string.help_settings_screen_title);
|
||||
description.setText(R.string.help_settings_screen2);
|
||||
break;
|
||||
case 4:
|
||||
img.setImageResource(R.drawable.help_create_profile_screen);
|
||||
title.setText(R.string.help_create_profile_screen_title);
|
||||
description.setText(R.string.help_create_profile_screen);
|
||||
break;
|
||||
case 5:
|
||||
img.setImageResource(R.drawable.help_break_screen);
|
||||
title.setText(R.string.help_break_screen_title);
|
||||
description.setText(R.string.help_break_screen);
|
||||
break;
|
||||
case 6:
|
||||
title.setText(R.string.disclaimer_title);
|
||||
img.setImageResource(R.drawable.ic_law);
|
||||
description.setText(R.string.disclaimer);
|
||||
break;
|
||||
default:
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupActionBar() {
|
||||
|
|
@ -87,22 +28,23 @@ public class HelpActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
switch (item.getItemId()) {
|
||||
// Respond to the action bar's Up/Home button
|
||||
case android.R.id.home:
|
||||
if(isInNextView){
|
||||
isInNextView = false;
|
||||
finish();
|
||||
Intent intent = new Intent(this, HelpActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
public static class HelpFragment extends PreferenceFragment {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
addPreferencesFromResource(R.xml.pref_help);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
46
app/src/main/res/layout/activity_help.xml
Normal file
46
app/src/main/res/layout/activity_help.xml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:openDrawer="start">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="orgprivacy_friendly_apps.secusoprivacyfriendlybreakreminder.HelpActivity">
|
||||
|
||||
<include layout="@layout/app_bar_break_reminder"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical"
|
||||
tools:context=".HelpActivity"
|
||||
android:weightSum="1">
|
||||
<fragment android:name="orgprivacy_friendly_apps.secuso.privacyfriendlybreakreminder.HelpActivity$HelpFragment"
|
||||
android:id="@+id/help_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
<android.support.design.widget.NavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:fitsSystemWindows="true"
|
||||
app:menu="@menu/activity_break_reminder_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue