当前位置: 首页>>代码示例>>Java>>正文


Java TweetComposer类代码示例

本文整理汇总了Java中com.twitter.sdk.android.tweetcomposer.TweetComposer的典型用法代码示例。如果您正苦于以下问题:Java TweetComposer类的具体用法?Java TweetComposer怎么用?Java TweetComposer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TweetComposer类属于com.twitter.sdk.android.tweetcomposer包,在下文中一共展示了TweetComposer类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: composeTweet

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
@ReactMethod
public void composeTweet(ReadableMap options, final Callback callback) {
    try {
        this.callback = callback;

        String body = options.hasKey("body") ? options.getString("body") : "";

        TweetComposer.Builder builder = new TweetComposer.Builder(reactContext).text(body);
        final Intent intent = builder.createIntent();
        reactContext.startActivityForResult(intent, REQUEST_CODE, intent.getExtras());

    } catch (Exception e) {
        //error!
        sendCallback(false, false, true);
        throw e;
    }
}
 
开发者ID:tkporter,项目名称:react-native-fabric-twitterkit,代码行数:18,代码来源:FabricTwitterKitModule.java

示例2: onOptionsItemSelected

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
    if (menuItem.getItemId() == android.R.id.home) {
        NavUtils.navigateUpFromSameTask(this);
        return true;
    } else if (menuItem.getItemId() == R.id.action_share) {
        TweetComposer.Builder builder = new TweetComposer.Builder(this)
            .text(String.format(getString(R.string.tweet_pattern), mItem.getPrice(), mItem.getName(), mItem.getGuid()));
        builder.show();
        return true;
    } else if(menuItem.getItemId() == R.id.action_bookmark) {
        attemptPostBookmark();
        return true;
    }else {
        return super.onOptionsItemSelected(menuItem);
    }
}
 
开发者ID:firejake308,项目名称:Show-And-Sell,代码行数:18,代码来源:ItemDetailActivity.java

示例3: onCreate

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tweetcomposer_activity_main);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setTitle(R.string.kit_tweetcomposer);
    }

    final Button tweetComposer = findViewById(R.id.tweet_composer);
    tweetComposer.setOnClickListener(view -> {
        try {
            new TweetComposer.Builder(TweetComposerMainActivity.this)
                    .text("Tweet from TwitterKit!")
                    .url(new URL("http://www.twitter.com"))
                    .show();

        } catch (MalformedURLException e) {
            Log.e(TAG, "error creating tweet intent", e);
        }
    });

    final Button organicComposer = findViewById(R.id.organic_composer);
    organicComposer.setOnClickListener(view -> launchPicker());
}
 
开发者ID:twitter,项目名称:twitter-kit-android,代码行数:26,代码来源:TweetComposerMainActivity.java

示例4: onCreate

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
    Fabric.with(this, new Twitter(authConfig));
    Fabric.with(this, new TweetComposer());
    setContentView(R.layout.activity_splash_screen);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            Intent accountPortalIntent = new Intent(SplashScreen.this, MainActivity.class);
            startActivity(accountPortalIntent);
            finish();
        }
    }, SPLASH_TIME_OUT);

    PreferencesLayer.initialize(getSharedPreferences("prefs", Context.MODE_PRIVATE));
    String id = PreferencesLayer.getInstance().getKey();
    Util.phoneNumbers = PreferencesLayer.getInstance().getPhoneNumbers();
    Util.emails = PreferencesLayer.getInstance().getEmails();
    if (id.equals("")) {
        new RegisterTask().execute();
    }
}
 
开发者ID:stevex86,项目名称:RandomActsOfKindness,代码行数:27,代码来源:SplashScreen.java

示例5: shareTwitter

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
private void shareTwitter(){
	Uri path = Uri.parse("android.resource://net.geekstools.floatshort.PRO/" + R.drawable.ic_launcher_pro_marsala);
	URL url = null;
	try {
		url = new URL(getString(R.string.link_shortcuts_pro));
	} catch (MalformedURLException e) {
		e.printStackTrace();
	}
	TweetComposer.Builder builder = new TweetComposer.Builder(this)
			.url(url)
			.text("@GeeksEmpire" + "\n" + getString(R.string.invitation_message)
					+ "\n" + "#GeeksEmpire")
			.image(path);
	builder.show();
}
 
开发者ID:GeeksEmpireNet,项目名称:Shortcuts,代码行数:16,代码来源:DetailHelper.java

示例6: onCreate

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
@Override
    public void onCreate() {
        super.onCreate();
        TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
//        Fabric.with(this, new TwitterCore(authConfig), new Digits());
        Fabric.with(this, new TwitterCore(authConfig),new TweetComposer());
    }
 
开发者ID:AlanCheen,项目名称:PracticeDemo,代码行数:8,代码来源:App.java

示例7: shareOnTwitter

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
/**
 * Shares the app on Twitter
 */
private void shareOnTwitter() {
    try {
        new TweetComposer.Builder(this)
                .text(getString(R.string.social_twitter_message_android, "Android"))
                .url(new URL(getString(R.string.social_link_android)))
                .show();
    } catch (MalformedURLException e) {
        Timber.e(e, "Twitter URL malformed");
    }
}
 
开发者ID:jguerinet,项目名称:MyMartlet,代码行数:14,代码来源:DrawerActivity.java

示例8: randomPost

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
public void randomPost() {
    Toast.makeText(this, "random post selected", Toast.LENGTH_SHORT).show();
    String tag = "@";
    String[] people = getResources().getStringArray(R.array.twitter_names);
    String person = people[randomInt(people.length)];
    String[] messages = getResources().getStringArray(R.array.twitter);
    String message = " " + messages[randomInt(messages.length)];
    String post = tag + person + message;
    TweetComposer.Builder builder = new TweetComposer.Builder(this)
            .text(post);
    builder.show();
    new UpdateMessages().execute();
}
 
开发者ID:stevex86,项目名称:RandomActsOfKindness,代码行数:14,代码来源:MainActivity.java

示例9: tweet

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
private static void tweet(){
    TweetComposer.Builder builder = new TweetComposer.Builder(mActivity)
            .text(mMediaContent.getTitle() + " - " + mMediaContent.getDescription());
    builder.show();
}
 
开发者ID:cscd-488,项目名称:event-app,代码行数:6,代码来源:ShareDrawer.java

示例10: onCreate

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
    Fabric.with(this, new Twitter(authConfig));
    Fabric.with(this, new TweetComposer(), new Twitter(authConfig));
    final Intent i = new Intent(this, SelectMatrixOrNew.class); // Move to the bacon activity!
    DBManager DBmgr = new DBManager(this);
    ArrayList<String> matrixNames = DBmgr.getMatrixNames();
    setTheme(android.R.style.Theme_Holo);
    setContentView(R.layout.activity_welcome_screen);

    if (matrixNames.size() != 0){
        // When it's a repeat visit Let's make a little runnable saying we're loading and meanwhile load the other activity
        // Though, generally this is too fast to be seen so it looks like we are jumping to the selection screen.
        Runnable r = new Runnable() {
            @Override
            public void run() {
                Message waitMsg = new Message();
                Bundle contentMsg = new Bundle();
                contentMsg.putString("status", "DirectionField\nLoading....");
                waitMsg.setData(contentMsg);
                handleTextChange.sendMessage(waitMsg);

            }
        };
        Thread loading = new Thread(r); // calls the run method on the r Runnable object
        loading.start();
        startActivity(i);
    } else {
        DBManager MatrixDB = new DBManager(this); // Don't do anything with it though... just creating the first association with it
        // Let's display something on the screen when it's the first time
        RelativeLayout.LayoutParams layoutRel = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        layoutRel.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        layoutRel.addRule(RelativeLayout.CENTER_HORIZONTAL);
        final Button clickToContinue = new Button(this);
        clickToContinue.setText("Click to load");
        RelativeLayout welcomeLayout = (RelativeLayout)findViewById(R.id.welcomeLayout);
        welcomeLayout.addView(clickToContinue, layoutRel); // insert the button into the view and position it according to the rules
        clickToContinue.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(i);
            }
        });

    }

}
 
开发者ID:DifferentialEq,项目名称:DirectionFieldAndroid,代码行数:50,代码来源:welcomeScreen.java

示例11: onCreate

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    // Timber
    if (BuildConfig.DEBUG) {
       Timber.plant(new Timber.DebugTree());
    }
    if (BuildConfig.REPORT_CRASHES) {
        Timber.plant(new ProductionTree() {
            @Override
            protected void log(String message) {
                Crashlytics.log(message);
            }

            @Override
            protected void logException(Throwable t) {
                //Don't log SocketTimeoutExceptions
                if (!(t instanceof SocketTimeoutException)) {
                    Crashlytics.logException(t);
                }
            }
        });
    }

    // Fabric: Twitter, Crashlytics
    TwitterAuthConfig authConfig = new TwitterAuthConfig(BuildConfig.TWITTER_KEY,
            BuildConfig.TWITTER_SECRET);
    @SuppressWarnings("PointlessBooleanExpression")
    Crashlytics crashlytics = new Crashlytics.Builder().core(new CrashlyticsCore.Builder()
            .disabled(!BuildConfig.REPORT_CRASHES).build()).build();
    Fabric.with(this, new Twitter(authConfig), new TweetComposer(), crashlytics);

    // Android ThreeTen
    AndroidThreeTen.init(this);

    // Dagger
    component = DaggerBaseComponent.builder()
            .appModule(new AppModule(this))
            .build();
    component.inject(this);

    // Hawk
    Hawk.init(this).build();

    // DBFlow
    FlowManager.init(new FlowConfig.Builder(this).build());

    // FormGenerator
    int padding = getResources().getDimensionPixelOffset(R.dimen.padding_small);
    FormGenerator.set(new FormGenerator.Builder()
            .setDefaultBackground(R.drawable.transparent_redpressed)
            .setDefaultDrawablePaddingSize(padding)
            .setDefaultPaddingSize(padding)
            .setDefaultIconColor(ContextCompat.getColor(this, R.color.red)));
}
 
开发者ID:jguerinet,项目名称:MyMartlet,代码行数:57,代码来源:App.java

示例12: doInBackground

import com.twitter.sdk.android.tweetcomposer.TweetComposer; //导入依赖的package包/类
@Override
protected Boolean doInBackground(View... views) {
    final View poem = views[0];
    boolean result = false;

    if (App.isExternalStorageWritable()) {
        // generating image
        final Bitmap bitmap = Bitmap.createBitmap(
                getResources().getDimensionPixelSize(R.dimen.share_width_px),
                getResources().getDimensionPixelSize(R.dimen.share_height_px),
                Bitmap.Config.ARGB_8888);
        final Canvas canvas = new Canvas(bitmap);
        poem.draw(canvas);

        final File picFile = App.getPoemFile("poem_" + poem.getTag() + ".jpg");

        try {
            picFile.createNewFile();
            final FileOutputStream picOut = new FileOutputStream(picFile);
            final boolean saved = bitmap.compress(Bitmap.CompressFormat.JPEG, 90, picOut);
            if (saved) {
                final CharSequence hashtag
                        = ((TextView) poem.findViewById(R.id.poem_theme)).getText();

                // create Uri from local image file://<absolute path>
                final Uri imageUri = Uri.fromFile(picFile);
                final TweetComposer.Builder builder
                        = new TweetComposer.Builder(PoemHistoryActivity.this)
                        .text(getApplicationContext().getResources()
                                .getString(R.string.share_poem_tweet_text) + " " + hashtag)
                        .image(imageUri);
                builder.show();

                result = true;
            } else {
                Crashlytics.log(Log.ERROR, TAG, "Error when trying to save Bitmap of poem");
                Toast.makeText(getApplicationContext(),
                        getResources().getString(R.string.toast_share_error),
                        Toast.LENGTH_SHORT).show();
            }
            picOut.close();
        } catch (IOException e) {
            Toast.makeText(getApplicationContext(),
                    getResources().getString(R.string.toast_share_error),
                    Toast.LENGTH_SHORT).show();
            Crashlytics.logException(e);
            e.printStackTrace();
        }

        poem.destroyDrawingCache();
    } else {
        Toast.makeText(getApplicationContext(),
                getResources().getString(R.string.toast_share_error),
                Toast.LENGTH_SHORT).show();
        Crashlytics.log(Log.ERROR, TAG, "External Storage not writable");
    }

    return result;
}
 
开发者ID:crashlytics,项目名称:cannonball-android,代码行数:60,代码来源:PoemHistoryActivity.java


注:本文中的com.twitter.sdk.android.tweetcomposer.TweetComposer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。