Followed by "Weibo tail"-"Fun tail"-point version, Weibo tail

Source: Internet
Author: User

Followed by "Weibo tail"-"Fun tail"-point version, Weibo tail

My first android app-loaded forced artifact "microblogging tail" Portal: http://blog.csdn.net/love_5209/article/details/38708991


"Play turn tail" Application of treasure: http://android.myapp.com/myapp/detail.htm? ApkName = com. xiaoku. playtail

(PS: the current individual developers are not very mixed, and the app market is getting stricter and stricter. Some individual app developers are welcome to communicate with each other)

Application Introduction:

It is the second version after "Weibo tail". It is a collection of interesting and interesting Weibo tails. It selects interesting and interesting tails carefully to make your tails move. The main tail module is divided into [popular mobile phones] [handsome guy] [cultural inspirational] [control family talents] [personalized hot] [fans] [exclusive customization] [otaku rotten girl] [Game movies] Nine module, the total number of tails is more than 200, so you can enjoy the fun of the tail!


Current version: V1.0


The principle of "fun and tail" is the same as that of "Weibo tail". This time, we mainly added functions such as sliding frame and acquisition of credits, acquisition of credits, and acquisition of credits by sign-in.


First look at the home page (this is a test, the bottom is used for AD ):



Hey, is the interface Really kawaii ~~ You have also added the left slide and right slide display menus, such:



Play turn tail retains the tail of popular mobile phones, such as iPhone6 and meizu 4. the tails of other sections are carefully selected and customized.


For individual developers, most of them use advertisements embedded in the advertising platform. I also choose the advertising platform youmi, because the platform youmi is relatively large and is well known, the background interface is also better, if you need to register can be registered through this link: https://www.youmi.net/account/register? R = NjQ4NjU = (Personal developers can communicate with each other on Promotion)

Its main forms of advertising include integral walls, interstitial screens, advertising bars, and so on.

The above three types of advertisement are used in this app. You can download the SDK from the background of youmi or communicate with me.


Next, let's go to the topic. The lowest version supported by this development is 2.2. fragment requires version 3.0 or later. This time, 2.2 can meet the needs of more users. It supports library android through v4. support. v4.app. fragment is compatible with earlier versions.


Let's talk about the problems encountered in the middle and some knowledge points ~~

First of all I have not read this article can first check: My first android Application-loaded force the artifact "microblogging tail" Portal: http://blog.csdn.net/love_5209/article/details/38708991


1. First, look for the framework used on the main interface. This time we use the slide menu. The source code is found on the android bus Forum. After some modifications, we can use it for you, framework source code (for reference only): http://yunpan.cn/Q7hQMBEjqWUbb extraction code 1430


2. After embedding the framework, you can simply read the source code to know that the ResideMenu main class is provided. The following code can easily add a menu option, then you can set the listening action:

Private ResideMenuItem itemHome; private ResideMenu resideMenu; public void onCreate (Bundle folder) {setUpMenu ();} private void setUpMenu () {// resideMenu initialize resideMenu = new ResideMenu (this ); resideMenu. setBackground (R. drawable. menu_background); resideMenu. attachToActivity (this); resideMenu. setMenuListener (menuListener); itemHome = new ResideMenuItem (this, R. drawable. icon_sy, "Homepage"); // you can specify the menu title and itemHome icon. setOnClickListener (this); // sets the listener resideMenu. addMenuItem (itemHome, ResideMenu. DIRECTION_LEFT); // Add the menu to the left // The findViewById (R. id. title_bar_left_menu ). setOnClickListener (new View. onClickListener () {@ Override public void onClick (View view) {resideMenu. openMenu (ResideMenu. DIRECTION_LEFT) ;}}); // click findViewById (R. id. title_bar_right_menu ). setOnClickListener (new View. onClickListener () {@ Override public void onClick (View view) {resideMenu. openMenu (ResideMenu. DIRECTION_RIGHT );}});}


3. The app_src configuration file at the end of Weibo is placed in assets. This time, points are added, which means you need to modify the value of points. However, the problem is that files in assets cannot be modified, you can use the database SQLite for writing (more standardized), or use sharedpreferences for storage (not recommended if there is a large amount of data). Later, sharedpreferences was used, at the beginning, place the configuration file in the src directory, and then directly read the sharedpreferences. You can directly modify the points to perform sharedpreferences operations. (Stupid method)


4. The problem of dynamic update of listview data: after using the purchased tail, you need to change the tail to the "Point-free" status, dynamically update the listview, and then use the viewholder method to cache the items of the listview, however, the consequence of doing so is that when you pull the listview up and down, the status of the listview's corresponding tail points will be messy. Some do not need to turn points into points, and do not need to turn points into points.

Solution: listview does not use viewholder for caching. (This may not be smooth for some low-configuration mobile phone models)


5. The following Code describes the point sign-In function:

Public boolean isQianDao () {Editor editor = sharedPreferences. edit (); String today = DateUtil. getDate (0); Log. I ("date", today); String date = sharedPreferences. getString ("date", DateUtil. getDate (0); Log. I ("date", date); if (today. equals (date) {editor. putString ("date", DateUtil. getDate (1 )). commit (); int amount = 2; Log. I ("date", DateUtil. getDate (1); boolean isSuccess = PointsManager. getInstance (this ). awardPoints (amount); if (isSuccess) {Toast. makeText (getApplicationContext (), "sign-in successful, get 2 points", Toast. LENGTH_LONG ). show ();} return true;} return false ;}

The getDate method of DateUtil is as follows: (The num parameter 0 represents today, 1 represents tomorrow, and so on)

Public static String getDate (int num) {Date date Date = new Date (); // obtain the time Calendar calendar = new GregorianCalendar (); calendar. setTime (date); calendar. add (calendar. DATE, num); // Add a day after the DATE. the integer is pushed back, and the negative number moves forward date = calendar ar. getTime (); SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd"); String dateString = formatter. format (date); return dateString ;}

The principle is to match whether the current date is the same as that in sharedPreferences. In the same way, you can sign in and add two points. At the same time, you can properly display ads with meters, after signing, modify the value of sharedPreferences to tomorrow's value.

Of course, sharedPreference is used in many of the above cases, so the security of this operation is definitely not worth mentioning. If you understand android, you can easily avoid points.

If you want to know the source code, you can also read it through decompilation. However, I have already obfuscated and reinforced the code. It may be a bit difficult to read ~


6. Because fragment is also used to slide the framework, you also need to set the android: screenOrientation = "of the Activity in AndroidManifest. xml to reload the screen"Nosensor"

7. In addition, another way to escape the advertisement detection is to use the date to display the advertisement. Generally, the review time is about three days. You can see the following code:

public static boolean isTimeToShowAd(){boolean flag;SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");String date=df.format(new Date());if(date.equals("2014-09-05")||date.equals("2014-09-06")||date.equals("2014-09-07")||date.equals("2014-09-08")||date.equals("2014-09-09")||date.equals("2014-09-10")||date.equals("2014-09-11")){flag=false;}else{flag=true;}return flag;}

If you want to add one day, you can add one day. For example, Xiaomi mall may not review large-screen advertisements. This helps you to pass the review for your reference only ~


8. Call the sharing function provided by the system. The Code is as follows:

// Share public static void shareText (Context context, String title, String text) {Intent intent = new Intent (Intent. ACTION_SEND); intent. setType ("text/plain"); intent. putExtra (Intent. EXTRA_SUBJECT, title); intent. putExtra (Intent. EXTRA_TEXT, text); context. startActivity (Intent. createChooser (intent, title ));}

Call:

ShareText (this, "share", "I'm using" Play with tail "to send Weibo posts with a single click. I just want to play with it! Http://a.app.qq.com/o/simple.jsp? Pkgname = com. xiaoku. playtail ");

9. You can see the setswipediredisdisable method in the sliding frame, but the available method cannot be found. Therefore, I added a method to the sliding frame for restoration (in ResideMenu. java file ):

// Public void setswipedireenable (int direction) {if (isInDisableDirection (direction) {disabledSwipeDirection. remove (disabledSwipeDirection. indexOf (direction); }}// the public void setSwipeDirectionDisable (int direction) {disabledSwipeDirection method in the framework. add (direction );}



In this app development process, I learned the simple use of others' frameworks, the embedding of integral advertisements, and the simplicity of AD strips. The UI configuration and the selection and matching of icons gradually become familiar with the code.

"Play turn tail" Application of treasure: http://android.myapp.com/myapp/detail.htm? ApkName = com. xiaoku. playtail


If you have any questions, please reply. Thank you for reading this 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.