Merge branch 'master' of https://github.com/LonamiWebs/Klooni1010
# Conflicts: # gradle/wrapper/gradle-wrapper.properties Also added Solarized Dark theme.
This commit is contained in:
commit
a4e9936a85
64 changed files with 1157 additions and 511 deletions
|
@ -6,10 +6,11 @@ import com.badlogic.gdx.backends.android.AndroidApplication;
|
|||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||
|
||||
public class AndroidLauncher extends AndroidApplication {
|
||||
@Override
|
||||
protected void onCreate (Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
||||
initialize(new Klooni(), config);
|
||||
}
|
||||
@Override
|
||||
protected void onCreate (Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
final AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
||||
final AndroidShareChallenge shareChallenge = new AndroidShareChallenge(this);
|
||||
initialize(new Klooni(shareChallenge), config);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package io.github.lonamiwebs.klooni;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
class AndroidShareChallenge extends ShareChallenge {
|
||||
|
||||
private final Handler handler;
|
||||
private final Context context;
|
||||
|
||||
AndroidShareChallenge(final Context context) {
|
||||
handler = new Handler();
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
File getShareImageFilePath() {
|
||||
return new File(context.getExternalCacheDir(), "share_challenge.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shareScreenshot(final boolean ok) {
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!ok) {
|
||||
Toast.makeText(context, "Failed to create the file", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
final String text = "Check out my score at 1010 Klooni!";
|
||||
final Uri pictureUri = Uri.fromFile(getShareImageFilePath());
|
||||
final Intent shareIntent = new Intent();
|
||||
shareIntent.setAction(Intent.ACTION_SEND);
|
||||
shareIntent.setType("image/png");
|
||||
|
||||
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "");
|
||||
shareIntent.putExtra(Intent.EXTRA_TEXT, text);
|
||||
shareIntent.putExtra(Intent.EXTRA_STREAM, pictureUri);
|
||||
|
||||
context.startActivity(Intent.createChooser(shareIntent, "Challenge your friends..."));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue