當前位置: 首頁>>代碼示例>>Java>>正文


Java TurbolinksSession類代碼示例

本文整理匯總了Java中com.basecamp.turbolinks.TurbolinksSession的典型用法代碼示例。如果您正苦於以下問題:Java TurbolinksSession類的具體用法?Java TurbolinksSession怎麽用?Java TurbolinksSession使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TurbolinksSession類屬於com.basecamp.turbolinks包,在下文中一共展示了TurbolinksSession類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_topic);

    Toolbar myToolbar = (Toolbar) findViewById(R.id.topic_toolbar);
    setSupportActionBar(myToolbar);
    ActionBar actionbar = getSupportActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);

    turbolinksView = (TurbolinksView) findViewById(R.id.topic_turbolinks_view);
    location = getIntent().getStringExtra(INTENT_URL);

    TurbolinksSession.getDefault(this)
            .activity(this)
            .adapter(this)
            .view(turbolinksView)
            .visit(location);
}
 
開發者ID:ruby-china,項目名稱:ruby-china-android,代碼行數:20,代碼來源:TopicActivity.java

示例2: onCreate

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reply_edit);

    Toolbar myToolbar = (Toolbar) findViewById(R.id.reply_edit_toolbar);
    setSupportActionBar(myToolbar);
    ActionBar actionbar = getSupportActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);

    turbolinksView = (TurbolinksView) findViewById(R.id.reply_edit_turbolinks_view);

    TurbolinksSession.getDefault(this)
            .activity(this)
            .adapter(this)
            .view(turbolinksView)
            .visit(location);
}
 
開發者ID:ruby-china,項目名稱:ruby-china-android,代碼行數:19,代碼來源:ReplyEditActivity.java

示例3: onCreate

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_topic_new);

    Toolbar myToolbar = (Toolbar) findViewById(R.id.topic_new_toolbar);
    setSupportActionBar(myToolbar);
    ActionBar actionbar = getSupportActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);

    turbolinksView = (TurbolinksView) findViewById(R.id.topic_new_turbolinks_view);

    TurbolinksSession.getDefault(this)
            .activity(this)
            .adapter(this)
            .view(turbolinksView)
            .visit(location);
}
 
開發者ID:ruby-china,項目名稱:ruby-china-android,代碼行數:19,代碼來源:TopicNewActivity.java

示例4: onCreate

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_topic_edit);

    Toolbar myToolbar = (Toolbar) findViewById(R.id.topic_edit_toolbar);
    setSupportActionBar(myToolbar);
    ActionBar actionbar = getSupportActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);

    turbolinksView = (TurbolinksView) findViewById(R.id.topic_edit_turbolinks_view);

    TurbolinksSession.getDefault(this)
            .activity(this)
            .adapter(this)
            .view(turbolinksView)
            .visit(location);
}
 
開發者ID:ruby-china,項目名稱:ruby-china-android,代碼行數:19,代碼來源:TopicEditActivity.java

示例5: onCreate

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_empty);

    Toolbar myToolbar = (Toolbar) findViewById(R.id.empty_toolbar);
    setSupportActionBar(myToolbar);
    ActionBar actionbar = getSupportActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);

    turbolinksView = (TurbolinksView) findViewById(R.id.empty_turbolinks_view);

    TurbolinksSession.getDefault(this)
            .activity(this)
            .adapter(this)
            .view(turbolinksView)
            .visit(location);
}
 
開發者ID:ruby-china,項目名稱:ruby-china-android,代碼行數:19,代碼來源:EmptyActivity.java

示例6: onCreate

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);

    Toolbar myToolbar = (Toolbar) findViewById(R.id.settings_toolbar);
    setSupportActionBar(myToolbar);
    ActionBar actionbar = getSupportActionBar();
    actionbar.setDisplayHomeAsUpEnabled(true);

    turbolinksView = (TurbolinksView) findViewById(R.id.settings_turbolinks_view);

    TurbolinksSession.getDefault(this)
            .activity(this)
            .adapter(this)
            .view(turbolinksView)
            .visit(location);
}
 
開發者ID:ruby-china,項目名稱:ruby-china-android,代碼行數:19,代碼來源:SettingsActivity.java

示例7: onCreate

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Find the custom TurbolinksView object in your layout
    turbolinksView = (TurbolinksView) findViewById(R.id.turbolinks_view);

    // For this demo app, we force debug logging on. You will only want to do
    // this for debug builds of your app (it is off by default)
    TurbolinksSession.getDefault(this).setDebugLoggingEnabled(true);

    // For this example we set a default location, unless one is passed in through an intent
    location = getIntent().getStringExtra(INTENT_URL) != null ? getIntent().getStringExtra(INTENT_URL) : BASE_URL;

    // Execute the visit
    TurbolinksSession.getDefault(this)
        .activity(this)
        .adapter(this)
        .view(turbolinksView)
        .visit(location);
}
 
開發者ID:turbolinks,項目名稱:turbolinks-android,代碼行數:23,代碼來源:MainActivity.java

示例8: shareTopic

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
private void shareTopic() {
    TurbolinksSession.getDefault(this).getWebView()
            .evaluateJavascript("document.querySelector('h1').innerText;", new ValueCallback<String>() {
        @Override
        public void onReceiveValue(String value) {
            String title = value.substring(1, value.length() - 1);
            Intent shareIntent = new Intent();
            shareIntent.setAction(Intent.ACTION_SEND);
            shareIntent.putExtra(Intent.EXTRA_TEXT, title + " " + location);
            shareIntent.setType("text/plain");
            startActivity(shareIntent);
        }
    });
}
 
開發者ID:ruby-china,項目名稱:ruby-china-android,代碼行數:15,代碼來源:TopicActivity.java

示例9: onQueryTextSubmit

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
public boolean onQueryTextSubmit(String query) {
    try {
        mSearched = true;
        location = getString(R.string.root_url) + "/search?q=" + URLEncoder.encode(query, "UTF-8");
        TurbolinksSession.getDefault(this).visit(location);
    } catch (UnsupportedEncodingException e){
        e.printStackTrace();
    }

    return true;
}
 
開發者ID:ruby-china,項目名稱:ruby-china-android,代碼行數:13,代碼來源:MainActivity.java

示例10: visitCompleted

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
public void visitCompleted() {
    TurbolinksSession.getDefault(this).getWebView().evaluateJavascript(
            "$('meta[name=\"current-user\"]').data()",
            new VisitCompletedCallback(this)
    );

    super.visitCompleted();
}
 
開發者ID:ruby-china,項目名稱:ruby-china-android,代碼行數:10,代碼來源:MainActivity.java

示例11: onCreate

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    TurbolinksSession.getDefault(this).getWebView().setWebChromeClient(new WebChromeClient());

    location = getIntent().getStringExtra(INTENT_URL);
}
 
開發者ID:ruby-china,項目名稱:ruby-china-android,代碼行數:9,代碼來源:BaseActivity.java

示例12: onRestart

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
protected void onRestart() {
    super.onRestart();

    if (!onSelectFileCallback) {
        TurbolinksSession.getDefault(this)
                .activity(this)
                .adapter(this)
                .restoreWithCachedSnapshot(true)
                .view(turbolinksView)
                .visit(location);
    } else {
        onSelectFileCallback = false;
    }
}
 
開發者ID:ruby-china,項目名稱:ruby-china-android,代碼行數:16,代碼來源:BaseActivity.java

示例13: onCreate

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dashes);

    // Setup Native Toolbar
    mToolbar = (Toolbar) findViewById(R.id.dashes_toolbar);
    mToolbar.setTitle(R.string.title_activity_dashes);

    setSupportActionBar(mToolbar);

    // Find the custom TurbolinksView object in your layout
    turbolinksView = (TurbolinksView) findViewById(R.id.turbolinks_dashes_view);
    turbolinksView.setBackgroundColor(Color.rgb(238, 238, 238));

    TurbolinksSession.getDefault(this).addJavascriptInterface(new DashWebService(this), "Android");

    // Use passed in intentURL else, just stick with the base url...
    location = getIntent().getStringExtra(INTENT_URL) != null ? getIntent().getStringExtra(INTENT_URL) : (getResources().getString(R.string.base_url) + "/dashers/dashes");
    dashID = getIntent().getStringExtra(DASH_ID);
    resourceID = getIntent().getStringExtra(RESOURCE_ID);

    // Execute the visit
    TurbolinksSession.getDefault(this)
            .activity(this)
            .adapter(this)
            .view(turbolinksView)
            .visit(location);


    // Make app active (used for push notifications)
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    sharedPreferences.edit().putBoolean(IS_APP_ACTIVE, true).apply();
}
 
開發者ID:tamcgoey,項目名稱:dasher-app-android,代碼行數:35,代碼來源:DashesActivity.java

示例14: onRestart

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
@Override
protected void onRestart() {
    super.onRestart();

    // Since the webView is shared between activities, we need to tell Turbolinks
    // to load the location from the previous activity upon restarting
    TurbolinksSession.getDefault(this)
            .activity(this)
            .adapter(this)
            .restoreWithCachedSnapshot(true)
            .view(turbolinksView)
            .visit(location);
}
 
開發者ID:tamcgoey,項目名稱:dasher-app-android,代碼行數:14,代碼來源:DashesActivity.java

示例15: handleError

import com.basecamp.turbolinks.TurbolinksSession; //導入依賴的package包/類
private void handleError(int code) {
    if (code == 404) {
        TurbolinksSession.getDefault(this)
                .activity(this)
                .adapter(this)
                .restoreWithCachedSnapshot(false)
                .view(turbolinksView)
                .visit(getResources().getString(R.string.base_url) + "/dashers/error");
    }
}
 
開發者ID:tamcgoey,項目名稱:dasher-app-android,代碼行數:11,代碼來源:DashesActivity.java


注:本文中的com.basecamp.turbolinks.TurbolinksSession類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。