Merge branch 'newnavigation' of git://github.com/fkloft/ingress-intel-total-conversion into fkloft-newnavigation

This commit is contained in:
Philipp Schaefer 2013-09-23 12:31:12 +02:00
commit 1705ea5c75
4 changed files with 68 additions and 23 deletions

View File

@ -318,7 +318,19 @@ public class IITC_Mobile extends Activity {
// we want a self defined behavior for the back button
@Override
public void onBackPressed() {
// first kill all open iitc dialogs
// exit fullscreen mode if it is enabled and action bar is disabled or the back stack is empty
if (mFullscreenMode && (mBackStack.isEmpty() || mNavigationHelper.hideInFullscreen())) {
toggleFullscreen();
return;
}
// close drawer if opened
if (mNavigationHelper.isDrawerOpened()) {
mNavigationHelper.closeDrawer();
return;
}
// kill all open iitc dialogs
if (!mDialogStack.isEmpty()) {
String id = mDialogStack.pop();
mIitcWebView.loadUrl("javascript: " +
@ -327,17 +339,17 @@ public class IITC_Mobile extends Activity {
"selector.remove();");
return;
}
// exit fullscreen mode if it is enabled and action bar is disabled
// or the back stack is empty
if (mFullscreenMode && (mBackStack.isEmpty() || mNavigationHelper.hideInFullscreen())) {
this.toggleFullscreen();
} else if (!mBackStack.isEmpty()) {
// Pop last item from backstack and pretend the relevant menu item was clicked
if (!mBackStack.isEmpty()) {
backStackPop();
} else {
if (mBackButtonPressed || !mSharedPrefs.getBoolean("pref_press_twice_to_exit", false))
return;
}
if (mBackButtonPressed || !mSharedPrefs.getBoolean("pref_press_twice_to_exit", false)) {
super.onBackPressed();
else {
return;
} else {
mBackButtonPressed = true;
Toast.makeText(this, "Press twice to exit", Toast.LENGTH_SHORT).show();
// reset back button after 2 seconds
@ -349,7 +361,6 @@ public class IITC_Mobile extends Activity {
}, 2000);
}
}
}
public void backStackPop() {
// shouldn't be called when back stack is empty

View File

@ -16,6 +16,8 @@ import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.Comparator;
public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNavigationListener, OnItemClickListener {
// Show/hide the up arrow on the very left
// getActionBar().setDisplayHomeAsUpEnabled(enabled);
@ -30,6 +32,22 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
// getActionBar().setHomeButtonEnabled(enabled);
private class HighlighterAdapter extends ArrayAdapter<String> {
// Move "No Highlights" on top. Sort the rest alphabetically
private class HighlighterComparator implements Comparator<String> {
@Override
public int compare(String lhs, String rhs) {
if (lhs.equals("No Highlights"))
return -1000;
else if (rhs.equals("No Highlights"))
return 1000;
else
return lhs.compareTo(rhs);
}
}
private HighlighterComparator mComparator = new HighlighterComparator();
public HighlighterAdapter() {
super(mIitc, android.R.layout.simple_list_item_1);
clear();
@ -39,6 +57,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
public void add(String object) {
super.remove(object); // to avoid duplicates
super.add(object);
super.sort(mComparator);
}
@Override
@ -178,7 +197,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
if (mHighlighters.getCount() < 2) // there should always be "No Highlights"
showHighlighter = false;
if(mDrawerOpened)
if (mDrawerOpened)
showHighlighter = false;
if (showHighlighter) {
@ -204,6 +223,10 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
updateActionBar();
}
public void closeDrawer() {
mDrawerLayout.closeDrawers();
}
public String getPaneTitle(Pane pane)
{
switch (pane) {
@ -224,6 +247,10 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
}
}
public boolean isDrawerOpened() {
return mDrawerOpened;
}
public boolean hideInFullscreen() {
return mHideInFullscreen;
}
@ -240,7 +267,7 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnNa
public void onDrawerOpened(View drawerView) {
// TODO change menu? (via invalidateOptionsMenu)
super.onDrawerOpened(drawerView);
mDrawerOpened=true;
mDrawerOpened = true;
updateActionBar();
}

View File

@ -15,6 +15,9 @@ offers many more features. It is available for
<h4>22nd September 2013</h4>
<p>
<b>Update</b>: IITC Mobile 0.6.5 replaces 0.6.4. This fixes a crash on entering plugin preferences on some tablets.
</p>
<p>
IITC 0.14.1 and IITC Mobile 0.6.4 have been released. Changes in this version include:
<ul>
<li>Better performance when a very large number of portals are within view (country/continent level)</li>
@ -44,4 +47,5 @@ And plugins:
And, as always, numerous other bug fixes, tweaks and improvements.
</p>
<a class="btn btn-small" href="?page=news">Older news</a>

View File

@ -2,6 +2,9 @@
<h4>22nd September 2013</h4>
<p>
<b>Update</b>: IITC Mobile 0.6.5 replaces 0.6.4. This fixes a crash on entering plugin preferences on some tablets.
</p>
<p>
IITC 0.14.1 and IITC Mobile 0.6.4 have been released. Changes in this version include:
<ul>
<li>Better performance when a very large number of portals are within view (country/continent level)</li>