目前我使用最新的sdk来实现facebook登录,但是,它与官方的实际行为略有不同
官方行为:用户点击登录按钮,权限对话框提示,如果我点击取消,它将关闭该框,只有当我点击确认时才会登录
我的应用行为:用户单击登录按钮,权限对话框提示,如果我单击取消,它将关闭该框,但如果我再次单击登录按钮,它将不会显示任何权限对话框,并将登录
我从官方样本中复制了代码,所以我很困惑为什么它在我的应用程序中表现不同.怎么解决?谢谢
Facebook示例(我使用官方代码构建我的登录按钮)
public class SessionLoginFragment extends Fragment {
private static final String URL_PREFIX_FRIENDS = "https://graph.facebook.com/me/friends?access_token=";
private TextView textInstructionsOrLink;
private Button buttonLoginLogout;
private Session.StatusCallback statusCallback = new SessionStatusCallback();
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment, container, false);
buttonLoginLogout = (Button) view.findViewById(R.id.buttonLoginLogout);
textInstructionsOrLink = (TextView) view.findViewById(R.id.instructionsOrLink);
Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
Session session = Session.getActiveSession();
if (session == null) {
if (savedInstanceState != null) {
session = Session.restoreSession(getActivity(), null, statusCallback, savedInstanceState);
}
if (session …Run Code Online (Sandbox Code Playgroud) 当我尝试在webview中显示Google日历时,会显示一些错误:
[INFO:CONSOLE(0)] "Refused to display 'https://accounts.google.com/ServiceLogin?service=cl&passive=1209600&continue=https://www.google.com/calendar/embed?src%3Detlwhk@gmail.com%26ctz%3DAsia/Hong_Kong&followup=https://www.google.com/calendar/embed?src%3Detlwhk@gmail.com%26ctz%3DAsia/Hong_Kong&btmpl=mobile<mpl=mobilex&scc=1' in a frame because it set 'X-Frame-Options' to 'DENY'.", source: about:blank (0)
Run Code Online (Sandbox Code Playgroud)
这是HTML代码
<p><iframe style="border: 0;" src="https://www.google.com/calendar/embed?src=etlwhk%40gmail.com&ctz=Asia/Hong_Kong&output=embed" width="800" height="600" frameborder="0" scrolling="no"></iframe></p>
Run Code Online (Sandbox Code Playgroud)
而对于android方面,它是一些简单的webview代码
StringBuilder sb = new StringBuilder();
sb.append("<HTML><HEAD><meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'><style>img{display: inline; height: auto; max-width: 100%}iframe{width:100%}</style></HEAD><body>");
sb.append(page.page_content_chi.toString());
sb.append("</body></HTML>");
webview.loadDataWithBaseURL("file:///android_asset/", sb.toString(), "text/html", "utf-8", null);
Run Code Online (Sandbox Code Playgroud)
如何修复错误?谢谢你的帮助.
将网页存储在数据库中是否合适?我使用的是mysql的InnoDB引擎,电子邮件模板是一个邮件格式的修改后的html文件,因此应该有一个普通的html文件.
请注意,这些模板不是每个人都可以访问的,它们应该引用userID,例如,用户A有template1,2,3 ..但是UserB可能有模板2,3,5,6 ..
我应该存储这种文件的数据类型是什么?
或者不是使用数据库,我应该创建一个html文件并使用PHP写入并为每个用户打开一个文件夹?
感谢您的帮助,我在处理此类数据方面经验不足
我想要实现的是当鼠标没有悬停menu3时,系统将继续检查aboutMenu是否悬停,如果是,则警告'h',并警告'nh'其他人.问题是它只在鼠标离开menu3时检查一次,如何解决这个问题?谢谢.
$('#menu3').live('mouseout',function() {
$("#aboutMenu").hover(function() {
$(this).data("hovered", true);
}, function() {
$(this).data("hovered", false);
});
if ( $("#aboutMenu").data("hovered") ) {
alert ('h');
} else {
alert ('nh');
}
});
Run Code Online (Sandbox Code Playgroud)
更新:
或者另一种方法是系统继续检查menu3或aboutMenu是否悬停,如果没有,则会弹出悬停的消息.但是,这只会在页面初始化时运行一次,如何让它继续检查?谢谢
$(document).ready(function() {
$("#aboutMenu,#menu3").hover(function() {
$(this).data("hovered", true);
}, function() {
$(this).data("hovered", false);
});
if ( $("#aboutMenu,#menu3").data("hovered") )
alert ('hovered');
});
Run Code Online (Sandbox Code Playgroud) 目标:具有缩放和拖动/平移功能的浏览器基础pdf查看器(如果允许隐藏保存功能,则更好)替换浏览器默认值
问题:所有浏览器(不包括旧的IE)在pdf查看器中都有自己的构建,没有拖动/平移功能
目前此代码使用默认的pdf查看器:
<object id = 'zoomPage' type='application/pdf' data= '1.pdf'>
<p>The PDF can not display
</p>
</object>
Run Code Online (Sandbox Code Playgroud)
是否可以使用adobe reader强制所有浏览器(Chrome,FireFox,IE8 +)使用javascript/jquery/html/php打开pdf文件?或者有任何网络基础pdf查看器具有上述功能?
注意:
对于第一种方法:
我找到了例如内容处理的方式:附件
但它只会改变从查看下载pdf的行为,而不是更改打开pdf文件的首选项
我正在建立会员订购系统,我想让用户无需注册,他们可以直接登录Facebook.
问题是,这种方法的数据流是什么?例如,Facebook是否返回用户帐户/ ID /电子邮件或任何其他信息,以便我可以将它们插入我的系统,或者它只是一个表明他/她已登录的会话?
另外,我想收集他们的电话号码(订单确认).如果访问者没有在他们的Facebook帐户中具体说明,如何处理此案?
以下是我研究后的代码,但似乎只能返回会员ID?
<?php
define('YOUR_APP_ID', 'YOUR APP ID');
//uses the PHP SDK. Download from https://github.com/facebook/php-sdk
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => YOUR_APP_ID,
'secret' => 'YOUR APP SECRET',
));
$userId = $facebook->getUser();
?>
<html>
<body>
<div id="fb-root"></div>
<?php if ($userId) {
$userInfo = $facebook->api('/' . $userId); ?>
Welcome <?= $userInfo['name'] ?>
<?php } else { ?>
<fb:login-button></fb:login-button>
<?php } ?>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : …Run Code Online (Sandbox Code Playgroud) 由于谷歌推出了导航抽屉,我试图使用这个组件来创建一个类似Facebook的菜单.问题是,视觉效果似乎不同.
当抽屉打开时,谷歌的操作栏会保留,而Facebook的操作栏则没有.相反,整个屏幕已推到右侧
我发现有一些lib可以实现这一点,但由于我不喜欢在项目中包含第三方lib,有没有办法实现这一点?谢谢


代码基于导航抽屉教程
protected void setupMenu(List<String> list, final ListView menu) {
Adapter customAdapter = new Adapter(getActionBar().getThemedContext(),
R.layout.item, list);
menu.setAdapter(customAdapter);
menu.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
final int pos, long id) {
String selected = ((TextView) view.findViewById(R.id.itemTxt))
.getText().toString();
// define pass data
final Bundle bData = new Bundle();
bData.putString("itemSelect", selected);
drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
FragmentTransaction tx = getSupportFragmentManager()
.beginTransaction();
tx.replace(R.id.mainContent, Fragment.instantiate(
MainActivity.this,
"com.example.utilities.ContentPage", bData));
tx.commit();
}
});
drawer.closeDrawer(menu);
}
}); …Run Code Online (Sandbox Code Playgroud) 目前我正在研究一个片段,它只是一个带有framelayout的webview,问题是,我想做一些像下拉刷新的东西(就像列表视图常见的一些刷新功能).
假设有一个refreshToDo()函数,我需要的只是一个布局(当我拖动它显示刷新标题时,当标题位于特定高度时,它调用refreshToDo(),当我释放它时,它会返回顶部并隐藏),但是如何实现呢?谢谢
布局:(它包含主要内容和目标内容,您可以简单地插入目标内容,它用于在webview中全屏播放视频):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<FrameLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
<FrameLayout
android:id="@+id/target_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:visibility="gone" >
</FrameLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
分段:
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.web_fragment, container,
false);
mTargetView = (FrameLayout) rootView.findViewById(R.id.target_view);
mContentView = (FrameLayout) rootView.findViewById(R.id.main_content);
mWebView = (WebView) rootView.findViewById(R.id.webView);
mWebView.setVerticalScrollBarEnabled(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WebView.setWebContentsDebuggingEnabled(true);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true); …Run Code Online (Sandbox Code Playgroud) 这是来自wsdl的数据
<s:element name="CreateDraftLead">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="formId" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="FirstName" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="LastName" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="Gender" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="AgeGroup" nillable="true" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="MobilePhone" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="Birthday" nillable="true" type="s:dateTime"/>
<s:element minOccurs="0" maxOccurs="1" name="District" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="email" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="Region" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="LocationId" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="LeadSourceId" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="CompanyId" nillable="true" type="s:int"/>
<s:element minOccurs="1" maxOccurs="1" name="SourceCampaignId" …Run Code Online (Sandbox Code Playgroud) 我正在使用elfinder制作一个自定义的共享按钮,有关于如何自定义右键菜单的教程,我已经实现了它.但是,我想申请菜单有一些规则
1) For folder only, exclude the button for file
2) For root level only, exclude the button for sub level folder
3) For single folder only, if select more than one folder will exclude the button
Run Code Online (Sandbox Code Playgroud)
这是当前代码,现在有分享按钮但不符合上述规则:
elFinder.prototype.i18.zh_TW.messages['cmdsharefolder'] = 'Share';
elFinder.prototype._options.commands.push('sharefolder');
elFinder.prototype.commands.sharefolder = function () {
this.exec = function (hashes) {
//open share menu
}
this.getstate = function () {
return 0;
}
}
Run Code Online (Sandbox Code Playgroud)
和elfinder实例:
var elfinder = $('#elfinder').elfinder({
url: '<?= $connector; ?>',
soundPath: '<?= site_url('assets/plugins/elFinder/sounds/rm.wav'); ?>',
height: 700, …Run Code Online (Sandbox Code Playgroud) javascript ×5
android ×4
jquery ×3
php ×3
facebook ×2
html ×2
java ×2
webview ×2
arrays ×1
database ×1
elfinder ×1
hover ×1
if-statement ×1
import ×1
pdf ×1
pdf-viewer ×1
sidebar ×1
soap ×1
soap-client ×1
wsdl ×1