we going back
This commit is contained in:
parent
bd775d5d0d
commit
2b4b83a0d2
6
.idea/encodings.xml
Normal file
6
.idea/encodings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/app/src/main/java/com/uam/wmi/findmytutor/activity/MapFragment.java" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
2
.settings/org.eclipse.buildship.core.prefs
Normal file
2
.settings/org.eclipse.buildship.core.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
connection.project.dir=
|
||||||
|
eclipse.preferences.version=1
|
6
app/.classpath
Normal file
6
app/.classpath
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||||
|
<classpathentry kind="output" path="bin/default"/>
|
||||||
|
</classpath>
|
2
app/.settings/org.eclipse.buildship.core.prefs
Normal file
2
app/.settings/org.eclipse.buildship.core.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
connection.project.dir=..
|
||||||
|
eclipse.preferences.version=1
|
@ -43,9 +43,9 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".activity.SharingActivity"
|
android:name=".activity.SharingActivity"
|
||||||
android:label="@string/title_activity_sharing" />
|
android:label="@string/title_activity_sharing" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.MainActivity"
|
||||||
|
android:label="@string/title_activity_sharing" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".service.BackgroundLocalizationService"
|
android:name=".service.BackgroundLocalizationService"
|
||||||
|
@ -45,6 +45,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
private FrameLayout mMainFrame;
|
private FrameLayout mMainFrame;
|
||||||
private boolean isTutor;
|
private boolean isTutor;
|
||||||
private MapFragment mapFragment;
|
private MapFragment mapFragment;
|
||||||
|
private SharingFragment sharingFragment;
|
||||||
private NotificationFragment notificationFragment;
|
private NotificationFragment notificationFragment;
|
||||||
private ProfileFragment profileFragment;;
|
private ProfileFragment profileFragment;;
|
||||||
|
|
||||||
@ -117,6 +118,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapFragment = new MapFragment();
|
mapFragment = new MapFragment();
|
||||||
|
sharingFragment = new SharingFragment();
|
||||||
notificationFragment = new NotificationFragment();
|
notificationFragment = new NotificationFragment();
|
||||||
profileFragment = new ProfileFragment();
|
profileFragment = new ProfileFragment();
|
||||||
|
|
||||||
@ -129,7 +131,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.nav_map:
|
case R.id.nav_map:
|
||||||
setFragment(mapFragment);
|
// setFragment(mapFragment);
|
||||||
|
setFragment(sharingFragment);
|
||||||
return true;
|
return true;
|
||||||
case R.id.nav_notif:
|
case R.id.nav_notif:
|
||||||
setFragment(notificationFragment);
|
setFragment(notificationFragment);
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
package com.uam.wmi.findmytutor.activity;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.ListPreference;
|
||||||
|
import android.preference.Preference;
|
||||||
|
import android.preference.PreferenceFragment;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.uam.wmi.findmytutor.R;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
//public class SharingFragment {
|
||||||
|
//}
|
||||||
|
|
||||||
|
public class SharingFragment extends PreferenceFragment {
|
||||||
|
@Override
|
||||||
|
public void onCreate(final Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
addPreferencesFromResource(R.xml.pref_sharing);
|
||||||
|
|
||||||
|
Preference manualStatus = findPreference("key_manual_status");
|
||||||
|
manualStatus.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
ListPreference lp = (ListPreference) findPreference("key_status_value");
|
||||||
|
updateListPreference(lp, newValue, "manual_statuses");
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Preference manualLocation = findPreference("key_sharing_enabled");
|
||||||
|
manualLocation.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||||
|
ListPreference lp = (ListPreference) findPreference("key_sharing_enabled");
|
||||||
|
updateListPreference(lp, newValue, "sharing_enabled");
|
||||||
|
return true;
|
||||||
|
});*/
|
||||||
|
|
||||||
|
Preference sharingLocation = findPreference("key_sharing_enabled");
|
||||||
|
sharingLocation.setOnPreferenceChangeListener((preference, o) -> {
|
||||||
|
Log.e("change", "1");
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void updateListPreference(ListPreference lp,Object newValue,String storageKey){
|
||||||
|
CharSequence [] entries = lp.getEntries();
|
||||||
|
Set<String> defaultEntries = new HashSet(Arrays.asList(entries));
|
||||||
|
SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
|
||||||
|
Set <String> manualStatusSet = sharedPref.getStringSet(storageKey,defaultEntries);
|
||||||
|
manualStatusSet.add((String) newValue);
|
||||||
|
String [] manualStatusArr = manualStatusSet.toArray(new String[0]);
|
||||||
|
Arrays.sort(manualStatusArr);
|
||||||
|
setListPreferenceData(lp.getKey(),manualStatusArr);
|
||||||
|
SharedPreferences.Editor editor = sharedPref.edit();
|
||||||
|
editor.putStringSet(storageKey,manualStatusSet);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ListPreference setListPreferenceData(String lp_name, String [] entries) {
|
||||||
|
ListPreference lp = (ListPreference) findPreference(lp_name);
|
||||||
|
lp.setEntries(entries);
|
||||||
|
CharSequence[] entryValues = new CharSequence [entries.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < entries.length; i++){
|
||||||
|
entryValues[i] = Integer.toString(i+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
lp.setDefaultValue("1");
|
||||||
|
lp.setEntryValues(entryValues);
|
||||||
|
|
||||||
|
return lp;
|
||||||
|
}
|
||||||
|
}
|
@ -2,8 +2,9 @@ package com.uam.wmi.findmytutor.activity;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
|
|
||||||
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
import com.uam.wmi.findmytutor.utils.PrefUtils;
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ public class StartupActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
if (PrefUtils.isLoggedIn(getApplicationContext())){
|
if (PrefUtils.isLoggedIn(getApplicationContext())){
|
||||||
Intent startupIntent = new Intent(this, MapActivity.class);
|
Intent startupIntent = new Intent(this, MainActivity.class);
|
||||||
startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
startActivity(startupIntent);
|
startActivity(startupIntent);
|
||||||
finish();
|
finish();
|
||||||
@ -30,7 +31,7 @@ public class StartupActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == AUTHENTICATION_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
|
if (requestCode == AUTHENTICATION_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
|
||||||
Intent startupIntent = new Intent(this, MapActivity.class);
|
Intent startupIntent = new Intent(this, MainActivity.class);
|
||||||
startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
startActivity(startupIntent);
|
startActivity(startupIntent);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user