ダイアログの作成
uuidの作成
This commit is contained in:
parent
248666695e
commit
7d2ee567f3
29
app/google-services.json
Normal file
29
app/google-services.json
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "317219128586",
|
||||||
|
"project_id": "oplogy-b6971",
|
||||||
|
"storage_bucket": "oplogy-b6971.appspot.com"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:317219128586:android:c29583456e8fbd5f12a6f3",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.example.oplogy"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDaULi2TFHLiscR7DSZBCKS08d76Rtb49c"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
|
@ -1,14 +1,12 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import java.util.UUID;
|
||||||
|
|
||||||
import android.os.Bundle;
|
public class CreateUUID {
|
||||||
|
|
||||||
public class CreateUUID extends AppCompatActivity {
|
public static String generateUUID() {
|
||||||
|
// UUIDを生成する処理
|
||||||
@Override
|
UUID uuid = UUID.randomUUID();
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
return uuid.toString();
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.create_uuid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,13 +1,17 @@
|
||||||
package com.example.oplogy;
|
package com.example.oplogy;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
|
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
|
||||||
|
|
||||||
|
@ -61,8 +65,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
// ID作成のクリック処理
|
// ID作成のクリック処理
|
||||||
if(view == creatUUID){
|
if(view == creatUUID){
|
||||||
imageUuid.setImageResource(R.drawable.ischecked_uuid);
|
imageUuid.setImageResource(R.drawable.ischecked_uuid);
|
||||||
Intent toCreateUUID = new Intent(MainActivity.this, CreateUUID.class);
|
showUUIDYesNoDialog();//UUIDを表示するかのダイアログ
|
||||||
startActivity(toCreateUUID);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// セットアップのクリック処理
|
// セットアップのクリック処理
|
||||||
|
@ -83,9 +86,28 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
Intent toSubmission = new Intent(MainActivity.this,SubmissionActivity.class);
|
Intent toSubmission = new Intent(MainActivity.this,SubmissionActivity.class);
|
||||||
startActivity(toSubmission);
|
startActivity(toSubmission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private void showUUIDYesNoDialog() {
|
||||||
|
//ダイアログの表示
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle("クラスID");
|
||||||
|
builder.setMessage("あなたのクラスIDを表示しますか?");
|
||||||
|
|
||||||
|
//YESのときは初回はUUIDを生成、表示
|
||||||
|
//二回目以降は保存されたUUIDを表示
|
||||||
|
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
String classId = CreateUUID.generateUUID();//classIDにuuidが入ってる
|
||||||
|
Toast.makeText(MainActivity.this, "クラスID: " + classId, Toast.LENGTH_SHORT).show();//テスト用
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
Log.d("DialogNO","DialogでNoが選ばれました");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.show();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user