Skip to content

Commit

Permalink
fix big screen rending error
Browse files Browse the repository at this point in the history
add global report
add fancy view
re build new icon and new image
remove same class
support android R
change version
  • Loading branch information
00sanoj00 committed Mar 24, 2020
1 parent 68757dd commit cb1971f
Show file tree
Hide file tree
Showing 20 changed files with 1,067 additions and 301 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.github.iammert:StatusView:1.3'
implementation 'com.github.iammert:StatusView:1.3'
implementation 'com.github.qapqap:TimelineView:v1.6'
implementation 'com.github.sillebille:dynamic-calendar:1.0.1'
implementation 'gun0912.ted:tedpermission-rx2:2.2.3'

implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
implementation 'com.allenliu:AndroidSystemShare:1.0.1'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
implementation 'com.github.elevenetc:textsurface:0.9.1'
implementation 'com.lusfold.spinnerloading:library:1.0.0'


}
11 changes: 8 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sanoj.Devildev.slcovid_19report">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
android:requestLegacyExternalStorage="true"
android:icon="@drawable/ic_face_mask"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@drawable/ic_face_mask"
android:supportsRtl="true"
android:theme="@style/sflash">
<activity android:name=".globle_sample"
android:theme="@style/globle">
</activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
Expand Down
Binary file added app/src/main/assets/fonts/Roboto-Black.ttf
Binary file not shown.
132 changes: 120 additions & 12 deletions app/src/main/java/com/sanoj/Devildev/slcovid_19report/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.FileProvider;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;

import android.Manifest;
import android.content.DialogInterface;
Expand All @@ -21,7 +22,9 @@
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

Expand Down Expand Up @@ -58,47 +61,54 @@ public class MainActivity extends AppCompatActivity {
private ConnectionStatusView statusView;
private RequestQueue mQueue;
private TextView totalcase,newcase,inhospital,deth,recovery,datesync;
private ConstraintLayout parentView;
private RelativeLayout parentView,totoalshearit;
private static final int APP_PERMISSION_REQUEST = 102;
ImageGenerator mImageGenerator;
private Button share;
private Button share,global;
private Bitmap bitmap;
private ImageView sample;
Calendar mCurrentDate;
Bitmap mGeneratedDateIcon;
ImageView mDisplayGeneratedImage;
private SharedPreferences.Editor editor;
private SwipeRefreshLayout swipeContainer;

private TextView totoalcase_dialog,newcase_dialog,deth_dialog ,recovery_dialog;

private String totalCasesset = "111";
private String newcaseset = "";
private String dethset = "";
private String dischargeset = "";




@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setContentView(R.layout.sample);

parentView = findViewById(R.id.parentView);
editor = getSharedPreferences("MyPrefsFile", MODE_PRIVATE).edit();


swipeContainer = (SwipeRefreshLayout) findViewById(R.id.swipeContainer);




try {
SharedPreferences prefs = this.getSharedPreferences("MyPrefsFile", MODE_PRIVATE);
String whymod = prefs.getString("1time", "");

if(whymod.equals("")){
dialog();
}else if(whymod.equals("ok")) {

}else {
dialog();
}

}catch (Exception o){


}


///////////////////////
mImageGenerator = new ImageGenerator(this);
mDisplayGeneratedImage = (ImageView) findViewById(R.id.imgGenerated);
mImageGenerator.setIconSize(50, 50);
Expand All @@ -113,11 +123,20 @@ protected void onCreate(Bundle savedInstanceState) {
int mYear = mCurrentDate.get(Calendar.YEAR);
int mMonth = mCurrentDate.get(Calendar.MONTH);
final int mDay = mCurrentDate.get(Calendar.DAY_OF_MONTH);
mCurrentDate.set(mYear,mMonth,mDay);
mCurrentDate.set(mYear,mMonth,mDay);
mGeneratedDateIcon = mImageGenerator.generateDateImage(mCurrentDate, R.drawable.empty_calendar);
mDisplayGeneratedImage.setImageBitmap(mGeneratedDateIcon);
global=findViewById(R.id.global);

global.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

btn_showMessage(share);
}
});


///////////////////////////

TedPermission.with(this)
.setPermissionListener(permissionlistener)
Expand All @@ -136,6 +155,10 @@ protected void onCreate(Bundle savedInstanceState) {
jsonParse();
statusView = findViewById(R.id.status);





sample = findViewById(R.id.imgGenerated);

share.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -170,11 +193,21 @@ public void onClick(View v) {
}
});

swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {

jsonParse();

}
});

}





private void jsonParse() {

String url = "https://hpb.health.gov.lk/api/get-current-statistical";
Expand All @@ -191,6 +224,16 @@ public void onResponse(JSONObject response) {
String deths = jsonArray.getString("local_deaths");
String discharge = jsonArray.getString("local_recovered");
String udatee = jsonArray.getString("update_date_time");
int totoalcaseesx = jsonArray.getInt("global_total_cases");
int newcasessx = jsonArray.getInt("global_new_cases");
int dethsx = jsonArray.getInt("global_deaths");
int dischargex = jsonArray.getInt("global_recovered");


totalCasesset = String.format("%,d", totoalcaseesx);
newcaseset = String.format("%,d", newcasessx);
dethset = String.format("%,d", dethsx);
dischargeset = String.format("%,d", dischargex);

totalcase.setText(totoalcasees);
newcase.setText(newcasess);
Expand All @@ -201,6 +244,7 @@ public void onResponse(JSONObject response) {


statusView.setStatus(Status.COMPLETE);
swipeContainer.setRefreshing(false);
} catch (JSONException e) {
e.printStackTrace();
statusView.setStatus(Status.ERROR);
Expand Down Expand Up @@ -279,5 +323,69 @@ private boolean getDialogStatus(){
return mSharedPreferences.getBoolean("item", false);

}
public void btn_showMessage(View view){
final AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this,R.style.CustomDialog);
View mView = getLayoutInflater().inflate(R.layout.dialogbox,null);
Button btn_okay = (Button)mView.findViewById(R.id.btn_okay);
Button funny = (Button)mView.findViewById(R.id.global);
Button share = (Button)mView.findViewById(R.id.it);
totoalshearit = mView.findViewById(R.id.totoalshare);
totoalcase_dialog = mView.findViewById(R.id.totoalcase_info);
newcase_dialog = mView.findViewById(R.id.totoalnew_info);
deth_dialog=mView.findViewById(R.id.totoaldeth_info);
recovery_dialog=mView.findViewById(R.id.totoalrec_info);
totoalcase_dialog.setText(totalCasesset);
newcase_dialog.setText(newcaseset);
deth_dialog.setText(dethset);
recovery_dialog.setText(dischargeset);


alert.setView(mView);
final AlertDialog alertDialog = alert.create();
alertDialog.setCanceledOnTouchOutside(false);
funny.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, globle_sample.class));
}
});
share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
bitmap = ScreenshotUtil.getInstance().takeScreenshotForView(totoalshearit);

Date currentTime = Calendar.getInstance().getTime();
String mPath = Environment.getExternalStorageDirectory().toString() + "/" +currentTime+"new2.png";
FileOutputStream fos;
try {
fos = new FileOutputStream(mPath);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
Toast.makeText(MainActivity.this, mPath, Toast.LENGTH_SHORT).show();
fos.flush();
fos.close();

Log.e("ImageSave", "Saveimage");
} catch (FileNotFoundException e) {
Log.e("GREC", e.getMessage(), e);
} catch (IOException e) {
Log.e("GREC", e.getMessage(), e);
}

Uri bmpUri = FileProvider.getUriForFile(MainActivity.this, BuildConfig.APPLICATION_ID + ".provider", new File(mPath));
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_STREAM, bmpUri);
intent.setType("image/*");
startActivity(Intent.createChooser(intent, "Share Image:"));
}
});
btn_okay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//myCustomMessage.setText(txt_inputText.getText().toString());
alertDialog.dismiss();
}
});
alertDialog.show();
}

}
Loading

0 comments on commit cb1971f

Please sign in to comment.