Android hide ads + run programs on specified dates

Source: Internet
Author: User

Package lawdaquan. co. cc;

Import java. text. DateFormat;
Import java. text. SimpleDateFormat;
Import java. util. Calendar;

Import net. miidi. credit. IAuxiliaryNotifier;
Import net. miidi. credit. IOffersNotifier;
Import net. miidi. credit. MiidiCredit;
Import android. app. Activity;
Import android. app. AlertDialog;
Import android. app. AlertDialog. Builder;
Import android. content. DialogInterface;
Import android. content. Intent;
Import android. OS. Bundle;
Import android. OS. Handler;
Import android. view. Menu;
Import android. view. MenuItem;
Import android. view. View;
Import android. view. View. OnClickListener;
Import android. widget. ImageView;
Import android. widget. TextView;

Public class LawdaquanActivity extends Activity implements IOffersNotifier,
IAuxiliaryNotifier {
Private ImageView mImageView9;
Private TextView mTextView9;
Handler mHandler;

/** Called when the activity is first created .*/
@ Override
Public void onCreate (Bundle savedInstanceState ){

Super. onCreate (savedInstanceState );
MiidiCredit. init (this, "4610", "9kub15589v2d35xw", false );
SetContentView (R. layout. main );

ImageView mImageView1 = (ImageView) findViewById (R. id. imageView1 );
ImageView mImageView2 = (ImageView) findViewById (R. id. imageView2 );
ImageView mImageView3 = (ImageView) findViewById (R. id. imageView3 );
ImageView mImageView4 = (ImageView) findViewById (R. id. imageView4 );
ImageView mImageView5 = (ImageView) findViewById (R. id. imageView5 );
ImageView mImageView6 = (ImageView) findViewById (R. id. imageView6 );
ImageView mImageView7 = (ImageView) findViewById (R. id. imageView7 );
ImageView mImageView8 = (ImageView) findViewById (R. id. imageView8 );
MImageView1.setOnClickListener (onclicklistener1 );
MImageView2.setOnClickListener (onclicklistener2 );
MImageView3.setOnClickListener (onclicklistener3 );
MImageView4.setOnClickListener (onclicklistener4 );
MImageView5.setOnClickListener (onclicklistener5 );
MImageView6.setOnClickListener (onclicklistener6 );
MImageView7.setOnClickListener (onclicklistener7 );
MImageView8.setOnClickListener (onclicklistener8 );

MImageView9 = (ImageView) findViewById (R. id. imageView9 );
MTextView9 = (TextView) findViewById (R. id. textView9 );
// SimpleDateFormat sdfTime = new
// SimpleDateFormat ("yyyy-MM-dd, hh: mm: ss ");
//
// String nowTime = sdfTime. format (new Date ());
// StringBuffer sba = new StringBuffer ();
// String astartTime = startTime. substring (0, 2 );

// Java. util. Date nowdate = new java. util. Date ();
// String myString = "2008-09-08 ";
// SimpleDateFormat sdf = new SimpleDateFormat ("yyyy/MM/dd ",
// Locale. CHINA );
// Try {
// Date d = sdf. parse (myString );
//} Catch (ParseException e ){
/// TODO Auto-generated catch block
// E. printStackTrace ();
//}
//// Boolean flag = d. before (nowdate );
// String s1 = "04:40:09 ";
// String s2 = "09:12:11 ";
//
// Java. text. DateFormat df = new java. text. SimpleDateFormat (
// "Yyyy-MM-dd HH: mm: ss ");
// Java. util. Calendar c1 = java. util. Calendar. getInstance ();
// Java. util. Calendar c2 = java. util. Calendar. getInstance ();
// Try {
// C1.setTime (df. parse (s1 ));
// C2.setTime (df. parse (s2 ));
//
//} Catch (Exception e ){
//// TODO: handle exception
//}
// Int result = c1.compareTo (c2 );
// If (result> ){
//
//}

String s1 = "12:00:00 ";

// SimpleDateFormat formatter = new
// SimpleDateFormat ("yyyy-MM-dd HH: mm: ss ");
SimpleDateFormat sDateFormat = new SimpleDateFormat (
"Yyyy-MM-dd hh: mm: ss ");
String date = sDateFormat. format (new java. util. Date ());

// String str = formatter. format (curDate );

DateFormat df = new SimpleDateFormat ("yyyy-MM-dd HH: mm: ss ");
Calendar c1 = Calendar. getInstance ();
Calendar str = Calendar. getInstance ();
Try {
C1.setTime (df. parse (s1 ));
Str. setTime (df. parse (date ));

} Catch (Exception e ){
// TODO: handle exception
}

Int result = c1.compareTo (str );
// If (result = 0)
// System. out. println ("current time equals System time ");
If (result <0 ){
System. out. println ("the current time is earlier than the System time ");
MImageView9.setVisibility (View. VISIBLE );
MTextView9.setVisibility (View. VISIBLE );

} Else {
System. out. println ("the current time is later than the System time ");
MImageView9.setVisibility (View. INVISIBLE );
MTextView9.setVisibility (View. INVISIBLE );

}

// MTextView9.setText (str );

MImageView9.setOnClickListener (onclicklistener9 );

 
// If (str-oooString ){
//
// MImageView9.setVisibility (View. VISIBLE );
//
//}

MiidiCredit. setOffersListener (this );
MiidiCredit. setAuxiliaryListener (this );

}

Private OnClickListener onclicklistener9 = new OnClickListener (){

@ Override
Public void onClick (View v ){
// TODO Auto-generated method stub
MiidiCredit. showAppOffers ();

}
};

Private OnClickListener onclicklistener1 = new OnClickListener (){

@ Override
Public void onClick (View v ){
// TODO Auto-generated method stub
Intent intent1 = new Intent (LawdaquanActivity. this, xingfa. class );
StartActivity (intent1 );

}
};

Private OnClickListener onclicklistener2 = new OnClickListener (){

@ Override
Public void onClick (View v ){
// TODO Auto-generated method stub
Intent intent2 = new Intent (LawdaquanActivity. this, minfa. class );
StartActivity (intent2 );

}
};

Private OnClickListener onclicklistener3 = new OnClickListener (){

@ Override
Public void onClick (View v ){
// TODO Auto-generated method stub
Intent intent3 = new Intent (LawdaquanActivity. this, chufa. class );
StartActivity (intent3 );

}
};

Private OnClickListener onclicklistener4 = new OnClickListener (){

@ Override
Public void onClick (View v ){
// TODO Auto-generated method stub
Intent intent4 = new Intent (LawdaquanActivity. this, xingsu. class );
StartActivity (intent4 );

}
};

Private OnClickListener onclicklistener5 = new OnClickListener (){

@ Override
Public void onClick (View v ){
// TODO Auto-generated method stub
Intent intent5 = new Intent (LawdaquanActivity. this, minsu. class );
StartActivity (intent5 );

}
};

Private OnClickListener onclicklistener6 = new OnClickListener (){

@ Override
Public void onClick (View v ){
// TODO Auto-generated method stub
Intent intent6 = new Intent (LawdaquanActivity. this, xinsu. class );
StartActivity (intent6 );

}
};

Private OnClickListener onclicklistener7 = new OnClickListener (){

@ Override
Public void onClick (View v ){
// TODO Auto-generated method stub
Intent intent7 = new Intent (LawdaquanActivity. this, wenshu. class );
StartActivity (intent7 );

}
};

Private OnClickListener onclicklistener8 = new OnClickListener (){

@ Override
Public void onClick (View v ){
// TODO Auto-generated method stub
Intent intent8 = new Intent (LawdaquanActivity. this, xianfa. class );
StartActivity (intent8 );

}
};

Public boolean onCreateOptionsMenu (Menu menu ){
// TODO Auto-generated method stub
Menu. add ("related ");
Return super. onCreateOptionsMenu (menu );
}

Public boolean onOptionsItemSelected (MenuItem item ){
// TODO Auto-generated method stub
New AlertDialog. Builder (this). setTitle ("Legal Daquan ")
. SetMessage (getString (R. string. about ))
. SetPositiveButton ("off", null). show ();
Return super. onOptionsItemSelected (item );

}

Public void onBackPressed (){
AlertDialog. Builder builder = new Builder (LawdaquanActivity. this );
Builder. setIcon (R. drawable. imagebutton5 );
Builder. setTitle ("prompt ");
Builder. setMessage ("Do you really want to exit the legal information software? ");
Builder. setPositiveButton ("yes ",
New android. content. DialogInterface. OnClickListener (){
@ Override
Public void onClick (DialogInterface dialog, int which ){
Dialog. dismiss ();
Android. OS. Process. killProcess (android. OS. Process
. MyPid ());

}
});
Builder. setNegativeButton ("no ",
New android. content. DialogInterface. OnClickListener (){
@ Override
Public void onClick (DialogInterface dialog, int which ){
Dialog. dismiss ();
}
});
Builder. create (). show ();

}

@ Override
Public void onChannelIdCb (int arg0 ){
// TODO Auto-generated method stub

}

@ Override
Public void onSdkVersionCb (String arg0 ){
// TODO Auto-generated method stub

}

@ Override
Public void onshow1_finishcb (){
// TODO Auto-generated method stub

}

@ Override
Public void onUpdatePointsCb (String arg0, int arg1 ){
// TODO Auto-generated method stub

}

}

 

 

From the column of gongzibai

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.