Merge user list to develop #24
@ -1,9 +1,11 @@
|
|||||||
package com.uam.wmi.findmytutor.activity;
|
package com.uam.wmi.findmytutor.activity;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.BottomNavigationView;
|
import android.support.design.widget.BottomNavigationView;
|
||||||
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.ActionBarDrawerToggle;
|
import android.support.v7.app.ActionBarDrawerToggle;
|
||||||
@ -12,6 +14,7 @@ import android.os.Bundle;
|
|||||||
import android.support.v7.widget.SearchView;
|
import android.support.v7.widget.SearchView;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -22,6 +25,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.uam.wmi.findmytutor.ListViewAdapter;
|
import com.uam.wmi.findmytutor.ListViewAdapter;
|
||||||
import com.uam.wmi.findmytutor.R;
|
import com.uam.wmi.findmytutor.R;
|
||||||
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -30,6 +34,8 @@ public abstract class BaseActivity
|
|||||||
implements BottomNavigationView.OnNavigationItemSelectedListener {
|
implements BottomNavigationView.OnNavigationItemSelectedListener {
|
||||||
|
|
||||||
protected BottomNavigationView navigationView;
|
protected BottomNavigationView navigationView;
|
||||||
|
protected NavigationView drawerNavigationView;
|
||||||
|
protected DrawerLayout sideDrawer;
|
||||||
|
|
||||||
protected Toolbar toolbar;
|
protected Toolbar toolbar;
|
||||||
|
|
||||||
@ -45,7 +51,44 @@ public abstract class BaseActivity
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(getContentViewId());
|
setContentView(getContentViewId());
|
||||||
|
drawerNavigationView = findViewById(R.id.nav_view);
|
||||||
|
sideDrawer = findViewById(R.id.activity_container);
|
||||||
|
drawerNavigationView.setNavigationItemSelectedListener(
|
||||||
|
new NavigationView.OnNavigationItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||||
|
String itemName = (String)item.getTitle();
|
||||||
|
Intent launchIntent;
|
||||||
|
if(itemName.equals("Whitelist")){
|
||||||
|
/*launchIntent = new Intent(getApplicationContext(), WhitelistActivity.class);
|
||||||
|
startActivity(launchIntent);*/
|
||||||
|
}else if (itemName.equals("Blacklist")){
|
||||||
|
/* launchIntent = new Intent(getApplicationContext(), BlacklistActivity.class);
|
||||||
|
startActivity(launchIntent);*/
|
||||||
|
}else if (itemName.equals("Profile")){
|
||||||
|
/* launchIntent = new Intent(getApplicationContext(), ProfileActivity.class);
|
||||||
|
startActivity(launchIntent);*/
|
||||||
|
}else if (itemName.equals("Settings")){
|
||||||
|
launchIntent = new Intent(getApplicationContext(), SettingsActivity.class);
|
||||||
|
startActivity(launchIntent);
|
||||||
|
|
||||||
|
}else if (itemName.equals("Log out")){
|
||||||
|
PrefUtils.cleanUserLocalStorage(getApplicationContext());
|
||||||
|
Intent i = getBaseContext().getPackageManager()
|
||||||
|
.getLaunchIntentForPackage(getBaseContext().getPackageName());
|
||||||
|
if (i != null) {
|
||||||
|
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
}
|
||||||
|
startActivity(i);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
sideDrawer.closeDrawers();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
navigationView = findViewById(R.id.navigation);
|
navigationView = findViewById(R.id.navigation);
|
||||||
navigationView.setOnNavigationItemSelectedListener(this);
|
navigationView.setOnNavigationItemSelectedListener(this);
|
||||||
|
|
||||||
|
@ -97,7 +97,6 @@ public class MapActivity extends BaseActivity {
|
|||||||
|
|
||||||
button.setOnClickListener(view -> {
|
button.setOnClickListener(view -> {
|
||||||
PrefUtils.cleanUserLocalStorage(getApplicationContext());
|
PrefUtils.cleanUserLocalStorage(getApplicationContext());
|
||||||
|
|
||||||
Intent i = getBaseContext().getPackageManager()
|
Intent i = getBaseContext().getPackageManager()
|
||||||
.getLaunchIntentForPackage(getBaseContext().getPackageName());
|
.getLaunchIntentForPackage(getBaseContext().getPackageName());
|
||||||
if (i != null) {
|
if (i != null) {
|
||||||
|
@ -32,17 +32,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
|
|||||||
public void onCreate(final Bundle savedInstanceState) {
|
public void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
addPreferencesFromResource(R.xml.pref_main);
|
addPreferencesFromResource(R.xml.pref_main);
|
||||||
|
|
||||||
//TODO add on change listeners for preferences
|
|
||||||
|
|
||||||
// feedback preference click listener
|
|
||||||
Preference myPref = findPreference(getString(R.string.key_send_feedback));
|
|
||||||
myPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
|
||||||
sendFeedback(getActivity());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
app:layout_anchorGravity="bottom|center"
|
app:layout_anchorGravity="bottom|center"
|
||||||
app:menu="@menu/nav_items" />
|
app:menu="@menu/nav_items" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/app_bar_main"
|
layout="@layout/app_bar_main"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -14,9 +14,7 @@
|
|||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?actionBarSize"
|
android:layout_height="?actionBarSize"/>
|
||||||
|
|
||||||
/>
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/activity_content"
|
android:id="@+id/activity_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -3,32 +3,20 @@
|
|||||||
<group>
|
<group>
|
||||||
<item android:id="@+id/nav_item_one"
|
<item android:id="@+id/nav_item_one"
|
||||||
android:icon="@drawable/ic_menu_camera"
|
android:icon="@drawable/ic_menu_camera"
|
||||||
android:title="Item 1" />
|
android:title="@string/navigation_item_whitelist" />
|
||||||
<item android:id="@+id/nav_item_two"
|
<item android:id="@+id/nav_item_two"
|
||||||
android:icon="@drawable/ic_menu_gallery"
|
android:icon="@drawable/ic_menu_gallery"
|
||||||
android:title="Item 2" />
|
android:title="@string/navigation_item_blacklist" />
|
||||||
<item android:id="@+id/nav_item_three"
|
<item android:id="@+id/nav_item_three"
|
||||||
android:icon="@drawable/ic_menu_share"
|
android:icon="@drawable/ic_menu_share"
|
||||||
android:title="Item 3" />
|
android:title="@string/navigation_item_profile" />
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group android:id="@+id/group_menu">
|
<group android:id="@+id/group_menu">
|
||||||
<item android:id="@+id/nav_item_four"
|
<item android:id="@+id/nav_item_four"
|
||||||
android:icon="@drawable/ic_people_white"
|
android:icon="@drawable/ic_people_white"
|
||||||
android:title="@string/action_white_list" />
|
android:title="@string/navigation_item_settings" />
|
||||||
<item android:id="@+id/nav_item_five"
|
<item android:id="@+id/nav_item_five"
|
||||||
android:icon="@drawable/ic_people_black"
|
android:icon="@drawable/ic_people_black"
|
||||||
android:title="@string/action_black_list" />
|
android:title="@string/navigation_item_logout" />
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<item android:title="Title 1">
|
|
||||||
<menu>
|
|
||||||
<item android:id="@+id/nav_item_six"
|
|
||||||
android:icon="@drawable/ic_menu_settings_gear"
|
|
||||||
android:title="@string/action_settings" />
|
|
||||||
<item android:id="@+id/nav_item_sign_out"
|
|
||||||
android:icon="@drawable/ic_menu_sign_out2"
|
|
||||||
android:title="@string/action_sign_out" />
|
|
||||||
</menu>
|
|
||||||
</item>
|
|
||||||
</menu>
|
</menu>
|
@ -11,7 +11,11 @@
|
|||||||
<!--Side Menu-->
|
<!--Side Menu-->
|
||||||
<string name="navigation_drawer_open">Drawer Open</string>
|
<string name="navigation_drawer_open">Drawer Open</string>
|
||||||
<string name="navigation_drawer_close">Drawer Closed</string>
|
<string name="navigation_drawer_close">Drawer Closed</string>
|
||||||
|
<string name="navigation_item_blacklist">Blacklist</string>
|
||||||
|
<string name="navigation_item_whitelist">Whitelist</string>
|
||||||
|
<string name="navigation_item_settings">Settings</string>
|
||||||
|
<string name="navigation_item_profile">Profile</string>
|
||||||
|
<string name="navigation_item_logout">Log out</string>
|
||||||
<!-- Tutors list -->
|
<!-- Tutors list -->
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="activity_title_home">Notes</string>
|
<string name="activity_title_home">Notes</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user