mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-08 23:07:26 -04:00
Fixed fullscreen button.
This commit is contained in:
parent
555ce47938
commit
8315ffc77a
@ -5,13 +5,10 @@ import android.app.FragmentTransaction;
|
|||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
@ -34,13 +31,14 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class KiwixMobileActivity extends FragmentActivity implements ActionBar.TabListener,
|
public class KiwixMobileActivity extends FragmentActivity implements ActionBar.TabListener,
|
||||||
View.OnLongClickListener, View.OnDragListener, KiwixMobileFragment.FragmentCommunicator {
|
View.OnLongClickListener, View.OnDragListener, KiwixMobileFragment.FragmentCommunicator {
|
||||||
|
|
||||||
public static ArrayList<State> mPrefState;
|
public static ArrayList<State> mPrefState;
|
||||||
|
|
||||||
|
public static boolean mIsFullscreenOpened;
|
||||||
|
|
||||||
private ViewPagerAdapter mViewPagerAdapter;
|
private ViewPagerAdapter mViewPagerAdapter;
|
||||||
|
|
||||||
private ViewPager mViewPager;
|
private ViewPager mViewPager;
|
||||||
@ -80,6 +78,8 @@ public class KiwixMobileActivity extends FragmentActivity implements ActionBar.T
|
|||||||
|
|
||||||
mPrefState = new ArrayList<State>();
|
mPrefState = new ArrayList<State>();
|
||||||
|
|
||||||
|
mIsFullscreenOpened = false;
|
||||||
|
|
||||||
setUpViewPagerAndActionBar();
|
setUpViewPagerAndActionBar();
|
||||||
|
|
||||||
// Set the initial tab. It's hidden.
|
// Set the initial tab. It's hidden.
|
||||||
@ -118,6 +118,10 @@ public class KiwixMobileActivity extends FragmentActivity implements ActionBar.T
|
|||||||
mActionBar.setSelectedNavigationItem(position);
|
mActionBar.setSelectedNavigationItem(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the visibillity of the fullscreen button
|
||||||
|
int visibillity = mIsFullscreenOpened ? View.VISIBLE : View.INVISIBLE;
|
||||||
|
mCurrentFragment.exitFullscreenButton.setVisibility(visibillity);
|
||||||
|
|
||||||
// If the app is in landscape mode, Android will switch the navigationmode from
|
// If the app is in landscape mode, Android will switch the navigationmode from
|
||||||
// "NAVIGATION_MODE_TABS" to "NAVIGATION_MODE_LIST" (as long as the app has more than 3 tabs open).
|
// "NAVIGATION_MODE_TABS" to "NAVIGATION_MODE_LIST" (as long as the app has more than 3 tabs open).
|
||||||
// There is no way to update this Spinner without creating an extra adapter for that.
|
// There is no way to update this Spinner without creating an extra adapter for that.
|
||||||
@ -221,7 +225,7 @@ public class KiwixMobileActivity extends FragmentActivity implements ActionBar.T
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.menu_fullscreen:
|
case R.id.menu_fullscreen:
|
||||||
if (mCurrentFragment.isFullscreenOpened) {
|
if (mIsFullscreenOpened) {
|
||||||
closeFullScreen();
|
closeFullScreen();
|
||||||
} else {
|
} else {
|
||||||
openFullScreen();
|
openFullScreen();
|
||||||
@ -248,14 +252,14 @@ public class KiwixMobileActivity extends FragmentActivity implements ActionBar.T
|
|||||||
mCurrentFragment = getCurrentVisibleFragment();
|
mCurrentFragment = getCurrentVisibleFragment();
|
||||||
|
|
||||||
getActionBar().hide();
|
getActionBar().hide();
|
||||||
mCurrentFragment.exitFullscreenButton.setVisibility(0);
|
mCurrentFragment.exitFullscreenButton.setVisibility(View.VISIBLE);
|
||||||
mCurrentFragment.menu.findItem(R.id.menu_fullscreen)
|
mCurrentFragment.menu.findItem(R.id.menu_fullscreen)
|
||||||
.setTitle(getResources().getString(R.string.menu_exitfullscreen));
|
.setTitle(getResources().getString(R.string.menu_exitfullscreen));
|
||||||
int fullScreenFlag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
int fullScreenFlag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
int classicScreenFlag = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
|
int classicScreenFlag = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
|
||||||
getWindow().addFlags(fullScreenFlag);
|
getWindow().addFlags(fullScreenFlag);
|
||||||
getWindow().clearFlags(classicScreenFlag);
|
getWindow().clearFlags(classicScreenFlag);
|
||||||
mCurrentFragment.isFullscreenOpened = true;
|
mIsFullscreenOpened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closeFullScreen() {
|
private void closeFullScreen() {
|
||||||
@ -264,12 +268,12 @@ public class KiwixMobileActivity extends FragmentActivity implements ActionBar.T
|
|||||||
getActionBar().show();
|
getActionBar().show();
|
||||||
mCurrentFragment.menu.findItem(R.id.menu_fullscreen)
|
mCurrentFragment.menu.findItem(R.id.menu_fullscreen)
|
||||||
.setTitle(getResources().getString(R.string.menu_fullscreen));
|
.setTitle(getResources().getString(R.string.menu_fullscreen));
|
||||||
mCurrentFragment.exitFullscreenButton.setVisibility(4);
|
mCurrentFragment.exitFullscreenButton.setVisibility(View.INVISIBLE);
|
||||||
int fullScreenFlag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
int fullScreenFlag = WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
int classicScreenFlag = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
|
int classicScreenFlag = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
|
||||||
getWindow().clearFlags(fullScreenFlag);
|
getWindow().clearFlags(fullScreenFlag);
|
||||||
getWindow().addFlags(classicScreenFlag);
|
getWindow().addFlags(classicScreenFlag);
|
||||||
mCurrentFragment.isFullscreenOpened = false;
|
mIsFullscreenOpened = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,8 +102,6 @@ public class KiwixMobileFragment extends Fragment {
|
|||||||
|
|
||||||
public KiwixWebView webView;
|
public KiwixWebView webView;
|
||||||
|
|
||||||
public boolean isFullscreenOpened;
|
|
||||||
|
|
||||||
public ImageButton exitFullscreenButton;
|
public ImageButton exitFullscreenButton;
|
||||||
|
|
||||||
public AutoCompleteTextView articleSearchtextView;
|
public AutoCompleteTextView articleSearchtextView;
|
||||||
@ -140,7 +138,6 @@ public class KiwixMobileFragment extends Fragment {
|
|||||||
requestInitAllMenuItems = false;
|
requestInitAllMenuItems = false;
|
||||||
nightMode = false;
|
nightMode = false;
|
||||||
isButtonEnabled = true;
|
isButtonEnabled = true;
|
||||||
isFullscreenOpened = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -149,11 +149,6 @@ public class LanguageUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isLanguageSet() {
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a list of all the language names
|
// Get a list of all the language names
|
||||||
public List<String> getValues() {
|
public List<String> getValues() {
|
||||||
|
|
||||||
@ -193,7 +188,6 @@ public class LanguageUtils {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(String name, Context context, AttributeSet attrs) {
|
public View onCreateView(String name, Context context, AttributeSet attrs) {
|
||||||
Log.e("kiwix", name);
|
|
||||||
|
|
||||||
// Apply the custom font, if the xml tag equals "TextView", "EditText" or "AutoCompleteTextView"
|
// Apply the custom font, if the xml tag equals "TextView", "EditText" or "AutoCompleteTextView"
|
||||||
if (name.equalsIgnoreCase("TextView")
|
if (name.equalsIgnoreCase("TextView")
|
||||||
@ -229,11 +223,10 @@ public class LanguageUtils {
|
|||||||
|
|
||||||
// This method will determine which font will be applied to the not-supported-locale.
|
// This method will determine which font will be applied to the not-supported-locale.
|
||||||
// You can define exceptions to the default DejaVu font in the 'exceptions' Hashmap:
|
// You can define exceptions to the default DejaVu font in the 'exceptions' Hashmap:
|
||||||
// Key: the language code; Value: the name of the font.
|
|
||||||
// The font has to be placed in the assets folder.
|
|
||||||
private String getTypeface() {
|
private String getTypeface() {
|
||||||
|
|
||||||
// Define the exceptions to the rule
|
// Define the exceptions to the rule. The font has to be placed in the assets folder.
|
||||||
|
// Key: the language code; Value: the name of the font.
|
||||||
HashMap<String, String> exceptions = new HashMap<String, String>();
|
HashMap<String, String> exceptions = new HashMap<String, String>();
|
||||||
exceptions.put("my", "Parabaik.ttf");
|
exceptions.put("my", "Parabaik.ttf");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user